CSCI3081W Drone Delivery System
Public Member Functions | Protected Attributes | List of all members
PathStrategy Class Reference

this class inhertis from the IStrategy class and is represents a movement strategy where the entity simply moves along the given path More...

#include <PathStrategy.h>

Inheritance diagram for PathStrategy:
Inheritance graph
[legend]
Collaboration diagram for PathStrategy:
Collaboration graph
[legend]

Public Member Functions

 PathStrategy (std::vector< Vector3 > path={})
 Construct a new PathStrategy Strategy object. More...
 
virtual void move (IEntity *entity, double dt)
 Move toward next position in the path. More...
 
virtual bool isCompleted ()
 Check if the trip is completed by seeing if index has reached the end of the path. More...
 
double currentPathDistance (Vector3 startPosition)
 Get the total distance of the entire path starting from startPosition and the current index. More...
 
double totalPathDistance (Vector3 startPosition)
 Get the total distance of the entire path starting from startPosition and index 0. More...
 
- Public Member Functions inherited from IStrategy
virtual ~IStrategy ()
 Destructor.
 

Protected Attributes

std::vector< Vector3path
 
int index
 

Detailed Description

this class inhertis from the IStrategy class and is represents a movement strategy where the entity simply moves along the given path

Constructor & Destructor Documentation

◆ PathStrategy()

PathStrategy::PathStrategy ( std::vector< Vector3 path = {})

Construct a new PathStrategy Strategy object.

Parameters
paththe path to follow

Member Function Documentation

◆ currentPathDistance()

double PathStrategy::currentPathDistance ( Vector3  startPosition)
virtual

Get the total distance of the entire path starting from startPosition and the current index.

Returns
float of total distance to final destination of this path starting from startPosition and the current index

Reimplemented from IStrategy.

◆ isCompleted()

virtual bool PathStrategy::isCompleted ( )
virtual

Check if the trip is completed by seeing if index has reached the end of the path.

Returns
True if complete, false if not complete

Implements IStrategy.

◆ move()

virtual void PathStrategy::move ( IEntity entity,
double  dt 
)
virtual

Move toward next position in the path.

Parameters
entityEntity to move
dtDelta Time

Implements IStrategy.

◆ totalPathDistance()

double PathStrategy::totalPathDistance ( Vector3  startPosition)
virtual

Get the total distance of the entire path starting from startPosition and index 0.

Returns
double of total distance to final destination of this path starting from startPosition

Reimplemented from IStrategy.


The documentation for this class was generated from the following file: