Emergency 20 Dokumentation  4.2.0
RabidDogLogic.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 //[-------------------------------------------------------]
14 #include <qsf/job/JobProxy.h>
15 
16 
17 //[-------------------------------------------------------]
18 //[ Forward declarations ]
19 //[-------------------------------------------------------]
20 namespace qsf
21 {
22  class JobArguments;
23  class ActionComponent;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
42  {
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public definitions ]
47  //[-------------------------------------------------------]
48  public:
49  static const uint32 GAMELOGIC_TYPE_ID; // "em5::RabidDogLogic" game logic type ID
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public methods ]
54  //[-------------------------------------------------------]
55  public:
56  RabidDogLogic();
57  bool isTargetValid() const;
58  void attackPerson(qsf::Entity& target);
59  void attackSquadPerson(qsf::Entity& target);
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public virtual qsf::GameLogic methods ]
64  //[-------------------------------------------------------]
65  public:
66  virtual bool onStartup() override;
67  virtual void onShutdown() override;
68 
69 
70  //[-------------------------------------------------------]
71  //[ Private methods ]
72  //[-------------------------------------------------------]
73  private:
74  // Job updates
75  void updateSimulation(const qsf::JobArguments& jobArguments);
76 
77  qsf::Entity* getNearestTarget();
78  bool checkTarget(qsf::Entity& targetEntity) const;
79  bool checkSquadTarget(qsf::Entity& targetEntity) const;
80  void startAttackPersonAction(qsf::ActionComponent& actionComponent);
81 
82 
83  //[-------------------------------------------------------]
84  //[ Private data ]
85  //[-------------------------------------------------------]
86  private:
87  qsf::WeakPtr<qsf::Entity> mTargetEntity;
88  qsf::JobProxy mSimulationJobProxy;
89 
90 
91  //[-------------------------------------------------------]
92  //[ CAMP reflection system ]
93  //[-------------------------------------------------------]
94  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
95 
96 
97  };
98 
99 
100 //[-------------------------------------------------------]
101 //[ Namespace ]
102 //[-------------------------------------------------------]
103 } // em5
104 
105 
106 //[-------------------------------------------------------]
107 //[ CAMP reflection system ]
108 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
bool isTargetValid() const
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
void attackSquadPerson(qsf::Entity &target)
unsigned int uint32
Definition: PlatformTypes.h:181
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: PickupPersonByParamedicAction.h:21
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
virtual bool onStartup() override
Startup the game logic.
void attackPerson(qsf::Entity &target)
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Action component.
Definition: ActionComponent.h:47
Game logic base class.
Definition: GameLogic.h:44
Rabid dog logic.
Definition: RabidDogLogic.h:41
static const uint32 GAMELOGIC_TYPE_ID
Definition: RabidDogLogic.h:49
virtual void onShutdown() override
Shutdown the game logic.