Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/components/ICmpUnitMotion.h
Show All 16 Lines | |||||
#ifndef INCLUDED_ICMPUNITMOTION | #ifndef INCLUDED_ICMPUNITMOTION | ||||
#define INCLUDED_ICMPUNITMOTION | #define INCLUDED_ICMPUNITMOTION | ||||
#include "simulation2/system/Interface.h" | #include "simulation2/system/Interface.h" | ||||
#include "simulation2/components/ICmpPathfinder.h" // for pass_class_t | #include "simulation2/components/ICmpPathfinder.h" // for pass_class_t | ||||
#include "simulation2/components/ICmpPosition.h" // for entity_pos_t | #include "simulation2/components/ICmpPosition.h" // for entity_pos_t | ||||
#include "simulation2/components/ICmpUnitMotionManager.h" | |||||
class CCmpUnitMotionManager; | |||||
/** | /** | ||||
* Motion interface for entities with complex movement capabilities. | * Motion interface for entities with complex movement capabilities. | ||||
* (Simpler motion is handled by ICmpMotion instead.) | * (Simpler motion is handled by ICmpMotion instead.) | ||||
* | * | ||||
* It should eventually support different movement speeds, moving to areas | * It should eventually support different movement speeds, moving to areas | ||||
* instead of points, moving as part of a group, moving as part of a formation, | * instead of points, moving as part of a group, moving as part of a formation, | ||||
* etc. | * etc. | ||||
*/ | */ | ||||
class ICmpUnitMotion : public IComponent | class ICmpUnitMotion : public IComponent | ||||
{ | { | ||||
friend class CCmpUnitMotionManager; | |||||
protected: | |||||
/** | |||||
* This external interface is used by the Unit Motion Manager. | |||||
* Components that do not register there do not need to implement these. | |||||
*/ | |||||
virtual void OnTurnStart() = 0; | |||||
virtual void PreMove(ICmpUnitMotionManager::MotionState& state) = 0; | |||||
virtual void Move(ICmpUnitMotionManager::MotionState& state, fixed dt) = 0; | |||||
virtual void PostMove(ICmpUnitMotionManager::MotionState& state, fixed dt) = 0; | |||||
public: | public: | ||||
/** | /** | ||||
* Attempt to walk into range of a to a given point, or as close as possible. | * Attempt to walk into range of a to a given point, or as close as possible. | ||||
* The range is measured from the center of the unit. | * The range is measured from the center of the unit. | ||||
* If cannot move anywhere at all, or if there is some other error, then returns false. | * If cannot move anywhere at all, or if there is some other error, then returns false. | ||||
* Otherwise, returns true. | * Otherwise, returns true. | ||||
* If maxRange is negative, then the maximum range is treated as infinity. | * If maxRange is negative, then the maximum range is treated as infinity. | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator