Ejemplo n.º 1
0
        public GameMain()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);

            // Set game to 502x700 or screen max if smaller.
            screenWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;  // Get current screen width
            screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; // Get current screen height
            if (screenWidth >= 502)
            {
                screenWidth = 502;
            }
            if (screenHeight >= 700)
            {
                screenHeight = 700;
            }
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.ApplyChanges();

            bloom          = new BloomComponent(this);
            bloom.Settings = new BloomSettings(null, 0.025f, 0.20f, 3f, 1f, 1f, 0.5f, screenWidth, screenHeight);
            //bloom.Settings = new BloomSettings(null, 0.5f, 0.75f, 0.5f, 0.5f, 0.5f, 4f, screenWidth, screenHeight);

            Components.Add(bloom);
        }
Ejemplo n.º 2
0
        protected override void Initialize()
        {
            models.Add(new IllModel(@"Combined\Combined", new Vector3(0, 0, 0), new Vector3(0, MathHelper.ToRadians(0), 0), ScreenWidth / 0.34f
                                    , this));
            models.Add(new IllModel(@"chahu\chahu", new Vector3(0, 0, 0), new Vector3(0, MathHelper.ToRadians(0), 0), ScreenWidth / 0.34f
                                    , this));
            models.Add(new IllModel(@"huaping\huaping", new Vector3(0, 0, 0), new Vector3(0, MathHelper.ToRadians(0), 0), 0.3f * ScreenWidth / 0.34f
                                    , this));
            models.Add(new IllModel(@"floor\floor", new Vector3(0, 0, 0), new Vector3(0, MathHelper.ToRadians(0), 0), 0.2f * ScreenWidth / 0.34f
                                    , this));

            graphDealer      = new ARGraphDealer(this);
            camera1          = new ARBaseCamera(new Vector3(0, 0, 1), new Vector3(0, 0, -2), graphDealer.Projection);
            camera1.Position = new Vector3(0, 0, 0.4f);
            graphDealer.SetCamera(camera1);
            updateDealer = new ARUpdateDealer(this);
            //GraphicsDeviceManager.ToggleFullScreen();

            if (kinectbool && KinectSensor.KinectSensors.Count > 0)
            {
                kinect = new KinectComponent(this);
                Components.Add(kinect);
            }

            bloom          = new BloomComponent(this);
            bloom.Settings = BloomSettings.PresetSettings[0];
            //bloom.Visible = false;
            Components.Add(bloom);

            base.Initialize();
        }
Ejemplo n.º 3
0
        public Renderer(IServiceProvider services, ContentManager content, Point virtualResolution, Point?targetResolution = null, bool bloom = true)
        {
            Log.WriteLine("Constructing renderer");
            GraphicsDevice = ((IGraphicsDeviceService)services.GetService(typeof(IGraphicsDeviceService))).GraphicsDevice;
            var RealResolution = new Point(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);

            DisplaySettings    = new DisplaySettings(virtualResolution, RealResolution, targetResolution);
            BloomEnabled       = bloom;
            PrimitivesRenderer = new PrimitivesRenderer(GraphicsDevice);
            SpriteBatch        = new SpriteBatch(GraphicsDevice);
            BloomEffect        = new BloomComponent(GraphicsDevice);

            _NeoManager = new Manager(services, GraphicsDevice, "Default")
            {
                AutoCreateRenderTarget = true,
                TargetFrames           = 60,
                LogUnhandledExceptions = false,
                ShowSoftwareCursor     = false
            };

            if ("de-DE" == Thread.CurrentThread.CurrentUICulture.Name)
            {
                GUIManager.KeyboardLayout = new GermanKeyboardLayout();
            }

            LoadContent(content);
        }
Ejemplo n.º 4
0
        public Kreen()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Set resolution
            graphics.PreferredBackBufferWidth  = 1280;
            graphics.PreferredBackBufferHeight = 720;

            graphics.IsFullScreen        = false;
            graphics.PreferMultiSampling = false;

            graphics.SynchronizeWithVerticalRetrace = true;
            this.IsFixedTimeStep = true;

            gameStateManager = new GameStateManager(this);
            bloomComponent   = new BloomComponent(this);

            Components.Add(gameStateManager);
            Components.Add(bloomComponent);

