mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update PlayerActor.cs
This commit is contained in:
@@ -14,7 +14,7 @@ namespace TEngine.Runtime.Actor
|
|||||||
|
|
||||||
GameActor actor = (GameActor)entityData.UserData;
|
GameActor actor = (GameActor)entityData.UserData;
|
||||||
|
|
||||||
actor.Get<ModelComponent>().BindModel(gameObject);
|
actor.Event.SendEvent(StringId.StringToHash("ActorEntityOnShow"),gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHide(bool isShutdown, object userData)
|
protected override void OnHide(bool isShutdown, object userData)
|
||||||
@@ -70,11 +70,18 @@ namespace TEngine.Runtime.Actor
|
|||||||
{
|
{
|
||||||
base.Awake();
|
base.Awake();
|
||||||
|
|
||||||
|
RegisterEvent();
|
||||||
|
|
||||||
InitModel();
|
InitModel();
|
||||||
|
|
||||||
BindOwnActor();
|
BindOwnActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RegisterEvent()
|
||||||
|
{
|
||||||
|
OwnActor.Event.AddEventListener<GameObject>(StringId.StringToHash("ActorEntityOnShow"),OnLoadModel,OwnActor);
|
||||||
|
}
|
||||||
|
|
||||||
private void InitModel()
|
private void InitModel()
|
||||||
{
|
{
|
||||||
//普通创建实体
|
//普通创建实体
|
||||||
@@ -85,7 +92,7 @@ namespace TEngine.Runtime.Actor
|
|||||||
PlayEntityMgr.Instance.CreatePlayerEntity(OwnActor,"Capsule",Vector3.zero, Quaternion.identity);
|
PlayEntityMgr.Instance.CreatePlayerEntity(OwnActor,"Capsule",Vector3.zero, Quaternion.identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindModel(GameObject gameObject)
|
public void OnLoadModel(GameObject gameObject)
|
||||||
{
|
{
|
||||||
_model = gameObject;
|
_model = gameObject;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user