OnDestroyZoneObject.cs 970 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEngine;
  2. namespace ET.Client
  3. {
  4. [Event(SceneType.Current)]
  5. public class OnDestroyZoneObjectHandler : AEvent<EventType.OnDestroyZoneObject>
  6. {
  7. protected override async ETTask Run(Scene scene, EventType.OnDestroyZoneObject args)
  8. {
  9. Log.Debug($"remove unit view: {args.ObjectId}");
  10. DestroyUnitModel(args.ObjectId);
  11. await ETTask.CompletedTask;
  12. }
  13. private void DestroyUnitModel(uint unitid)
  14. {
  15. ModelViewComponent.Instance?.RemoveChild(unitid);
  16. if (unitid == UnitMgr.Instance.ActorId)
  17. {
  18. //相机跟随主角
  19. //ModelViewComponent.Instance.AddComponent<CameraComponent>().Unit = unit;
  20. //固定视角相机
  21. var camera = Camera.main;
  22. //camera.transform.position = new Vector3(unit.Position.x, 7, unit.Position.z - 15);
  23. }
  24. }
  25. }
  26. }