private bool IncrementPlayerScore(List <PlayerID> winners) { bool scoreReached = false; foreach (PlayerID id in winners) { GameObject go = (GameObject)GameObject.Instantiate(bloodDrainPrefab); go.GetComponent <BloodDrainEffect>().start = GetPlayer(id).transform.position; Enums.Characters c = characterToPlayer.FirstOrDefault(x => x.Value == id).Key; Goblet g = goblets.Find(x => x.character.Equals(c)); go.GetComponent <BloodDrainEffect>().end = g.transform.position; playerScores[((int)id) - 1] += pointStep; g.UpdateScale(Mathf.Clamp01(((float)playerScores[((int)id) - 1]) / (float)MAX_SCORE)); if (playerScores[((int)id) - 1] >= MAX_SCORE) { scoreReached = true; winningCharacter = c; } } return(scoreReached); }
public void ResetGame() { Camera.main.GetComponent <Animator>().SetTrigger("RestartGame"); for (int i = 0; i < 4; i++) { playerScores[i] = 0; } foreach (PlayerID id in characterToPlayer.Values) { Enums.Characters c = characterToPlayer.FirstOrDefault(x => x.Value == id).Key; Goblet g = goblets.Find(x => x.character.Equals(c)); g.UpdateScale(Mathf.Clamp01(((float)playerScores[((int)id) - 1]) / (float)MAX_SCORE)); } inGame = true; for (int i = 0; i < controllers.Count; i++) { controllers[i].Enable(); RespawnNode playerNode = respawnNodes.Find(x => x.ID.Equals(controllers[i].ID)); controllers[i].transform.position = playerNode.transform.position; } }