41 #ifndef __CU_MOVE_ACTION_H__
42 #define __CU_MOVE_ACTION_H__
71 #pragma mark Constructors
114 return init(delta,0.0f);
128 bool init(
const Vec2& delta,
float time);
130 #pragma mark Static Constructors
141 static std::shared_ptr<MoveBy>
alloc() {
142 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
143 return (result->init() ? result :
nullptr);
156 static std::shared_ptr<MoveBy>
alloc(
const Vec2& delta) {
157 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
158 return (result->init(delta) ? result :
nullptr);
172 static std::shared_ptr<MoveBy>
alloc(
const Vec2& delta,
float time) {
173 std::shared_ptr<MoveBy> result = std::make_shared<MoveBy>();
174 return (result->init(delta,time) ? result :
nullptr);
177 #pragma mark Atributes
198 #pragma mark Animation Methods
204 virtual std::shared_ptr<Action>
clone()
override;
216 virtual void update(
const std::shared_ptr<Node>& target, Uint64* state,
float dt)
override;
218 #pragma mark Debugging Methods
229 virtual std::string
toString(
bool verbose =
false)
const override;
255 #pragma mark Constructors
298 return init(target,0.0f);
311 bool init(
const Vec2& target,
float time);
313 #pragma mark Static Constructors
322 static std::shared_ptr<MoveTo>
alloc() {
323 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
324 return (result->init() ? result :
nullptr);
336 static std::shared_ptr<MoveTo>
alloc(
const Vec2& target) {
337 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
338 return (result->init(target) ? result :
nullptr);
351 static std::shared_ptr<MoveTo>
alloc(
const Vec2& target,
float time) {
352 std::shared_ptr<MoveTo> result = std::make_shared<MoveTo>();
353 return (result->init(target, time) ? result :
nullptr);
356 #pragma mark Attributes
377 #pragma mark Animation Methods
383 virtual std::shared_ptr<Action>
clone()
override;
394 virtual void load(
const std::shared_ptr<Node>& target, Uint64* state)
override;
406 virtual void update(
const std::shared_ptr<Node>& target, Uint64* state,
float dt)
override;
408 #pragma mark Debugging Methods
419 virtual std::string
toString(
bool verbose =
false)
const override;
virtual std::shared_ptr< Action > clone() override
Definition: CUMoveAction.h:249
MoveBy()
Definition: CUMoveAction.h:78
static std::shared_ptr< MoveTo > alloc(const Vec2 &target)
Definition: CUMoveAction.h:336
Vec2 _delta
Definition: CUMoveAction.h:68
static std::shared_ptr< MoveBy > alloc(const Vec2 &delta, float time)
Definition: CUMoveAction.h:172
void setTarget(const Vec2 &target)
Definition: CUMoveAction.h:375
Definition: CUMoveAction.h:65
static std::shared_ptr< MoveTo > alloc()
Definition: CUMoveAction.h:322
const Vec2 & getTarget() const
Definition: CUMoveAction.h:365
static std::shared_ptr< MoveBy > alloc(const Vec2 &delta)
Definition: CUMoveAction.h:156
Definition: CUAction.h:70
virtual void load(const std::shared_ptr< Node > &target, Uint64 *state) override
static std::shared_ptr< MoveTo > alloc(const Vec2 &target, float time)
Definition: CUMoveAction.h:351
virtual std::string toString(bool verbose=false) const override
~MoveBy()
Definition: CUMoveAction.h:83
virtual std::string toString(bool verbose=false) const override
virtual void update(const std::shared_ptr< Node > &target, Uint64 *state, float dt) override
MoveTo()
Definition: CUMoveAction.h:262
bool init()
Definition: CUMoveAction.h:284
bool init()
Definition: CUMoveAction.h:99
~MoveTo()
Definition: CUMoveAction.h:267
Vec2 _target
Definition: CUMoveAction.h:252
virtual void update(const std::shared_ptr< Node > &target, Uint64 *state, float dt) override
void dispose()
Definition: CUMoveAction.h:90
void dispose()
Definition: CUMoveAction.h:274
bool init(const Vec2 &delta)
Definition: CUMoveAction.h:113
void setDelta(const Vec2 &delta)
Definition: CUMoveAction.h:196
bool init(const Vec2 &target)
Definition: CUMoveAction.h:297
Definition: CUAction.h:51
static const Vec2 ZERO
Definition: CUVec2.h:71
virtual std::shared_ptr< Action > clone() override
const Vec2 & getDelta() const
Definition: CUMoveAction.h:186
static std::shared_ptr< MoveBy > alloc()
Definition: CUMoveAction.h:141