private static IEnumerator Respawn(int countdownFrom, float shieldDuration, InitializeGameRLR initializeGame, PlayerManager playerManager) { yield return(new WaitForSeconds(1)); // Countdown var respawnIn = Instantiate(initializeGame.CountdownPrefab, GameObject.Find("Canvas").transform); respawnIn.GetComponent <TextMeshProUGUI>().text = "Respawn in"; respawnIn.GetComponent <TextMeshProUGUI>().fontSize = 30; respawnIn.GetComponent <RectTransform>().anchoredPosition += new Vector2(0, 100); for (var i = 0; i < countdownFrom; i++) { var countdown = Instantiate(initializeGame.CountdownPrefab, GameObject.Find("Canvas").transform); countdown.GetComponent <TextMeshProUGUI>().text = (countdownFrom - i).ToString(); if (i == countdownFrom - 1) { playerManager.Model.SetActive(true); playerManager.Shield.SetActive(true); playerManager.IsDead = false; playerManager.IsInvulnerable = true; } yield return(new WaitForSeconds(1)); Destroy(countdown); } Destroy(respawnIn); playerManager.IsImmobile = false; yield return(new WaitForSeconds(shieldDuration)); playerManager.Shield.SetActive(false); playerManager.IsInvulnerable = false; }
private void Awake() { _levelManager = GetComponent <LevelManagerRLR>(); _initializeGame = GetComponent <InitializeGameRLR>(); PlayerTrigger.onFinishedLevel += OnFinishedLevel; }
private void Awake() { _initializeGame = GetComponent <InitializeGameRLR>(); _levelManager = GetComponent <LevelManagerRLR>(); PlayerTrigger.onPlayerDeath += Death; }
public void Awake() { _initializeGame = GetComponent <InitializeGameRLR>(); _score = GetComponent <ScoreRLR>(); _controlRLR = GetComponent <ControlRLR>(); _levels = _initializeLevelsRLR.SetDifficulty(this); }