#if DEBUG
            FPS fps = new FPS(this);
            Components.Add(fps);
#endif

            // Add initial game state
            gameStateManager.AddGameState(new StateMenu(gameStateManager));
        }
Ejemplo n.º 5
0
 public Solarsystem()
 {
     GraphicsDeviceManager = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     BloomComponent        = new BloomPostprocess.BloomComponent(this);
     Components.Add(BloomComponent);
     CelestialBodies = new List <CelestialBody>();
 }
Ejemplo n.º 6
0
        public void Draw(BloomComponent bloom, bool isActive, bool isBloom)
        {
            switch (State)
            {
            case GameStates.loading:
                _spriteBatch.Begin();
                //DebugTextManager.DrawTextToScreenLeft(_spriteBatch, 3, "Loading Level");
                _spriteBatch.End();
                break;

            case GameStates.updating:

                // Sometimes there is a discrepency due to methods calling world update
                Camera.Pos = ConvertUnits.ToDisplayUnits(_shipManager.PlayerShip.Position);

                if (isBloom)
                {
                    _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
                    _spriteBatch.Draw(bloom.screenTarget, Vector2.Zero, Color.White);

                    _spriteBatch.End();


                    _spriteBatch.Begin();

                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 25, "Bullets: " + _projectileManager.GetProjectileCount());
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 26, "Structures: " + _structures.Count);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 27, "Latency: " + (MainNetworkingManager.LastLatency * 1000) + "ms");
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 28, "NPCs: " + Debugging.SimulationManager.GetSimulatedShips().Count);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 29, "Player Speed: " + LegacyStatics.playerShipManager.PlayerShip.LinearVelocity.Length());
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 30, "Player Location: " + LegacyStatics.playerShipManager.PlayerShip.Position.ToString());



                    Vector2 mousePoss = MousePosToSimUnits(_shipManager.PlayerShip, _spriteBatch);

                    //float shipToMousAngle = AIHelper.GetRotationToPosition(_shipManager.PlayerShip.Position, mousePoss, _shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;
                    float shipToMousAngle = AIHelper.GetAngleToPosition(_shipManager.PlayerShip.Position, mousePoss) * 180 / (float)Math.PI;
                    float shipAngle       = AIHelper.ClampRotation(_shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;
                    //AIHelper.TurnTowardPosition(ref mouseToShipAngle, .10f, mousePoss, _shipManager.PlayerShip.Position, .00001f, 10f);
                    float angleToRotate = AIHelper.GetRotationToPosition(_shipManager.PlayerShip.Position, mousePoss, _shipManager.PlayerShip.Rotation) * 180 / (float)Math.PI;

                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 31, "Angle, Ship To Mouse: " + shipToMousAngle);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 32, "Ship Angle, clamped: " + shipAngle);
                    Debugging.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 33, "Angle to rotate: " + angleToRotate);
                    //Main.DebugTextManager.DrawTextToScreenRight(_spriteBatch, 26, "FPS: " + Main.DebugTextManager.getFPS());


                    _spriteBatch.End();
                }

                _UI.Draw(_spriteBatch);

                break;
            }
        }
        public void Initialize(Game game)
        {
            Bloom          = new BloomComponent(game);
            Bloom.Settings = BloomSettings.Default;

            if (PostProcessingEnabled)
            {
                game.Components.Add(Bloom);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                area = new Area(content.Load<Texture2D>("pinkArea"),new Vector2(500,500),0f,world);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 100), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 80), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(120, 100), world));

                int space = 0;

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 9
0
 public MainClass()
 {
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferredBackBufferHeight = 1080; // 544;
     graphics.PreferredBackBufferWidth  = 1920; // 960;
     this.graphics.IsFullScreen         = false;
     Content.RootDirectory = "Content";
     bloom = new BloomComponent(this);
     Components.Add(bloom);
     bloom.Settings = new BloomSettings(null, .25f, 4, 4, 1, 1.5f, 1); //new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
 }
