Jump to content

Anyone give me example of using Actor in CPP


Go to solution Solved by GorzenDev,

Recommended Posts

  • Solution
Posted

The BaseActor class i use to derive actors from.
Use it just like you would use a entity script.

Attach actor to a entity.

baseActor = new BaseActor();
entity->SetActor(baseActor);


BaseActor.h


#include "Leadwerks.h"


using namespace Leadwerks;

const enum class ActorType : char { Base, Player, NPC};

class BaseActor : public Actor
{
	//Built-in extendable functions
	//
	//virtual void EndAnimation(const int sequence);
	virtual void Sleep();
	//virtual void Wake();
	virtual void Attach();
	//virtual void Detach();
	//virtual void Collision(Entity* entity, const Vec3& position, const Vec3& normal, float speed);
	virtual void UpdateWorld();
	virtual void UpdatePhysics();
	//virtual void UpdateMatrix();
	virtual void PostRender(Context* context);
	//virtual void Draw();
	//virtual void DrawEach(Camera* camera);
	//virtual void ReceiveSignal(const std::string& inputname, Entity* sender);
public:
	ActorType actorType = ActorType::Base;


	BaseActor();
	virtual ~BaseActor();


};


BaseActor.cpp

#include "BaseActor.h"


BaseActor::BaseActor()
{
}


BaseActor::~BaseActor()
{
}

void BaseActor::Attach()
{
	//
	//System::Print("BaseActor Attached.");
}

void BaseActor::Sleep()
{
	//
	//System::Print("BaseActor Sleep.");
}

void BaseActor::UpdateWorld()
{
	//System::Print("BaseActor UpdateWorld.");
}

void BaseActor::UpdatePhysics()
{
	//System::Print("BaseActor UpdatePhysics.");
}

void BaseActor::PostRender(Context* context)
{
	//
}

 

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...