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