Ejemplo n.º 10
0
        public DebugScreen(Game game, GameStateManager manager)
            : base(game, manager)
        {
            Players = new List <Player>();

            // Bloom
            _bloom = new BloomComponent(GameRef);
            Components.Add(_bloom);
            _bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
            _useBloom       = true;
        }
Ejemplo n.º 11
0
 public ActionScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch)
 {
     game.IsMouseVisible = false;
     particleManager     = new ParticleManager();
     powerUpManager      = new PowerUpManager();
     bloom = new BloomComponent(game);
     bloom.Initialize();
     Components.Add(bloom);
     paused   = false;
     gameOver = false;
 }
Ejemplo n.º 12
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory              = "Content";
     graphics.PreferredBackBufferWidth  = (int)GameValues.ScreenSize.X;
     graphics.PreferredBackBufferHeight = (int)GameValues.ScreenSize.Y;
     bloom = new BloomComponent(this);
     Components.Add(bloom);
     bloom.Settings = new BloomSettings(null, 0.001f, 2, 2, 1, 1.5f, 1);
     IsMouseVisible = true;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            bloom = new BloomComponent();
            bloom.LoadContent(spriteBatch, Content, graphics);

            bloom.Settings = new BloomSettings("catpants", 0, 2, 1.1f, 0.1f, 1, 1);
            background     = Content.Load <Texture2D>("Braid_screenshot8");
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            try
            {
                CurrentStage  = AODSaver.LoadData <int>(GameConsts.GameSaveDirectory + @"\" + "Cs.aod");
                EnabledStages = AODSaver.LoadData <List <int> >(GameConsts.GameSaveDirectory + @"\" + "Es.aod");
            }
            catch
            {
                CurrentStage  = 0;
                EnabledStages = new List <int>(10);
                EnabledStages.Add(1);
#if DEBUG
                EnabledStages.Add(2);
                EnabledStages.Add(3);
                EnabledStages.Add(4);
                EnabledStages.Add(5);
                EnabledStages.Add(6);
#endif
                EnabledStages.Add(11);
            }

            if (Directory.Exists(GameConsts.SettingsDirectory) == false)
            {
                Directory.CreateDirectory(GameConsts.SettingsDirectory);
            }
            if (Directory.Exists(GameConsts.GameSaveDirectory) == false)
            {
                Directory.CreateDirectory(GameConsts.GameSaveDirectory);
            }


            mainMenu                  = new AODMainMenuScene(this);
            mainMenu.StartGame       += new StartGameHandler(this.StartGame);
            mainMenu.SettingsChanged += new EventHandler(this.SettingsChanged);
            Components.Add(mainMenu);
            //添加GameComponent
            gameScene = new GameScene(this);
            gameScene.ExitToMainMenu += new EventHandler(gameScene_ExitToMainMenu);
            Components.Add(gameScene);
            gameScene.Enabled = false;
            bloom             = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Enabled = false;
            bloom.Visible = false;
            fpsShower     = new FpsShower(this);
            Components.Add(fpsShower);


            base.Initialize();
        }
Ejemplo n.º 15
0
        public ShooterGame()
        {
            Instance = this;

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            bloom = new BloomComponent(this);

            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
        }
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public BitSitsGames()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);

            ScoreData = ScoreData.Load(GameContent.MaxLevelIndex);
            Settings = Settings.Load();

            #if WINDOWS
            graphics.IsFullScreen = Settings.IsFullScreen;
            ViewportSize = new Vector2(800, 600);
            #endif
            #if WINDOWS_PHONE
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            ViewportSize = new Vector2(640, 480);
            graphics.IsFullScreen = true;
            #endif
            graphics.PreferredBackBufferWidth = (int)ViewportSize.X;
            graphics.PreferredBackBufferHeight = (int)ViewportSize.Y;

            IsMouseVisible = true;

            // Create the screen manager component.
            screenManager = new ScreenManager(this, graphics);
            Components.Add(screenManager);

            #if WINDOWS
            //graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;

            bloom = new BloomComponent(this);
            Components.Add(bloom);

            bloom.Settings = BloomSettings.PresetSettings[5 % BloomSettings.PresetSettings.Length];
            #endif

            #if DEBUG && WINDOWS
            Components.Add(new DebugComponent(this));

            //Level Menu
            LoadingScreen.Load(screenManager, false, null, new BackgroundScreen(), new MainMenuScreen());

            //LoadingScreen.Load(screenManager, false, PlayerIndex.One, new BackgroundScreen(), new MainMenuScreen()
            //    , new LabScreen());

            //LoadingScreen.Load(screenManager, false, PlayerIndex.One, new GameplayScreen());
            #else
            //graphics.IsFullScreen = true;
            LoadingScreen.Load(screenManager, true, null, new BackgroundScreen(), new MainMenuScreen());
            #endif
        }
