/// <summary> /// Changes the active input configuration. /// </summary> public static void SetInputConfiguration(string name, PlayerID playerID) { PlayerID?playerWhoUsesInputConfig = _instance.IsInputConfigurationInUse(name); if (playerWhoUsesInputConfig.HasValue && playerWhoUsesInputConfig.Value != playerID) { Debug.LogErrorFormat("The input configuration named \'{0}\' is already being used by player {1}", name, playerWhoUsesInputConfig.Value.ToString()); return; } if (playerWhoUsesInputConfig.HasValue && playerWhoUsesInputConfig.Value == playerID) { return; } InputConfiguration inputConfig = null; if (_instance._configurationTable.TryGetValue(name, out inputConfig)) { _instance.SetInputConfigurationByPlayerID(playerID, inputConfig); ResetInputConfiguration(playerID); _instance.RaiseInputConfigurationChangedEvent(playerID); } else { Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", name)); } }
/// <summary> /// Changes the active control scheme. /// </summary> public static void SetControlScheme(string name, PlayerID playerID) { PlayerID?playerWhoUsesControlScheme = m_instance.IsControlSchemeInUse(name); if (playerWhoUsesControlScheme.HasValue && playerWhoUsesControlScheme.Value != playerID) { Debug.LogErrorFormat("The control scheme named \'{0}\' is already being used by player {1}", name, playerWhoUsesControlScheme.Value.ToString()); return; } if (playerWhoUsesControlScheme.HasValue && playerWhoUsesControlScheme.Value == playerID) { return; } ControlScheme controlScheme = null; if (m_instance.m_schemeLookup.TryGetValue(name, out controlScheme)) { controlScheme.Reset(); m_instance.SetControlSchemeByPlayerID(playerID, controlScheme); m_instance.RaisePlayerControlsChangedEvent(playerID); } else { Debug.LogError(string.Format("A control scheme named \'{0}\' does not exist", name)); } }
public void RestartGame() { score[0] = 0; score[1] = 0; lastGoalPlayerID = null; MoveStateTo(MatchState.WaitingToStart); }
public void Unready() { Debug.Log("LaunchPad " + role.ToString() + " Unready"); readyID = null; SpaceStationManager.stationManager.PadUnready(this); _spriteRenderer.color = Color.grey; }
public void Ready(PlayerID id) { Debug.Log("LaunchPad " + role.ToString() + " -> Player " + id.ToString()); readyID = id; SpaceStationManager.stationManager.PadReady(this); _spriteRenderer.color = Color.white; }
public MatchStateTransition( MatchState oldState, MatchState newState, int leftScore, int rightScore, bool isMatchPoint, PlayerID?lastGoalPlayerID ) { this.oldState = oldState; this.newState = newState; this.leftScore = leftScore; this.rightScore = rightScore; this.isMatchPoint = isMatchPoint; this.lastGoalPlayerID = lastGoalPlayerID; }
public void OnGoalMade(PlayerID playerId) { lastGoalPlayerID = playerId; score[(int)playerId]++; MoveStateTo(IsMatchOver ? MatchState.Ended : MatchState.GoalMade); }