using TEngine.Runtime.Entity; using UnityEngine; namespace TEngine.Runtime.Actor { public class PlayEntityMgr:UnitySingleton { protected override void OnLoad() { RegisterEvent(); base.OnLoad(); } /// /// RegisterEvent /// void RegisterEvent() { GameEventMgr.Instance.AddEventListener(EntityEvent.ShowEntitySuccess, OnShowEntitySuccess); GameEventMgr.Instance.AddEventListener(EntityEvent.ShowEntityFailure, OnShowEntityFailure); GameEventMgr.Instance.AddEventListener(EntityEvent.HideEntityComplete, OnHideEntityComplete); } /// /// OnShowEntitySuccess /// /// /// /// private void OnShowEntitySuccess(IEntity entity, float duration, object userData) { Log.Warning("OnShowEntitySuccess" + entity.ToString() + " " + duration + " " + userData); } /// /// OnShowEntityFailure /// /// /// /// /// /// private void OnShowEntityFailure(int entityId, string entityAssetName, string entityGroupName, string errorMessage, object userData) { } /// /// OnHideEntityComplete /// /// /// /// /// private void OnHideEntityComplete(int entityId, string entityAssetName, IEntityGroup entityGroup, object userData) { } /// /// 玩家Actor实体管理器创建光源/ URP可最佳实践 /// /// /// /// public void CreatePlayerEntity(int actorId,string entityPath, Vector3 position,Quaternion quaternion) { EntityData data = EntityData.Create(position,quaternion,actorId); EntitySystem.Instance.CreateEntity(entityPath, data); } } }