Exemplo n.º 1
0
        public override void Update(ControllableObject actor)
        {
            if (!(actor is Unit)) //this ain't a unit! ...it can't move!
                return;

            if (!initialized) { //get a path if i haven't already
                path = Scenario.Map.GetPath(new Point((int)actor.Position.X, (int)actor.Position.Y), destination, new Point(actor.Width, actor.Height));
                destination = path.Pop();
                initialized = true;
            }

            if (actor.Position != destination.Vector) {
                //i am headed to a point in my path
                actor.Position = Global.MoveLinearly(actor.Position, 40, destination.Vector);

            } else if (actor.Position == destination.Vector && path.Count > 0) {
                //i have reached a point in my path, but have more points to go; head to next point
                destination = path.Pop();

            } else if (actor.Position == destination.Vector && path.Count == 0) {
                //i am done moving
                Finished = true;
            }
        }
Exemplo n.º 2
0
 public void RemoveObject(ControllableObject co)
 {
     MyStuff.Remove(co);
 }
Exemplo n.º 3
0
 public void AddObject(ControllableObject co)
 {
     MyStuff.Add(co);
 }
Exemplo n.º 4
0
 public FollowTask(ControllableObject target) {
     this.Target = target;
 }
Exemplo n.º 5
0
        //a task tells a unit what to do
        public virtual void Update(ControllableObject actor) {

        }