public void UpdateBunkerResources()
 {
     FoodInBunker.text            = "Food\n" + ResourceHolder.GetFood().Count;
     WaterInBunker.text           = "Water\n" + ResourceHolder.GetWater().Count;
     MedicalSuppliesInBunker.text = "Medical Supplies\n" + ResourceHolder.GetMedicalSupplies().Count;
     WeaponsInBunker.text         = "Weapons\n" + ResourceHolder.GetWeapon().Count;
 }
Exemple #2
0
    public bool ReduceResources()
    {
        List <Food>            food            = ResourceHolder.GetFood();
        List <MedicalSupplies> medicalSupplies = ResourceHolder.GetMedicalSupplies();
        List <Water>           water           = ResourceHolder.GetWater();
        List <Weapon>          weapon          = ResourceHolder.GetWeapon();

        //did the player die? if so don't even bother with anything else
        if (food.Count < foodReduction || water.Count < waterReduction || medicalSupplies.Count < medicalSuppliesReduction || weapon.Count < weaponsReduction)
        {
            //player is dead...... do something
            Debug.Log("Player died from lack of resources");
            DeathScreen.instance.EnableDeathScreen("Not having enough resources to survive");
            return(false);
        }
        else
        {
            //remove food from bunker
            for (int i = 0; i < foodReduction; i++)
            {
                ResourceHolder.Bunker.Remove(food[i]);
            }
            //remove water from bunker
            for (int i = 0; i < waterReduction; i++)
            {
                ResourceHolder.Bunker.Remove(water[i]);
            }
            //remove meds from player
            for (int i = 0; i < medicalSuppliesReduction; i++)
            {
                ResourceHolder.Bunker.Remove(medicalSupplies[i]);
            }
            //remove weapons from player
            for (int i = 0; i < weaponsReduction; i++)
            {
                ResourceHolder.Bunker.Remove(weapon[i]);
            }
            //increase the reduction for next time this function is called
            IncreaseReduction();
            //update the UI for in bunker
            UIManager.instance.UpdateBunkerResources();
            //had enough resources to live?
            return(true);
        }
    }