public static void Draw(SpriteBatch spriteBatch, GameTime gameTime, AmbientObject ambientObject)
        {
            var ambientObjectType = AmbientObjectType.lookup[ambientObject.AmbientObjectType];

            if (ambientObjectType != null)
            {
                var depth = GeometryUtils.GetLayerDepthFromReservedLayer(ReservedDepthLayers.BlockDecoration);

                if (ambientObjectType.InForeground == true)
                {
                    depth = 1.0f;
                }
                else if (ambientObjectType.HasDepth == true)
                {
                    depth = GeometryUtils.GetLayerDepthFromPosition(ambientObject.Position.X, ambientObject.Position.Y + ambientObject.YPositionDepthOffset);
                }

                if (ambientObjectType.SpritePositions.Length > 1)
                {
                    if (ambientObject.ObjectAnimation == null)
                    {
                        ambientObject.ObjectAnimation = AmbientObjectType.CreateAnimation(ambientObject);
                        ambientObject.ObjectAnimation.Start(Repeat.Mode.Loop);
                    }

                    ambientObject.ObjectAnimation.Update(gameTime);
                    spriteBatch.Draw(ambientObject.ObjectAnimation, ambientObject.Position.ToVector(), color: Color.White, layerDepth: depth);
                }
                else
                {
                    spriteBatch.Draw(SimulationGame.ContentManager.Load <Texture2D>(ambientObjectType.SpritePath), ambientObject.Position.ToVector(), new Rectangle(ambientObjectType.SpritePositions[0], ambientObjectType.SpriteBounds), Color.White, 0.0f, ambientObjectType.SpriteOrigin, 1.0f, SpriteEffects.None, depth);
                }

                if (ambientObjectType.Lightning != null)
                {
                    LightningRenderer.AddLightning(ambientObject.Position.ToVector(), ambientObjectType.Lightning);
                }
            }
        }
示例#2
0
        public static void Draw(SpriteBatch spriteBatch, GameTime gameTime, SimulationGame simulationGame)
        {
            simulationGame.GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SimulationGame.Camera, SpriteSortMode.FrontToBack);

            WorldRenderer.Draw(spriteBatch, gameTime);

            if (SimulationGame.IsGodMode)
            {
                MovingEntityRenderer.Draw(spriteBatch, gameTime, SimulationGame.Player);
            }

            spriteBatch.End();

            LightningRenderer.Draw(spriteBatch, gameTime);

            // Hud
            spriteBatch.Begin();

            SimulationGame.Hud.Draw(spriteBatch, gameTime);

            spriteBatch.End();
        }
示例#3
0
 public static void LoadContent()
 {
     LightningRenderer.LoadContent();
 }