Пример #1
0
        private void determineActionByMenu(CombatMenu.CombatMenuItem menuItem)
        {
            CombatAction.ActionType actionType = CombatAction.ActionType.Choose;

            switch (menuItem)
            {
            case CombatMenu.CombatMenuItem.Attack:
                actionType = CombatAction.ActionType.Attack;
                break;

            case CombatMenu.CombatMenuItem.Move:
                actionType = CombatAction.ActionType.Move;
                break;

            case CombatMenu.CombatMenuItem.Defend:
                actionType = CombatAction.ActionType.Defend;
                break;

            case CombatMenu.CombatMenuItem.Use:
                actionType = CombatAction.ActionType.Use;
                break;

            case CombatMenu.CombatMenuItem.Inventory:
                break;

            case CombatMenu.CombatMenuItem.EndTurn:
                actionType = CombatAction.ActionType.EndTurn;
                break;
            }

            moveToNextAction(actionType);
        }
Пример #2
0
        private void moveToNextAction(CombatAction.ActionType actionType)
        {
            switch (actionType)
            {
            case CombatAction.ActionType.Choose:
                this.nextAction = chooseAction;
                break;

            case CombatAction.ActionType.Attack:
                this.nextAction = attackAction;
                break;

            case CombatAction.ActionType.Move:
                this.nextAction = moveAction;
                break;

            case CombatAction.ActionType.Use:
                this.nextAction = useAction;
                break;

            case CombatAction.ActionType.Defend:
                this.nextAction = defendAction;
                break;

            case CombatAction.ActionType.EndTurn:
                this.nextAction = endTurnAction;
                break;
            }
        }
Пример #3
0
        public void handleActionComplete(CombatAction.ActionType actionType)
        {
            if (!mainPlayer.IsAlive)
            {
                // The main player is dead.  The game is now over.
                this.combatSystem.endCombat(CombatSystem.Result.Fail);
            }
            else
            {
                // Main player is still alive, so continue with the combat scene...

                if (actionType == CombatAction.ActionType.Choose)
                {
                    // Current player has made a choice about which play they want to make.  Perform that action
                    chooseAction.Stop();
                    determineActionByMenu(chooseAction.MenuChoice);
                }
                else if (actionType == CombatAction.ActionType.EndTurn)
                {
                    moveToNextPlayer();
                }
                else
                {
                    // Determine if the player can choose another action or if their turn is finished
                    if (currentPlayer.MyAttributes.actionPoints <= 0)
                    {
                        // Player has ran out of action points, so their turn is now over.
                        // Move to the next player with the highest initiative.
                        moveToNextPlayer();
                    }

                    // Allow the player to choose the next action
                    moveToNextAction(CombatAction.ActionType.Choose);
                }
            }
        }