2019-04-11 14:40:54 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-03-31 01:37:06 +08:00
|
|
|
|
// 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:
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-03-31 01:37:06 +08:00
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
|
// all copies or substantial portions of the Software.
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-03-31 01:37:06 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2019-10-11 21:55:29 +08:00
|
|
|
|
#include <kiwano/2d/action/Action.h>
|
2020-05-24 11:26:21 +08:00
|
|
|
|
#include <kiwano/utils/Logger.h>
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
|
namespace kiwano
|
2019-03-31 01:37:06 +08:00
|
|
|
|
{
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
using EaseFunc = Function<float(float)>;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
|
|
|
|
|
|
/// @details <20>鿴 https://easings.net <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
2020-01-21 10:09:55 +08:00
|
|
|
|
struct Ease
|
|
|
|
|
|
{
|
2020-03-19 14:28:50 +08:00
|
|
|
|
static KGE_API EaseFunc Linear; ///< <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseIn; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseOut; ///< <20>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc EaseInOut; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoIn; ///< <20><><EFBFBD><EFBFBD><EFBFBD>伫<EFBFBD><E4BCAB>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoOut; ///< <20>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ExpoInOut; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticIn; ///< <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticOut; ///< <20><><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc ElasticInOut; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>赯<EFBFBD><E8B5AF>
|
|
|
|
|
|
static KGE_API EaseFunc BounceIn; ///< <20><><EFBFBD><EFBFBD><EFBFBD>㸳<EFBFBD>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc BounceOut; ///< <20><><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
|
|
|
|
|
static KGE_API EaseFunc BounceInOut; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ㸳<D5B5>跴<EFBFBD><E8B7B4><EFBFBD><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
static KGE_API EaseFunc BackIn;
|
|
|
|
|
|
static KGE_API EaseFunc BackOut;
|
|
|
|
|
|
static KGE_API EaseFunc BackInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuadIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuadOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuadInOut;
|
|
|
|
|
|
static KGE_API EaseFunc CubicIn;
|
|
|
|
|
|
static KGE_API EaseFunc CubicOut;
|
|
|
|
|
|
static KGE_API EaseFunc CubicInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuartIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuartOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuartInOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuintIn;
|
|
|
|
|
|
static KGE_API EaseFunc QuintOut;
|
|
|
|
|
|
static KGE_API EaseFunc QuintInOut;
|
|
|
|
|
|
static KGE_API EaseFunc SineIn;
|
|
|
|
|
|
static KGE_API EaseFunc SineOut;
|
|
|
|
|
|
static KGE_API EaseFunc SineInOut;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionTweenEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionMoveByEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionMoveToEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionJumpByEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionJumpToEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionScaleByEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionScaleToEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionFadeToEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionRotateByEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionRotateToEntity);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(ActionCustomEntity);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* \addtogroup Actions
|
|
|
|
|
|
* @{
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>䶯<EFBFBD><E4B6AF>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionTweenEntity : public ActionEntity
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionTweenEntity();
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>䶯<EFBFBD><E4B6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param func <20><><EFBFBD><EFBFBD><EFBFBD>ٶȻ<D9B6><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionTweenEntity(Duration duration, EaseFunc ease);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
Duration GetDuration() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>ʱ<EFBFBD><CAB1>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
void SetDuration(Duration duration);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ٶȻ<D9B6><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
const EaseFunc& GetEaseFunc() const;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ٶȻ<D9B6><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetEaseFunc(const EaseFunc& func);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Update(Actor* target, Duration dt) override;
|
|
|
|
|
|
|
|
|
|
|
|
virtual void UpdateTween(Actor* target, float percent) = 0;
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr DoClone(ActionTweenEntityPtr to) const;
|
2020-02-12 23:37:05 +08:00
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
private:
|
|
|
|
|
|
Duration dur_;
|
|
|
|
|
|
EaseFunc ease_func_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>䶯<EFBFBD><E4B6AF>
|
2020-07-20 23:11:10 +08:00
|
|
|
|
class ActionTween : public Action
|
2020-07-20 21:35:33 +08:00
|
|
|
|
{
|
2020-07-20 23:11:10 +08:00
|
|
|
|
public:
|
|
|
|
|
|
ActionTween() = default;
|
|
|
|
|
|
|
|
|
|
|
|
inline ActionTween(ActionTweenEntityPtr ptr)
|
|
|
|
|
|
: Action(ptr.Get())
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
inline ActionTween& Ease(EaseFunc ease)
|
|
|
|
|
|
{
|
2020-07-20 23:11:10 +08:00
|
|
|
|
auto tween_ptr = Get();
|
|
|
|
|
|
if (tween_ptr)
|
|
|
|
|
|
tween_ptr->SetEaseFunc(ease);
|
2020-07-20 21:35:33 +08:00
|
|
|
|
return (*this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 23:11:10 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡָ<C8A1><D6B8>
|
|
|
|
|
|
inline ActionTweenEntity* Get() const
|
2020-07-20 21:35:33 +08:00
|
|
|
|
{
|
2020-07-20 23:11:10 +08:00
|
|
|
|
return const_cast<ActionTweenEntity*>(static_cast<const ActionTweenEntity*>(ptr.Get()));
|
2020-07-20 21:35:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 23:11:10 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
inline void SetEntity(ActionTweenEntityPtr tween_ptr)
|
2020-07-20 21:35:33 +08:00
|
|
|
|
{
|
2020-07-20 23:11:10 +08:00
|
|
|
|
this->ptr = static_cast<ActionEntity*>(tween_ptr.Get());
|
2020-07-20 21:35:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 23:11:10 +08:00
|
|
|
|
inline ActionTweenEntity* operator->() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return Get();
|
|
|
|
|
|
}
|
2020-07-20 21:35:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
class KGE_API ActionMoveBy : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param displacement λ<><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionMoveBy(Duration duration, const Vec2& displacement);
|
|
|
|
|
|
};
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionMoveByEntity : public ActionTweenEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param displacement λ<><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static ActionMoveByEntityPtr Create(Duration duration, const Vec2& displacement);
|
|
|
|
|
|
|
|
|
|
|
|
ActionMoveByEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡλ<C8A1><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Vec2 GetDisplacement() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetDisplacement(const Vec2& displacement);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Reverse() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
Point start_pos_;
|
|
|
|
|
|
Point prev_pos_;
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Vec2 displacement_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief λ<>ƶ<EFBFBD><C6B6><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
class KGE_API ActionMoveTo : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param distination Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ActionMoveTo(Duration duration, const Point& distination);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief λ<>ƶ<EFBFBD><C6B6><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionMoveToEntity : public ActionMoveByEntity
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>λ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param distination Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
static ActionMoveToEntityPtr Create(Duration duration, const Point& distination);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionMoveToEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Point GetDistination() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetDistination(const Point& distination);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
virtual ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionMoveToEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Point distination_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
class KGE_API ActionJumpBy : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param displacement <20><>Ծλ<D4BE><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param height <20><>Ծ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
/// @param count <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionJumpBy(Duration duration, const Vec2& displacement, float height, int count = 1);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionJumpByEntity : public ActionTweenEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param displacement <20><>Ծλ<D4BE><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param height <20><>Ծ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
/// @param count <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
static ActionJumpByEntityPtr Create(Duration duration, const Vec2& displacement, float height, int count = 1);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionJumpByEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>Ծλ<D4BE><CEBB>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Vec2 GetDisplacement() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>Ծ<EFBFBD>߶<EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetJumpHeight() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
int GetJumpCount() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծλ<D4BE><CEBB>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetDisplacement(const Vec2& displacement);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD>߶<EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetJumpHeight(float height);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetJumpCount(int count);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Reverse() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float height_;
|
2020-02-12 22:34:40 +08:00
|
|
|
|
int jump_count_;
|
|
|
|
|
|
Point start_pos_;
|
|
|
|
|
|
Point displacement_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
Point prev_pos_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
class KGE_API ActionJumpTo : public ActionTween
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param distination Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param height <20><>Ծ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
/// @param count <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionJumpTo(Duration duration, const Point& distination, float height, int count = 1);
|
|
|
|
|
|
};
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionJumpToEntity : public ActionJumpByEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param distination Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param height <20><>Ծ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
/// @param count <20><>Ծ<EFBFBD><D4BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
static ActionJumpToEntityPtr Create(Duration duration, const Point& distination, float height, int count = 1);
|
|
|
|
|
|
|
|
|
|
|
|
ActionJumpToEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Point GetDistination() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-02-19 12:09:50 +08:00
|
|
|
|
void SetDistination(const Point& distination);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
virtual ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionJumpToEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2020-02-12 22:34:40 +08:00
|
|
|
|
Point distination_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
class KGE_API ActionScaleBy : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale_x <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
|
|
|
|
|
/// @param scale_y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionScaleBy(Duration duration, float scale_x, float scale_y);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
|
|
|
|
|
ActionScaleBy(Duration duration, Vec2 scale);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionScaleByEntity : public ActionTweenEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale_x <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
|
|
|
|
|
/// @param scale_y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
|
|
|
|
|
static ActionScaleByEntityPtr Create(Duration duration, float scale_x, float scale_y);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionScaleByEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetScaleX() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetScaleY() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetScaleX(float scale_x);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetScaleY(float scale_y);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Reverse() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float start_scale_x_;
|
|
|
|
|
|
float start_scale_y_;
|
|
|
|
|
|
float delta_x_;
|
|
|
|
|
|
float delta_y_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
class KGE_API ActionScaleTo : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale_x <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
|
|
|
|
|
/// @param scale_y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
|
|
|
|
|
ActionScaleTo(Duration duration, float scale_x, float scale_y);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
|
|
|
|
|
ActionScaleTo(Duration duration, Vec2 scale);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionScaleToEntity : public ActionScaleByEntity
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param scale_x <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
|
|
|
|
|
/// @param scale_y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
2020-07-20 21:35:33 +08:00
|
|
|
|
static ActionScaleToEntityPtr Create(Duration duration, float scale_x, float scale_y);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionScaleToEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetTargetScaleX() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetTargetScaleY() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetTargetScaleX(float scale_x);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetTargetScaleY(float scale_y);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
virtual ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionScaleToEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
float end_scale_x_;
|
|
|
|
|
|
float end_scale_y_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
class KGE_API ActionFadeTo : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param opacity Ŀ<><C4BF><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionFadeTo(Duration duration, float opacity);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>붯<EFBFBD><EBB6AF>
|
|
|
|
|
|
class KGE_API ActionFadeIn : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯<EFBFBD><EBB6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
ActionFadeIn(Duration duration);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
class KGE_API ActionFadeOut : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
ActionFadeOut(Duration duration);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionFadeToEntity : public ActionTweenEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD>Ƚ<EFBFBD><C8BD>䶯<EFBFBD><E4B6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param opacity Ŀ<><C4BF><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|
|
|
|
|
static ActionFadeToEntityPtr Create(Duration duration, float opacity);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionFadeToEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĿ<C8A1><C4BF><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetTargetOpacity() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetTargetOpacity(float opacity);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
virtual ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionFadeToEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
float start_val_;
|
|
|
|
|
|
float delta_val_;
|
|
|
|
|
|
float end_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
|
class KGE_API ActionRotateBy : public ActionTween
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// @param rotation <20>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD>Ա仯ֵ
|
|
|
|
|
|
ActionRotateBy(Duration duration, float rotation);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-07-20 21:35:33 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionRotateByEntity : public ActionTweenEntity
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param rotation <20>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-07-20 21:35:33 +08:00
|
|
|
|
static ActionRotateByEntityPtr Create(Duration duration, float rotation);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionRotateByEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetRotation() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD>Ա仯ֵ
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetRotation(float rotation);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Reverse() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
float start_val_;
|
|
|
|
|
|
float delta_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
class KGE_API ActionRotateTo : public ActionTween
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param rotation Ŀ<><C4BF><EFBFBD>Ƕ<EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionRotateTo(Duration duration, float rotation);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionRotateToEntity : public ActionRotateByEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param rotation Ŀ<><C4BF><EFBFBD>Ƕ<EFBFBD>
|
|
|
|
|
|
static ActionRotateToEntityPtr Create(Duration duration, float rotation);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionRotateToEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡĿ<C8A1><C4BF><EFBFBD>Ƕ<EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
float GetTargetRotation() const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>Ƕ<EFBFBD>
|
2020-02-12 22:34:40 +08:00
|
|
|
|
void SetTargetRotation(float rotation);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
virtual ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionRotateToEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
float end_val_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
class KGE_API ActionCustom : public ActionTween
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @details <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ص<EFBFBD><D8B5>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>꣬<EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>0.0 - 1.0<EFBFBD><EFBFBD>
|
2020-01-21 10:09:55 +08:00
|
|
|
|
using TweenFunc = Function<void(Actor* /* target */, float /* percent */)>;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param tween_func <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionCustom(Duration duration, TweenFunc tween_func);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
class KGE_API ActionCustomEntity : public ActionTweenEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>嶯<EFBFBD><E5B6AF>
|
|
|
|
|
|
/// @param duration <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
/// @param tween_func <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
static ActionCustomEntityPtr Create(Duration duration, ActionCustom::TweenFunc tween_func);
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionCustomEntity();
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionCustom::TweenFunc GetTweenFunc() const;
|
2020-02-12 22:34:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
void SetTweenFunc(const ActionCustom::TweenFunc& tween_func);
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Clone() const override;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2020-03-19 14:28:50 +08:00
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionEntityPtr Reverse() const override
|
2020-01-21 10:09:55 +08:00
|
|
|
|
{
|
2020-07-20 21:35:33 +08:00
|
|
|
|
KGE_ERRORF("Reverse() not supported in ActionCustomEntity");
|
2020-01-21 10:09:55 +08:00
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void Init(Actor* target) override;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateTween(Actor* target, float percent) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2020-07-20 21:35:33 +08:00
|
|
|
|
ActionCustom::TweenFunc tween_func_;
|
2020-01-21 10:09:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline const EaseFunc& ActionTweenEntity::GetEaseFunc() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return ease_func_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline Duration ActionTweenEntity::GetDuration() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return dur_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionTweenEntity::SetDuration(Duration duration)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
dur_ = duration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionTweenEntity::SetEaseFunc(const EaseFunc& func)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
ease_func_ = func;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline Vec2 ActionMoveByEntity::GetDisplacement() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return displacement_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionMoveByEntity::SetDisplacement(const Vec2& displacement)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
displacement_ = displacement;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline Point ActionMoveToEntity::GetDistination() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return distination_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionMoveToEntity::SetDistination(const Point& distination)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
distination_ = distination;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline Vec2 ActionJumpByEntity::GetDisplacement() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return displacement_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionJumpByEntity::GetJumpHeight() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return height_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline int ActionJumpByEntity::GetJumpCount() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return jump_count_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionJumpByEntity::SetDisplacement(const Vec2& displacement)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
displacement_ = displacement;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionJumpByEntity::SetJumpHeight(float height)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
height_ = height;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionJumpByEntity::SetJumpCount(int count)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
jump_count_ = count;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline Point ActionJumpToEntity::GetDistination() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return distination_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionJumpToEntity::SetDistination(const Point& distination)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
distination_ = distination;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionScaleByEntity::GetScaleX() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return delta_x_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionScaleByEntity::GetScaleY() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return delta_y_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionScaleByEntity::SetScaleX(float scale_x)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
delta_x_ = scale_x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionScaleByEntity::SetScaleY(float scale_y)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
delta_y_ = scale_y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionScaleToEntity::GetTargetScaleX() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return end_scale_x_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionScaleToEntity::GetTargetScaleY() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return end_scale_y_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionScaleToEntity::SetTargetScaleX(float scale_x)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
end_scale_x_ = scale_x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionScaleToEntity::SetTargetScaleY(float scale_y)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
end_scale_y_ = scale_y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionFadeToEntity::GetTargetOpacity() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return end_val_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionFadeToEntity::SetTargetOpacity(float opacity)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
end_val_ = opacity;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionRotateByEntity::GetRotation() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return delta_val_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionRotateByEntity::SetRotation(float rotation)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
delta_val_ = rotation;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline float ActionRotateToEntity::GetTargetRotation() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return end_val_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionRotateToEntity::SetTargetRotation(float rotation)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
end_val_ = rotation;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline ActionCustom::TweenFunc ActionCustomEntity::GetTweenFunc() const
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
return tween_func_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:35:33 +08:00
|
|
|
|
inline void ActionCustomEntity::SetTweenFunc(const ActionCustom::TweenFunc& tween_func)
|
2020-02-12 22:34:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
tween_func_ = tween_func;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-21 10:09:55 +08:00
|
|
|
|
} // namespace kiwano
|