コード例 #1
0
    public void SpawnBrain()
    {
        float x = transform.localPosition.x + BRAIN_OFFSET_X;
        float y = transform.localPosition.y + BRAIN_OFFSET_Y;
        float z = y;

        GameObject brain = Instantiate(SCR_Gameplay.instance.PFB_BRAIN, transform.parent);

        brain.transform.localPosition = new Vector3(x, y, z);
        brain.GetComponent <SCR_Brain>().SetValue(SCR_Config.GetProductionRate((int)type));
    }
コード例 #2
0
    public void UpdateTotalProductionRate()
    {
        totalProductionRate = 0;

        for (int i = 0; i < SCR_Profile.NUMBER_ZOMBIES; i++)
        {
            int productionRate = SCR_Config.GetProductionRate(i) * SCR_Profile.numberZombies[i];
            totalProductionRate += productionRate;
        }

        txtTotalProductionRate.text = FormatNumber(totalProductionRate) + " brains/s";
    }
コード例 #3
0
    public void OnUpgradeZombie(int index)
    {
        if (SCR_Config.GetUpgradePrice(index) <= SCR_Profile.brain)
        {
            SCR_Gameplay.instance.DecreaseBrain(SCR_Config.GetUpgradePrice(index));

            SCR_Profile.upgradeZombies[index]++;
            SCR_Profile.SaveUpgradeZombies();

            RefreshUpgradeInfo();
        }
    }
コード例 #4
0
    public void RefreshUpgradeInfo()
    {
        for (int i = 0; i < zombieUpgradePrices.Length; i++)
        {
            int productionRate = SCR_Config.GetProductionRate(i);

            zombieLevels[i].text          = "LEVEL " + (SCR_Profile.upgradeZombies[i] + 1).ToString();
            zombieProductionRates[i].text = SCR_Gameplay.FormatNumber(productionRate) + " brains/s";
            zombieUpgradePrices[i].text   = SCR_Gameplay.FormatNumber(SCR_Config.GetUpgradePrice(i));
        }

        SCR_Gameplay.instance.UpdateTotalProductionRate();
    }
コード例 #5
0
    public void Start()
    {
        for (int i = 0; i < zombiePrices.Length; i++)
        {
            string productionRate = SCR_Gameplay.FormatNumber(SCR_Config.GetProductionRate(i)) + " brains/s";

            zombieNames[i].text           = SCR_Config.ZOMBIE_INFO[i].name.ToUpper();
            zombieProductionRates[i].text = productionRate;
            zombiePrices[i].text          = SCR_Gameplay.FormatNumber(SCR_Config.ZOMBIE_INFO[i].price);
        }

        RefreshUnlocked();
        UpdateBrain();
    }
コード例 #6
0
 public void UpdateBrain()
 {
     for (int i = 0; i < zombieUpgradeButtons.Length; i++)
     {
         if (SCR_Config.GetUpgradePrice(i) <= SCR_Profile.brain)
         {
             zombieUpgradeButtons[i].interactable = true;
         }
         else
         {
             zombieUpgradeButtons[i].interactable = false;
         }
     }
 }
コード例 #7
0
    public void UpdateZombie()
    {
        for (int i = 0; i < zombies.Length; i++)
        {
            zombies[i].SetActive(false);
        }

        zombies[currentZombie].SetActive(true);

        string productionRate = "Brains per second: " + SCR_Gameplay.FormatNumber(SCR_Config.GetProductionRate(currentZombie));

        txtName.text           = SCR_Config.ZOMBIE_INFO[currentZombie].name.ToUpper();
        txtProductionRate.text = productionRate.ToUpper();
        txtDescription.text    = SCR_Config.ZOMBIE_INFO[currentZombie].description.ToUpper();
    }