Пример #1
0
    void FixedUpdate()
    {
        up    = false;
        down  = false;
        left  = false;
        right = false;
        float horizontal = Input.GetAxisRaw(playerController + "Horizontal");
        float vertical   = Input.GetAxisRaw(playerController + "Vertical");

        if (vertical == 0)
        {
            verticalButtonDown = false;
        }
        else
        {
            if (verticalButtonDown == false)
            {
                up   = (vertical > 0);
                down = (vertical < 0);
                verticalButtonDown = true;
            }
        }

        if (horizontal == 0)
        {
            horizontalButtonDown = false;
        }
        else
        {
            if (horizontalButtonDown == false)
            {
                left  = (horizontal < 0);
                right = (horizontal > 0);
                horizontalButtonDown = true;
            }
        }

        if (up || down || left || right)
        {
            grid.CursorInput(up, down, left, right);
        }

        // input to place enemy prefab in the wave being built
        if (Input.GetButtonDown(playerController + action1Key))
        {
            waveManager.EnqueueEnemy(enemyPool[0]);
        }
        if (Input.GetButtonDown(playerController + action2Key))
        {
            waveManager.EnqueueEnemy(enemyPool[1]);
        }
        if (Input.GetButtonDown(playerController + action3Key))
        {
            waveManager.EnqueueEnemy(enemyPool[2]);
        }
        if (Input.GetButtonDown(playerController + action4Key))
        {
            waveManager.EnqueueEnemy(enemyPool[3]);
        }
    }