Esempio n. 1
0
 void Update()
 {
             #if UNITY_EDITOR || UNITY_STANDALONE_WIN
     if (Input.GetKeyDown(KeyCode.K) && Input.GetKey(KeyCode.LeftControl))
     {
         EnemyHealthManager[] enemies = FindObjectsOfType <EnemyHealthManager>();
         foreach (EnemyHealthManager enemy in enemies)
         {
             enemy.ChangeHealth(-500);
         }
     }
     if (Input.GetKeyDown(KeyCode.G) && Input.GetKey(KeyCode.LeftControl))         //allows spawn gold
     {
         goldManager.ChangeGold(500, Vector3.zero);
     }
     if (Input.GetKeyDown(KeyCode.Q))
     {
         Time.timeScale += 0.5f;
     }
     if (Input.GetKeyDown(KeyCode.E) && Time.timeScale > 0.0f)
     {
         Time.timeScale -= 0.5f;
     }
             #endif
 }
Esempio n. 2
0
 public void onButtonBuyItem()
 {
     if (goldManager.gold > item.goldCost)
     {
         goldManager.ChangeGold(-item.goldCost);
         Inventory_VFP.instance.Add(item);
         ShopInventory_VFP.instance.Remove(item);
     }
 }
Esempio n. 3
0
 void Update()
 {
     if (betweenWavesCounter > 0)
     {
         betweenWavesCounter  -= Time.deltaTime;
         nextWaveTimeText.text = Mathf.Round(betweenWavesCounter).ToString();
     }
     else
     {
         if (!waveHasStarted)
         {
             DeleteInfo();
             nextWaveTimeText.text  = "STARTED";
             nextWaveTimeText.color = Color.red;
             StartCoroutine(SpawnWave());
             waveHasStarted = true;
             startWaveButton.SetActive(false);
         }
         else if ((FindObjectOfType <EnemyHealthManager>() == null) && allEnemiesInWaveSpawned)            //if the wave is completed
         {
             goldManager.ChangeGold(waves[currentWave].waveCompletedBonus, positionToSpawnGold.position);
             currentWave++;
             if (currentWave == waves.Length)
             {
                 enabled = false;
                 if (LivesManager.isAlive)
                 {
                     StartCoroutine(FindObjectOfType <GameOverMenu>().LevelCompleted(2.0f));
                 }
             }
             else
             {
                 SendInfo();
                 waveNumberText.text    = "Wave: " + (currentWave + 1);
                 nextWaveTimeText.color = baseColor;
                 nextWaveTimeText.text  = timeBetweenWaves.ToString();
                 betweenWavesCounter    = timeBetweenWaves;
                 startWaveButton.SetActive(true);
             }
             waveHasStarted = false;
         }
     }
 }
 public void Sell()
 {
     goldManager.ChangeGold((int)(marketScript.GetPrice() * sellingMultiplier), marketScript.transform.position);
     towerHolder.DeleteTower();
 }
 public void ConfirmPurchase(Vector3 positionToSpawnGold)
 {
     goldManager.ChangeGold(-currentTowerPrice, positionToSpawnGold);
     placesManager.HighlightAll(false);
     isHighlighted = false;
 }