Exemplo n.º 1
0
 /// <summary>
 /// Belongs to InitalizeEventTrigger().
 ///
 /// Author: Steven Johnson, David Askari
 /// </summary>
 /// <param name="data">Information about the event.</param>
 public void OnPointerExitDelegate(PointerEventData data)
 {
     if (!Hover.IsActive())
     {
         TowerInformation.Reset();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Check whether a tower is currently selected and the tile is empty, then either place a tower or reset TowerInformation panel based on Hover.
 /// Authors: David Askari, Steven Johnson
 /// </summary>
 private void OnMouseUpAsButton()
 {
     if (!EventSystem.current.IsPointerOverGameObject() && GameManager.SelectedTower != null && this.placedTower == null)
     {
         if (Hover.IsActive())
         {
             Tower possiblyPlacedTower = GameManager.SelectedTower.PlaceTower(this);
             this.placedTower = possiblyPlacedTower == null ? null : possiblyPlacedTower;
         }
         else
         {
             TowerInformation.Reset();
         }
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Updates times and other necessary pieces of game play.
    ///
    /// Authors: Amy Lewis, Cole Twitchell, David Askari, Steven Johnson, Courtney Chu
    /// </summary>
    public void Update()
    {
        SetTimerText();
        WaveManager.Update();

        var saturation = ppProfile.colorGrading.settings;

        if (currentWave == 1)
        {
            saturation.basic.saturation = 1;
        }
        else if (currentWave == 6)
        {
            sendBossButton.SetActive(true);
            PauseGame.sendBossButton = sendBossButton.GetComponent <SendBossButton>();
        }

        if (gameOver)
        {
            waveTimer.SetPaused(true);

            if (CastleManager.CastleHealth > 0)
            {
                saturation.basic.saturation = 0;
            }

            PauseGame.Status = true;

            GameObject.Find("OptionsMenu").SetActive(false);
            GameObject.Find("OptionsButton").GetComponent <Button>().interactable = false;
            sendBossButton.GetComponent <SendBossButton>().DisableButton();

            if (CastleManager.CastleHealth > 0)
            {
                XmlImporter.Cleanup();
                PauseGame.Status = false;
                SceneManager.LoadScene("victory_cutscene");
            }
            else
            {
                gameOverObject.transform.Find("GameOverText").GetComponent <Text>().text = "GAME OVER";
                gameOverObject.SetActive(true);
                enabled = false;
            }
        }
        else
        {
            if (!waveTimer.IsPaused() && waveTimer.IsDone())
            {
                waveTimer.SetPaused(true);
                WaveManager.BeginWave();
                AudioManager.PlayBeginWaveSound();
                sendBossButton.GetComponent <SendBossButton>().DisableButton();
            }

            if (WaveManager.WaveFinished() && EnemyManager.EnemiesRemaining() <= 0)
            {
                saturation.basic.saturation = 1.0f - ((float)(currentWave - 1) / (float)totalWaves);
                currentWave++;
                waveText.text = currentWave.ToString();
                waveTimer.Reset();
                waveTimer.SetPaused(false);
                WaveManager.SetNextWave();
                skipTimeButton.interactable = true;
                sendBossButton.GetComponent <SendBossButton>().ResetButton();
            }

            if (Hover.IsActive())
            {
                GameManager.rangeIndicatorRenderer.transform.position = Hover.GetPosition();
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                GameManager.AddMoney(100);
            }

            if (Input.GetKeyDown(KeyCode.A))
            {
                SkipTimer();
            }
            else if (Input.GetMouseButtonUp(1) && Hover.IsActive())
            {
                GameManager.rangeIndicatorRenderer.enabled = false;
                Hover.Deactivate();
                GameManager.ResetTower();
                TowerInformation.Reset();
            }
        }
        ppProfile.colorGrading.settings = saturation;
        healthText.text = CastleManager.CastleHealth.ToString();
        moneyText.text  = money.ToString();

        errorTextTimer.Update();
        if (errorTextTimer.IsDone())
        {
            errorText.gameObject.SetActive(false);
            errorTextTimer.Reset();
            errorTextTimer.SetPaused(true);
        }
    }