OnDestroyZoneObject.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. if(ModelViewComponent.Instance != null)
  16. {
  17. ModelViewComponent.Instance.RemoveChild(unitid);
  18. }
  19. if (unitid == UnitMgr.Instance.ActorId)
  20. {
  21. //相机跟随主角
  22. //ModelViewComponent.Instance.AddComponent<CameraComponent>().Unit = unit;
  23. //固定视角相机
  24. var camera = Camera.main;
  25. //camera.transform.position = new Vector3(unit.Position.x, 7, unit.Position.z - 15);
  26. }
  27. }
  28. }
  29. }