Example #1
0
            public new bool Remove(T item)
            {
                if (Contains(item))
                {
                    RemoveQueue.Enqueue(item);
                    return(true);
                }

                return(false);
            }
    //this method assumes the new henchman hasn't yet been added to henchmenOrder
    private void TriggerAttentionSeekerEvents()
    {
        //invoke attention-seeker events on all henchman, in the order they came into play
        RemoveQueue <BoardSpaceEnum> newOrder = new RemoveQueue <BoardSpaceEnum>();

        while (!henchmenOrder.IsEmpty())
        {
            BoardSpaceEnum henchmanSpace = henchmenOrder.Dequeue();
            HenchmanCard   henchman      = board[henchmanSpace];
            henchman.AttentionSeekerEvent.Invoke();
            newOrder.Enqueue(henchmanSpace);
        }
        henchmenOrder = newOrder;
    }
    //NOTE: Should be called before switching the active player!
    public void HandleEndOfTurn(PlayerManager activePlayer)
    {
        //call HandleEndOfTurn() on all HenchmanCards in play, in the order they came into play
        RemoveQueue <BoardSpaceEnum> newOrder = new RemoveQueue <BoardSpaceEnum>();

        while (!henchmenOrder.IsEmpty())
        {
            BoardSpaceEnum henchmanSpace = henchmenOrder.Dequeue();
            HenchmanCard   henchman      = board[henchmanSpace];
            if (henchman.GetController() == activePlayer)
            {
                henchman.HandleEndOfTurn();
            }
            newOrder.Enqueue(henchmanSpace);
        }
        henchmenOrder = newOrder;
    }
    //---------------------
    // responding to events
    //---------------------

    private void TriggerVengeanceEvents(PlayerManager prizeCardRecipient)
    {
        //invoke vengeance events on relevant henchman, in the order they came into play
        RemoveQueue <BoardSpaceEnum> newOrder = new RemoveQueue <BoardSpaceEnum>();

        while (!henchmenOrder.IsEmpty())
        {
            BoardSpaceEnum henchmanSpace = henchmenOrder.Dequeue();
            HenchmanCard   henchman      = board[henchmanSpace];
            if (henchman.GetController() != prizeCardRecipient)
            {
                //only invoke the event if the recipient of the prize card was not the henchman's controller
                henchman.VengeanceEvent.Invoke();
            }
            newOrder.Enqueue(henchmanSpace);
        }
        henchmenOrder = newOrder;
    }
    //should only be called if CanPutHenchmanAtSpace() returns true
    public void PutHenchmanAtSpace(HenchmanCard henchman, BoardSpaceEnum space)
    {
        //put it on the board
        board[space] = henchman;
        henchman.SetPlayState(PlayStateEnum.BOARD);
        henchman.SetLocation(space);

        //move the henchman visually
        VisuallyPutHenchmanAtSpace(henchman, space);

        //invoke its flashy event
        henchman.FlashyEvent.Invoke();
        //invoke all other henchmen's attention-seeker events
        TriggerAttentionSeekerEvents();

        //add it to the order
        henchmenOrder.Enqueue(space);
    }
Example #6
0
 public void Remove(int x, int y, int z)
 {
     RemoveQueue.Enqueue(new OctreeRemove(x, y, z));
 }
Example #7
0
 public new void RemoveAt(int index)
 {
     RemoveQueue.Enqueue(this[index]);
 }