Ejemplo n.º 17
0
        public void DrawBloom(Camera2D camera, BloomComponent bloom, bool isBloom)
        {
            _background.Draw(false, Camera.Pos);

            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            _spaceManager.Draw(_spriteBatch, Camera.Pos, Camera.Zoom);


            _spriteBatch.End();

            // Draw particles in different spritebatch. Otherwise they look absolutely awful.
            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.Additive,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            _particleManager.Draw(camera);

            _spriteBatch.End();

            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            foreach (var s in _spaceViewModel.Structures)
            {
                switch (s.StructureType)
                {
                default:
                    s.Draw(camera);
                    break;
                }
            }

            _floatyAreaObjectManager.Draw(_spriteBatch, camera);
            _projectileManager.Draw(camera);
            _clientShipManager.Draw(camera);
            _drawShipNames();

            _spriteBatch.End();
        }
Ejemplo n.º 18
0
        public NeonShooterGame()
        {
            Instance = this;
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
            bloom.Visible  = false;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");
                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex];

                backgroundTexture = content.Load<Texture2D>("Logo");
            }
        }
Ejemplo n.º 20
0
        public GameRoot()
        {
            Instance = this;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 600;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
        }
Ejemplo n.º 21
0
        private void OnEngineStart(object sender, System.EventArgs e)
        {
            this._timeRuler = new TimeRuler(this)
            {
                Visible = true, ShowLog = true
            };
            this.Components.Add(this._timeRuler);

        #if XNA
            this._bloomComponent = new BloomComponent(this);
            this.Components.Add(this._bloomComponent);
        #endif
        }
        public GameplayScreen(Game game, GameStateManager manager)
            : base(game, manager)
        {
            Players = new List <Player>();

            // Timer
            _timer = new Timer(Game);

            // Bloom effect
            _bloom = new BloomComponent(this.Game);

            Components.Add(_bloom);
        }
Ejemplo n.º 23
0
 public myFirstXNAGame()
 {
     // Create the new graphics device manager
     graphics = new GraphicsDeviceManager(this);
     // Set the root directory of the content.
     Content.RootDirectory = "Content";
     // Set the screen size
     graphics.PreferredBackBufferHeight = 480;
     graphics.PreferredBackBufferWidth  = 640;
     // Set the window size
     windowSize = new Point(640, 480);
     bloom      = new BloomComponent(this);
     Components.Add(bloom);
 }
