Example #1
0
    public void endGame()
    {
        enemySpawner.SetActive(false);
        GameMenu.SetActive(false);
        SummaryGUI.SetActive(true);

        //Calculate Level End Reward
        int stars = gameSceneController.getCurrentStar();

        if (stars == 3)
        {
            fm.increaseMoney(1000);
        }
        else if (stars == 2)
        {
            fm.increaseMoney(400);
        }
        else if (stars == 1)
        {
            fm.increaseMoney(250);
        }

        //Persist balance into global
        data.balance = fm.getBalance();
    }
Example #2
0
    public void endGame()
    {
        enemySpawner.SetActive(false);
        GameMenu.SetActive(false);
        SummaryGUI.SetActive(true);

        //Calculate Level End Reward
        int stars = gameSceneController.getCurrentStar();

        //TODO: [?] Determine if the player should be rewarded with/or without previous star count?

        if (stars == 3)
        {
            fm.increaseMoney(1000);
        }
        else if (stars == 2)
        {
            fm.increaseMoney(400);
        }
        else if (stars == 1)
        {
            fm.increaseMoney(250);
        }

        //Persist balance into global
        data.balance = fm.getBalance();
        //Persist stars into global
        data.LevelStar[level] = stars;
    }
Example #3
0
    public void sellTower()
    {
        int       id          = gameSceneController.getChosenTowerNum();
        Transform chosenTower = null;

        for (int i = 0; i < towerList.Count; i++)
        {
            if (towerList[id].GetComponent <BaseTowerBehavior>().getID() == id)
            {
                chosenTower = towerList[id];
            }
        }
        if (chosenTower != null)
        {
            int stubid = chosenTower.GetComponent <BaseTowerBehavior>().getStubID();
            int value  = chosenTower.GetComponent <BaseTowerBehavior>().valueOf();
            fm.increaseMoney(value);

            chosenTower.GetComponent <BaseTowerBehavior>().sell();
            towerList.Remove(chosenTower);

            UpgradeBtnGroup.SetActive(false);
            stubList[stubid].gameObject.SetActive(true);
        }
        else
        {
            Debug.Log("Cannot find chosen tower!");
        }
    }
Example #4
0
 void destroy()
 {
     //Reset
     hp            = 100;
     waypointIndex = 0;
     //Reward
     fm.increaseMoney(myValue);
     //Recycle
     enemyFactory.recycle(transform.gameObject);
 }