42 lines
1007 B
C#
42 lines
1007 B
C#
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;
|
|
}
|
|
|
|
}
|
|
}
|