void Update() { // Start the game off with Stefano if (FindObjectOfType <WeaponScreen>() == null && !started) { ui = FindObjectOfType <UIManager>(); started = true; ui.Dialouge("Mission is go! Get those points!"); } ControlPoint.Ownership winner = checkWinner(); if (winner != ControlPoint.Ownership.UNCAPTURED && !ended) { // Specific dialogue switch (winner) { case ControlPoint.Ownership.BLUE: ui.Dialouge("All points are under our control! Good job!"); StartCoroutine(fadeToMainMenu()); break; case ControlPoint.Ownership.RED: ui.Dialouge("We've lost all control! Retreat!"); StartCoroutine(fadeToMainMenu()); break; } ended = true; } }
ControlPoint.Ownership checkWinner() { // Check control point status winner = points[0].ownership; foreach (ControlPoint point in points) { if (point.ownership != winner) { return(ControlPoint.Ownership.UNCAPTURED); } } return(winner); }