示例#1
0
    public void CreateWaterWell()
    {
        //--------TODO-------
        //Area levels will have different rights to build and more to unlock
        //e.g area level 1 until 2 = 5 wells
        //WHAT HAPPENS IF THERE ARE 2 WELLS?

        bool valid = false;


        //Purchase + funds Check
        if (CharacterCreator.currentPlayerCoin >= 10)
        {
            CharacterCreator.currentPlayerCoin = CharacterCreator.currentPlayerCoin - purchaseWaterObjects[0].Cost;



            ch.setPlayerCoin();

            valid = true;
            Debug.Log("Water Well purchase");
        }
        else
        {
            Debug.Log("Not enough funds - 10 coins are needed");
        }

        //Purchase confirmation + Creation

        //Creation of well (Prefab graphic)
        //Timer of how often water gens


        if (valid == true)
        {
            Debug.Log("creating well");
            // Create well on screen --TODO!!!


            //Storage - Player Storage/SAVE

            // add Timer + add water


            Debug.Log("WLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");

            statsManager.increaseThirstMethod();
            statsManager.PlayerLevelCheck();



            validInstantiate = true; // Allows SpawnObject Script to call method which spawns prefab


            //Create waterWell / Prefab on screen
            spawnObjects.SetItemWaterWell(WaterWell);

            spawnObjects.name = "Water Well";
        }

        else // prevents prefab instantiate
        {
            Debug.Log("Unable to spawn due player not having funds");
        }
    }