public GameBuildingBehavior( IGameplayService gameplayService, GameStateModel gameState) { _gameplayService = gameplayService; _gameState = gameState; }
void Start() { //PowerupService.ownInventory = new PowerupInventory(true);//H4CK // Try to load the level configuration if (!GameplayService.networked && MissionManager.instance.SetCurrentMission(GameplayService.gameLevelMission.MissionFileName, GameplayService.gameLevelMission.Index)) { GameplayService.gameLevelMission.Freeze(); GameplayService.initialGameMode = MissionManager.instance.GetMission().PlayerType; Debug.Log("Mission " + GameplayService.gameLevelMission.MissionFileName + " successfully loaded!"); Debug.Log("Rounds loaded = " + MissionManager.instance.GetMission().RoundsCount); // inicializar el "RoundInfoManager" para esta mision RoundInfoManager.instance.Inicializar(); } // FPA (04/01/17): Eliminado GameAnalitics de momento. // GA.API.Design.NewEvent("PartidaIniciada:"+(GameplayService.networked ? "Multiplayer":"Singleplayer"), (GameplayService.networked ? 0f:(float)MissionManager.instance.GetMission().indexMision), Vector3.zero); doppelgangerindex = localGoalkeeper.idModelo; goalKeeper = GameplayService.initialGameMode == GameMode.GoalKeeper; InstantiatePrefabs(); GetFieldAndGoalBounds(); ServiceLocator.Request <IShotService>().RegisterListener(ShotStarted); ServiceLocator.Request <IShotResultService>().RegisterListener(ShotFinished); gpService = ServiceLocator.Request <IGameplayService>(); gpService.RegisterListener(ChangeGameMode); ServiceLocator.Request <IGameplayService>().SetGameMode(GameplayService.initialGameMode); ServiceLocator.Request <IPowerupService>().RegisterListener(SharpCamera); if (ifcBase.activeIface != ifcAyudaInGame.instance) { ifcThrower.instance.Invoke("setFase", 2f); } totalTime = 0f; minutes = 0; seconds = 0; ResetGameStats(); ResetDuelGameStats(); //goalKeeper = true; setRoundCooldown(0.1f); SpawnThrower(); Habilidades.ResetPremonicion(); EscudosManager.instance.DecrementaEscudoActual(); if (!GameplayService.networked) { GameObject.Find("pastilla-disparos/ronda/texto").GetComponent <GUIText>().text = "0/" + MissionManager.instance.GetMission().RoundsCount; GameObject.Find("pastilla-disparos/ronda/textoSombra").GetComponent <GUIText>().text = GameObject.Find("pastilla-disparos/ronda/texto").GetComponent <GUIText>().text; } }
private static void PlayGame(IGameplayService gameplayService) { int[] deck = null; try { while (true) { if (deck == null) { deck = gameplayService.InitializeDeck(); } Console.Write(Constants.CommandMessage); string command = Console.ReadLine().Trim().ToLower(); switch (command) { case Constants.PlayCard: string playedCard = gameplayService.PlayCard(ref deck); Console.WriteLine(string.Format(Constants.PlayedCardMessage, playedCard)); break; case Constants.ShuffleDeck: gameplayService.ShuffleDeck(ref deck); Console.WriteLine(Constants.ShuffledDeckMessage); break; case Constants.RestartGame: deck = gameplayService.InitializeDeck(); Console.WriteLine(Constants.ResetDeckMessage); break; case Constants.QuitGame: case Constants.ExitGame: return; default: Console.WriteLine(Constants.InvalidCommandMessage); break; } ; } } catch (Exception ex) { ExceptionDispatchInfo.Capture(ex).Throw(); } }
public static void Main(string[] args) { RegisterServices(); Console.WriteLine(Constants.WelcomeMessage); IServiceScope scope = _serviceProvider.CreateScope(); IGameplayService gameplayService = scope.ServiceProvider.GetRequiredService <IGameplayService>(); PlayGame(gameplayService); DisposeServices(); }
public GameViewModel( IGameBoardViewModel gameBoard, IGameInstructionsViewModel instructions, IGameplayService gameplayService, IGameSettingsViewModel settings, GameStateModel gameState, INavigationService navigationService) { _instructions = instructions; _navigationService = navigationService; _settings = settings; _subscriptions = new CompositeDisposable(); navigationService.CurrentTarget .Subscribe(x => CurrentNavigationTarget = x) .DisposeWith(_subscriptions); GameBoard = gameBoard .DisposeWith(_subscriptions); gameState.State .Subscribe(x => { IsComplete = x == GameState.Completed; IsIdle = x == GameState.Idle; }) .DisposeWith(_subscriptions); NavigateToInstructionsCommand = new ActionCommand( execute: () => _navigationService.NavigateTo(_instructions), canExecute: navigationService.CanNavigateTo) .DisposeWith(_subscriptions); NavigateToSettingsCommand = new ActionCommand( execute: () => _navigationService.NavigateTo(_settings), canExecute: navigationService.CanNavigateTo) .DisposeWith(_subscriptions); PauseCommand = new ActionCommand( execute: gameplayService.Pause, canExecute: gameplayService.CanPause) .DisposeWith(_subscriptions); ResetCommand = new ActionCommand( execute: gameplayService.Reset, canExecute: gameplayService.CanReset) .DisposeWith(_subscriptions); gameState.Runtime .Subscribe(x => Runtime = x) .DisposeWith(_subscriptions); StartCommand = new ActionCommand( execute: gameplayService.Start, canExecute: gameplayService.CanStart) .DisposeWith(_subscriptions); UnpauseCommand = new ActionCommand( execute: gameplayService.Unpause, canExecute: gameplayService.CanUnpause) .DisposeWith(_subscriptions); }
public GameBoardTileViewModel( IGameplayService gameplayService, GameStateModel gameState) { _subscriptions = new CompositeDisposable(); var cachedModel = Observable.CombineLatest( this.ObserveProperty(x => x.ColIndex), this.ObserveProperty(x => x.RowIndex), gameState.GameBoard, (colIndex, rowIndex, gameBoard) => gameBoard .Tiles .FirstOrDefault(x => (x.ColIndex == colIndex) && (x.RowIndex == rowIndex))) .ToCached() .DisposeWith(_subscriptions); var modelContent = cachedModel .Select(x => x?.Content ?? Observable.Return <DominoModel>(null)) .SelectLatest(); Observable.CombineLatest( modelContent .Select(x => x?.FirstSuit), modelContent .Select(x => x?.SecondSuit), cachedModel .Select(x => x?.IsRotated), (firstSuit, secondSuit, isRotated) => (firstSuit, secondSuit, isRotated)) .Subscribe(x => { if (!(x.isRotated is null)) { if (x.isRotated.Value) { FirstSuit = x.secondSuit; SecondSuit = x.firstSuit; } else { FirstSuit = x.firstSuit; SecondSuit = x.secondSuit; } } }) .DisposeWith(_subscriptions); modelContent .Select(x => x is null) .Subscribe(x => IsEmpty = x) .DisposeWith(_subscriptions); cachedModel .Select(x => x?.IsFaceUp?.Select(y => (bool?)y) ?? Observable.Return <bool?>(null)) .SelectLatest() .Subscribe(x => IsFaceUp = x) .DisposeWith(_subscriptions); FlipCommand = new AsyncActionCommand( cancellationToken => gameplayService.FlipTileAsync(cachedModel.Value, cancellationToken), gameplayService.ObserveCanFlipTile(cachedModel)) .DisposeWith(_subscriptions); }
public GameplayController(IGameplayService gameplayService) { _gameplayService = gameplayService; }
public GameplayController(IGameplayService gameplayService, IUserService userService, IPlayerService playerService) { _gameplayService = gameplayService; _userService = userService; _playerService = playerService; }