public override void Show() { base.Show(); _activeCharacterSelectionPanels.Clear(); GameStartParameters gameStartParameters = MainMenuManager.Instance.GameStartParameters; int characterSelectionsToShow; if (gameStartParameters.Type == GameStartParameters.GameStartType.LocalMultiplayer) { characterSelectionsToShow = gameStartParameters.GameConfiguration.PlayerCount; } else { characterSelectionsToShow = 1; } for (int i = 0; i < _characterSelectionPanels.Length; i++) { bool active = i < characterSelectionsToShow; _characterSelectionPanels[i].gameObject.SetActive(active); if (active) { _activeCharacterSelectionPanels.Add(_characterSelectionPanels[i]); } } }
public Game1() { var services = new InteractiveServices(); services.Setup(this); this.Content.RootDirectory = "Content"; // Create the screen manager component. var screenManager = new ScreenManager(this); this.Components.Add(screenManager); #if DEBUG screenManager.TraceEnabled = true; #endif var gameStartParameters = new GameStartParameters { CountOfLives = 3, WorldToLoad = "TestWorld", WorldLoader = new WorldLoader() }; var gamePlayScreen = new GameplayScreen(gameStartParameters, screenManager.InputState); LoadingScreen.Load(screenManager, true, null, gamePlayScreen); #if DEBUG this.Components.Add(new FrameRateCounter(this)); #endif }
private void JoinOnlineMatch() { GameStartParameters startGameParameters = new GameStartParameters(GameStartParameters.GameStartType.JoinRandomMatch); startGameParameters.GameConfiguration = GameConfiguration.RandomOnlineMatch(); MainMenuManager.Instance.GameStartParameters = startGameParameters; TransitionToScreen(CharacterSelectionScreen.Instance, true); }
/// <summary> /// Constructor. /// </summary> public GameplayScreen([NotNull] GameStartParameters gameStartParameters, InputState inputState) { this._gameStartParameters = gameStartParameters ?? throw new ArgumentNullException(nameof(gameStartParameters)); this.TransitionOnTime = TimeSpan.FromSeconds(1.5); this.TransitionOffTime = TimeSpan.FromSeconds(0.5); this._scoreKeeper = new ScoreKeeper.ScoreKeeper(); this._gameInput = new GameInput(inputState); this._livesRemaining = this._gameStartParameters.CountOfLives - 1; this._content = new ContentManager(GlobalServices.Game.Services, GlobalServices.Game.Content.RootDirectory); VolumeControl.Instance.LoadState(); }
private void ActivateScorePanelsForPlayer(Player localPlayer) { var playersSelectedForPhotonPlayer = GameStartParameters.GetLocallySelectedPlayersFromPlayerProperties(localPlayer.CustomProperties); for (int i = 0; i < playersSelectedForPhotonPlayer.Count; i++) { var identifier = new PlayerIdentifier(localPlayer.ActorNumber, i); var playerType = playersSelectedForPhotonPlayer[i]; ScoreDisplayPanel scoreDisplayPanel = _scoreDisplayPanels[_activatedScorePanels]; scoreDisplayPanel.Initialize(identifier, playerType); } }
public void LoadLevel(string worldData) { var gameStartParameters = new GameStartParameters { WorldToLoad = worldData, WorldLoader = new WorldLoaderForTest() }; var gamePlayScreen = new GameplayScreen(gameStartParameters, new InputState()); this._world = gamePlayScreen.LoadWorld(worldData); GlobalServices.SetWorld(this._world); }
private IEnumerator SpawnPlayers() { yield return(null); List <PlayerType> localPlayers = GameStartParameters.GetLocallySelectedPlayersFromPlayerProperties(PhotonNetwork.LocalPlayer.CustomProperties); for (int i = 0; i < localPlayers.Count; i++) { PlayerIdentifier playerIdentifier = new PlayerIdentifier(PhotonNetwork.LocalPlayer.ActorNumber, i); PlayerType localPlayer = localPlayers[i]; PhotonNetwork.Instantiate(localPlayer.ToString(), PlayerSpawnPoints.Instance.GetForPlayer(PhotonNetwork.LocalPlayer.ActorNumber - 1).position, Quaternion.identity, 0, new[] { playerIdentifier, }); } _initialized = true; }