Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (oscControl.unlimitedPublicFunds)
        {
            publicFunds.text = "Public Funds: \n INFINITY";
        }

        else
        {
            publicFunds.text = "Public Funds: \n" + economyManager.politicianFunds.ToString();
        }

        switch (activeState)
        {
        case 0:
            currentBG.color = Color.black;
            currentBG       = healthBG;
            currentBG.color = Color.green;
            break;

        case 1:
            currentBG.color = Color.black;
            currentBG       = ammoBG;
            currentBG.color = Color.green;
            break;

        case 2:
            currentBG.color = Color.black;
            currentBG       = cogBG;
            currentBG.color = Color.green;
            break;

        case 3:
            currentBG.color = Color.black;
            currentBG       = wageBG;
            currentBG.color = Color.green;
            break;
        }

        if (Input.GetAxis("Vertical") < -0.2f && waitUp)
        {
            Debug.Log("OK");
            waitUp = false;
            activeState++;
            if (activeState == 4)
            {
                activeState = 0;
            }
            // roleSwitcher.SwitchRole(++RoleSwitcher.currentRole);
        }
        else if (Input.GetAxis("Vertical") > 0.2f && waitUp)
        {
            waitUp = false;
            activeState--;
            if (activeState == -1)
            {
                activeState = 3;
            }
        }

        if (Mathf.Abs(Input.GetAxis("Vertical")) < 0.2f)
        {
            waitUp = true;
        }
        if (Input.GetButtonDown("Jump"))
        {
            if (activeState == 0)
            {
                if (economyManager.politicianFunds > healthValue || oscControl.unlimitedPublicFunds)
                {
                    playerShoot.healthSlider.maxValue += 10;
                    StartCoroutine("HealthUpgrade");
                    canvasManager.ActivateHealth();
                    economyManager.politicianFunds -= (int)healthValue;
                    healthValue += 1000;
                }
            }

            if (activeState == 1)
            {
                if (economyManager.politicianFunds > ammoValue || oscControl.unlimitedPublicFunds)
                {
                    playerShoot.totalAmmo += 10;
                    StartCoroutine("AmmoUpgrade");
                    canvasManager.ActivateAmmo();
                    economyManager.politicianFunds -= (int)ammoValue;
                    ammoValue += 1000;
                }
            }
            if (activeState == 2)
            {
                if (economyManager.politicianFunds > ammoValue || oscControl.unlimitedPublicFunds)
                {
                    economyManager.politicianFunds -= (int)cogValue;
                    canvasManager.ActivateAim();
                    EconomyManager.autoAim = true;
                    cogValue += 2000;
                }
            }
            if (activeState == 3)
            {
                if (economyManager.politicianFunds > ammoValue || oscControl.unlimitedPublicFunds)
                {
                    economyManager.maxMoney += 50;
                    StartCoroutine("WageUpgrade");
                    canvasManager.ActivateWage();
                    economyManager.politicianFunds -= (int)wageValue;
                    wageValue += 2000;
                }
            }
            StartCoroutine("SwitchRole");
        }
    }