Пример #1
0
    void MakeMove(ComboKeys key)
    {
        madeMove = true;

        foreach (PlayerAction ac in repertoire.actions)
        {
            if (ac.HandleKey(key))
            {
                PerformAction(ac);
                continue;
            }
        }
    }
Пример #2
0
    public bool HandleKey(ComboKeys key)
    {
        if (comboKeys[consecutive] == key)
        {
            consecutive++;
        }
        else
        {
            consecutive = 0;
        }

        return(consecutive >= comboKeys.Count);
    }
Пример #3
0
    public static KeyCode ToKeyCode(ComboKeys comboKeys)
    {
        Dictionary <ComboKeys, KeyCode> conversion = new Dictionary <ComboKeys, KeyCode>()
        {
            { ComboKeys.I, KeyCode.I },
            { ComboKeys.J, KeyCode.J },
            { ComboKeys.K, KeyCode.K },
            { ComboKeys.L, KeyCode.L },
            { ComboKeys.W, KeyCode.W },
            { ComboKeys.A, KeyCode.A },
            { ComboKeys.S, KeyCode.S },
            { ComboKeys.D, KeyCode.D }
        };

        return(conversion[comboKeys]);
    }
Пример #4
0
    private void AddComboToQueue(ComboKeys comboType)
    {
        if (tooltipActive)
        {
            return;
        }

        comboHistroy.Enqueue(comboType);
        if (comboHistroy.Count > 10)
        {
            comboHistroy.Dequeue();
            Destroy(targetUIPanel.GetChild(0).gameObject);
        }

        GameObject arrowPrefab = null;

        switch (comboType)
        {
        case ComboKeys.UP:
            arrowPrefab = upArrow;
            break;

        case ComboKeys.DOWN:
            arrowPrefab = downArrow;
            break;

        case ComboKeys.LEFT:
            arrowPrefab = leftArrow;
            break;

        case ComboKeys.RIGHT:
            arrowPrefab = rightArrow;
            break;
        }

        Instantiate(arrowPrefab, targetUIPanel);
    }