2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2009 On-Core
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __ACTION_CCGRID_ACTION_H__
|
|
|
|
#define __ACTION_CCGRID_ACTION_H__
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "2d/CCActionInterval.h"
|
|
|
|
#include "2d/CCActionInstant.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class GridBase;
|
2013-12-16 14:21:05 +08:00
|
|
|
class NodeGrid;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@class GridAction
|
|
|
|
@brief Base class for Grid actions.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details Grid actions are the actions take effect on GridBase.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL GridAction : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-12-26 18:59:31 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the pointer of GridBase.
|
|
|
|
@return The pointer of GridBase.
|
|
|
|
*/
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual GridBase* getGrid();
|
|
|
|
|
|
|
|
// overrides
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual GridAction * clone() const override
|
2014-07-11 10:19:49 +08:00
|
|
|
{
|
|
|
|
CC_ASSERT(0);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual GridAction* reverse() const override;
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-08-21 15:11:33 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
GridAction() {}
|
|
|
|
virtual ~GridAction() {}
|
2015-01-20 15:41:59 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
* @brief Initializes the action with size and duration.
|
|
|
|
* @param duration The duration of the GridAction. It's a value in seconds.
|
|
|
|
* @param gridSize The size of the GridAction should be.
|
|
|
|
* @return Return true when the initialization success, otherwise return false.
|
2015-01-20 15:41:59 +08:00
|
|
|
*/
|
2013-11-23 07:07:58 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize);
|
|
|
|
|
2014-08-21 15:11:33 +08:00
|
|
|
protected:
|
2013-06-20 14:13:12 +08:00
|
|
|
Size _gridSize;
|
2013-12-12 16:20:52 +08:00
|
|
|
|
2013-12-16 14:21:05 +08:00
|
|
|
NodeGrid* _gridNodeTarget;
|
2013-12-12 16:20:52 +08:00
|
|
|
|
|
|
|
void cacheTargetAsGridNode();
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
/**
|
2013-06-20 14:13:12 +08:00
|
|
|
@brief Base class for Grid3D actions.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details Grid3D actions can modify a non-tiled grid.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Grid3DAction : public GridAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual GridBase* getGrid() override;
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Get the vertex that belongs to certain position in the grid.
|
|
|
|
* @param position The position of the grid.
|
|
|
|
* @return Return a pointer of vertex.
|
2015-03-18 21:45:58 +08:00
|
|
|
* @js vertex
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec3 getVertex(const Vec2& position) const;
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2013-09-13 11:41:20 +08:00
|
|
|
/** @deprecated Use getVertex() instead
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE inline Vec3 vertex(const Vec2& position) { return getVertex(position); }
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Get the non-transformed vertex that belongs to certain position in the grid.
|
|
|
|
* @param position The position of the grid.
|
|
|
|
* @return Return a pointer of vertex.
|
2015-03-18 21:45:58 +08:00
|
|
|
* @js originalVertex
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec3 getOriginalVertex(const Vec2& position) const;
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2013-09-13 11:41:20 +08:00
|
|
|
/** @deprecated Use getOriginalVertex() instead
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE inline Vec3 originalVertex(const Vec2& position) { return getOriginalVertex(position); }
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Set a new vertex to a certain position of the grid.
|
|
|
|
* @param position The position of the grid.
|
|
|
|
* @param vertex The vertex will be used on the certain position of grid.
|
2015-03-18 21:45:58 +08:00
|
|
|
* @js setVertex
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setVertex(const Vec2& position, const Vec3& vertex);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
|
|
|
// Overrides
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual Grid3DAction * clone() const override
|
2014-07-11 10:19:49 +08:00
|
|
|
{
|
|
|
|
CC_ASSERT(0);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-07-08 15:57:27 +08:00
|
|
|
|
2015-07-08 22:34:33 +08:00
|
|
|
/**
|
|
|
|
* @brief Get the effect grid rect.
|
|
|
|
* @return Return the effect grid rect.
|
|
|
|
*/
|
2015-07-08 15:57:27 +08:00
|
|
|
Rect getGridRect() const;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-03-18 20:56:17 +08:00
|
|
|
@brief Base class for TiledGrid3D actions.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TiledGrid3DAction : public GridAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Create the action with size and duration.
|
|
|
|
* @param duration The duration of the action. It's a value in seconds.
|
|
|
|
* @param gridSize Specify the grid size of the action.
|
|
|
|
* @return A pointer of TiledGrid3DAction. If creation failed, return nil.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-18 07:56:19 +08:00
|
|
|
static TiledGrid3DAction* create(float duration, const Size& gridSize);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Get the tile that belongs to a certain position of the grid.
|
|
|
|
* @param position The position of the tile want to get.
|
|
|
|
* @return A quadrilateral of the tile.
|
2015-03-18 21:45:58 +08:00
|
|
|
* @js tile
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Quad3 getTile(const Vec2& position) const;
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2013-09-13 11:41:20 +08:00
|
|
|
/** @deprecated Use getTile() instead
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vec2& position) { return getTile(position); }
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Get the non-transformed tile that belongs to a certain position of the grid.
|
|
|
|
* @param position The position of the tile want to get.
|
|
|
|
* @return A quadrilateral of the tile.
|
2015-03-18 21:45:58 +08:00
|
|
|
* @js originalTile
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Quad3 getOriginalTile(const Vec2& position) const;
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/** @deprecated Use getOriginalTile() instead.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vec2& position) { return getOriginalTile(position); }
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
* @brief Set a new tile to a certain position of the grid.
|
|
|
|
* @param position The position of the tile.
|
|
|
|
* @param coords The quadrilateral of the new tile.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setTile(const Vec2& position, const Quad3& coords);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** returns the grid */
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual GridBase* getGrid() override;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Override
|
2014-07-11 10:19:49 +08:00
|
|
|
virtual TiledGrid3DAction * clone() const override
|
|
|
|
{
|
|
|
|
CC_ASSERT(0);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief AccelDeccelAmplitude action.
|
2015-03-18 21:45:58 +08:00
|
|
|
@js NA
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with an inner action that has the amplitude property, and a duration time.
|
2015-03-27 10:17:33 +08:00
|
|
|
@param action A pointer of the inner action.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param duration Specify the duration of the AccelDeccelAmplitude action.
|
|
|
|
@return Return a pointer of AccelDeccelAmplitude action. When the creation failed, return nil.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
static AccelDeccelAmplitude* create(Action *action, float duration);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the value of amplitude rate.
|
|
|
|
@return the value of amplitude rate.
|
|
|
|
*/
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getRate(void) const { return _rate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the value of amplitude rate.
|
|
|
|
@param rate Specify the value of amplitude rate.
|
|
|
|
*/
|
2014-05-28 17:41:34 +08:00
|
|
|
inline void setRate(float rate) { _rate = rate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
|
|
|
virtual void update(float time) override;
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual AccelDeccelAmplitude* clone() const override;
|
|
|
|
virtual AccelDeccelAmplitude* reverse() const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
AccelDeccelAmplitude() {}
|
|
|
|
virtual ~AccelDeccelAmplitude();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with an inner action that has the amplitude property, and a duration time.
|
|
|
|
@param action A pointer of the inner action.
|
|
|
|
@param duration Specify the duration of the AccelDeccelAmplitude action.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2014-05-28 17:41:34 +08:00
|
|
|
bool initWithAction(Action *action, float duration);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _rate;
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *_other;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief AccelAmplitude action.
|
2015-03-18 21:45:58 +08:00
|
|
|
@js NA
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL AccelAmplitude : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with an inner action that has the amplitude property, and a duration time.
|
|
|
|
@param action A pointer of the inner action.
|
|
|
|
@param duration Specify the duration of the AccelAmplitude action.
|
|
|
|
@return Return a pointer of AccelAmplitude action. When the creation failed, return nil.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
static AccelAmplitude* create(Action *action, float duration);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the value of amplitude rate.
|
|
|
|
@return The value of amplitude rate.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
inline float getRate() const { return _rate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the value of amplitude rate.
|
|
|
|
@param rate Specify the value of amplitude rate.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
inline void setRate(float rate) { _rate = rate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
|
|
|
virtual void update(float time) override;
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual AccelAmplitude* clone() const override;
|
|
|
|
virtual AccelAmplitude* reverse() const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
AccelAmplitude() {}
|
|
|
|
virtual ~AccelAmplitude();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-23 07:07:58 +08:00
|
|
|
bool initWithAction(Action *action, float duration);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _rate;
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *_other;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-03-18 20:56:17 +08:00
|
|
|
@brief DeccelAmplitude action.
|
2015-03-18 21:45:58 +08:00
|
|
|
@js NA
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL DeccelAmplitude : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Creates the action with an inner action that has the amplitude property, and a duration time.
|
|
|
|
@param action A pointer of the inner action.
|
|
|
|
@param duration Specify the duration of the DeccelAmplitude action.
|
|
|
|
@return Return a pointer of DeccelAmplitude. When the creation failed, return nil.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
static DeccelAmplitude* create(Action *action, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the value of amplitude rate.
|
|
|
|
@return The value of amplitude rate.
|
|
|
|
*/
|
2014-05-28 17:41:34 +08:00
|
|
|
inline float getRate() const { return _rate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the value of amplitude rate.
|
|
|
|
@param rate Specify the value.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
inline void setRate(float rate) { _rate = rate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// overrides
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
|
|
|
virtual void update(float time) override;
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual DeccelAmplitude* clone() const override;
|
|
|
|
virtual DeccelAmplitude* reverse() const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
DeccelAmplitude() {}
|
|
|
|
virtual ~DeccelAmplitude();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with an inner action that has the amplitude property, and a duration time.
|
|
|
|
@param action The pointer of inner action.
|
|
|
|
@param duration The duration of the DeccelAmplitude action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-11-23 07:07:58 +08:00
|
|
|
bool initWithAction(Action *action, float duration);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _rate;
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *_other;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief StopGrid action.
|
2012-04-18 18:43:45 +08:00
|
|
|
@warning Don't call this action if another grid action is active.
|
2015-09-22 16:08:23 +08:00
|
|
|
Call if you want to remove the grid effect. Example:
|
2013-12-18 17:47:20 +08:00
|
|
|
Sequence::actions(Lens::action(...), StopGrid::action(...), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL StopGrid : public ActionInstant
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create a StopGrid Action.
|
|
|
|
@return Return a pointer of StopGrid. When the creation failed, return nil.
|
|
|
|
*/
|
2013-11-16 21:08:00 +08:00
|
|
|
static StopGrid* create();
|
2013-07-18 07:56:19 +08:00
|
|
|
|
|
|
|
// Overrides
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual StopGrid* clone() const override;
|
|
|
|
virtual StopGrid* reverse() const override;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-08-21 15:11:33 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
StopGrid() {}
|
|
|
|
virtual ~StopGrid() {}
|
2013-12-12 16:20:52 +08:00
|
|
|
|
2014-08-21 15:11:33 +08:00
|
|
|
protected:
|
2013-12-16 14:21:05 +08:00
|
|
|
NodeGrid* _gridNodeTarget;
|
2013-12-12 16:20:52 +08:00
|
|
|
|
|
|
|
void cacheTargetAsGridNode();
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief ReuseGrid action.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ReuseGrid : public ActionInstant
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create an action with the number of times that the current grid will be reused.
|
|
|
|
@param times Specify times the grid will be reused.
|
|
|
|
@return Return a pointer of ReuseGrid. When the creation failed, return nil.
|
|
|
|
*/
|
2013-07-18 07:56:19 +08:00
|
|
|
static ReuseGrid* create(int times);
|
|
|
|
|
|
|
|
// Override
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
2014-07-18 14:53:00 +08:00
|
|
|
virtual ReuseGrid* clone() const override;
|
|
|
|
virtual ReuseGrid* reverse() const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-23 07:07:58 +08:00
|
|
|
ReuseGrid() {}
|
|
|
|
virtual ~ReuseGrid() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes an action with the number of times that the current grid will be reused.
|
|
|
|
@param times Specify times the grid will be reused.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-11-23 07:07:58 +08:00
|
|
|
bool initWithTimes(int times);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
protected:
|
2013-12-16 14:21:05 +08:00
|
|
|
NodeGrid* _gridNodeTarget;
|
2013-12-12 16:20:52 +08:00
|
|
|
|
|
|
|
void cacheTargetAsGridNode();
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
int _times;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of actions group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __ACTION_CCGRID_ACTION_H__
|