Ejemplo n.º 1
0
    void ProcessActions()
    {
        if (Input.GetKeyDown(ActionMoveUp))
        {
            PassActionToNPC(ActionMoveUp);

            ResetBuildTimer();
            playerMovement.MovePlayerUp(playerObj);
        }

        if (Input.GetKeyDown(ActionMoveDown))
        {
            PassActionToNPC(ActionMoveDown);

            ResetBuildTimer();
            playerMovement.MovePlayerDown(playerObj);
        }

        if (Input.GetKeyDown(ActionShoot))
        {
            PassActionToNPC(ActionShoot);

            playerShooting.ShootProjectile(playerObj, playerID);
        }

        if (Input.GetKey(ActionBuildFirewall))
        {
            CheckFirewallsInLane();
            ChangeComputerFirewallFill(playerMovement.CurrentLane);
            if (Input.GetKeyDown(ActionBuildFirewall))
            {
                PassActionToNPC(ActionBuildFirewall);
            }

            isPlayerBuildingFirewall = true;
            firewallTimer           += Time.deltaTime;
            audioManager.PlayFirewallBuildingSound();
            if (firewallTimer >= firewallTimerThreshold)
            {
                playerBuilding.HandleBuild(playerObj, playerID, playerMovement.CurrentLane);
                ResetBuildTimer();
            }
        }
        else
        {
            audioManager.StopFirewallBuildingSound();
            ResetBuildTimer();
        }

        if (Input.GetKeyUp(ActionBuildFirewall))
        {
            playerComputers [playerMovement.CurrentLane].transform.Find("Arrow").GetComponent <Image> ().fillAmount = (firewallTimer / firewallTimerThreshold);
        }
    }