Пример #1
0
    public void Purchase()
    {
        if (PlayerManager.GetGold() >= totalCost)
        {
            PlayerManager.SetGold(PlayerManager.GetGold() - totalCost);

            PlayerManager.SetCrewMate("sword", PlayerManager.GetSword() + sword.GetAmount());
            PlayerManager.SetCrewMate("axe", PlayerManager.GetAxe() + axe.GetAmount());
            PlayerManager.SetCrewMate("gunner", PlayerManager.GetGunner() + gunner.GetAmount());
            PlayerManager.SetCrewMate("looter", PlayerManager.GetLooter() + looter.GetAmount());

            toggleVar = 0;
            sword.SetAmount(0);
            axe.SetAmount(0);
            gunner.SetAmount(0);
            looter.SetAmount(0);
            showMenuScript.isDone     = false;
            showMenuScript.printingIP = false;
            goldSound.Play();

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
            camera.enabled   = true;
        }//IfPlayerCanAfford
    }
Пример #2
0
    public void RevisedButtonInc(string name)
    {
        if (sword.GetAmount() + axe.GetAmount() + gunner.GetAmount() + looter.GetAmount() < maxPirates)
        {
            Debug.Log("You Incremented.");
            if (name == "sword")
            {
                if (sword.GetAmount() + 1 <= PlayerManager.GetSword())
                {
                    sword.SetAmount(sword.GetAmount() + 1);
                }
            }

            if (name == "axe")
            {
                if (axe.GetAmount() + 1 <= PlayerManager.GetAxe())
                {
                    axe.SetAmount(axe.GetAmount() + 1);
                }
            }

            if (name == "gunner")
            {
                if (gunner.GetAmount() + 1 <= PlayerManager.GetGunner())
                {
                    gunner.SetAmount(gunner.GetAmount() + 1);
                }
            }

            if (name == "looter")
            {
                if (looter.GetAmount() + 1 <= PlayerManager.GetLooter())
                {
                    looter.SetAmount(looter.GetAmount() + 1);
                }
            }
        }
    }