Exemple #1
0
        public void IncrementPreferredPath()
        {
            if (AllPaths == null)
            {
                AllPaths = new List <PathEntity>();
                if (RightPaths != null)
                {
                    AllPaths.AddRange(RightPaths);
                }
                if (LeftPaths != null)
                {
                    AllPaths.AddRange(LeftPaths);
                }
            }

            if (PreferredPathEntity == null)
            {
                PreferredPathEntity = AllPaths[0];
                PreferredPathEntity.IsPreferredPath = true;
            }
            else
            {
                int index = AllPaths.IndexOf(PreferredPathEntity);
                if (index + 1 < AllPaths.Count)
                {
                    PreferredPathEntity.IsPreferredPath = false;
                    PreferredPathEntity = AllPaths[index + 1];
                    PreferredPathEntity.IsPreferredPath = true;
                }
                else
                {
                    PreferredPathEntity.IsPreferredPath = false;
                    PreferredPathEntity = AllPaths[0];
                    PreferredPathEntity.IsPreferredPath = true;
                }
            }
            if (PathSelectionEntity != null)
            {
                this.Game.PathSelectionList.Remove(PathSelectionEntity);
                PathSelectionEntity = null;
            }
        }
Exemple #2
0
 public void ClearPreferred()
 {
     if (PreferredPathEntity != null)
     {
         PreferredPathEntity.IsPreferredPath = false;
         PreferredPathEntity = null;
     }
     if (PathSelectionEntity != null)
     {
         this.Game.PathSelectionList.Remove(PathSelectionEntity);
         PathSelectionEntity = null;
     }
     if (this.Owner != Owners.NEUTRAL)
     {
         Order = Orders.NONE;
         if (OrderEntity != null)
         {
             this.Game.OrderList.Remove(OrderEntity);
             OrderEntity = null;
         }
     }
 }