void EnableTrailRenderer(CountdownTimer t) { if(toDisable.Count > 0) { toDisable.Dequeue().Clear(); } }
private void ResawnHelper(CountdownTimer t) { // Find the dead player again Controller deadPlayer = controllers.Find(x => x.ID.Equals(System.Enum.Parse(typeof(PlayerID), t.ID))); //RespawnNode playerNode = respawnNodes.Find(x => x.ID.Equals(System.Enum.Parse(typeof(PlayerID), t.ID))); RespawnNode playerNode = respawnNodes[Random.Range(0, respawnNodes.Count)]; if (deadPlayer != null) { deadPlayer.transform.position = playerNode.transform.position; // Let the player revive itself if (currentGame.GetType().Equals(typeof(MeleeMinigame))) deadPlayer.LifeComponent.Respawn(false); else if (currentGame.GetType().Equals(typeof(CaymanGame))) deadPlayer.LifeComponent.Respawn(false); else deadPlayer.LifeComponent.Respawn(); } }
/// <summary> /// Target for the respawn timer to run on timeout. /// </summary> /// <param name="t">The timer that is firing the event</param> private void ResawnHelper(CountdownTimer t) { // Find the dead player again Controller deadPlayer = controllers.Find(x => x.ID.Equals(System.Enum.Parse(typeof(PlayerID), t.ID))); if (deadPlayer != null) { // Find an appropriate spawning pod (set to default for now) deadPlayer.transform.position = Vector3.zero; // Let the player revive itself deadPlayer.LifeComponent.Respawn(); } }
/// <summary> /// Timer that will end the match /// </summary> /// <param name="t">The timer that timed out</param> private void TimeUp(CountdownTimer t) { Debug.Log("Time is up"); }
/// <summary> /// Resets the scene. /// </summary> private void ResetLevel(CountdownTimer t) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
private void GoToMatchSummary(CountdownTimer t) { GameObject g = new GameObject("MatchSummaryManager"); MatchSummaryManager summary = g.AddComponent<MatchSummaryManager>(); DontDestroyOnLoad(g); MatchSummaryManager.winner = currentWinner; MatchSummaryManager.playerInfo = new Dictionary<PlayerID, int>(); if(currentGameSettings.Type == Enums.GameType.Deathmatch) { for(int i = 0; i < controllers.Count; i++) { MatchSummaryManager.playerInfo.Add(controllers[i].ID,controllers[i].LifeComponent.kills); } } else { for(int i = 0; i < controllers.Count; i++) { MatchSummaryManager.playerInfo.Add(controllers[i].ID,(int)controllers[i].LifeComponent.Lives); } } SceneManager.LoadScene("MatchSummary", LoadSceneMode.Single); }
/// <summary> /// Timer that will end the match /// </summary> /// <param name="t">The timer that timed out</param> private void TimeUp(CountdownTimer t) { GameOver(); }