private int DistanceTo(Unit u)// checks ranged unit distance to the other unirs { if (u.GetType() == typeof(TwoHandedUnits)) { TwoHandedUnits n = (TwoHandedUnits)u; int d = (Xpos - n.xpos) + Math.Abs(Ypos - n.ypos); return(d); } else { return(0); } }
public override bool Inranged(Unit u)// checks to see if the other unit is inrange for combat { if (u.GetType() == typeof(TwoHandedUnits)) { TwoHandedUnits n = (TwoHandedUnits)u; if (DistanceTo(u) <= range) { return(true); } else { return(false); } } return(false); }