Emergency 20 Dokumentation  4.2.0
GangsterBaseLogic-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Namespace ]
6 //[-------------------------------------------------------]
7 namespace em5
8 {
9 
10 
11  //[-------------------------------------------------------]
12  //[ Public methods ]
13  //[-------------------------------------------------------]
15  {
16  return mEquippedWeaponTypes;
17  }
18 
20  {
21  mEquippedWeaponTypes = weapons;
22  }
23 
25  {
26  return mCurrentState;
27  }
28 
29  inline void GangsterBaseLogic::setEscapeTargetTag(const std::string& escapeTargetTag)
30  {
31  mEscapeTargetTag = escapeTargetTag;
32  }
33 
35  {
36  return mIdleReaction;
37  }
38 
40  {
41  mIdleReaction = autoReaction;
42  }
43 
45  {
46  return mAutoTargetReaction;
47  }
48 
50  {
51  mAutoTargetReaction = autoReaction;
52  }
53 
55  {
56  return mAutoAggression;
57  }
58 
59  inline void GangsterBaseLogic::setAutoAggression(bool autoAggression)
60  {
61  mAutoAggression = autoAggression;
62  }
63 
65  {
66  return mAutoAggroRange;
67  }
68 
69  inline void GangsterBaseLogic::setAutoAggroRange(float autoAggroRange)
70  {
71  mAutoAggroRange = autoAggroRange;
72  }
73 
75  {
76  return mAutoDeAggroRange;
77  }
78 
79  inline void GangsterBaseLogic::setAutoDeAggroRange(float autoAggroRange)
80  {
81  mAutoDeAggroRange = autoAggroRange;
82  }
83 
85  {
86  return mResistArrest;
87  }
88 
89  inline void GangsterBaseLogic::setResistArrest(bool resistArrest)
90  {
91  mResistArrest = resistArrest;
92  }
93 
95  {
96  const weapon::WeaponConfiguration* weaponConfiguration = getConfigurationForWeapon(weapon);
97  if (nullptr != weaponConfiguration)
98  {
99  return weaponConfiguration->mShootRange;
100  }
101 
102  return 0.0f;
103  }
104 
105  inline void GangsterBaseLogic::setWeaponAttackDistance(weapon::Weapon weapon, float distance)
106  {
107  QSF_WARN_IF(weapon != weapon::PISTOL && weapon != weapon::RIFLE,"Only RIFLE and PISTOL can have custom attack distances", return);
108 
109  weapon::WeaponConfiguration* weaponConfiguration = getConfigurationForWeapon(weapon);
110  if (nullptr != weaponConfiguration)
111  {
112  weaponConfiguration->mShootRange = distance;
113  }
114  }
115 
117  {
118  return mCelebrateWinTime;
119  }
120 
121  inline void GangsterBaseLogic::setCelebrateWinTime(qsf::Time celebrateWinTime)
122  {
123  mCelebrateWinTime = celebrateWinTime;
124  }
125 
127  {
128  return mChainReaction;
129  }
130 
132  {
133  return mPatrolOnWaypoints;
134  }
135 
137  {
138  mPatrolOnWaypoints = patrol;
139  }
140 
141 
142  //[-------------------------------------------------------]
143  //[ Public virtual methods ]
144  //[-------------------------------------------------------]
146  {
147  // Default return 3.0f = running
148  return 3.0f;
149  }
150 
151 
152 //[-------------------------------------------------------]
153 //[ Namespace ]
154 //[-------------------------------------------------------]
155 } // em5
State getCurrentState() const
Definition: GangsterBaseLogic-inl.h:24
float getAutoAggroRange() const
Definition: GangsterBaseLogic-inl.h:64
Definition: ActionPriority.h:13
weapon::WeaponConfiguration * getConfigurationForWeapon(weapon::Weapon usedWeapon)
AutoReaction getIdleReaction() const
Definition: GangsterBaseLogic-inl.h:34
float mAutoDeAggroRange
Range where this gangster ignored the target.
Definition: GangsterBaseLogic.h:449
void setCelebrateWinTime(qsf::Time celebrateWinTime)
Definition: GangsterBaseLogic-inl.h:121
WeaponFlagSet getEquippedWeaponTypes() const
Definition: GangsterBaseLogic-inl.h:14
void setAutoAggroRange(float autoAggroRange)
Definition: GangsterBaseLogic-inl.h:69
qsf::Time mCelebrateWinTime
Time to celebrate a win.
Definition: GangsterBaseLogic.h:455
void setIdleReaction(AutoReaction autoReaction)
Definition: GangsterBaseLogic-inl.h:39
std::string mEscapeTargetTag
Event tag of the target spawn point to escape to.
Definition: GangsterBaseLogic.h:443
bool getAutoAggression() const
Definition: GangsterBaseLogic-inl.h:54
AutoReaction
Definition: GangsterBaseLogic.h:79
bool mAutoAggression
Lets a gangster search for targets to attack.
Definition: GangsterBaseLogic.h:447
void setPatrolOnWaypoints(bool patrol)
Definition: GangsterBaseLogic-inl.h:136
WeaponFlagSet mEquippedWeaponTypes
Indicates which weapons the gangster has.
Definition: GangsterBaseLogic.h:434
Definition: Weapon.h:29
#define QSF_WARN_IF(condition, explanation, reaction)
Definition: ErrorHandling.h:152
Definition: WeaponConfiguration.h:31
float mAutoAggroRange
Range this gangster searches to targets.
Definition: GangsterBaseLogic.h:448
float getWeaponAttackDistance(weapon::Weapon weapon) const
Definition: GangsterBaseLogic-inl.h:94
AutoReaction mIdleReaction
What to do when idling.
Definition: GangsterBaseLogic.h:445
virtual float getMovingSpeed() const
Returns the moving speed with which the gangster should move.
Definition: GangsterBaseLogic-inl.h:145
void setEquippedWeaponTypes(WeaponFlagSet weapons)
Definition: GangsterBaseLogic-inl.h:19
bool mPatrolOnWaypoints
If set, the gangster will repeatedly cycle through his waypoints, and won't run in between...
Definition: GangsterBaseLogic.h:460
float mShootRange
Definition: WeaponConfiguration.h:36
void setEscapeTargetTag(const std::string &escapeTargetTag)
Definition: GangsterBaseLogic-inl.h:29
State
Definition: GangsterBaseLogic.h:62
bool mChainReaction
If set, gangster will detect if nearby gangster are attacked.
Definition: GangsterBaseLogic.h:442
void setAutoAggression(bool autoAggression)
Definition: GangsterBaseLogic-inl.h:59
AutoReaction getAutoTargetReaction() const
Definition: GangsterBaseLogic-inl.h:44
bool getChainReaction()
Definition: GangsterBaseLogic-inl.h:126
AutoReaction mAutoTargetReaction
Reaction to targets in aggro range.
Definition: GangsterBaseLogic.h:446
float getAutoDeAggroRange() const
Definition: GangsterBaseLogic-inl.h:74
Weapon
Definition: Weapon.h:22
void setWeaponAttackDistance(weapon::Weapon weapon, float distance)
Sets the attack distance required for a specific weapon.
Definition: GangsterBaseLogic-inl.h:105
Definition: Weapon.h:28
qsf::Time getCelebrateWinTime() const
Definition: GangsterBaseLogic-inl.h:116
void setResistArrest(bool resistArrest)
Definition: GangsterBaseLogic-inl.h:89
void setAutoDeAggroRange(float autoAggroRange)
Definition: GangsterBaseLogic-inl.h:79
void setAutoTargetReaction(AutoReaction autoReaction)
Definition: GangsterBaseLogic-inl.h:49
bool getPatrolOnWaypoints() const
Definition: GangsterBaseLogic-inl.h:131
bool getResistArrest() const
Definition: GangsterBaseLogic-inl.h:84
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32