using Framework; using Gameplay.Common; using UnityEngine; namespace Gameplay.Level { public partial class Level { public GameUnit selectUnit { get; private set; } public void SelectUnit(GameUnit newUnit) { if (selectUnit == newUnit) return; if (!newUnit.commonData.canSelect) return; UnSelectUnit(); newUnit.OnSelect(); selectUnit = newUnit; } public void SelectUnit(uint id) { var newUnit = GameUnitMapper.Inst.GetUnitById(id); if (selectUnit == newUnit) return; if (newUnit.commonData.canSelect) { UnSelectUnit(); newUnit.OnSelect(); selectUnit = newUnit; } } public void UnSelectUnit() { if (selectUnit == null) return; selectUnit.OnUnSelect(); selectUnit = null; } } }