Пример #1
0
    public static CommandMenuManager FetchCommandMenuManager()
    {
        GameObject         commandMenuManagerObject = GameObject.FindGameObjectWithTag(TagsConstants.COMMAND_MENU_MANAGER_TAG);
        CommandMenuManager commandMenuManager       = commandMenuManagerObject.GetComponent <CommandMenuManager>();

        return(commandMenuManager);
    }
    // Update is called once per frame
    void Update()
    {
        if (CommandMenuManager.isMenuDisplayEnabled && !TargetSelectionManager.IsActivated)
        {
            PlayerAbilities playerAbilitiesScript = null;

            switch (this.TurnState)
            {
            case TurnStateEnum.STANDBY:
                break;

            case TurnStateEnum.PITCHER_TURN:
                GameObject pitcher = TeamUtils.GetPlayerTeamMember(PlayerFieldPositionEnum.PITCHER, TeamUtils.GetPlayerIdFromPlayerFieldPosition(PlayerFieldPositionEnum.PITCHER));
                playerAbilitiesScript = PlayerUtils.FetchPlayerAbilitiesScript(pitcher);
                break;

            case TurnStateEnum.BATTER_TURN:
                GameObject batter = TeamUtils.GetPlayerTeamMember(PlayerFieldPositionEnum.BATTER, TeamUtils.GetPlayerIdFromPlayerFieldPosition(PlayerFieldPositionEnum.BATTER));
                playerAbilitiesScript = PlayerUtils.FetchPlayerAbilitiesScript(batter);
                break;

            case TurnStateEnum.RUNNER_TURN:
                GameObject runner = this.GetNextRunner();
                if (runner != null)
                {
                    playerAbilitiesScript = PlayerUtils.FetchPlayerAbilitiesScript(runner);
                }
                break;

            case TurnStateEnum.CATCHER_TURN:
                GameObject catcher = TeamUtils.GetPlayerTeamMember(PlayerFieldPositionEnum.CATCHER, TeamUtils.GetPlayerIdFromPlayerFieldPosition(PlayerFieldPositionEnum.CATCHER));
                playerAbilitiesScript = PlayerUtils.FetchPlayerAbilitiesScript(catcher);
                break;

            case TurnStateEnum.FIELDER_TURN:
                GameObject fielder = TeamUtils.GetPlayerTeamMember(CurrentFielderTypeTurn, TeamUtils.GetPlayerIdFromPlayerFieldPosition(CurrentFielderTypeTurn));
                playerAbilitiesScript = PlayerUtils.FetchPlayerAbilitiesScript(fielder);
                break;

            default:
                break;
            }

            if (playerAbilitiesScript != null)
            {
                CameraController.FocusOnPlayer(playerAbilitiesScript.gameObject.transform);
                CommandMenuManager.GenerateCommandMenu(playerAbilitiesScript);
            }
        }
    }