/// <summary>
    /// Stop the icon's movement when the fight phase ends (implicitly occurs if the Besiege Walls phase has begun).
    /// </summary>
    /// <param name="e">A PhaseStartEvent.</param>
    private void ListenForCombatEnd(global::Event e)
    {
        Debug.Assert(e.GetType() == typeof(PhaseStartEvent), "Non-PhaseStartEvent in ListenForCombatEnd");

        PhaseStartEvent phaseEvent = e as PhaseStartEvent;

        if (phaseEvent.Phase.GetType() == typeof(TurnManager.BesiegeWalls))
        {
            SetStatus(TaskStatus.Success);
        }
    }
Example #2
0
    /// <summary>
    /// Handle the phase-end button, which displays when the player is in control and can end the phase, with
    /// appropriate text for each phase.
    ///
    /// This triggers based on phase start, rather than phase end, because the button doesn't always end the phase.
    /// Frex., the first click on the button doesn't end the Defenders Move phase if all defenders have not yet moved.
    /// </summary>
    /// <param name="e">A PhaseStartEvent.</param>
    protected virtual void PhaseStartHandling(Event e)
    {
        Debug.Assert(e.GetType() == typeof(PhaseStartEvent));

        PhaseStartEvent startEvent = e as PhaseStartEvent;

        if (startEvent.Phase.GetType() == typeof(TurnManager.PlayerMove))
        {
            SetButtonText(MOVE_DONE_MSG);
            TogglePhaseButton(OnOrOff.On);
            ToggleUndoButton(OnOrOff.On);
        }
        else if (startEvent.Phase.GetType() == typeof(TurnManager.PlayerFight))
        {
            SetButtonText(FIGHT_DONE_MSG);
            PlayerPhaseStatement(MOVE_DONE_MSG);
            ToggleUndoButton(OnOrOff.Off);
        }
        else if (startEvent.Phase.GetType() == typeof(TurnManager.BesiegeWalls))
        {
            TogglePhaseButton(OnOrOff.Off);
            PlayerPhaseStatement(FIGHT_DONE_MSG);
        }
    }