//Flag collision void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "flag") { collision.gameObject.SetActive(false); this.flags++; Globals.updatePoints(gameObject.tag, 0.3f); FinalText.updateFlags(GameStart.currentTeam, 1); } }
public static void updatePoints(int team, float points) { GameStart.bar1.fillAmount += (team == 0) ? points : 0f; GameStart.bar2.fillAmount += (team == 1) ? points : 0f; FinalText.updatePoints(team, (int)points * 100); if (GameStart.bar2.fillAmount >= 1 || GameStart.bar1.fillAmount >= 1) { SceneManager.LoadScene("FinalScene"); } }
public void Refresh(PlayerCharacter character) { FinalText = LetterText; FinalText = FinalText.Replace("{charname}", character.FirstName); foreach (PrologueLetterAction action in LetterActions) { if (action.Confirmed) { FinalText = FinalText.Replace(action.ReplaceString, action.Result); } else { action.TriggerCharacter = FinalText.IndexOf(action.ReplaceString); } } }
public bool GoToNextChar(out PrologueLetterAction newAction) { bool triggeredNewAction = false; newAction = null; LastCharDisplayed++; if (LastCharDisplayed <= FinalText.Length) { DisplayText = FinalText.Substring(0, LastCharDisplayed); } foreach (PrologueLetterAction action in LetterActions) { if (!action.Activated && action.TriggerCharacter == LastCharDisplayed) { action.Activated = true; newAction = action; triggeredNewAction = true; break; } } return(triggeredNewAction); }
public static void deleteChicken(GameObject chicken) { int team; for (team = 0; team < numTeams; team++) { if (chicken == currentChickens[team].Value) { currentChickens[team] = currentChickens[team].Previous ?? squads[team].Last; squads[team].Remove(chicken); Globals.changeTurn = true; break; } else if (squads[team].Remove(chicken)) { break; } } Globals.updatePoints(team, 0.1f); FinalText.updateDeaths(team, 1); if (squads[team].Count == 0) { numTeams--; squads.RemoveAt(team); if (squads.Count <= 1) { SceneManager.LoadScene("FinalScene"); } if (team < currentTeam) { currentTeam--; } } }