Update Demo目录

Update Demo目录
This commit is contained in:
ALEXTANG
2022-10-24 20:39:01 +08:00
parent 5186b2f8fc
commit 94be77bec5
61 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using System.Collections.Generic;
using TEngine.Runtime;
using TEngine.Runtime.Actor;
using UnityEngine;
public class ActorTestMain : MonoBehaviour
{
private uint _actorId = 1000;
void Start()
{
//Demo示例监听TEngine流程加载器OnStartGame事件
//抛出这个事件说明框架流程加载完成(热更新,初始化等)
GameEventMgr.Instance.AddEventListener(TEngineEvent.OnStartGame,OnStartGame);
}
private void OnStartGame()
{
Log.Debug("TEngineEvent.OnStartGame");
//激活ActorManager
ActorManager.Instance.Active();
//注册Actor类型
ActorManager.Instance.RegisterActorType(ActorType.ActorPlayer,typeof(PlayerActor));
//创建Actor
var actor = ActorManager.Instance.CreateGameActor(ActorType.ActorPlayer, _actorId++, true);
//附加组件ActorGameObjet可视化
actor.Attach<ModelComponent>();
actor.Attach<FsmComponent>();
actor.Attach<AnimatorComponent>();
}
}