public void PlayerDied(RoboModule player) { _playerInstances.Remove(player); if (_playerInstances.Count == 1) { PlayerWon(_playerInstances.FirstOrDefault()); } _camMan.PlayerDied(player); }
void PlayerWon(RoboModule player) { if (_playerWon == false) { _playerWon = true; print($"PLAYER {player.InputModule.Player} WON!"); Observable.Timer(System.TimeSpan.FromSeconds(3)).Subscribe(_ => { SceneManager.LoadScene("Main"); }); } }
public void AddVisualizer(RoboModule player, Color color) { _canvas = FindObjectOfType <Canvas>(); var playerNumber = player.InputModule.Player; var visualization = Instantiate(_visualizerPrefab); var rect = visualization.GetComponent <RectTransform>(); rect.SetParent(_canvas.transform); rect.sizeDelta = new Vector2(BeginWidth, 32f); rect.localScale = VisualizerScales[playerNumber - 1]; rect.anchorMin = VisualizerMins[playerNumber - 1]; rect.anchorMax = VisualizerMaxs[playerNumber - 1]; rect.anchoredPosition = VisualizerPositions[playerNumber - 1]; rect.gameObject.GetComponent <Image>().color = color * 0.75f; player.InputModule.visualizer = visualization; }
public void PlayerDied(RoboModule player) { _robots.Remove(player); }
void Start() { robo = GetComponent <RoboModule>(); _health = MaxHealth; }