diff --git a/DepthsBelow/DepthsBelow/Camera.cs b/DepthsBelow/DepthsBelow/Camera.cs
index d41839d..eebcc25 100644
--- a/DepthsBelow/DepthsBelow/Camera.cs
+++ b/DepthsBelow/DepthsBelow/Camera.cs
@@ -51,12 +51,12 @@ namespace DepthsBelow
if (ms.X < 20)
Position.X += Speed * elapsed;
- if (ms.X > core.GraphicsDevice.Viewport.Width - 20)
+ if (ms.X > Core.GraphicsDevice.Viewport.Width - 20)
Position.X -= Speed * elapsed;
if (ms.Y < 20)
Position.Y += Speed * elapsed;
- if (ms.Y > core.GraphicsDevice.Viewport.Height - 20)
+ if (ms.Y > Core.GraphicsDevice.Viewport.Height - 20)
Position.Y -= Speed * elapsed;
int scrollChange = ms.ScrollWheelValue - lastMouseState.ScrollWheelValue;
diff --git a/DepthsBelow/DepthsBelow/Component/Flashlight.cs b/DepthsBelow/DepthsBelow/Component/Flashlight.cs
new file mode 100755
index 0000000..f69d1fc
--- /dev/null
+++ b/DepthsBelow/DepthsBelow/Component/Flashlight.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace DepthsBelow.Component
+{
+ public class Flashlight : Component
+ {
+ public float Range
+ {
+ get { return KryptonLight.Range; }
+ set { KryptonLight.Range = value; }
+ }
+ public float Fov
+ {
+ get { return KryptonLight.Fov; }
+ set { KryptonLight.Fov = value; }
+ }
+ public float Intensity
+ {
+ get { return KryptonLight.Intensity; }
+ set { KryptonLight.Intensity = value; }
+ }
+ public float Angle
+ {
+ get { return KryptonLight.Angle; }
+ set { KryptonLight.Angle = value; }
+ }
+ public Vector2 Position
+ {
+ get { return KryptonLight.Position; }
+ set { KryptonLight.Position = value; }
+ }
+
+ public Color Color
+ {
+ get { return KryptonLight.Color; }
+ set { KryptonLight.Color = value; }
+ }
+
+ public bool IsOn
+ {
+ get { return KryptonLight.IsOn; }
+ set { KryptonLight.IsOn = value; }
+ }
+
+ public Krypton.Lights.ShadowType ShadowType
+ {
+ get { return KryptonLight.ShadowType; }
+ set { KryptonLight.ShadowType = value; }
+ }
+
+ public Krypton.Lights.Light2D KryptonLight;
+
+ public Flashlight(Entity parent)
+ : base(parent)
+ {
+ KryptonLight = new Krypton.Lights.Light2D()
+ {
+ Texture = Krypton.LightTextureBuilder.CreatePointLight(Core.GraphicsDevice, 512),
+ Range = (float)(100),
+ Position = parent.Transform.World + Parent.Transform.World.Origin,
+ Angle = parent.Transform.World.Rotation,
+ Color = Color.White,
+ Intensity = 1f,
+ Fov = MathHelper.TwoPi,
+ IsOn = true,
+ ShadowType = Krypton.Lights.ShadowType.Illuminated
+ };
+ }
+
+ public static explicit operator Krypton.Lights.Light2D(Flashlight flashlight)
+ {
+ return flashlight.KryptonLight;
+ }
+
+ public override void Update(GameTime gameTime)
+ {
+ Position = Parent.Transform.World + Parent.Transform.World.Origin;
+ Angle = Parent.Transform.World.Rotation;
+ }
+
+ }
+}
diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs
index 778e2c5..8ead385 100755
--- a/DepthsBelow/DepthsBelow/Core.cs
+++ b/DepthsBelow/DepthsBelow/Core.cs
@@ -17,6 +17,7 @@ namespace DepthsBelow
///
public class Core : Microsoft.Xna.Framework.Game
{
+ public static GraphicsDevice GraphicsDevice;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
@@ -43,7 +44,7 @@ namespace DepthsBelow
this.IsMouseVisible = true;
- KryptonEngine = new Krypton.KryptonEngine(this, "KryptonEffect");
+
}
///
@@ -54,7 +55,9 @@ namespace DepthsBelow
///
protected override void Initialize()
{
- // TODO: Add your initialization logic here
+ GraphicsDevice = graphics.GraphicsDevice;
+
+ KryptonEngine = new Krypton.KryptonEngine(this, "KryptonEffect");
// Initialize lighting engine
this.KryptonEngine.Initialize();
@@ -75,16 +78,16 @@ namespace DepthsBelow
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
- spriteBatch = new SpriteBatch(GraphicsDevice);
+ spriteBatch = new SpriteBatch(Core.GraphicsDevice);
Map = Content.Load