/// <summary> /// Check the victory condition in each frame. /// </summary> private void Update() { if (victoryCondition == null) { var vc = GameObject.Find("VictoryCondition"); if (vc != null) { victoryCondition = vc.GetComponent <VictoryCondition>(); victoryCondition.players.Add(this); } } if (hasAuthority && InGame && victoryCondition != null) { if (victoryCondition.PlayerMeetsLosingConditions(this)) { Lose(); } else if (victoryCondition.PlayerMeetsConditions(this)) { Win(); } } }