Пример #1
0
 public CellLogic(IGameLogic game, IHomeLogic homeLogic, ICollisionLogic collider, ICellManager cellManager)
 {
     _game                 = game;
     _homeLogic            = homeLogic;
     _cellManager          = cellManager;
     collider.onCollision += onCollision;
 }
Пример #2
0
 public GameController(IGameLogic gameLogic, IGameBetsLogic gameBetsLogic, IUserLogic userLogic, ILogger <GameController> logger)
 {
     _gameLogic     = gameLogic;
     _gameBetsLogic = gameBetsLogic;
     _userLogic     = userLogic;
     _logger        = logger;
 }
Пример #3
0
 public GameRunner(IGameState state, IGameLogic gameLogic, Gui gui, UserInput input)
 {
     _gameState = state;
     _gameLogic = gameLogic;
     _gui       = gui;
     _input     = input;
 }
Пример #4
0
 public FoodLogic(IGameLogic game, ITimeLogic timer, ICollisionLogic collider, IFoodManager foodManager)
 {
     _timer                = timer;
     _game                 = game;
     _foodManager          = foodManager;
     collider.onCollision += onCollision;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InGameState"/> class.
 /// </summary>
 /// <param name="gameLogic">Object that holds the game logic.</param>
 /// <param name="gameStatistics">Object that holds the game statistics.</param>
 /// <param name="fileIo">Object that holds information where the data should be saved.</param>
 public InGameState(IGameLogic gameLogic, IScoreCalculator gameStatistics, IFileIo fileIo)
 {
     this.gameLogic       = gameLogic;
     this.scoreCalculator = gameStatistics;
     this.fileIo          = fileIo;
     this.message         = "Welcome, please make your guess:";
 }
Пример #6
0
 void Start()
 {
     gameLogic     = GameObject.Find("ScriptHolder").GetComponent <IGameLogic>();
     flickerLights = GetComponent <IFlickerLights>();
     gameLogic.GameStateChanged += GameLogic_GameStateChanged;
     particleSystems             = GetComponentsInChildren <ParticleSystem>();
 }
Пример #7
0
 private void RollMany(int nrolls, int pins, IGameLogic gameLogic)
 {
     for (int i = 0; i < nrolls; i++)
     {
         gameLogic.Roll(pins);
     }
 }
Пример #8
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="playout">The strategy used to play out a game in simulation.</param>
 /// <param name="evaluation">The evaluation strategy for determining the value of samples.</param>
 /// <param name="gameLogic">The game specific logic required for searching through SabberStoneStates and SabberStoneActions.</param>
 public SabberStoneSideInformationStrategy(IPlayoutStrategy <List <SabberStoneAction>, SabberStoneState, SabberStoneAction, object, SabberStoneAction> playout, IStateEvaluation <List <SabberStoneAction>, SabberStoneState, SabberStoneAction, object, SabberStoneAction, TreeSearchNode <SabberStoneState, SabberStoneAction> > evaluation, IGameLogic <List <SabberStoneAction>, SabberStoneState, SabberStoneAction, object, SabberStoneAction, SabberStoneAction> gameLogic)
 {
     PlayoutBot = new RandomBot();
     Playout    = playout;
     Evaluation = evaluation;
     GameLogic  = gameLogic;
 }
        /// <inheritdoc/>
        public void MakeDecision(IGameModel model, IGameLogic logic)
        {
            List <IActiveNetworkController> owned    = this.GetOwnedNetworkController(model);
            List <INetworkController>       notowned = this.GetNotOwnedNetworkController(model);

            foreach (var item in owned)
            {
                foreach (var utp in item.Utps)
                {
                    if (utp.IsActive && utp.Target.Owner == this && utp.Target.IsEnable && utp.Target is IServerNetworkController && this.RandomDecision(this.abackLimit))
                    {
                        logic.DisconectUtp(utp);
                    }

                    if (utp.IsActive && utp.Mode == UtpModes.ConnectedToServer && utp.Target.Owner != this && utp.Target.Life < utp.Cables.Count - 5 && this.RandomDecision(this.cutLimit))
                    {
                        logic.CutUtp(utp, utp.Cables[utp.Target.Life]);
                    }
                }

                if (this.RandomDecision(this.attackLimit) && item.Utps.Count < item.CableCapacity && notowned.Count != 0)
                {
                    logic.ConnectTwoServer(item, notowned[random.Next(0, notowned.Count)]);
                }
            }
        }
Пример #10
0
 public GameCreationService(IGameLogic gameLogic, IGameSettingsLogic gameSettingsLogic,
                            ILogger <GameCreationService> logger)
 {
     _gameLogic         = gameLogic;
     _gameSettingsLogic = gameSettingsLogic;
     _logger            = logger;
 }
Пример #11
0
        public void Init()
        {
            modelMock = new Mock <GameModel>();
            modelMock.Object.Player = new Player(400, 700, 3);
            List <Enemy> enemies = new List <Enemy>();

            enemies.Add(new Enemy(50, 10));
            enemies.Add(new Enemy(150, 10));
            enemies.Add(new Enemy(250, 10));
            modelMock.Object.Enemies       = enemies;
            modelMock.Object.EnemyBullets  = new List <Bullet>();
            modelMock.Object.PlayerBullets = new List <Bullet>();

            modelMock.Object.PlayerBullets.Add(new Bullet(10, 900));
            modelMock.Object.PlayerBullets.Add(new Bullet(25, 900));
            modelMock.Object.PlayerBullets.Add(new Bullet(60, 900));

            modelMock.Object.EnemyBullets.Add(new Bullet(50, 400));
            modelMock.Object.EnemyBullets.Add(new Bullet(100, 500));
            modelMock.Object.EnemyBullets.Add(new Bullet(150, 700));
            modelMock.Object.Wave = 1;
            modelMock.Object.Enemiesinthiswave = 50;

            gameLogic = new GameLogic(modelMock.Object);
        }
Пример #12
0
 public GameModule(IGameLogic gameLogic) : base("game")
 {
     Before += ctx => CheckAccess();
     Get("/", parameters => gameLogic.GetGames());
     Post("/", parameters => gameLogic.CreateGame(RequestBodyDecoder.Decode <GameDto>(Request.Body as RequestStream)));
     Put("/", parameters => gameLogic.UpdateGame(RequestBodyDecoder.Decode <GameDto>(Request.Body as RequestStream)));
 }
Пример #13
0
 public GameInstanceValidator(IGameLogic gameLogic, IUserLogic userLogic, IRequestContext requestContext, IGameInstanceLogic gameInstanceLogic)
 {
     GameLogic         = gameLogic;
     UserLogic         = userLogic;
     RequestContext    = requestContext;
     GameInstanceLogic = gameInstanceLogic;
 }
Пример #14
0
 public GameController(IGameLogic gm, IWordBankLogic wb,
                       IUserProfileLogic up)
 {
     Game        = gm;
     WordBank    = wb;
     UserProfile = up;
 }
Пример #15
0
 private void StartGame()
 {
     if (NetworkManager.IsOffline || (!NetworkManager.IsOffline && PhotonNetwork.isMasterClient))
     {
         List <Actor> _allActors = ActorManager.AllActors;
         for (int i = 0; i < _allActors.Count; i++)
         {
             if (m_otherAIObjectInstanceID.Contains(_allActors[i].gameObject.GetInstanceID()))
             {
                 _allActors[i].EnableAI(true);
             }
         }
         m_runningGameLogic  = new MainGameLogic(50f, 3f);
         m_gameState         = GameState.Running;
         m_gameOverCondition = new GameOverCondition_AllActorDied(m_currentNewGameSetting.startAs);
         if (!NetworkManager.IsOffline)
         {
             PhotonEventSender.StartGame();
         }
         else
         {
             SyncGameStart();
         }
     }
 }
Пример #16
0
        private void Start()
        {
            Balls      = new List <PassiveMoveBehavior>();
            _player    = RealizationBox.Instance.Player;
            _gameLogic = RealizationBox.Instance.GameLogic;

            CreateNewBall();
        }
Пример #17
0
 public MainViewModel(IGameLogic gameLogic)
 {
     _gameLogic = gameLogic;
     _gameLogic.CellStatusChanged += _board_CellStatusChanged;
     _gameLogic.GameFinished      += _gameLogic_GameFinished;
     SetupCellStatusViewModels(_gameLogic.NumCols, _gameLogic.NumRows);
     _gameLogic.StartGame();
 }
Пример #18
0
 public GameController(IGameLogic gameLogic, IUserLogic userLogic, IOrganizationLogic organizationLogic, IGameVariantLogic gameVariantLogic, IMapper mapper)
 {
     _GameLogic         = gameLogic;
     _GameVariantLogic  = gameVariantLogic;
     _UserLogic         = userLogic;
     _OrganizationLogic = organizationLogic;
     _Mapper            = mapper;
 }
Пример #19
0
        public GameMachine(IGameLogic gameLogic)
        {
            _gameLogic = gameLogic ?? throw new ArgumentException(
                                   Constants.ArgumentExceptionMessage(nameof(IGameLogic)),
                                   nameof(gameLogic));

            _stateMachine = SetCreateStateMachine();
        }
Пример #20
0
 public HomeController(IUserLogic userLogic, IGameLogic gameLogic, IGameBetsLogic gameBetsLogic, IPlayerLogic playerLogic, ILogger <HomeController> logger)
 {
     _userLogic     = userLogic;
     _gameLogic     = gameLogic;
     _gameBetsLogic = gameBetsLogic;
     _playerLogic   = playerLogic;
     _logger        = logger;
 }
Пример #21
0
 public ParallelRunnerV1()
 {
     _consoleUserInterface = new ConsoleUserInterface();
     _gameLogic            = new GameLogic();
     _validator            = new Validator();
     _gameTasks            = new ConcurrentDictionary <int, Task>();
     _gameRunnerInstances  = new ConcurrentDictionary <int, GameRunner>();
 }
Пример #22
0
 public TournamentController(ITournamentRepository tournamentRepository, IMapper mapper, IGameLogic gameLogic, ITournamentLogic tournamentLogic, ITournamentBroadcast tournamentBroadcast)
 {
     this.TournamentRepository = tournamentRepository;
     this.Mapper              = mapper;
     this.GameLogic           = gameLogic;
     this.TournamentLogic     = tournamentLogic;
     this.TournamentBroadcast = tournamentBroadcast;
 }
Пример #23
0
 public void Setup(IGameLogic <object, TicTacToeState, TicTacToeMove, object, TicTacToeMove, TicTacToeMove> gameLogic,
                   IPlayoutStrategy <object, TicTacToeState, TicTacToeMove, object, TicTacToeMove> playoutStrategy,
                   IStateEvaluation <object, TicTacToeState, TicTacToeMove, object, TicTacToeMove, TreeSearchNode <TicTacToeState, TicTacToeMove> > evaluation)
 {
     GameLogic          = gameLogic;
     PlayoutStrategy    = playoutStrategy;
     EvaluationStrategy = evaluation;
 }
Пример #24
0
 public GameRunner()
 {
     _consoleUserInterface = new ConsoleUserInterface();
     _gameLogic            = new GameLogic();
     _matrixFieldLogic     = new MatrixFieldLogic();
     _cellLogic            = new CellLogic();
     _ruleLogic            = new RuleLogic();
 }
Пример #25
0
 public GameService(IStorage storage, IGameLogic gameLogic,
                    IGameStatisticsService gameStatistics,
                    IOptions <GameOptions> optionsAccessor)
 {
     _storage        = storage;
     _gameLogic      = gameLogic;
     _gameStatistics = gameStatistics;
     _options        = optionsAccessor.Value;
 }
Пример #26
0
        public ProductController(IGameLogic gameLogic, IGenreLogic genreLogic, IOrderLogic orderLogic)
        {
            _pageSize         = int.Parse(ConfigurationManager.AppSettings["PageSize"]);
            _maxPageSelectors = int.Parse(ConfigurationManager.AppSettings["MaxPageSelectors"]);

            _gameLogic  = gameLogic;
            _genreLogic = genreLogic;
            _orderLogic = orderLogic;
        }
Пример #27
0
 /// <summary>
 /// Creates a new instance of a Linear Side Information search.
 /// </summary>
 /// <param name="sideInformationStrategy">The strategy used to create the side information.</param>
 /// <param name="samplingStrategy">A strategy to sample actions during the Generation process.</param>
 /// <param name="playout">The strategy used to play out a game in simulation.</param>
 /// <param name="evaluation">The evaluation strategy for determining the value of samples.</param>
 /// <param name="gameLogic">The game specific logic required for searching.</param>
 /// <param name="budgetEstimationStrategy">The strategy used to determine the number of samples to be used in the different phases.</param>
 public LSI(ISideInformationStrategy <D, P, A, S, A, T> sideInformationStrategy, ILSISamplingStrategy <P, A, T> samplingStrategy, IPlayoutStrategy <D, P, A, S, A> playout, IStateEvaluation <D, P, A, S, A, N> evaluation, IGameLogic <D, P, A, S, A, A> gameLogic, IBudgetEstimationStrategy <D, P, A, S, A> budgetEstimationStrategy)
 {
     SideInformationStrategy = sideInformationStrategy;
     SamplingStrategy        = samplingStrategy;
     Playout    = playout;
     Evaluation = evaluation;
     GameLogic  = gameLogic;
     BudgetEstimationStrategy = budgetEstimationStrategy;
 }
        /// <summary>
        /// Creates a SearchContext that uses the provided GameLogic as Application, Expansion and Goal strategies.
        /// </summary>
        /// <param name="gameLogic">The GameLogic that should be used.</param>
        /// <param name="domain"><see cref="SearchContext{D, P, A, S, Sol, N}.Domain"/></param>
        /// <param name="source"><see cref="SearchContext{D, P, A, S, Sol, N}.Source"/></param>
        /// <param name="subject"><see cref="SearchContext{D, P, A, S, Sol, N}.Subject"/></param>
        /// <param name="search"><see cref="SearchContext{D, P, A, S, Sol, N}.Search"/></param>
        /// <returns>A SearchContext with the provided arguments set.</returns>
        public static SearchContext <D, P, A, S, Sol> GameSearchSetup(IGameLogic <D, P, A, S, Sol, A> gameLogic, D domain, P source, S subject, ISearchStrategy <D, P, A, S, Sol> search)
        {
            var context = Context(domain, source, null, subject, search, null);

            context.Application = gameLogic;
            context.Expansion   = gameLogic;
            context.Goal        = gameLogic;
            return(context);
        }
Пример #29
0
 public GameEngine(IGameLogic gameLogic)
 {
     ConsoleCommand    = new ConcurrentQueue <char>();
     GameLogic         = gameLogic;
     this.CurrentState = new GameStatus()
     {
         GameState = GameProgress.INIT, Message = $"Game Initialised"
     };
 }
Пример #30
0
        public MainViewModel(IGameLogic gameLogic)
        {
            SurrenderGameCommand          = new RelayCommand(SurrenderGameCommandHandle, (e) => true);
            RestartGameCommand            = new RelayCommand(RestartGameCommandHandle, (e) => true);
            _gameLogic                    = gameLogic;
            _gameLogic.CellStatusChanged += _chessboard_CellStatusChanged;

            SetupCellStatusViewModels(_gameLogic.NumRows, _gameLogic.NumCols);
            _gameLogic.StartGame();
        }
Пример #31
0
        // A constructor that takes a premade board as its parameter.
        public GameServer(int port, GameState state, GameServerEventHandlerType aHandler)
        {
            this.shutDown = false;
            this.gameInProgress = false;
            this.client1Id = -1;
            this.client2Id = -1;
            this.connectionCount = 0;

            this.gameStateUpdateEventHandler = aHandler;
            this.logic = GameChoice.CurrentGame.GetNewGameLogic(state);

            this.server = new NetworkServer(port, new NetworkServerEventHandlerType(ServerEventHandler));
        }
Пример #32
0
 // Returns true if the specified IGameLogic implementation also
 // provides an implementation of IGameControl.
 public static bool GameLogicSupportsControlMessages(IGameLogic gameLogicInterface)
 {
     return (gameLogicInterface.GetType().GetInterface("IGameControl") != null);
 }
Пример #33
0
		private void ApplyCustomLogic()
		{
			foreach (var pair in GameLogics) {
				if (pair.Key.SourceChanged) {
					ModifiedScripts.Add(pair.Key);
					continue;
				}

				foreach (IGameLogic gameLogic in pair.Value) {
					gameLogic.Update(Game.Timer);
				}
			}

			if (ModifiedScripts.Count > 0) {
				foreach (var script in ModifiedScripts) {
					try {
						script.LoadOrExecute();
						ReloadGameLogics(script);

					} catch {
						Console.WriteLine("Failed to load script: {0}", script.Path);
						GameLogics[script] = new IGameLogic[0];
					}
				}

				ModifiedScripts.Clear();
			}
		}
Пример #34
0
        public void Initialize()
        {
            // Clear
            tankHealth.Clear();
            blockSpriteHealth.Clear();
            clientInfo.Clear();
            killers.Clear();
            victims.Clear();

            clientInfo.Add(IPAddress.Loopback, new ClientInfo(0));

            ict = (IControlTank)TankAGame.ThisGame.Services.GetService(typeof(IControlTank));
            map = (IMap)TankAGame.ThisGame.Services.GetService(typeof(IMap));
            netStat = (INetStat)TankAGame.ThisGame.Services.GetService(typeof(INetStat));
            gameLogic = (IGameLogic)TankAGame.ThisGame.Services.GetService(typeof(IGameLogic));
        }
 protected override void Setup()
 {
     HorizontalCondition = new HorizontalWinState();
     DiognalCondition = new DiagonalWinState();
     VerticalWinCondition = new VerticalWinState();
 }