private int DistanceTo(Unit u)// checks ranged unit distance to the other unirs { if (u.GetType() == typeof(ProphetsUnit)) { ProphetsUnit n = (ProphetsUnit)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 for combat { if (u.GetType() == typeof(DoctorsUnit)) { ProphetsUnit n = (ProphetsUnit)u; if (DistanceTo(u) <= range) { return(true); } else { return(false); } } return(false); }
public override bool Inranged(Unit u)//This checks if meleeunit is inrange of other units on the field. { if (u.GetType() == typeof(ProphetsUnit)) { ProphetsUnit n = (ProphetsUnit)u; if (DistanceTo(u) <= range) { return(true); } else { return(false); } } return(false); }