Exemple #1
0
    private void CheckMovementInputs()
    {
        //Up one row
        if (Input.GetKeyDown(KeyCode.W))
        {
            playerCoordinates[0] -= 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[0]++;
            }
        }
        //Left one column
        else if (Input.GetKeyDown(KeyCode.A))
        {
            playerCoordinates[1] -= 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[1]++;
            }
        }
        //Down one row
        else if (Input.GetKeyDown(KeyCode.S))
        {
            playerCoordinates[0] += 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[0]--;
            }
        }
        //Right one column
        else if (Input.GetKeyDown(KeyCode.D))
        {
            playerCoordinates[1] += 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[1]--;
            }
        }

        //Shoot
        else if (Input.GetKeyDown(KeyCode.J))
        {
            if (canShoot)
            {
                if (isTurret)
                {
                    if (turretStacks < 5)
                    {
                        turretStacks += 1;
                    }
                    shootRateModifier += turretStacks * turretModifer;
                    shootCD            = initialShootCD / (1 + (1 * shootRateModifier));
                }
                Shoot();
                audio.PlayShootSFX();
                StartCoroutine(ShootCooldown());
                shootCooldownIcon.StartCooldown(shootCD);
            }
        }

        else if (Input.GetKeyDown(KeyCode.K))
        {
            if (canBomb)
            {
                Bomb();
                StartCoroutine(BombCooldown());
                bombCooldownIcon.StartCooldown(bombCD);
            }
        }
    }
Exemple #2
0
    private void CheckMovementInputs()
    {
        //Up one row
        if (Input.GetKeyDown(KeyCode.W))
        {
            playerCoordinates[0] -= 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[0]++;
            }
        }
        //Left one column
        else if (Input.GetKeyDown(KeyCode.A))
        {
            playerCoordinates[1] -= 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[1]++;
            }
        }
        //Down one row
        else if (Input.GetKeyDown(KeyCode.S))
        {
            playerCoordinates[0] += 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[0]--;
            }
        }
        //Right one column
        else if (Input.GetKeyDown(KeyCode.D))
        {
            playerCoordinates[1] += 1;
            if (LegalMove(playerCoordinates))
            {
                Move(playerCoordinates);
            }
            else
            {
                playerCoordinates[1]--;
            }
        }

        //Shoot
        else if (Input.GetKeyDown(KeyCode.J))
        {
            if (canShoot)
            {
                Shoot();
                audio.PlayShootSFX();
                StartCoroutine(ShootCooldown());
                shootCooldownIcon.StartCooldown(shootCD);
            }
        }

        else if (Input.GetKeyDown(KeyCode.L))
        {
            if (canBomb)
            {
                Bomb();
                StartCoroutine(BombCooldown());
                bombCooldownIcon.StartCooldown(bombCD);
            }
        }
    }