MovementAiComponent pass

This commit is contained in:
David Markowitz
2023-07-09 20:38:47 -07:00
parent 2528e02b98
commit 8a512e5c76
3 changed files with 94 additions and 218 deletions

View File

@@ -3,18 +3,16 @@
* Copyright 2018
*/
#ifndef MOVEMENTAICOMPONENT_H
#define MOVEMENTAICOMPONENT_H
#ifndef __MOVEMENTAICOMPONENT_H__
#define __MOVEMENTAICOMPONENT_H__
#pragma once
#include <cstdint>
#include <stack>
#include <vector>
#include "BitStream.h"
#include "Entity.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "Game.h"
#include "dLogger.h"
#include "Component.h"
#include "eReplicaComponentType.h"
#include <vector>
class ControllablePhysicsComponent;
class BaseCombatAIComponent;
@@ -23,7 +21,6 @@ class BaseCombatAIComponent;
* Information that describes the different variables used to make an entity move around
*/
struct MovementAIInfo {
// copy assignment
MovementAIInfo& operator=(const MovementAIInfo& other) = default;
@@ -74,7 +71,7 @@ public:
* Returns the basic settings that this entity uses to move around
* @return the basic settings that this entity uses to move around
*/
const MovementAIInfo& GetInfo() const;
const MovementAIInfo& GetInfo() const { return m_Info; };
/**
* Set a destination point for the entity to move towards
@@ -92,61 +89,61 @@ public:
* Sets the max speed at which this entity may run
* @param value the speed value to set
*/
void SetSpeed(float value);
void SetSpeed(const float value);
/**
* Returns the max speed at which this entity may run
* @return the max speed at which this entity may run
*/
float GetSpeed() const;
float GetSpeed() const { return m_Speed; };
/**
* Sets how fast the entity will accelerate when not running at full speed
* @param value the acceleration to set
*/
void SetAcceleration(float value);
void SetAcceleration(const float value) { m_Acceleration = value; }
/**
* Returns the current speed at which this entity accelerates when not running at full speed
* @return the current speed at which this entity accelerates when not running at full speed
*/
float GetAcceleration() const;
float GetAcceleration() const { return m_Acceleration; };
/**
* Sets the halting distance (the distance at which we consider the target to be reached)
* @param value the halting distance to set
*/
void SetHaltDistance(float value);
void SetHaltDistance(const float value) { m_HaltDistance = value; }
/**
* Returns the current halting distance (the distance at which we consider the target to be reached)
* @return the current halting distance
*/
float GetHaltDistance() const;
float GetHaltDistance() const { return m_HaltDistance; };
/**
* Sets the speed the entity is currently running at
* @param value the speed value to set
*/
void SetCurrentSpeed(float value);
void SetCurrentSpeed(const float value) { m_CurrentSpeed = value; }
/**
* Returns the speed the entity is currently running at
* @return the speed the entity is currently running at
*/
float GetCurrentSpeed() const;
float GetCurrentSpeed() const { return m_CurrentSpeed; };
/**
* Locks the rotation of this entity in place, depending on the argument
* @param value if true, the entity will be rotationally locked
*/
void SetLockRotation(bool value);
void SetLockRotation(const bool value) { m_LockRotation = value; }
/**
* Returns whether this entity is currently rotationally locked
* @return true if the entity is rotationally locked, false otherwise
*/
bool GetLockRotation() const;
bool GetLockRotation() const { return m_LockRotation; };
/**
* Attempts to update the waypoint index, making the entity move to the next waypoint
@@ -164,7 +161,7 @@ public:
* Returns the waypoint this entity is supposed to move towards next
* @return the waypoint this entity is supposed to move towards next
*/
NiPoint3 GetNextWaypoint() const;
NiPoint3 GetNextWaypoint() const { return m_NextWaypoint; };
/**
* Returns the current position of this entity
@@ -190,13 +187,13 @@ public:
* Returns the time it will take to reach the final waypoint according to the current speed
* @return the time it will take to reach the final waypoint according to the current speed
*/
float GetTimer() const;
float GetTimer() const { return m_Timer; };
/**
* Returns if the entity is at its final waypoint
* @return if the entity is at its final waypoint
*/
bool AtFinalWaypoint() const;
bool AtFinalWaypoint() const { return m_Done; };
/**
* Renders the entity stationary
@@ -214,14 +211,14 @@ public:
* Sets a path to follow for the AI
* @param path the path to follow
*/
void SetPath(std::vector<NiPoint3> path);
void SetPath(const std::vector<NiPoint3>& path);
/**
* Returns the base speed from the DB for a given LOT
* @param lot the lot to check for
* @return the base speed of the lot
*/
static float GetBaseSpeed(LOT lot);
static float GetBaseSpeed(const LOT lot);
void SetMoveInfo(const MovementAIInfo& value);
private:
@@ -230,19 +227,19 @@ private:
* Sets the current position of the entity
* @param value the position to set
*/
void SetPosition(const NiPoint3& value);
void SetPosition(const NiPoint3& value) const;
/**
* Sets the current rotation of the entity
* @param value the rotation to set
*/
void SetRotation(const NiQuaternion& value);
void SetRotation(const NiQuaternion& value) const;
/**
* Sets the current velocity of the entityes
* @param value the velocity to set
*/
void SetVelocity(const NiPoint3& value);
void SetVelocity(const NiPoint3& value) const;
/**
* Base information regarding the movement information for this entity
@@ -337,4 +334,4 @@ private:
int32_t m_ComponentId;
};
#endif // MOVEMENTAICOMPONENT_H
#endif // __MOVEMENTAICOMPONENT_H__