protected override void OnGamepadPluggedIn(SocketGamepad gamepad) { //Temporary until Acquire Caleb's menu system to select player if (PlayerSpawn.Count > 0) { //Debug.Log("Next Player: " + NextSpawn.ToString()); if (NextSpawn < PlayerSpawn.Count) { GameObject PlayerObj = PlayerSpawn[NextSpawn].Spawn(PlayerSpawn[NextSpawn].transform.position, PlayerSpawn[NextSpawn].transform.rotation); SurvivorPlayer Player = PlayerObj.AddComponent <SurvivorPlayer>(); Player.Gamepad = gamepad; Player.FyoApp = this; Player.PlayerId = LocalPlayers.Count; LocalPlayers.Add(Player); ActiveGamepads.Add(gamepad, Player); Framing.TrackedObjects.Add(Player.gameObject); } //Advance Spawn Point if (++NextSpawn >= PlayerSpawn.Count) { NextSpawn = 0; } } else { Debug.LogError("Negative Spawn Index"); } }
protected override void OnStart() { if (XPlayerTile == null) { Debug.LogError("X Player Tile GameObject is null!"); } else { XPlayer = XPlayerTile.GetComponent <TicTacToePlayer>(); } if (OPlayerTile == null) { Debug.LogError("O Player Tile GameObject is null!"); } else { OPlayer = OPlayerTile.GetComponent <TicTacToePlayer>(); } LocalPlayers.Add(XPlayer); LocalPlayers.Add(OPlayer); Reset(); }
/// <summary> /// Raised when the Live player signed in /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnLiveGamerSignedIn(object sender, SignedInEventArgs e) { var identifiedPlayer = new LiveIdentifiedPlayer(e.Gamer); LocalPlayers.Add(e.Gamer.PlayerIndex, identifiedPlayer); OnPlayerLogin(identifiedPlayer); }
/// <summary> /// Raised when the Live player signed out /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnLiveGamerSignedOut(object sender, SignedOutEventArgs e) { IdentifiedPlayer identifiedPlayer = LocalPlayers[e.Gamer.PlayerIndex]; LocalPlayers.Remove(e.Gamer.PlayerIndex); OnPlayerLogoff(identifiedPlayer); }
/// <summary> /// Identifies a player /// </summary> /// <param name="playerInput">The PlayerInput instance used by the player to identify</param> public override void IdentifyPlayer(PlayerInput playerInput) { var identifiedPlayer = new LocalIdentifiedPlayer(playerInput); LocalPlayers.Add(playerInput.PlayerIndex, identifiedPlayer); OnPlayerLogin(identifiedPlayer); }
protected override void OnGamepadUnplugged(SocketGamepad gamepad) { SurvivorPlayer Player = (SurvivorPlayer)ActiveGamepads[gamepad]; Debug.Log("Removing Player " + Player.PlayerId + "(" + gamepad.SGID + ")"); LocalPlayers.Remove(Player); Framing.TrackedObjects.Remove(Player.gameObject); ActiveGamepads.Remove(gamepad); Destroy(Player.gameObject); }
/// <summary> /// Identifies a player /// </summary> /// <param name="playerInput">The PlayerInput instance used by the player to identify</param> public override void IdentifyPlayer(PlayerInput playerInput) { if (Guide.IsVisible) { return; } if (LocalPlayers.ContainsKey(playerInput.PlayerIndex) && (IsIdentifyingPlayers || (CurrentSession != null && CurrentSession.Status == SessionState.Playing && CurrentSession.AllowJoinInProgress))) { OnPlayerLogin(LocalPlayers[playerInput.PlayerIndex]); return; } Guide.ShowSignIn(1, false); }
protected override void OnGamepadUnplugged(SocketGamepad gamepad) { if (ActiveGamepads.ContainsKey(gamepad)) { //Remove from players TicTacToePlayer player = (TicTacToePlayer)ActiveGamepads[gamepad]; player.PlayerIcon.SetActive(false); ActiveGamepads.Remove(gamepad); LocalPlayers.Remove(player); player.Gamepad = null; if (XPlayer.Gamepad == null && OPlayer.Gamepad == null) { CurrentMode = CurrentModeType.WaitForPlayers; } } }
/// <summary> /// Finds names of remote players that play in sessions. /// </summary> /// <returns></returns> public HashSet <string> FindRemotePlayers() { HashSet <string> remotePlayerNames = new HashSet <string>(); foreach (SessionCfg sc in Sessions) { foreach (PlayerSessionCfg psc in sc.Players) { LocalPlayerCfg localPlayer = LocalPlayers.FirstOrDefault( delegate(LocalPlayerCfg lpc) { return(lpc.Name == psc.Name); }); if (localPlayer != null) { continue; // This is a local player. } if (!remotePlayerNames.Contains(psc.Name)) { remotePlayerNames.Add(psc.Name); } } } return(remotePlayerNames); }
void Start() { CurrentHealth = FullHealth; dead = GetComponent <LocalPlayers>(); }
public PlayerInfo LoadPlayer() { return(LocalPlayers.GetPlayer(playerID)); }