Beispiel #1
0
        // Add a slot to fill to the queue of animations to perform
        public static void FillSlotEventually(TokenAndSlot tokenAndSlot, ElementStackToken elementStackToken)
        {
            SlotToFill slotToFill = new SlotToFill
            {
                TokenAndSlot      = tokenAndSlot,
                ElementStackToken = elementStackToken
            };

            if (Validator.Available(slotToFill) && !AlreadyHandlingSlotToFill(slotToFill))
            {
                SlotsToFill.Add(slotToFill);
            }
        }
Beispiel #2
0
        private static bool AlreadyHandlingSlotToFill(SlotToFill newSlot)
        {
            // We do not want to add the SlotToFill queue if 1) we already are using that token 2) the slot is already going to be filled
            foreach (var existingSlot in SlotsToFill)
            {
                if (
                    existingSlot.ElementStackToken == newSlot.ElementStackToken ||
                    (existingSlot.TokenAndSlot.Token == newSlot.TokenAndSlot.Token && existingSlot.TokenAndSlot.RecipeSlot == newSlot.TokenAndSlot.RecipeSlot)
                    )
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #3
0
 public static bool Available(SlotToFill slotToFill)
 {
     return(slotToFill != null && Available(slotToFill.TokenAndSlot) && Available(slotToFill.ElementStackToken));
 }