Example #1
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"),
            };
        }
        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"),
            };
        }