SuzanneIsland: An island of Real-time rendering effects!
eagle.h
1 #pragma once
2 
3 #include <glm/gtx/vector_angle.hpp>
4 
5 #include "geometry.h"
6 
7 
8 enum EagleState
9 {
10  CIRCLING = 0,
11  ATTACKING = 1,
12  RETREATING = 2
13 };
14 
15 
16 class Eagle : public Geometry
17 {
18 public:
19  Eagle(const glm::mat4 &matrix, const std::string &filePath);
20  ~Eagle();
21 
22  virtual void update(float timeDelta, const glm::vec3 &targetPos_, bool targetHidden_, bool targetDefenseActive_);
23 
26  EagleState getState();
27 
31 
34  bool isTargetEaten();
35 
36  void resetEagle();
37 private:
38  // GAMEPLAY
39  // all durations given in seconds
40 
41  const float EAT_RADIUS = 1.0f;
42  const float TARGET_DEFENSE_REACH_RADIUS = 13.0f;
43 
44  // min time after which eagle will attempt to attack player
45  const float ATTACK_WAIT_TIME_MIN = 15.0f;
46  // max time after which eagle will attempt to attack player
47  const float ATTACK_WAIT_TIME_MAX = 25.0f;
48 
49  glm::mat4 eagleInitTransform;
50  EagleState state = CIRCLING;
51 
52  float totalTimePassed = 0;
53  float timeSinceLastAttack = 0;
54  float timeIntervalToNextAttack = ATTACK_WAIT_TIME_MIN;
55 
56  glm::vec3 targetPos;
57  bool targetHidden = false;
58  bool targetDefenseActive = false;
59 };
60 
bool isTargetEaten()
Check whether the target is in EAT_RADIUS of the eagle.
Definition: eagle.cpp:89
Definition: eagle.h:16
A SceneObject that holds Surfaces containing mesh data and textures.
Definition: geometry.h:19
bool isInTargetDefenseReach()
Check whether target is in TARGET_DEFENSE_REACH_RADIUS of the eagle.
Definition: eagle.cpp:84
EagleState getState()
Returns the current state of the eagle&#39;s behaviour.
Definition: eagle.cpp:79