Ejemplo n.º 24
0
 public Terrain2D(DwarfGame game)
 {
     Bloom = new BloomComponent(game)
     {
         Settings = BloomSettings.PresetSettings[0]
     };
     CaveScale     = 0.08f;
     HeightScale   = 0.01f;
     CaveThreshold = 0.5f;
     LavaHeight    = 0.6f;
     TileSize      = 64;
     Noise         = new Perlin(new Random().Next());
     Bloom.Initialize();
     CreateAssets();
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            SystemCore.InitialiseGameSystems();

            postProcessComponent           = new BloomComponent(this);
            postProcessComponent.Settings  = new BloomSettings(null, 0.5f, 0.5f, 0.5f, 1, 1, 1);
            postProcessComponent.DrawOrder = 1000;

            if (enableBloom)
            {
                this.Components.Add(postProcessComponent);
            }

            base.Initialize();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Initializes the RenderManager
        /// </summary>
        public void init(GraphicsDevice graphicsDevice)
        {
            this.GraphicsDevice = graphicsDevice;
            if (graphicsDevice != null)
            {
                bloomComponent = new BloomComponent(graphicsDevice, GameManager.Instance.Content);
                bloomComponent.loadContent();

                bloomLightComponent = new BloomComponent(graphicsDevice, GameManager.Instance.Content);
                bloomLightComponent.loadContent();

                this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
                lightEffect      = GameManager.Resources.Content.Load <Effect>("light.mgfx");
            }
        }
Ejemplo n.º 27
0
        public GameRoot()
        {
            Instance = this;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 600;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            //bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);
            //                                   Name    Thresh   Blur    Bloom    Base   BloomSat   BaseSat
            //bloom.Settings = new BloomSettings("Custom",  0.25f,   0.75f,   3f,    1f,      1f,     0.5f);
            bloom.Settings = BloomSettings.PresetSettings[7];
        }
    private void Awake()
    {
        Content.RootDirectory = "Content";

        graphics = new GraphicsDeviceManager(this);

        // Set fullscreen
        graphics.PreferredBackBufferWidth  = SCREEN_WIDTH;
        graphics.PreferredBackBufferHeight = SCREEN_HEIGHT;
        graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0;
        //graphics.PreferMultiSampling = true;
        graphics.IsFullScreen = false;

        bloom = new BloomComponent(this);
        Components.Add(bloom);
    }
Ejemplo n.º 29
0
        /// <summary>
        /// Adds game-components.
        /// </summary>
        private void AddComponents()
        {
            this.Components.Add(new InputManager(this));

            this.Components.Add(new AssetManager(this));

            #if XNA
            this.Components.Add(new Sky(this));
            #endif

            this.Components.Add(new Fogger(this));

            var chunkStorage = new ChunkStorage(this);
            this.Components.Add(chunkStorage);

            var vertexBuilder = new VertexBuilder(this);
            this.Components.Add(vertexBuilder);

            var chunkCache = new ChunkCache(this);
            this.Components.Add(chunkCache);

            var world = new World(this, chunkStorage, chunkCache);
            this.Components.Add(world);

            this.Components.Add(new Player(this, world));

            #if XNA
            bloom = new BloomComponent(this);
            this.Components.Add(bloom);
            #endif

            this.Components.Add(new Camera(this));
            this.Components.Add(new UserInterface(this));

            this.Components.Add(new InGameDebugger(this));
            this.Components.Add(new Statistics(this));
            this.Components.Add(new GraphManager(this));

            #if XNA
            this.Components.Add(new AudioManager(this));
            #endif

            this._timeRuler         = new TimeRuler(this);
            this._timeRuler.Visible = true;
            this._timeRuler.ShowLog = true;
            this.Components.Add(this._timeRuler);
        }
Ejemplo n.º 30
0
        public NeonShooterGame()
        {
            Instance = this;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth  = 1024;
            graphics.PreferredBackBufferHeight = 768;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, 0.25f, 4, 2, 1, 1.5f, 1);

#if WINDOWS_PHONE
            TargetElapsedTime = TimeSpan.FromTicks(333333);
#endif
        }
Ejemplo n.º 31
0
        public Game1()
            : base()
        {
            windowRes = new Rectangle(
                0, 0,
                960, 544);

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content/";

            graphics.PreferredBackBufferWidth  = windowRes.Width;
            graphics.PreferredBackBufferHeight = windowRes.Height;
            IsFixedTimeStep = false;

            bloomShader = new BloomComponent(this);
            Components.Add(bloomShader);
            bloomShader.Settings = new BloomSettings(null, 0.25f, 1.25f, 2.6f, 2f, 2.5f, 1f);
        }
