NumberOfSteps, CurrentStep, Enter = Next Turn
Also, added KeyboardInput
This commit is contained in:
@@ -22,6 +22,7 @@ namespace DepthsBelow
|
|||||||
public Camera Camera;
|
public Camera Camera;
|
||||||
|
|
||||||
public static MouseInput MouseInput;
|
public static MouseInput MouseInput;
|
||||||
|
public static KeyboardInput KeyboardInput;
|
||||||
public List<Soldier> Squad;
|
public List<Soldier> Squad;
|
||||||
public List<SmallEnemy> Swarm;
|
public List<SmallEnemy> Swarm;
|
||||||
public static Map Map;
|
public static Map Map;
|
||||||
@@ -81,6 +82,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
MouseInput = new MouseInput(this);
|
MouseInput = new MouseInput(this);
|
||||||
MouseInput.LoadContent();
|
MouseInput.LoadContent();
|
||||||
|
KeyboardInput = new KeyboardInput(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -105,6 +107,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
Camera.Update(gameTime);
|
Camera.Update(gameTime);
|
||||||
MouseInput.Update(gameTime);
|
MouseInput.Update(gameTime);
|
||||||
|
KeyboardInput.Update(gameTime);
|
||||||
|
|
||||||
// Update soldiers in squad
|
// Update soldiers in squad
|
||||||
foreach (var soldier in Squad)
|
foreach (var soldier in Squad)
|
||||||
|
|||||||
@@ -122,6 +122,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Camera.cs" />
|
<Compile Include="Camera.cs" />
|
||||||
|
<Compile Include="KeyboardInput.cs" />
|
||||||
<Compile Include="Component\PathFinder.cs" />
|
<Compile Include="Component\PathFinder.cs" />
|
||||||
<Compile Include="Component\Transform.cs" />
|
<Compile Include="Component\Transform.cs" />
|
||||||
<Compile Include="Grid.cs" />
|
<Compile Include="Grid.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using Microsoft.Xna.Framework.Media;
|
||||||
|
|
||||||
|
namespace DepthsBelow
|
||||||
|
{
|
||||||
|
public class KeyboardInput
|
||||||
|
{
|
||||||
|
Core core;
|
||||||
|
|
||||||
|
public KeyboardInput(Core core)
|
||||||
|
{
|
||||||
|
this.core = core;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
KeyboardState ks = Keyboard.GetState();
|
||||||
|
|
||||||
|
if (ks.IsKeyDown(Keys.Enter))
|
||||||
|
{
|
||||||
|
foreach (var unit in core.Squad)
|
||||||
|
{
|
||||||
|
unit.step = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,21 @@ namespace DepthsBelow
|
|||||||
private PathFinder.Node lastNode;
|
private PathFinder.Node lastNode;
|
||||||
private PathFinder.Node lastLastNode;
|
private PathFinder.Node lastLastNode;
|
||||||
|
|
||||||
|
public int numberOfSteps = 14;
|
||||||
|
public int currentStep = 0;
|
||||||
|
|
||||||
|
public int step
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return currentStep;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
currentStep = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Soldier(Core core, ref List<Soldier> squad) : base(core)
|
public Soldier(Core core, ref List<Soldier> squad) : base(core)
|
||||||
{
|
{
|
||||||
if (Texture == null)
|
if (Texture == null)
|
||||||
@@ -108,10 +123,18 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
if (Transform.World == nodeWorldPos)
|
if (Transform.World == nodeWorldPos)
|
||||||
{
|
{
|
||||||
|
if (currentStep < numberOfSteps)
|
||||||
|
{
|
||||||
|
currentStep++;
|
||||||
lastLastNode = lastNode;
|
lastLastNode = lastNode;
|
||||||
lastNode = nextNode;
|
lastNode = nextNode;
|
||||||
nextNode = GetComponent<PathFinder>().Next();
|
nextNode = GetComponent<PathFinder>().Next();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetComponent<PathFinder>().Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,13 @@
|
|||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="images\Enter.bmp">
|
||||||
|
<Name>Enter</Name>
|
||||||
|
<Importer>TextureImporter</Importer>
|
||||||
|
<Processor>TextureProcessor</Processor>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 670 B |
Reference in New Issue
Block a user