public void Eval(WObject o) { if (o.getPos() == destination || o.getPos() == waypoint) { Use(o.getUtil()); } }
public void resolveUD(WObject wobject) { if (position.X > wobject.getPos().X) //horizontal position reset to right of object { newPos(wobject.getPos().X + wobject.sprite.Width, position.Y); } else //horizontal position reset to left of object { newPos(wobject.getPos().X - sprite.Width, position.Y); } }
public void resolveLR(WObject wobject) { CDresolved = false; if (position.Y > wobject.getPos().Y) //vertical position reset to under object { newPos(position.X, wobject.getPos().Y + wobject.sprite.Height); } else //vertical position reset to above object { newPos(position.X, wobject.getPos().Y - sprite.Height); } }
public void resolveLR(WObject wobject) { CDresolved = false; if (position.Y > wobject.getPos().Y) //vertical position reset to under object { newPos(position.X, wobject.getPos().Y + wobject.sprite.Height); } else //vertical position reset to above object { newPos(position.X, wobject.getPos().Y - sprite.Height); } if (destination.X < wobject.getPos().X) //waypoint set to the left { waypoint = new Vector2(wobject.getPos().X - sprite.Width, position.Y); } else { waypoint = new Vector2(wobject.getPos().X + wobject.sprite.Width, position.Y); } _addWP(waypoint); WPSet = true; }
public void resolveUD(WObject wobject) { if (position.X > wobject.getPos().X) //horizontal position reset to right of object { newPos(wobject.getPos().X + wobject.sprite.Width, position.Y); } else //horizontal position reset to left of object { newPos(wobject.getPos().X - sprite.Width, position.Y); } if (destination.Y < wobject.getPos().Y) //waypoint set to above object { waypoint = new Vector2(position.X, wobject.getPos().Y - sprite.Height); } else //waypoint set below object { waypoint = new Vector2(position.X, wobject.getPos().Y + wobject.sprite.Height); } _addWP(waypoint); WPSet = true; }
private double distanceTo(WObject o) { double f = Math.Sqrt(Math.Pow(o.getPos().X - getPos().X, 2) + Math.Pow(o.getPos().Y - getPos().Y, 2)); return f; }