improved humanoid animations, some map stats in map editor, gap connections visible in editor, editing wire nodes in editor, pumps don't have to be manually linked, coroutine exception handling

This commit is contained in:
Regalis
2015-09-15 17:24:52 +03:00
parent d29ee03681
commit 16bf562837
21 changed files with 254 additions and 136 deletions
@@ -0,0 +1,65 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Subsurface.Lights
{
class LightSource
{
private static Texture2D lightTexture;
private Color color;
private float range;
private Texture2D texture;
public Vector2 Position;
public Color Color
{
get { return color; }
set { color = value; }
}
public float Range
{
get { return range; }
set
{
range = MathHelper.Clamp(value, 0.0f, 2048.0f);
}
}
public LightSource(Vector2 position, float range, Color color)
{
Position = position;
this.range = range;
this.color = color;
if (lightTexture == null)
{
lightTexture = TextureLoader.FromFile("Content/Lights/light.png");
}
texture = lightTexture;
Game1.LightManager.AddLight(this);
}
public void Draw(SpriteBatch spriteBatch)
{
Vector2 center = new Vector2(lightTexture.Width / 2, lightTexture.Height / 2);
float scale = range / ((float)lightTexture.Width / 2.0f);
spriteBatch.Draw(lightTexture, new Vector2(Position.X, -Position.Y), null, color, 0, center, scale, SpriteEffects.None, 1);
}
public void Remove()
{
Game1.LightManager.RemoveLight(this);
}
}
}