Panic works with death. Press P to spawn an enemy below group 2.

This commit is contained in:
Simon Holmberg
2012-11-01 00:33:49 +00:00
parent d9bff905b5
commit 31394b1e7c
4 changed files with 25 additions and 13 deletions
+6 -1
View File
@@ -109,15 +109,20 @@ namespace DepthsBelow
Map.ParseObjects(this); Map.ParseObjects(this);
Squad[0].Name = "Dean H. Jones"; Squad[0].Name = "Dean H. Jones";
Squad[0].Transform.World.Rotation = -MathHelper.PiOver2;
Squad[1].Name = "Walter L. Verville"; Squad[1].Name = "Walter L. Verville";
Squad[1].Transform.World.Rotation = -MathHelper.PiOver2;
Squad[2].Name = "Patrick Y. Southerland"; Squad[2].Name = "Patrick Y. Southerland";
Squad[2].Transform.World.Rotation = -MathHelper.PiOver2;
Squad[3].Name = "Andrew C. Friend"; Squad[3].Name = "Andrew C. Friend";
Squad[3].Transform.World.Rotation = -MathHelper.PiOver2;
Squad[4].Name = "Gary B. Whitley"; Squad[4].Name = "Gary B. Whitley";
Squad[4].Transform.World.Rotation = -MathHelper.PiOver2;
// Center the camera on a unit // Center the camera on a unit
Camera.Position = Squad[0].Transform.World.Position * -1 + new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2); Camera.Position = Squad[0].Transform.World.Position * -1 + new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
GroupManager = new DynamicGroupManager(Squad.Cast<Entity>().ToList(), (float)Grid.TileSize * 1.5f); GroupManager = new DynamicGroupManager(Squad.Cast<Entity>().ToList(), (float)Grid.TileSize * 3.5f);
Interface.CreateUnitFrames(Squad); Interface.CreateUnitFrames(Squad);
@@ -20,7 +20,7 @@ namespace DepthsBelow
foreach (var entity in Entities) foreach (var entity in Entities)
{ {
var stats = entity.GetComponent<Component.Stat>(); var stats = entity.GetComponent<Component.Stat>();
if (stats != null) if (stats != null && stats.Life > 0)
maxPanic += stats.MaxPanic; maxPanic += stats.MaxPanic;
} }
return maxPanic; return maxPanic;
@@ -68,12 +68,16 @@ namespace DepthsBelow
if (oldGroup != null) if (oldGroup != null)
{ {
newGroup.Panic += (oldGroup.Panic / oldGroup.MaxPanic) * (float)entity.GetComponent<Component.Stat>().MaxPanic; if (entity.GetComponent<Component.Stat>().Life > 0)
oldGroup.Panic -= (oldGroup.Panic / oldGroup.MaxPanic) * (float)entity.GetComponent<Component.Stat>().MaxPanic; {
newGroup.Panic += (oldGroup.Panic/oldGroup.MaxPanic)*(float) entity.GetComponent<Component.Stat>().MaxPanic;
//if (entity.GetComponent<Component.Stat>().Life > 0)
oldGroup.Panic -= (oldGroup.Panic/oldGroup.MaxPanic)*(float) entity.GetComponent<Component.Stat>().MaxPanic;
oldGroup.Entities.Remove(entity); oldGroup.Entities.Remove(entity);
} }
}
else else
newGroup.Panic = 10; newGroup.Panic = 125;
} }
} }
+1 -1
View File
@@ -564,7 +564,7 @@ namespace DepthsBelow
var pFrameBar = (GUI.Frame)pFrame["panicBar"]; var pFrameBar = (GUI.Frame)pFrame["panicBar"];
var pFrameText = (GUI.Text)pFrame["text"]; var pFrameText = (GUI.Text)pFrame["text"];
pFrameBar.Width = (int)(pFrameBarBg.Width * (group.Panic / group.MaxPanic)); pFrameBar.Width = (int)(pFrameBarBg.Width * (group.Panic / group.MaxPanic));
pFrameText.Value = Math.Round(group.Panic).ToString() + " (" + Math.Round(group.Panic / group.MaxPanic * 100f).ToString() + "%)"; pFrameText.Value = Math.Round(group.Panic).ToString() + "/" + group.MaxPanic.ToString() + " (" + Math.Round(group.Panic / group.MaxPanic * 100f).ToString() + "%)";
pFrame.Visible = true; pFrame.Visible = true;
if (lastFrame != null) if (lastFrame != null)
+4 -1
View File
@@ -220,7 +220,10 @@ namespace DepthsBelow
{ {
try try
{ {
EntityManager.GetEntities<Door>()[1].Toggle(); var pos = core.GroupManager.Groups[1].Entities[0].Transform.World.Position;
var enemy = new SmallEnemy(ref core.Swarm);
enemy.Transform.World.Position = pos + new Vector2(0, Grid.TileSize*3);
core.Swarm.Add(enemy);
} }
catch catch
{ {