private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } //Instanciação de valores PositionNowClicked = 0; CurrentGamePosition = new List <int>(); //Instanciação Win-Loose YouWin = GameObject.FindGameObjectWithTag("Win"); YouLoose = GameObject.FindGameObjectWithTag("Loose"); YouWin.SetActive(false); YouLoose.SetActive(false); //Player Config AllowedToClick = false; //Rounds Inicias, depois alterar Rounds = 3; }
// Update is called once per frame void Update() { if (GameObject.FindGameObjectWithTag("ZombieHeart") == null) { Destroy(Zombie); YouWin a = new YouWin(); a.Level(); } if (Vector2.Distance(transform.position, player.position) > stoppingDistance) { transform.position = Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime); } else if (Vector2.Distance(transform.position, player.position) < stoppingDistance && Vector2.Distance(transform.position, player.position) > retreatDistance) { transform.position = this.transform.position; } else if (Vector2.Distance(transform.position, player.position) < retreatDistance) { transform.position = Vector2.MoveTowards(transform.position, player.position, -speed * Time.deltaTime); } if (timeBtwShots <= 0) { Instantiate(projectile, transform.position, Quaternion.identity); timeBtwShots = startTimeBtwShots; } else { timeBtwShots -= Time.deltaTime; } }
private void FixedUpdate() { if (WaveStatus == WaveStatus.Preparation) { var timeSincePreparationStart = Time.time - _preparationStart; if (timeSincePreparationStart > PreparationTime) { StartWave(); } } else if (WaveStatus == WaveStatus.InProgress) { var enemies = GameObject.FindGameObjectsWithTag("Enemy"); if (enemies.Length == 0) { if (Level == _waves.Count) { YouWin?.Invoke(this, EventArgs.Empty); return; } StartPreparation(); } } }
void Awake() { if (instance == null) { instance = this; // DontDestroyOnLoad (this.gameObject); } else { Destroy(gameObject); } }
private void Update() { if (!Bots[0].activeSelf && !Bots[1].activeSelf && !Bots[2].activeSelf && !Bots[3].activeSelf) { YouWin.SetActive(true); TimerStart = false; MoveChar.isControllChar = false; } if (!TimerStart) { seconds = 30f; Text.color = new Color(87, 69, 50, 255); TimeSnap(seconds); } if (TimerStart == true && !Healths.isGameOver) { seconds -= 1 * Time.deltaTime; TimeSnap(seconds); if (seconds <= 10) { Text.color = new Color(1, 0, 0); } if (seconds <= 0) { seconds = 0; if (!GamePlayer) { AIBot.instance.DelayEnd(); Bots[SelectBot].GetComponent <AIBot>().enabled = false; NextMovePlayerNow(); } else { MoveChar.isControllChar = false; Aiming.instance.Delay(); NextMoveBot(); } TimerStart = false; } } if (NextMovePlayer == true) { NextMovePlayerNow(); NextMovePlayer = false; } }
private void Setup() { gameOverMenu = GameObject.Find("GameOver"); pauseMenuPanel = GameObject.Find("PauseMenu"); timerText = GameObject.Find("Timer").GetComponent <Text>(); gameOver = gameOverMenu.GetComponent <GameOver>(); pauseMenu = pauseMenuPanel.GetComponent <PauseMenu>(); youWin = GameObject.Find("YouWin").GetComponent <YouWin>(); eventSystem = EventSystem.current; mTime = 0f; isPaused = false; isStopped = false; }
//Caso vc ganhe ou perca sete tais telas public void setYouWinScreen() { YouWin.SetActive(true); }
public void WinInLuckyNumbers(bool state) { YouWin?.Invoke(state); }