示例#1
0
 public void Eval(WObject o)
 {
     if (o.getPos() == destination || o.getPos() == waypoint)
     {
         Use(o.getUtil());
     }
 }
示例#2
0
 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);
     }
 }
示例#3
0
 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);
     }
 }
示例#4
0
        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;
        }
示例#5
0
        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;
        }
示例#6
0
 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;
 }