From 91e589d1678a8187c307e09b98b67ec4133092ff Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 19 Jan 2019 01:44:05 +0800 Subject: =?UTF-8?q?*=E6=B8=B8=E6=88=8F=E6=A1=86=E6=9E=B6=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Asura.Engine/Graphics/Animator.h | 96 +++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Source/Asura.Engine/Graphics/Animator.h (limited to 'Source/Asura.Engine/Graphics/Animator.h') diff --git a/Source/Asura.Engine/Graphics/Animator.h b/Source/Asura.Engine/Graphics/Animator.h new file mode 100644 index 0000000..4d3d269 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animator.h @@ -0,0 +1,96 @@ +#ifndef __AE_ANIMATOR_H__ +#define __AE_ANIMATOR_H__ + +#include "Component.h" +#include "Animation.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 控制animation的组件,主要是作为animation的代理 + /// + class Animator final : public Component + { + public: + + void OnEnable() override; + void OnUpdate(uint32 milliseconds) override; + + /// + /// 设置animation + /// + void SetAnimation(uint ID); + + /// + /// 设置animation + /// + void SetAnimation(Animation* animation); + + /// + /// 根据设置animation状态 + /// + void SetTime(float time); + + /// + /// 修改播放速度 + /// + void SetSpeed(float speed); + + /// + /// 设置是否循环 + /// + void SetLoop(bool isloop); + + /// + /// 根据关键帧修改animation + /// + void SetKeyFrame(uint keyFrame); + + /// + /// 设置到结束 + /// + void SetToBegin(); + + /// + /// 设置到开始 + /// + void SetToEnd(); + + /// + /// 暂停 + /// + void Pause(); + + private: + + /// + /// 当前的animation + /// + Animation* mAnimation; + + /// + /// Animation要求物体必须有一个sprite renderer组件 + /// + SpriteRenderer* mSpriteRenderer; + + /// + /// 播放速度,默认为1,dt = mSpeed * DELTA_TIME + /// + float mSpeed; + + /// + /// 当前执行的时间 + /// + float mTime; + + bool mLoop; + + }; + + } +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0