Beispiel #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);
            }
        }
Beispiel #2
0
 public bool addPeon(Peon peon)
 {
     if (!peons.Contains(peon))
     {
         peons.Add(peon);
         return(true);
     }
     return(false);
 }
Beispiel #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);
        }
Beispiel #4
0
 public void deattachPeon(Peon peon)
 {
     attachedPeons.Remove(peon);
 }
Beispiel #5
0
 public bool remove(Peon peon)
 {
     return(peons.Remove(peon));
 }
Beispiel #6
0
 public bool contains(Peon peon)
 {
     return(peons.Contains(peon));
 }