コード例 #1
0
    public override void OnEnter()
    {
        base.OnEnter();

        _currentPerformanceThreshold = TimedActionController.Performance.Meh;
        _isButtonPressed             = false;
        _isButtonReleased            = false;
        _idleCounter           = 0;
        _endEarlyButtonPressed = false;
        _performanceHasEnded   = false;

        EventManager <TimedActionController.Performance> .AddListener(EventType.OnPerformanceMarked, MarkPerformance);

        EventManager <TimedActionController.Performance> .AddListener(EventType.OnAbilityEnd, FinishAction);

        Button[] inputButtons = InputController.AbilityInputButtons();
        _correctButton = inputButtons[Random.Range(0, inputButtons.Length)];
        foreach (Button button in inputButtons)
        {
            Action downAction;
            if (button == _correctButton)
            {
                downAction = CorrectButtonPressed;
            }
            else
            {
                downAction = WrongButtonPressed;
            }
            InputController.BindActionToKey(button, downAction, RegisterPerformance);
        }
        CurrentActor.overheadHud.inputIndicator.Show(true, InputController.GetKeyCode(_correctButton));
        InputController.BindActionToKey(Button.Back, null, EndPerformanceEarly);

        Gm.hudManager.inputInfoInterface.ShowCommands(new Dictionary <string, string>
        {
            { InputController.GetKeyCode(_correctButton).ToString(), "(Hold) Execute command" },
            { "E", "(Twice) End turn early" }
        });

        Gm.tileManager.RemoveFlags(Tile.Flag.HighlightedForMovement, Tile.Flag.HighlightedForAttack);
        HighlightTargetTiles();
    }