Exemplo n.º 1
0
        public GameClient(GameServer server, int playerId)
        {
            this.server            = server;
            server.GameUpdated    += OnGameUpdated;
            server.TriggerChanged += OnTriggerUpdated;

            PlayerId = playerId;
            gameView = server.GetPlayerView(this);
        }
Exemplo n.º 2
0
        protected void finish(StateContainer <TPeer> .IBuilder state)
        {
            this.gameBuilder.Finish();
            var game = this.gameBuilder.Game;
            var view = new PlayerGameView(game);

            new EconomyController(game, this.ownID, view);

            state.Game = game;
            state.View = view;
        }
Exemplo n.º 3
0
        public EconomyController(GameState game, Id <Player> player, PlayerGameView view)
            : base(game)
        {
            this.view    = view;
            this.player  = game.Players[player];
            this.economy = game.Economies.First(e => e.Player == this.player);
            this.body    = this.economy.Body;

            view.FocusOnBody(this.body);

            this.controls = new PlayerControls();

            this.stats = new[]
            {
                new EcoStatController(this.game, this, this.economy, EcoValue.Income,
                                      KeyboardAction.FromKey(Key.Number1), KeyboardAction.FromKey(Key.Number2), "1<>2"),
                new EcoStatController(this.game, this, this.economy, EcoValue.Projectiles,
                                      KeyboardAction.FromKey(Key.Q), KeyboardAction.FromKey(Key.W), "Q<>W"),
                new EcoStatController(this.game, this, this.economy, EcoValue.FireRate,
                                      KeyboardAction.FromKey(Key.A), KeyboardAction.FromKey(Key.S), "A<>S"),
                new EcoStatController(this.game, this, this.economy, EcoValue.Defenses,
                                      KeyboardAction.FromKey(Key.Z), KeyboardAction.FromKey(Key.X), "Z<>X"),
            };
        }
Exemplo n.º 4
0
 private void OnGameUpdated(object sender, EventArgs e)
 {
     gameView = server.GetPlayerView(this);
     GameUpdated?.Invoke(this, e);
 }