public override bool InRange(ICombatObject obj) { if (obj.ClassType == BattleClass.Unit) { return(tileLocator.IsOverlapping(obj.Location(), obj.Size, obj.AttackRadius(), Structure.PrimaryPosition, Structure.Size, Structure.Stats.Base.Radius)); } throw new Exception(string.Format("Why is a structure trying to kill a unit of type {0}?", obj.GetType().FullName)); }
public override bool InRange(ICombatObject obj) { switch (obj.ClassType) { case BattleClass.Unit: return(true); case BattleClass.Structure: return(tileLocator.IsOverlapping(Location(), Size, AttackRadius(), obj.Location(), obj.Size, obj.AttackRadius())); default: throw new Exception(string.Format("Why is an attack combat unit trying to kill a unit of type {0}?", obj.GetType().FullName)); } }