easyx_framework V1.0.0
基于easyx的c++游戏框架
 
载入中...
搜索中...
未找到
SunFlower类 参考

#include <sunflower.h>

类 SunFlower 继承关系图:
BasePlant Sprite Object base

Public 成员函数

 SunFlower ()
 
virtual void Update (float deltaTime)
 实现闪烁功能
 
void Produce ()
 
- Public 成员函数 继承自 BasePlant
 BasePlant ()
 
void TakeDamage (float damage)
 
virtual void BeginPlay () override
 设置虚函数,把不能写在构造却需要优先实现的写在这
 
void Activate ()
 
int GetCost () const
 
- Public 成员函数 继承自 Sprite
 Sprite ()
 创建渲染组件,加入世界容器
 
void LoadSprite (std::string)
 加载图片资源.
 
void Blink (float duration=0.2f, COLORREF col=BLACK, int level=60)
 闪烁效果.
 
- Public 成员函数 继承自 Object
 Object ()
 只是一个场景根组件(带有场景属性),不需要遍历,所以不需要加入容器
 
 ~Object ()
 组件删除的控制权在对象中
 
virtual void EndPlay ()
 设置虚函数,把不能写在析构却需要优先实现的写在这 例如delete this
 
void RegisterComponent (Component *pCom)
 在物体容器中注册组件.
 
void UnregisterComponent (Component *pCom)
 从物体组件容器中删除相应组件.
 
template<class T >
T * GetComponentByClass ()
 访问物体对象的跟他匹配的组件.
 
template<class T >
T * ConstructComponent ()
 创建组件,绑定到对象,并注册到对象容器.
 
void AttachTo (Object *par)
 设置所属物体 实现物体绑定.
 
void DetachForm (Object *par)
 解除所属物体 解除物体绑定.
 
void SetRootComponent (SceneComponent *newroot)
 设置场景根组件,物体以哪个组件场景属性作为自己的场景属性.
 
void Destroy ()
 用深度优先遍历进行遍历,借助栈来实现,实现物体及其所有绑定的物体类销毁
 
Vector2D GetLocalPosition () const
 获取物体相对坐标
 
float GetLocalRotation () const
 获取物体相对角度
 
Vector2D GetLocalScale () const
 获取物体相对缩放大小
 
Vector2D GetWorldPosition () const
 递归获取物体类的世界坐标
 
float GetWorldRotation () const
 递归获取物体类的世界旋转角度
 
Vector2D GetWorldScale () const
 递归获取物体类的世界缩放大小
 
void SetLocalPosition (const Vector2D &pos)
 设置物体相对坐标
 
void SetLocalRotation (float rot)
 设置物体相对角度
 
void SetLocalScale (const Vector2D &scale)
 设置物体相对缩放大小
 
void AddPosition (const Vector2D &pos)
 加上一个坐标
 
void AddRotation (float rot)
 加上一个角度
 
virtual void DrawDebugPosition () const
 调试 在画布上显示物体的坐标
 
- Public 成员函数 继承自 base
 base ()
 
virtual ~base ()
 
std::string GetName () const
 
void SetName (const std::string &name)
 

Private 属性

class Animation idle
 
Timer ProduceTimerHandle
 
float transitionLevel = 0
 
int state = 0
 

额外继承的成员函数

- Protected 属性 继承自 BasePlant
SpriteRendererrenderer
 
BoxColliderbox
 
class Animatorani
 
int blood = 10
 
int cost = 0
 
- Protected 属性 继承自 Object
SceneComponent *const root = new SceneComponent
 场景根组件,赋予场景属性 刚创建物体一定同时创建了它的场景组件,不允许改变指向
 

构造及析构函数说明

◆ SunFlower()

SunFlower::SunFlower ( )

成员函数说明

◆ Produce()

void SunFlower::Produce ( )

◆ Update()

void SunFlower::Update ( float deltaTime)
virtual

实现闪烁功能

重载 Sprite .

类成员变量说明

◆ idle

class Animation SunFlower::idle
private

◆ ProduceTimerHandle

Timer SunFlower::ProduceTimerHandle
private

◆ state

int SunFlower::state = 0
private

◆ transitionLevel

float SunFlower::transitionLevel = 0
private