Beispiel #1
0
        public AngryTanks()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // increase update rate to 120 Hz
            IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, (int)(1000 / 120));

            // instantiate server link
            serverLink = new ServerLink();

            // get GameStateManager up and running
            gameStateManager = new GameStateManager(Services);
            Components.Add(gameStateManager);
            gameStateManager.UpdateOrder = 200;
            gameStateManager.DrawOrder = 200;

            // down with xna's input!
            input = new InputManager(Services, Window.Handle);
            Components.Add(input);
            input.UpdateOrder = 100;

            input.GetKeyboard().KeyPressed += HandleKeyPress;

            // instantiate world
            world = new World(Services, serverLink);
            world.UpdateOrder = 500;
            world.DrawOrder = 500;
            Components.Add(world);

            // instantiate game console
            gameConsole = new GameConsole(this, new Vector2(0, 400), new Vector2(800, 200),
                                          new Vector2(10, 10), new Vector2(10, 10), new Color(255, 255, 255, 100));
            Components.Add(gameConsole);
            gameConsole.UpdateOrder = 1000;
            gameConsole.DrawOrder = 1000;

            gameConsole.PromptReceivedInput += HandlePromptInput;
            
            // instantiate  AudioManager 
            audioManager = new AudioManager(this);

        }
Beispiel #2
0
        public AngryTanks()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // increase update rate to 120 Hz
            IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, (int)(1000 / 120));

            // instantiate server link
            serverLink = new ServerLink();

            // down with xna's input!
            Input = new InputManager(Services, Window.Handle);
            Services.AddService(typeof(InputManager), Input);
            Components.Add(Input);
            Input.UpdateOrder = 100;

            gameServices = new GameServiceContainer();
            gui = new GuiManager(gameServices, graphics, Input);
            Services.AddService(typeof(GuiManager), gui);
            Components.Add(gui);

            IsMouseVisible = true;
            //Input.GetKeyboard().KeyPressed += HandleKeyPress;

            // instantiate game console
            //gameConsole = new GameConsole(this, new Vector2(0, 400), new Vector2(800, 200),
            //                              new Vector2(10, 10), new Vector2(10, 10), new Color(255, 255, 255, 100));
            //Components.Add(gameConsole);
            //gameConsole.UpdateOrder = 1000;
            //gameConsole.DrawOrder = 1000;

            //gameConsole.PromptReceivedInput += HandlePromptInput;

            // instantiate the world
            /* disabling for testing
            world = new World(this, serverLink);
            Components.Add(world);
            world.UpdateOrder = 100;
            world.DrawOrder = 100;
             */
        }
Beispiel #3
0
        private Vector2     lastPlayerPosition; // TODO we shouldn't store this here

        public World(IServiceProvider iservice, ServerLink serverLink)
            : base(iservice)
        {
            this.IService = iservice;

            this.serverLink = serverLink;

            this.tiled = new List<Sprite>();
            this.stretched = new List<Sprite>();

            // initialize variable database
            // TODO need to get variables from server and stick them in this structure
            this.varDB = new VariableDatabase();

            // initialize player manager
            this.playerManager = new PlayerManager(this); 
           
            // initialize score HUD
            this.scoreHUD = new ScoreHUD(this.playerManager);

            ServerLink.MessageReceivedEvent += HandleReceivedMessage;
        }
Beispiel #4
0
        private Vector2     lastPlayerPosition; // TODO we shouldn't store this here

        public World(Game game, ServerLink serverLink)
            : base(game)
        {
            this.serverLink = serverLink;

            this.tiled = new List<Sprite>();
            this.stretched = new List<Sprite>();

            // initialize variable database
            // TODO need to get variables from server and stick them in this structure
            this.varDB = new VariableDatabase();

            // initialize player manager
            this.playerManager = new PlayerManager(this);
        }