public Direction Directionto(Unit u) { if (u.GetType() == typeof(deadshot)) { deadshot d = (deadshot)u; if (d.Xpos < Xpos) { return(Direction.North); } else if (d.Ypos > Ypos) { return(Direction.East); } else if (d.Xpos > xpos) { return(Direction.South); } else { return(Direction.West); } } else { return(Direction.North); } }
private int Distance(Unit u) { if (u.GetType() == typeof(deadshot)) { deadshot ds = (deadshot)u; int d = Math.Abs(Xpos - ds.Xpos) + Math.Abs(Ypos - ds.Ypos); return(d); } else { return(0); } }
public override bool Range(Unit u) { if (u.GetType() == typeof(deadshot)) { deadshot d = (deadshot)u; if (Distance(u) <= Attackrange) { return(true); } else { return(false); } } else { return(false); } }