diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs index 539ed61..f814d06 100755 --- a/DepthsBelow/DepthsBelow/Core.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -21,7 +21,8 @@ namespace DepthsBelow public Camera Camera; - public static MouseInput MouseInput; + public static MouseInput MouseInput; + public static KeyboardInput KeyboardInput; public List Squad; public List Swarm; public static Map Map; @@ -80,7 +81,8 @@ namespace DepthsBelow SmallEnemy.LoadContent(this); MouseInput = new MouseInput(this); - MouseInput.LoadContent(); + MouseInput.LoadContent(); + KeyboardInput = new KeyboardInput(this); } /// @@ -104,7 +106,8 @@ namespace DepthsBelow this.Exit(); Camera.Update(gameTime); - MouseInput.Update(gameTime); + MouseInput.Update(gameTime); + KeyboardInput.Update(gameTime); // Update soldiers in squad foreach (var soldier in Squad) diff --git a/DepthsBelow/DepthsBelow/DepthsBelow.csproj b/DepthsBelow/DepthsBelow/DepthsBelow.csproj index 68cfd78..48ff742 100644 --- a/DepthsBelow/DepthsBelow/DepthsBelow.csproj +++ b/DepthsBelow/DepthsBelow/DepthsBelow.csproj @@ -122,6 +122,7 @@ + diff --git a/DepthsBelow/DepthsBelow/KeyboardInput.cs b/DepthsBelow/DepthsBelow/KeyboardInput.cs new file mode 100644 index 0000000..41ec90c --- /dev/null +++ b/DepthsBelow/DepthsBelow/KeyboardInput.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; + } + } + } + } +} diff --git a/DepthsBelow/DepthsBelow/Soldier.cs b/DepthsBelow/DepthsBelow/Soldier.cs index 2a22f9f..86af12f 100644 --- a/DepthsBelow/DepthsBelow/Soldier.cs +++ b/DepthsBelow/DepthsBelow/Soldier.cs @@ -20,6 +20,21 @@ namespace DepthsBelow private PathFinder.Node lastNode; 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 squad) : base(core) { if (Texture == null) @@ -108,9 +123,17 @@ namespace DepthsBelow if (Transform.World == nodeWorldPos) { - lastLastNode = lastNode; - lastNode = nextNode; - nextNode = GetComponent().Next(); + if (currentStep < numberOfSteps) + { + currentStep++; + lastLastNode = lastNode; + lastNode = nextNode; + nextNode = GetComponent().Next(); + } + else + { + GetComponent().Stop(); + } } } diff --git a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj index a009837..82ab136 100644 --- a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj +++ b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj @@ -1,117 +1,124 @@ - - - - {433A77A2-DE52-4875-A4EF-232CF59C2DD3} - {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Debug - x86 - Library - Properties - v4.0 - v4.0 - bin\$(Platform)\$(Configuration) - Content - - - x86 - - - x86 - - - DepthsBelowContent - - - - False - - - False - - - False - - - False - - - False - - - False - - - - - soldier - TextureImporter - TextureProcessor - - - test - TmxImporter - MapProcessor - - - - - {EC3F6988-459C-4783-89E9-F34C0CC731C7} - TiledLib - - - {D054E3A6-7E05-4255-984F-69FE40D9137F} - DepthsBelowContentPipeline - - - - - aztek - TextureImporter - TextureProcessor - - - - - soldier2 - TextureImporter - TextureProcessor - - - - - collision - TextureImporter - TextureProcessor - - - - - Cave.Level1 - MapProcessor - TmxImporter - Designer - - - - - cave - TextureImporter - TextureProcessor - - - - - Monster - TextureImporter - TextureProcessor - - - - + + + + {433A77A2-DE52-4875-A4EF-232CF59C2DD3} + {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + Library + Properties + v4.0 + v4.0 + bin\$(Platform)\$(Configuration) + Content + + + x86 + + + x86 + + + DepthsBelowContent + + + + False + + + False + + + False + + + False + + + False + + + False + + + + + soldier + TextureImporter + TextureProcessor + + + test + TmxImporter + MapProcessor + + + + + {EC3F6988-459C-4783-89E9-F34C0CC731C7} + TiledLib + + + {D054E3A6-7E05-4255-984F-69FE40D9137F} + DepthsBelowContentPipeline + + + + + aztek + TextureImporter + TextureProcessor + + + + + soldier2 + TextureImporter + TextureProcessor + + + + + collision + TextureImporter + TextureProcessor + + + + + Cave.Level1 + MapProcessor + TmxImporter + Designer + + + + + cave + TextureImporter + TextureProcessor + + + + + Monster + TextureImporter + TextureProcessor + + + + + Enter + TextureImporter + TextureProcessor + + + + \ No newline at end of file diff --git a/DepthsBelow/DepthsBelowContent/images/Enter.bmp b/DepthsBelow/DepthsBelowContent/images/Enter.bmp new file mode 100644 index 0000000..0a23577 Binary files /dev/null and b/DepthsBelow/DepthsBelowContent/images/Enter.bmp differ