Ejemplo n.º 1
0
 public void InsertIntoInitiativeQueueAtIndex(BattleActor ba, int index)
 {
     if (index >= queue.Count)
     {
         Debug.LogWarning("WARNING: Inserting into Initiative Queue at an out-of-bounds index of " + index.ToString() + ". Inserting at the end instead.");
         AddToInitiativeQueue(ba);
     }
     else
     {
         queue.Insert(index, ba);
     }
 }
Ejemplo n.º 2
0
 private static int InitiativeQueueSortBySpeed(BattleActor x, BattleActor y) // this method becomes an IComparable by default and when used on a List<> must pass x and y of the type in the list (i.e. BattleActor in this case)
 {
     // Check if equal to, greater, or less than
     if (x.speed == y.speed)
     {
         // if equal to, there should be some randomization here on just WHICH gets to go first
         return(0);
     }
     else if (x.speed > y.speed)
     {
         // if the current BattleActor is faster than the next BattleActor, move the current BattleActor closer to the 0-index of the List
         return(-1);
     }
     else if (x.speed < y.speed)
     {
         // if the current BattleActor is slower than the next BattleActor, move the current BattleActor further from the 0-index of the List
         return(1);
     }
     else
     {
         // catch-all case - make no adjustments
         return(0);
     }
 }
Ejemplo n.º 3
0
        public void RandomlyInsertIntoInitiativeQueue(BattleActor ba)
        {
            int posi = UnityEngine.Random.Range(0, queue.Count);

            queue.Insert(posi, ba);
        }
Ejemplo n.º 4
0
 public void AddToInitiativeQueue(BattleActor ba)
 {
     queue.Add(ba);
 }
Ejemplo n.º 5
0
 public void RemoveFromInitiativeQueue(BattleActor ba)
 {
     queue.Remove(ba);
 }