Level H Engine
Boid.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include "../Maths/Vec2.h"
5 #include "../Maths/Vec3.h"
6 #include "../Core/GameObject.h"
7 
12 class Boid
13 {
14 public:
22  Boid(std::string inSpriteID, Vec2 inDirection, float inMoveSpeed, Vec2 inPosition);
23 
35  Boid(int boidIndex, std::string inMesh, std::string inBoidTexture, std::string inBoidVertexShader,
36  std::string inBoidFragmentShader, Vec3 inDirection, float inMoveSpeed, Vec3 inPosition);
37 
48  Boid(int boidIndex, std::string inMesh, std::string inBoidVertexShader, std::string inBoidFragmentShader,
49  Vec3 inDirection, float inMoveSpeed, Vec3 inPosition);
50 
54  ~Boid();
55 
59  void update2D();
60 
64  void update3D();
65 
69  void draw2D();
70 
75  void setPosition2D(Vec2 inPosition);
76 
81  void setPosition3D(Vec3 inPosition);
82 
88  void setPosition2D(float inX, float inY);
89 
96  void setPosition3D(float inX, float inY, float inZ);
97 
102  void move2D(Vec2 movement);
103 
108  void move3D(Vec3 movement);
109 
114  void move2DX(float movement);
115 
120  void move2DY(float movement);
121 
126  void move3DX(float movement);
127 
132  void move3DY(float movement);
133 
138  void move3DZ(float movement);
139 
144  void setMoveSpeed(float inMoveSpeed);
145 
150  void setDirection2D(Vec2 inDirection);
151 
156  void setDirection3D(Vec3 inDirection);
157 
162  float getMoveSpeed();
163 
169 
175 
181 
187 
192  std::shared_ptr<GameObject> getObject();
193 
194 private:
196  std::string spriteID;
198  std::shared_ptr<GameObject> object;
208  float moveSpeed;
209 };
void move3DX(float movement)
Move the 2D Boid along the X axis.
Definition: Boid.cpp:127
void move2D(Vec2 movement)
Move the 2D Boid.
Definition: Boid.cpp:104
void move3DZ(float movement)
Move the 3D Boid along the Z axis.
Definition: Boid.cpp:137
Vec3 direction3D
The 3D direction of the Particle.
Definition: Boid.h:202
Contains the Vec2 structure with functions and overloaded operators.
Definition: Vec2.h:8
void setPosition3D(Vec3 inPosition)
Sets the position of the 3D Boid.
Definition: Boid.cpp:92
Vec3 getPosition3D()
Gets the position of the 3D Boid.
Definition: Boid.cpp:171
void setDirection2D(Vec2 inDirection)
Sets the direction of the 2D Boid.
Definition: Boid.cpp:148
Vec3 getDirection3D()
Gets the direction of the 3D Boid.
Definition: Boid.cpp:182
~Boid()
Destructs the Boid Object deleting the Boid Object from memory.
Definition: Boid.cpp:56
void move2DY(float movement)
Move the 2D Boid along the Y axis.
Definition: Boid.cpp:121
void setPosition2D(Vec2 inPosition)
Sets the position of the 2D Boid.
Definition: Boid.cpp:78
Boid(std::string inSpriteID, Vec2 inDirection, float inMoveSpeed, Vec2 inPosition)
Constructs the 2D Boid Object.
Definition: Boid.cpp:9
void setDirection3D(Vec3 inDirection)
Sets the direction of the 3D Boid.
Definition: Boid.cpp:154
Vec2 getPosition2D()
Gets the position of the 2D Boid.
Definition: Boid.cpp:165
Vec3 position3D
The 3D Position of the Particle.
Definition: Boid.h:206
void move3DY(float movement)
Move the 3D Boid along the Y axis.
Definition: Boid.cpp:132
void update3D()
A function that updates the 3D Boid.
Definition: Boid.cpp:66
std::shared_ptr< GameObject > getObject()
Gets the Boid 3D game object ID.
Definition: Boid.cpp:187
Contains the Vec3 structure with functions and overloaded operators.
Definition: Vec3.h:8
Vec2 direction2D
The 2D direction of the Particle.
Definition: Boid.h:200
void move2DX(float movement)
Move the 2D Boid along the X axis.
Definition: Boid.cpp:115
Vec2 getDirection2D()
Gets the direction of the 2D Boid.
Definition: Boid.cpp:176
void draw2D()
Draw the 2D Boid to the screen.
Definition: Boid.cpp:72
void update2D()
A function that updates the 2D Boid.
Definition: Boid.cpp:60
Creates a Boid object. NOTE - This is a HEAVILY modifed version of code from a previous assignment (I...
Definition: Boid.h:12
void move3D(Vec3 movement)
Move the 3D Boid.
Definition: Boid.cpp:110
std::shared_ptr< GameObject > object
A shared pointer to the 3D game object.
Definition: Boid.h:198
Vec2 position2D
The 2D Position of the Particle.
Definition: Boid.h:204
float getMoveSpeed()
Gets the moveSpeed of the Boid.
Definition: Boid.cpp:159
std::string spriteID
The 2D sprite ID.
Definition: Boid.h:196
float moveSpeed
The movement speed of the Particle.
Definition: Boid.h:208
void setMoveSpeed(float inMoveSpeed)
Sets the moveSpeed of the Boid.
Definition: Boid.cpp:142