Example #1
0
 public static void DrawSpotLighting(SpriteBatch sb, Camera cam, RenderTarget2D lightsTarget, List <Sprite> drawOrder)
 {
     // draw lights (render target should already be set to lightsTarget for lights)
     foreach (var obj in drawOrder)
     {
         if (obj is IPlayer) // check the player's handheld
         {
             PlayerPirate p = (PlayerPirate)obj;
             Light        l = p.inHand.GetEmittingLight();
             if (l != null && l.lit)
             {
                 l.Draw(sb, cam);
             }
         }
         else if (obj is ILight)
         {
             ILight l  = (ILight)obj;
             Light  lt = l.GetEmittingLight();
             if (l != null && lt != null && lt.lit)
             {
                 lt.Draw(sb, cam);
             }
         }
     }
 }
Example #2
0
        public void Update(KeyboardState kstate, GameTime gameTime, Camera cam)
        {
            nearStructure = false;

            // sructure lighting animation
            foreach (var obj in structureInterior.interiorObjects)
            {
                if (obj is ILight)
                {
                    ILight l  = (ILight)obj;
                    Light  lt = l.GetEmittingLight();
                    if (lt.lit)
                    {
                        msLightFrame += gameTime.ElapsedGameTime.Milliseconds;
                        if (msLightFrame > 500)
                        {
                            msLightFrame = 0;
                            currColumnFrame++;
                            if (currColumnFrame >= nColumns)
                            {
                                currColumnFrame = 1;
                            }
                        }
                    }
                    else
                    {
                        currColumnFrame = 0;
                    }
                }
            }
        }