Created
March 12, 2018 13:30
-
-
Save Vavius/7914d1424a12abbda2a5152e7440ea9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------------------------// | |
// Copyright (c) 2016 CloudTeam, Inc | |
// All Rights Reserved. | |
//----------------------------------------------------------------// | |
#ifndef DOBA_MOVEMENT_COMPONENT_H | |
#define DOBA_MOVEMENT_COMPONENT_H | |
#include <components/DOBAComponentBase-impl.h> | |
//================================================================// | |
// MovementComponent | |
//================================================================// | |
/* "seek" steering behavior | |
TODO: maybe it's worth implementing a full set of configurable steering behaviors as components? | |
*/ | |
struct MovementComponent : | |
public entityx::Component < MovementComponent > { | |
ZLFixVec2D targetPosition; | |
// controls how fast entity will turn to it's target direction | |
Fix16 steeringForce; | |
Fix16 maximumSpeed; | |
bool active; | |
//----------------------------------------------------------------// | |
MovementComponent () : | |
steeringForce ( 0.1f ), | |
maximumSpeed ( 1.f ), | |
active ( false ) { | |
} | |
}; | |
//================================================================// | |
// DOBAMovementComponent | |
//================================================================// | |
class DOBAMovementComponent : | |
public DOBAComponentBase < MovementComponent > { | |
private: | |
void RegisterProperties ( MOAILuaState& state ) { | |
DOBA_DECL_FIELD ( MovementComponent, targetPosition ) | |
DOBA_DECL_FIELD ( MovementComponent, steeringForce ) | |
DOBA_DECL_FIELD ( MovementComponent, maximumSpeed ) | |
DOBA_DECL_FIELD ( MovementComponent, active ) | |
}; | |
public: | |
DECL_LUA_FACTORY ( DOBAMovementComponent ) | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment