OnDestroyZoneObject.cs 1.0 KB

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