mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
75 lines
2.6 KiB
C#
75 lines
2.6 KiB
C#
using TEngine.Runtime.Entity;
|
|
using UnityEngine;
|
|
|
|
namespace TEngine.Runtime.Actor
|
|
{
|
|
public class PlayEntityMgr:UnitySingleton<PlayEntityMgr>
|
|
{
|
|
protected override void OnLoad()
|
|
{
|
|
RegisterEvent();
|
|
|
|
base.OnLoad();
|
|
}
|
|
|
|
/// <summary>
|
|
/// RegisterEvent
|
|
/// </summary>
|
|
void RegisterEvent()
|
|
{
|
|
GameEvent.AddEventListener<IEntity, float, object>(EntityEvent.ShowEntitySuccess, OnShowEntitySuccess);
|
|
GameEvent.AddEventListener<int, string, string, string, object>(EntityEvent.ShowEntityFailure, OnShowEntityFailure);
|
|
GameEvent.AddEventListener<int, string, IEntityGroup, object>(EntityEvent.HideEntityComplete, OnHideEntityComplete);
|
|
}
|
|
|
|
/// <summary>
|
|
/// OnShowEntitySuccess
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <param name="duration"></param>
|
|
/// <param name="userData"></param>
|
|
private void OnShowEntitySuccess(IEntity entity, float duration, object userData)
|
|
{
|
|
Log.Warning("OnShowEntitySuccess" + entity.ToString() + " " + duration + " " + userData);
|
|
}
|
|
|
|
/// <summary>
|
|
/// OnShowEntityFailure
|
|
/// </summary>
|
|
/// <param name="entityId"></param>
|
|
/// <param name="entityAssetName"></param>
|
|
/// <param name="entityGroupName"></param>
|
|
/// <param name="errorMessage"></param>
|
|
/// <param name="userData"></param>
|
|
private void OnShowEntityFailure(int entityId, string entityAssetName, string entityGroupName,
|
|
string errorMessage, object userData)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// OnHideEntityComplete
|
|
/// </summary>
|
|
/// <param name="entityId"></param>
|
|
/// <param name="entityAssetName"></param>
|
|
/// <param name="entityGroup"></param>
|
|
/// <param name="userData"></param>
|
|
private void OnHideEntityComplete(int entityId, string entityAssetName, IEntityGroup entityGroup,
|
|
object userData)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 玩家Actor实体管理器创建光源/ URP可最佳实践
|
|
/// </summary>
|
|
/// <param name="lightType"></param>
|
|
/// <param name="position"></param>
|
|
/// <param name="quaternion"></param>
|
|
public void CreatePlayerEntity(GameActor actor,string entityPath, Vector3 position,Quaternion quaternion)
|
|
{
|
|
EntityData data = EntityData.Create(position,quaternion,actor);
|
|
|
|
EntitySystem.Instance.CreateEntity<ActorEntity>(entityPath, data);
|
|
}
|
|
}
|
|
} |