Example #1
0
            public void Draw(GameTime gameTime, bool DebugDraw)
            {
                this.FloorShelf = new Texture2D(this.Game.GraphicsDevice, this.Game.Window.ClientBounds.Width, this.Game.Window.ClientBounds.Height - this.Floor);
                Color[] dataG = new Color[this.Game.Window.ClientBounds.Width * (this.Game.Window.ClientBounds.Height - this.Floor)];
                for (int i = 0; i < dataG.Length; ++i)
                {
                    dataG[i] = CycleColor;
                }
                FloorShelf.SetData(dataG);

                if (this.DayNightCycleEnabled)
                {
                    this.Game.spriteBatch.Draw(this.MoonTexture, this.MoonPosition, Color.White);
                    this.Game.spriteBatch.Draw(this.SunTexture, this.SunPosition, Color.White);
                }

                this.Game.spriteBatch.Draw(this.FloorShelf, FloorShelfRectangle, Color.White);

                for (int i = 0; i < FloorpiecePositions.Count; i++)
                {
                    this.Game.spriteBatch.Draw(this.FloorTexture, FloorpiecePositions[i], Color.White);
                }

                foreach (var obstacle in Obstacles)
                {
                    obstacle.Draw(gameTime, DebugDraw);
                }

                if (DebugDraw)
                {
                    this.Game.spriteBatch.Draw(this.FloorColliderTexture, this.FloorCollider, Color.White);
                }
            }
Example #2
0
            public Enviroment(Game1 Game, int Floor, float GravityConstant, float DayNightCycleTime)
            {
                this.Game                 = Game;
                this.Floor                = Floor;
                this.GravityConstant      = GravityConstant;
                this.DayNightCycleTime    = DayNightCycleTime;
                this.CurrentTimeOfDay     = 0.0f;
                this.DayNightCycleEnabled = true;
                this.IsDay                = true;

                this.ColorDay   = 180;
                this.ColorNight = 20;
                this.CycleColor = new Color(ColorNight, ColorNight, ColorNight);


                this.MoonTexture  = this.Game.Content.Load <Texture2D>("Enviroment/Moon_0");
                this.SunTexture   = this.Game.Content.Load <Texture2D>("Enviroment/Sun_0");
                this.MoonPosition = new Vector2(-200, -200);
                this.SunPosition  = new Vector2(-200, -200);


                this.FloorTexture        = this.Game.Content.Load <Texture2D>("Sprites/Ground/ground_0");
                this.FloorpiecePositions = new List <Vector2>();
                this.TimeMultiplier      = 1;

                this.Random = new Random();
                LoadObstacleSystem();
                FloorFirstLoad();

                // Create Collider Rectangle and Texture
                Vector2 Position = new Vector2(0.0f, this.Floor);
                Vector2 Size     = new Vector2(this.Game.Window.ClientBounds.Width, 20);

                this.FloorCollider = new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y);

                this.FloorColliderTexture = new Texture2D(this.Game.GraphicsDevice, (int)Size.X, (int)Size.Y);
                Color[] data = new Color[(int)Size.X * (int)Size.Y];
                for (int i = 0; i < data.Length; ++i)
                {
                    data[i] = new Color(0, 50, 250, 30);
                }
                FloorColliderTexture.SetData(data);

                this.FloorShelfRectangle = new Rectangle(0, this.Floor, this.Game.Window.ClientBounds.Width, this.Game.Window.ClientBounds.Height - this.Floor);

                this.FloorShelf = new Texture2D(this.Game.GraphicsDevice, this.Game.Window.ClientBounds.Width, this.Game.Window.ClientBounds.Height - this.Floor);
                Color[] dataG = new Color[this.Game.Window.ClientBounds.Width * (this.Game.Window.ClientBounds.Height - this.Floor)];
                for (int i = 0; i < dataG.Length; ++i)
                {
                    dataG[i] = CycleColor;
                }
                FloorShelf.SetData(dataG);
            }