using Gameplay.Level.Select; using Gameplay.Unit; using PhxhSDK; namespace Gameplay.Level { public partial class Level { public GameUnit selectUnit { get { return selectView.selectUnit; } } public SelectView selectView { get; private set; } public void SelectUnit(GameUnit newUnit) { if (selectUnit == newUnit) return; if (!newUnit.commonData.canSelect) return; UnSelectUnit(); newUnit.OnSelect(); selectView.SetOwner(newUnit); // 居中镜头 if (LevelManager.Instance.CurrentLevel.isInBattle) { CameraManager.Instance.MainCamera.GetComponent().KeepCenter(newUnit.transform.position); } } public void SelectUnit(uint id) { var newUnit = GameUnitManager.instance.infightUnits.Search(id); SelectUnit(newUnit); } public void UnSelectUnit() { if (selectUnit == null) return; selectUnit.OnUnSelect(); selectView.SetOwner(null); } } }