Ejemplo n.º 32
0
        public MainManager(BloomComponent bloom,
                           TextDrawingService textDrawingService,
                           Game game,
                           IGameStateManager gameStateManager,
                           GraphicsDeviceManager graphics,
                           MainNetworkingManager mainNetworkingManager)
        {
            _textDrawingService = textDrawingService;

            _game = game;

            _gameStateManager = gameStateManager;

            _graphics = graphics;

            _mainNetworkingManager = mainNetworkingManager;

            _drawsPerSecondCounter   = new OPSCounter(5);
            _updatesPerSecondCounter = new OPSCounter(5);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Initialize the game, after the ScreenManager is set, but not every time
        /// the graphics are reloaded.
        /// </summary>
        public void Initialize()
        {
            // create and add the bloom effect
            bloomComponent = new BloomComponent(ScreenManager.Game);
            ScreenManager.Game.Components.Add(bloomComponent);
            // do not automatically draw the bloom component
            bloomComponent.Visible = false;

            // create the world
            world = new World(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width,
                                          ScreenManager.GraphicsDevice.Viewport.Height));

            // retrieve the audio manager
            audio = (AudioManager)ScreenManager.Game.Services.GetService(
                typeof(AudioManager));
            world.AudioManager = audio;
            // start up the music
            audio.PlayMusic("gameMusic");
            // start up the game
            world.StartNewGame();
            gameOver = false;
        }
