You can now fire selected units with S
This commit is contained in:
@@ -127,6 +127,9 @@ namespace DepthsBelow
|
||||
foreach (var body in Swarm)
|
||||
body.Update(gameTime);
|
||||
|
||||
foreach (var bullet in Volley)
|
||||
bullet.Update(gameTime);
|
||||
|
||||
TestMonster.Update(gameTime);
|
||||
GUIManager.Update(gameTime);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace DepthsBelow
|
||||
foreach (var unit in core.Squad)
|
||||
{
|
||||
unit.step = 0;
|
||||
unit.Fired = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -76,16 +77,28 @@ namespace DepthsBelow
|
||||
if (ks.IsKeyDown(Keys.S))
|
||||
{
|
||||
foreach (var soldier in core.Squad)
|
||||
{
|
||||
if (soldier.Selected == true && soldier.Fired == false)
|
||||
{
|
||||
core.Volley.Add(new Shot(core));
|
||||
soldier.Fired = true;
|
||||
foreach (var shot in core.Volley)
|
||||
{
|
||||
if (shot.select == false)
|
||||
{
|
||||
shot.select = true;
|
||||
shot.X = soldier.X;
|
||||
shot.Y = soldier.Y;
|
||||
//shot.Transform.World.X += Grid.TileSize / 2;
|
||||
//shot.Transform.World.Y += Grid.TileSize / 2;
|
||||
}
|
||||
if (shot.direction == Vector2.Zero)
|
||||
{
|
||||
double directionX = Math.Cos(soldier.GetComponent<Component.Transform>().World.Rotation);
|
||||
double directionY = Math.Sin(soldier.GetComponent<Component.Transform>().World.Rotation);
|
||||
shot.direction = new Vector2((float)directionX, (float)directionY);
|
||||
|
||||
shot.Transform.World.Rotation = soldier.Transform.World.Rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,16 @@ namespace DepthsBelow
|
||||
public Color Color;
|
||||
public static Point Origin;
|
||||
|
||||
private bool _selected; //I guess as in "currently doing something"
|
||||
private bool _selected = false; //I guess as in "currently doing something"
|
||||
|
||||
public bool select
|
||||
{
|
||||
get { return _selected; }
|
||||
set
|
||||
{
|
||||
_selected = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Shot> Volley;
|
||||
|
||||
|
||||
@@ -20,6 +20,17 @@ namespace DepthsBelow
|
||||
private PathFinder.Node lastNode;
|
||||
private PathFinder.Node lastLastNode;
|
||||
|
||||
private bool hasFiredAlready = false;
|
||||
|
||||
public bool Fired
|
||||
{
|
||||
get { return hasFiredAlready; }
|
||||
set
|
||||
{
|
||||
hasFiredAlready = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int numberOfSteps = 14;
|
||||
public int currentStep = 0;
|
||||
|
||||
|
||||
@@ -121,7 +121,14 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="images\Shot.bmp">
|
||||
<Compile Include="images\Shot2.bmp">
|
||||
<Name>Shot2</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="images\FireBall.PNG">
|
||||
<Name>Shot</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
Reference in New Issue
Block a user