diff --git a/Assets/TEngine.Demo/TEngine.ActorDemo/ActorTestMain.cs b/Assets/TEngine.Demo/TEngine.ActorDemo/ActorTestMain.cs index 354d5d34..5d891dc8 100644 --- a/Assets/TEngine.Demo/TEngine.ActorDemo/ActorTestMain.cs +++ b/Assets/TEngine.Demo/TEngine.ActorDemo/ActorTestMain.cs @@ -5,7 +5,7 @@ using UnityEngine; public class ActorTestMain : MonoBehaviour { - private uint _actorId = 0; + private uint _actorId = 1000; void Start() { diff --git a/Assets/TEngine.Demo/TEngine.ActorDemo/PlayEntityMgr.cs b/Assets/TEngine.Demo/TEngine.ActorDemo/PlayEntityMgr.cs index bf0d1a17..6363c9bd 100644 --- a/Assets/TEngine.Demo/TEngine.ActorDemo/PlayEntityMgr.cs +++ b/Assets/TEngine.Demo/TEngine.ActorDemo/PlayEntityMgr.cs @@ -65,9 +65,9 @@ namespace TEngine.Runtime.Actor /// /// /// - public void CreatePlayerEntity(int actorId,string entityPath, Vector3 position,Quaternion quaternion) + public void CreatePlayerEntity(GameActor actor,string entityPath, Vector3 position,Quaternion quaternion) { - EntityData data = EntityData.Create(position,quaternion,actorId); + EntityData data = EntityData.Create(position,quaternion,actor); EntitySystem.Instance.CreateEntity(entityPath, data); } diff --git a/Assets/TEngine.Demo/TEngine.ActorDemo/PlayerActor.cs b/Assets/TEngine.Demo/TEngine.ActorDemo/PlayerActor.cs index bd7e7308..2e4023b2 100644 --- a/Assets/TEngine.Demo/TEngine.ActorDemo/PlayerActor.cs +++ b/Assets/TEngine.Demo/TEngine.ActorDemo/PlayerActor.cs @@ -6,16 +6,21 @@ namespace TEngine.Runtime.Actor { public class ActorEntity : EntityLogicEx { - protected override void OnInit(object userData) + protected override void OnShow(object userData) { base.OnInit(userData); var entityData = (EntityData)userData; - var actor = ActorManager.Instance.GetActor((uint)entityData.UserData); - + GameActor actor = (GameActor)entityData.UserData; + actor.Get().BindModel(gameObject); } + + protected override void OnHide(bool isShutdown, object userData) + { + + } } /// @@ -77,7 +82,7 @@ namespace TEngine.Runtime.Actor // _model = Object.Instantiate(obj); //通过Entity创建实体 - PlayEntityMgr.Instance.CreatePlayerEntity((int)OwnActor.ActorId,"Capsule",Vector3.zero, Quaternion.identity); + PlayEntityMgr.Instance.CreatePlayerEntity(OwnActor,"Capsule",Vector3.zero, Quaternion.identity); } public void BindModel(GameObject gameObject)