Esempio n. 1
0
    IEnumerator StartRound()
    {
        timerText.text = "";
        if (_currentRound % 7 == 0)
        {
            isFlyingRound = true;
        }
        else
        {
            isFlyingRound = false;
        }
        if (_currentRound % 5 == 0)
        {
            isBossRound = true;
        }
        else
        {
            isBossRound = false;
        }
        _enemySpawner.SpawnEnemies();
        _isEndOfRound      = false;
        _endOfRoundTracker = 0;
        yield return(new WaitForSeconds(2));

        yield return(new WaitUntil(() => _enemies.Length == 1));

        goldManager.AddGold(_currentRound * 11);
        _currentRound++;
        if (_currentRound >= 2)
        {
            EndOfRoundTime = 15f;
        }
        _isEndOfRound  = true;
        roundText.text = $"Round: {((_currentRound < 10) ? $"0{_currentRound}" : _currentRound.ToString())}";
    }
Esempio n. 2
0
    private void HandleDeath()
    {
        if (health <= 0)
        {
            int rand;
            if (_curRound < 10)
            {
                rand = UnityEngine.Random.Range(1, 4);
            }
            else if (_curRound < 20)
            {
                rand = UnityEngine.Random.Range(3, 7);
            }
            else if (_curRound < 30)
            {
                rand = UnityEngine.Random.Range(6, 10);
            }
            else
            {
                rand = UnityEngine.Random.Range(10, 20);
            }
            if (_curRound % 5 == 0)
            {
                rand += 50 * (_curRound / 5);
            }
            if (_curRound % 7 == 0)
            {
                rand *= 2;
            }
            _gold.AddGold(rand);

            gameObject.SetActive(false);
            healthbar.gameObject.SetActive(false);
        }
    }
Esempio n. 3
0
	void Death () {
		GoldManager.AddGold (type.reward);
		monsterList.Remove (transform);

		if (WaveManager.wavesAreOver && monsterList.Count == 0)
			FlowManager.Victory();
		
		Destroy (gameObject);
	}
Esempio n. 4
0
 public void SellTower()
 {
     foreach (TowerController tower in _selectedTowers)
     {
         _goldManager.AddGold(tower.cost / 4);
         tower.gameObject.SetActive(false);
         _targetInfoUI.parent.SetActive(false);
     }
     DeselectAllTowers();
     StartCoroutine(BuildNavMesh());
 }
Esempio n. 5
0
 void EndPurchase()
 {
     SetMaterial(opaque);
     GridManager.SetAdjacentTiles(SnapUnderCursor(), GridManager.Tile.TOWER);
     GoldManager.AddGold(-tower.type.price);
     purchaseInProgress             = false;
     tower.purchaseInProgress       = false;
     TowerManager.towerBuildPreview = null;
     TowerManager.SetCancelButton(false, tower.typeNumber);
     tower.Reload();
 }
Esempio n. 6
0
 private void ClearBuilds(bool destroyObject = true)
 {
     if (destroyObject)
     {
         if (objectForBuild != null)
         {
             goldManager.AddGold(objectForBuild.Price);
         }
         Destroy(objectInWorld);
     }
     objectInWorld  = null;
     objectForBuild = null;
 }
Esempio n. 7
0
 private void AttackTarget()
 {
     if (Target != null && Agent.remainingDistance <= Stats.RangeAttack && timerAttack > Stats.DelayAttack)
     {
         timerAttack = 0;
         var go = Instantiate(attackEffect, transform.position, Quaternion.identity);
         go.GetComponent <Attack>().destination = Target.transform;
         if (Target.TakeDamage(Stats.Damge))
         {
             goldManager.AddGold(10);
             Target = null;
         }
     }
 }
    public void LoadGame()
    {
        string level     = PlayerPrefs.GetString("Level", "None");
        string fire      = PlayerPrefs.GetString("Fire");
        string lightning = PlayerPrefs.GetString("Lightning");
        string ice       = PlayerPrefs.GetString("Ice");
        string rock      = PlayerPrefs.GetString("Rock");
        string slot1     = PlayerPrefs.GetString("Slot1");
        string slot2     = PlayerPrefs.GetString("Slot2");
        string slot3     = PlayerPrefs.GetString("Slot3");
        string slot4     = PlayerPrefs.GetString("Slot4");
        string slot5     = PlayerPrefs.GetString("Slot5");
        string slot6     = PlayerPrefs.GetString("Slot6");
        string slot7     = PlayerPrefs.GetString("Slot7");
        string slot8     = PlayerPrefs.GetString("Slot8");
        string gold      = PlayerPrefs.GetString("Gold");
        string spawn     = PlayerPrefs.GetString("Spawn");

        gold = gold.Substring(0, (gold.Length - 1));

        Debug.Log("Starting LOAD process");
        //Loading Gold
        int gold2 = 0;

        try{
            gold2 = System.Convert.ToInt32(gold);
        }
        catch (IOException) {
            Debug.Log("Something wrong with LOAD - GOLD");
        }
        GoldManager.AddGold(gold2);
        Debug.Log("Loading completed: GOLD");

        //Loading Skills
        int fire2      = 0;
        int lightning2 = 0;
        int ice2       = 0;
        int rock2      = 0;

        try{
            fire2 = System.Convert.ToInt32(fire);
        }
        catch (IOException) {
            Debug.Log("Something wrong with LOAD - FIRE");
        }
        try{
            lightning2 = System.Convert.ToInt32(lightning);
        }catch (IOException) {
            Debug.Log("Something wrong with LOAD - LIGHTNING");
        }
        try{
            ice2 = System.Convert.ToInt32(ice);
        }catch (IOException) {
            Debug.Log("Something wrong with LOAD - ICE");
        }
        try{
            rock2 = System.Convert.ToInt32(rock);
        }catch (IOException) {
            Debug.Log("Something wrong with LOAD - ROCK");
        }
        MovementScript.fireCount      = fire2;
        MovementScript.lightningCount = lightning2;
        MovementScript.iceCount       = ice2;
        MovementScript.rockCount      = rock2;

        Debug.Log("Loading completed: SKILLS");

        //Loading inventory
        if (slot1 != "Empty")
        {
            InventoryScript.addItem(slot1);
        }
        if (slot2 != "Empty")
        {
            InventoryScript.addItem(slot2);
        }
        if (slot3 != "Empty")
        {
            InventoryScript.addItem(slot3);
        }
        if (slot4 != "Empty")
        {
            InventoryScript.addItem(slot4);
        }
        if (slot5 != "Empty")
        {
            InventoryScript.addItem(slot5);
        }
        if (slot6 != "Empty")
        {
            InventoryScript.addItem(slot6);
        }
        if (slot7 != "Empty")
        {
            InventoryScript.addItem(slot7);
        }
        if (slot8 != "Empty")
        {
            InventoryScript.addItem(slot8);
        }
        Debug.Log("Loading completed: INVENTORY");
        //Loading location
        switch (spawn)
        {
        case "1":
            Vector2 vec = new Vector2(25, -1.7f);
            rb.MovePosition(vec);
            Debug.Log("Moved player");
            break;

        default:
            break;
        }
        Debug.Log("Loading completed: SPAWN POINT");
    }
Esempio n. 9
0
 public void OnMouseDown()
 {
     GoldManager.AddGold(Amount);
     objectPooler.SetObjectInactive(gameObject);
 }