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

#include <BaseZomble.h>

类 BaseZomble 继承关系图:
Sprite Object base NormalZomble

Public 成员函数

 BaseZomble ()
 
virtual void BeginPlay ()
 设置虚函数,把不能写在构造却需要优先实现的写在这
 
virtual void Update (float deltaTime) override
 实现闪烁功能
 
void GetDamage (float damage)
 
void OnOverlap (Collider *overlapcomponentself, Collider *othercomponent, Object *otherobject)
 
void EndOverlap (Collider *overlapcomponentself, Collider *othercomponent, Object *otherobject)
 
- 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)
 

Protected 属性

SpriteRendererrenderer
 
BoxColliderbox
 
class Animatorani
 
class FSMfsm
 
int blood = 5
 
float speed = 0.2f
 
Animation walk
 
Animation eat
 
Animation die
 
std::set< Object * > OverlapPlants
 
BasePlanteatingPlant =nullptr
 
- Protected 属性 继承自 Object
SceneComponent *const root = new SceneComponent
 场景根组件,赋予场景属性 刚创建物体一定同时创建了它的场景组件,不允许改变指向
 

构造及析构函数说明

◆ BaseZomble()

BaseZomble::BaseZomble ( )

成员函数说明

◆ BeginPlay()

void BaseZomble::BeginPlay ( )
virtual

设置虚函数,把不能写在构造却需要优先实现的写在这

重载 Sprite .

◆ EndOverlap()

void BaseZomble::EndOverlap ( Collider * overlapcomponentself,
Collider * othercomponent,
Object * otherobject )

◆ GetDamage()

void BaseZomble::GetDamage ( float damage)

◆ OnOverlap()

void BaseZomble::OnOverlap ( Collider * overlapcomponentself,
Collider * othercomponent,
Object * otherobject )

◆ Update()

void BaseZomble::Update ( float deltaTime)
overridevirtual

实现闪烁功能

重载 Sprite .

类成员变量说明

◆ ani

class Animator* BaseZomble::ani
protected

◆ blood

int BaseZomble::blood = 5
protected

◆ box

BoxCollider* BaseZomble::box
protected

◆ die

Animation BaseZomble::die
protected

◆ eat

Animation BaseZomble::eat
protected

◆ eatingPlant

BasePlant* BaseZomble::eatingPlant =nullptr
protected

◆ fsm

class FSM* BaseZomble::fsm
protected

◆ OverlapPlants

std::set<Object*> BaseZomble::OverlapPlants
protected

◆ renderer

SpriteRenderer* BaseZomble::renderer
protected

◆ speed

float BaseZomble::speed = 0.2f
protected

◆ walk

Animation BaseZomble::walk
protected