Ejemplo n.º 34
0
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                {
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                }
                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                tex = content.Load<Texture2D>("DeadScreen/redDeathScreen");

                UI = new ChoiceDisplay(null, null, null, null, null, null, null, null, content);
                UI.setSub = "Press A to respawn.";

                ScreenManager.Game.ResetElapsedTime();

            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
            //    cam2D.MoveCamera(new Vector2(1024 / 2, 768 / 2));
                playerSpwan = content.Load<Texture2D>("redPlayer");
                blueWall = content.Load<Texture2D>("Walls/blueWallMedium");

                // set cam track
                // don't need to for the moment

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                /*
                 * Welcome, Blue, Pink, iniProgress, progressLoadedSFX,
            Questions, One, Two, Three, Opo, System, entryPoint;
                 *
                 */

                WelcomeSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_Welcome_UK_WAV");
                BlueSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_BlueSquare_UK_WAV");
                PinkSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_PinkSquare_UK_WAV");
                QuestionsSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_Questions_UK_WAV");
                progressLoadedSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_ProgessLoaded_WAV");
                iniProgressSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_Progress_Tracker_WAV");

                OneSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_One_WAV");
                TwoSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_Two_WAV");
                ThreeSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_Three_WAV");
                OpoSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_You_are_opo_UK_WAV");
                SystemSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_System_UK_WAV");
                EntryPointSFX = content.Load<SoundEffect>("Audio/SoundFX/Vivi_Tut/Vivi_EntryPoint_WAV");

                WelcomeSFXInstance = WelcomeSFX.CreateInstance();
                BlueSFXInstance = BlueSFX.CreateInstance();
                PinkSFXInstance = PinkSFX.CreateInstance();
                QuestionsSFXInstance = QuestionsSFX.CreateInstance();
                iniProgressSFXInstance = iniProgressSFX.CreateInstance();
                progressLoadedSFXInstance = progressLoadedSFX.CreateInstance();
                OneSFXInstance = OneSFX.CreateInstance();
                TwoSFXInstance = TwoSFX.CreateInstance();
                ThreeSFXInstance = ThreeSFX.CreateInstance();
                OpoSFXInstance = OpoSFX.CreateInstance();
                SystemSFXInstance = SystemSFX.CreateInstance();
                EntryPointSFXInstance = EntryPointSFX.CreateInstance();

                UI = new ChoiceDisplay(content.Load<Texture2D>("a-Button"), content.Load<Texture2D>("b-Button"),
                    content.Load<Texture2D>("x-Button"), null, "No, Let's go!.", "Who am I?", "Where am I?!", null, content);
                UI.Acitve = false;

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);
                playerBody.getSetLaserStatus = false;
                playerBody.getSetDrawScore = false;
                playerBody.getSetChoicePoint = false;

                int space = 0;

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                Art.Load(content);
                gameFont = content.Load<SpriteFont>("gamefont");

                ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle);
                particleArt = content.Load<Texture2D>("Laser");

                const int maxGridPoints = 1600;
                Vector2 gridSpacing = new Vector2((float)Math.Sqrt(1024 * 768 / maxGridPoints));

                Rectangle posAndSize = new Rectangle(-75, -20, 1140, 640 );
              //  Grid = new Grid(this.ScreenManager.GraphicsDevice.Viewport.Bounds, gridSpacing);
                Grid = new Grid(posAndSize, gridSpacing);

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                area = new Area(content.Load<Texture2D>("pinkArea"),new Vector2(500,500),0f,world);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 100), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 80), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(120, 100), world));

                Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(500, 300), world, content, 20));
                Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(600, 350), world, content, 25));

                Drones[0].Stationary = true;

                int space = 0;

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);

                ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");

                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                playerBody.setPostion = new Vector2(-940, -450);

                // for some reason we have to offet on the X by -120 px. This just get the level bounds to aling with world objects.
                // I think it's to do with the scale factor when it's turned into a poly. Maybe? :(
                LevelArena.Add(new Arena(content.Load<Texture2D>("Levels/Delta"), new Vector2(-120f / 64f, 0f), world));

                // LEVEL CREATION MUHAHAHAAHAHAH
                {

                    string line = string.Empty;
                    string [] vals;
                    using (StreamReader sr = new StreamReader("Content/Levels/deltaLevel.txt"))
                    {
                        while ((line = sr.ReadLine()) != null)
                        {

                            vals = line.Split(',');

                            if (vals[0].Equals("greenMine"))
                            {
                                Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"),
                                    new Vector2((float)Convert.ToInt32(vals[1]), (float)Convert.ToInt32(vals[2])), world));

                            }
                            else if(vals[0].Equals("FixedDrone"))
                            {

                            }

                        }

                    }

                }

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                // drones - can only have two without performance issues
                {

                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(100, 500), world, content, 10));
                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(200, 150), world, content, 9));
                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(300, 200), world, content, 12));
                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(400, 250), world, content, 14));
                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(500, 300), world, content, 20));
                    Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(600, 350), world, content, 25));

                    Drones[0].Stationary = true;
                    Drones[5].Stationary = true;

                }

                {

                         Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(0, 50), world));
                         Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(400, 50), world));
                         Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(240, 350), world));
                         Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(300, 400), world));
                         Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(300, 550), world));
                }

                int space = 0;
                int i = 0;
                for (; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45 ), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");
                Song = content.Load<Song>("Audio/Soundtrack/Mr_Spastic_-_b3ta_B1t3r");
                if (MediaPlayer.State != MediaState.Paused)
                {

                    MediaPlayer.Volume = 0.75f;
                    MediaPlayer.Play(Song);
                    MediaPlayer.IsRepeating = true;

                }
                else
                {
                    MediaPlayer.Resume();
                }

                bloom = new BloomComponent(ScreenManager.Game);

                for (int k = 0; k < ScreenManager.Game.Components.Count; ++k)
                {
                    if(ScreenManager.Game.Components[k].Equals(bloom))
                    {
                        ScreenManager.Game.Components.RemoveAt(k);
                    }

                }
               //
                 ScreenManager.Game.Components.Add(bloom);
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world,content);
                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
               reticle = content.Load<Texture2D>("redReticle");
                // neon whip wheel
                {
                    // instantiate the cirlce body
                    circleBody = BodyFactory.CreateCircle(world, 20.0f / 64, 1f, new Vector2(1000f / 64f, 1000f / 64f));
                    circleBody.BodyType = BodyType.Static;
                    circleBody.CollisionCategories = Category.Cat2;
                    circleBody.BodyId = 11;
                    circleTex = content.Load<Texture2D>("orangeCircle");

                    // fix the circle to the world

                    FixedRevoluteJoint fixedJoint = new FixedRevoluteJoint(circleBody, Vector2.Zero, circleBody.Position);
                    world.AddJoint(fixedJoint);

                    // create the whips
                    Whips.Add(new Whip(content.Load<Texture2D>("orangeChianLinkSmall"), new Vector2(1000, 1000), new Vector2(1350, 1000f), world));
                    Whips.Add(new Whip(content.Load<Texture2D>("orangeChianLinkSmall"), new Vector2(1000, 1000), new Vector2(650, 1000), world));
                    //    Whips.Add(new Whip(content.Load<Texture2D>("orangeChianLinkSmall"), new Vector2(1000, 1000), new Vector2(1000, 1350), world));

                    for (int k = 0; k < Whips.Count; k++)
                    {

                        world.AddJoint(new FixedRevoluteJoint(Whips[k].chainLinks[k], Vector2.Zero, circleBody.Position));
                    }

                }

                // add badies
                {
                    Badies.Add(new Bady(content.Load<Texture2D>("Badies/orangeBady"), new Vector2(-1, -2), 15, true, 180f, content, world));
                    Badies.Add(new Bady(content.Load<Texture2D>("Badies/pinkBady"), new Vector2(-3, 0.5f), 8, false, 90f, content, world));
                }

                // add some squares and some walls
                {
                    int space = 0;

                    for (int i = 0; i < 10; i++)
                    {
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                        Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space, 100), world));
                        Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space + 50, 200), world));

                        Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space, 300), world));
                        Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space + 50, 400), world));

                        Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space, 500), world));

                        if (i <= 5)
                        {
                            //vertical walls
                            Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                            Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                        }

                        space += 100;

                    }
                    Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space , 100), world));

                    Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space, 300), world));

                    Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(space , 500), world));

                    // extra wall
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space + 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 10, 0), true, world));

                    // Ninja gate
                    {
                        ninjaGate = new Shape(content.Load<Texture2D>("NinjaWeapons/blueNinjaWheel"),new Vector2((space - 5), 600f),false,false,world);
                        Shapes.Add(ninjaGate);
                        Shapes[0].shapeBody.AngularVelocity = 10f;
                      //  Shapes.Add(new Shape(content.Load<Texture2D>("NinjaWeapons/blueNinjaWheel"),new Vector2((space - 5), 600f),false,world));
                        world.AddJoint(new FixedRevoluteJoint(Shapes[0].shapeBody, Vector2.Zero, Shapes[0].shapeBody.Position));

                    }

                }

                //add collectables
                {
                    Collectables.Add(new Collectable(content.Load<Texture2D>("redStar"), new Vector2(0, 25), world));
                    Collectables.Add(new Collectable(content.Load<Texture2D>("redStar"), new Vector2(900, 25), world));
                    Collectables.Add(new Collectable(content.Load<Texture2D>("redStar"), new Vector2(900, 625), world));
                }

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);
                playerBody.setPostion = new Vector2(900, 100);

                Squares.Add(new Square(content.Load<Texture2D>("Squares/greenSquare"), new Vector2(-28, 200 ), world));
                //spinning wheel.
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-5, 250), false, world));

                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-5, 350), false, world));

                    // filler
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(205, 360), false, world));

                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(205, 250), false, world));
                    // filler
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(205, 240), false, world));

                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(205, 350), false, world));

                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(160, 190), true, world));

                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(160, 410), true, world));

                    spinningWheel = new Shape(content.Load<Texture2D>("Shapes/orangeSpinningWheel"), new Vector2(100, 300), true,false, world);

                    FixedRevoluteJoint fixedJoint = new FixedRevoluteJoint(spinningWheel.shapeBody, Vector2.Zero, spinningWheel.shapeBody.Position);
                    world.AddJoint(fixedJoint);
                }

                int space = 0;

                int k = 260;
                for (; k < 1000; k += 100)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(k, 190), true, world));
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(k - 65, 190), true, world));

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }