예제 #1
0
        /// <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));
            }
        }
예제 #2
0
        /// <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));
            }
        }
예제 #3
0
 public void RestartGame()
 {
     score[0]         = 0;
     score[1]         = 0;
     lastGoalPlayerID = null;
     MoveStateTo(MatchState.WaitingToStart);
 }
예제 #4
0
    public void Unready()
    {
        Debug.Log("LaunchPad " + role.ToString() + " Unready");
        readyID = null;

        SpaceStationManager.stationManager.PadUnready(this);

        _spriteRenderer.color = Color.grey;
    }
예제 #5
0
    public void Ready(PlayerID id)
    {
        Debug.Log("LaunchPad " + role.ToString() + " -> Player " + id.ToString());
        readyID = id;

        SpaceStationManager.stationManager.PadReady(this);

        _spriteRenderer.color = Color.white;
    }
예제 #6
0
 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;
 }
예제 #7
0
 public void OnGoalMade(PlayerID playerId)
 {
     lastGoalPlayerID = playerId;
     score[(int)playerId]++;
     MoveStateTo(IsMatchOver ? MatchState.Ended : MatchState.GoalMade);
 }