Ejemplo n.º 1
0
        /// <summary>
        /// Gets the position the specified peon should seek to.
        /// </summary>
        /// <param name="peon"></param>
        /// <returns></returns>
        public Vehicle getFollowTarget(Peon peon)
        {
            int i;

            for (i = 0; i < attachedPeons.Count; ++i)
            {
                if (peon.Equals(attachedPeons[i]))
                {
                    break;
                }
            }
            if (i == attachedPeons.Count)
            {
                throw new Exception("Tried to get position of peon who was not attached to player.");
            }

            if (i == 0)
            {
                return(vehicle);
            }
            else
            {
                return(attachedPeons[i - 1].Vehicle);
            }
        }
Ejemplo n.º 2
0
 public bool addPeon(Peon peon)
 {
     if (!peons.Contains(peon))
     {
         peons.Add(peon);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a peon to this player so it starts being followed.
        /// Handles removing the peon from other players so things can't f**k up.
        /// </summary>
        /// <param name="peon"></param>
        public void attachPeon(Peon peon)
        {
            foreach (Player p in Engine.players.Values)
            {
                p.deattachPeon(peon);
            }

            // add the peon to the back of the queue
            attachedPeons.Add(peon);
        }
Ejemplo n.º 4
0
 public void deattachPeon(Peon peon)
 {
     attachedPeons.Remove(peon);
 }
Ejemplo n.º 5
0
 public bool remove(Peon peon)
 {
     return(peons.Remove(peon));
 }
Ejemplo n.º 6
0
 public bool contains(Peon peon)
 {
     return(peons.Contains(peon));
 }