Emergency 20 Dokumentation  4.2.0
SendDogForSearchAction.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/audio/AudioProxy.h"
14 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
41 
42  enum State
43  {
45  STATE_SENDDOG
46  };
47 
48  enum class UseCase
49  {
50  RESCUE_DOG_SEARCH_VICTIM,
51  POLICE_DOG_SEARCH_OBJECT,
52  POLICE_DOG_ATTACK_GANGSTER
53  };
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public methods ]
58  //[-------------------------------------------------------]
59  public:
65 
70  virtual ~SendDogForSearchAction();
71 
72  void init(qsf::Entity* targetEntity, UseCase useCase, bool* anyFound = nullptr);
73 
74 
75  //[-------------------------------------------------------]
76  //[ Public virtual qsf::Actions methods ]
77  //[-------------------------------------------------------]
78  public:
79  virtual void serialize(qsf::BinarySerializer& serializer) override;
80 
81 
82  //[-------------------------------------------------------]
83  //[ Protected virtual qsf::Action methods ]
84  //[-------------------------------------------------------]
85  protected:
86  virtual bool onStartup() override;
87  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
88 
89 
90  //[-------------------------------------------------------]
91  //[ Private methods ]
92  //[-------------------------------------------------------]
93  private:
94  void playRescueDogLeaderAnimation() const;
95  void pushMoveToTarget();
96 
97  void pushMoveToRandomPositions();
98  glm::vec3 getRandomPositionInRange(const glm::vec3& entityPosition, const qsf::Map& map, float searchRange);
99 
100 
101  //[-------------------------------------------------------]
102  //[ Private data ]
103  //[-------------------------------------------------------]
104  private:
105  qsf::WeakPtr<qsf::Entity> mTargetEntity;
106  qsf::WeakPtr<qsf::Entity> mRescueDogEntity;
107  State mState;
108  UseCase mUseCase;
109  bool mAnyFound;
110  AudioProxy mAudioProxy;
111 
112 
113  //[-------------------------------------------------------]
114  //[ CAMP reflection system ]
115  //[-------------------------------------------------------]
116  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
117 
118 
119  };
120 
121 
122 //[-------------------------------------------------------]
123 //[ Namespace ]
124 //[-------------------------------------------------------]
125 } // em5
126 
127 
128 //[-------------------------------------------------------]
129 //[ CAMP reflection system ]
130 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
Map class.
Definition: Map.h:93
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
UseCase
Definition: SendDogForSearchAction.h:48
EMERGENCY 5 send dog for search action.
Definition: SendDogForSearchAction.h:32
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
static const qsf::NamedIdentifier ACTION_ID
"em5::SendDogForSearchAction" unique action identifier
Definition: SendDogForSearchAction.h:40
State
Definition: ProcessState.h:20
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
Definition: SendDogForSearchAction.h:44
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
State
Definition: SendDogForSearchAction.h:42