Emergency 20 Dokumentation  4.2.0
PersonAnimationController.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/Export.h"
14 
16 #include <qsf/base/WeakPtr.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Entity;
26  class MovableComponent;
27  namespace ai
28  {
29  class NavigationComponent;
30  }
31 }
32 
33 
34 //[-------------------------------------------------------]
35 //[ Namespace ]
36 //[-------------------------------------------------------]
37 namespace em5
38 {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Classes ]
43  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public definitions ]
54  //[-------------------------------------------------------]
55  public:
57  {
58  MOVEMENTSTATE_UNDEFINED, // Can also be custom animation
61  MOVEMENTSTATE_INJURED
62  };
64  {
65  PERSONTYPE_OTHER, // Split out more person types as needed
66  PERSONTYPE_DIVER
67  };
68 
69 
70  //[-------------------------------------------------------]
71  //[ Public methods ]
72  //[-------------------------------------------------------]
73  public:
78  explicit PersonAnimationController(qsf::Entity& callerEntity);
79 
84  virtual ~PersonAnimationController();
85 
86  virtual void updateAnimation();
87 
88  // Reset the PersonAnimationController, so it can choose again what kind of animation should be played. Use this to interrupt animations.
89  virtual void resetAnimationState();
90 
91  virtual void forceIdleAnimationUpdate();
92 
93  // Get the correct name for the injury of the given entity (returns an empty string when not injured etc)
94  virtual std::string getInjuredAnimation(qsf::Entity& entity);
95 
96 
97  //[-------------------------------------------------------]
98  //[ Protected methods ]
99  //[-------------------------------------------------------]
100  protected:
101  MovementState calculateMovementState();
102 
103  bool setInjuredAnimation();
104 
105  void setAnimationState();
106 
107  void setMovementAnimationParamedics();
108  void setMovementAnimationDoctor();
109  void setMovementAnimationFireFighter();
110  void setMovementAnimationDiver();
111  void setMovementAnimationResueDogLeader();
112  void setMovementAnimationPolicePerson();
113  void setMovementAnimationSekSpecialist();
114  void setMovementAnimationPoliceDogLeader();
115  void setMovementAnimationArrested();
116  void setMovementContaminatedLead();
117  void setMovementAnimationUnit();
118 
119  bool blendToAnimation(qsf::Entity& entity, const std::string& animationName, float animationBlendTime) const;
120 
121  // Check if we care for the movement of this entity or of it's parent
122  void checkMovingEntity();
123 
124 
125  //[-------------------------------------------------------]
126  //[ Protected data ]
127  //[-------------------------------------------------------]
128  protected:
133  bool mIsSwimming; // Supported for diver only right now
134 
139 
140 
141  //[-------------------------------------------------------]
142  //[ CAMP reflection system ]
143  //[-------------------------------------------------------]
144  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
145 
146 
147  };
148 
149 
150 //[-------------------------------------------------------]
151 //[ Namespace ]
152 //[-------------------------------------------------------]
153 } // em5
154 
155 
156 //[-------------------------------------------------------]
157 //[ CAMP reflection system ]
158 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Object base class.
Definition: Object.h:68
Entity class.
Definition: Entity.h:46
MovementState mMovementState
Definition: PersonAnimationController.h:130
Definition: PersonAnimationController.h:59
Definition: PersonAnimationController.h:58
qsf::WeakPtr< qsf::ai::NavigationComponent > mNavigationComponent
Definition: PersonAnimationController.h:137
#define EM5_API_EXPORT
Definition: Export.h:28
MovementState mFormerMovementState
Definition: PersonAnimationController.h:131
qsf::WeakPtr< qsf::MovableComponent > mMovableComponent
Definition: PersonAnimationController.h:136
Person animation class, handles the move cycle animation for persons.
Definition: PersonAnimationController.h:48
bool mIsSwimming
Definition: PersonAnimationController.h:133
Definition: PersonAnimationController.h:60
Definition: PickupPersonByParamedicAction.h:21
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
Definition: PersonAnimationController.h:65
MovementState
Definition: PersonAnimationController.h:56
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
PersonType mPersonType
Definition: PersonAnimationController.h:132
qsf::Entity & mEntity
Definition: PersonAnimationController.h:129
PersonType
Definition: PersonAnimationController.h:63
qsf::WeakPtr< qsf::ActionComponent > mActionComponent
Definition: PersonAnimationController.h:138
qsf::WeakPtr< qsf::Entity > mMovingEntity
Definition: PersonAnimationController.h:135