NumberOfSteps, CurrentStep, Enter = Next Turn
Also, added KeyboardInput
This commit is contained in:
@@ -21,7 +21,8 @@ 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;
|
||||||
@@ -80,7 +81,8 @@ namespace DepthsBelow
|
|||||||
SmallEnemy.LoadContent(this);
|
SmallEnemy.LoadContent(this);
|
||||||
|
|
||||||
MouseInput = new MouseInput(this);
|
MouseInput = new MouseInput(this);
|
||||||
MouseInput.LoadContent();
|
MouseInput.LoadContent();
|
||||||
|
KeyboardInput = new KeyboardInput(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -104,7 +106,8 @@ namespace DepthsBelow
|
|||||||
this.Exit();
|
this.Exit();
|
||||||
|
|
||||||
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,9 +123,17 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
if (Transform.World == nodeWorldPos)
|
if (Transform.World == nodeWorldPos)
|
||||||
{
|
{
|
||||||
lastLastNode = lastNode;
|
if (currentStep < numberOfSteps)
|
||||||
lastNode = nextNode;
|
{
|
||||||
nextNode = GetComponent<PathFinder>().Next();
|
currentStep++;
|
||||||
|
lastLastNode = lastNode;
|
||||||
|
lastNode = nextNode;
|
||||||
|
nextNode = GetComponent<PathFinder>().Next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetComponent<PathFinder>().Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,117 +1,124 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{433A77A2-DE52-4875-A4EF-232CF59C2DD3}</ProjectGuid>
|
<ProjectGuid>{433A77A2-DE52-4875-A4EF-232CF59C2DD3}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
|
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
||||||
<ContentRootDirectory>Content</ContentRootDirectory>
|
<ContentRootDirectory>Content</ContentRootDirectory>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>DepthsBelowContent</RootNamespace>
|
<RootNamespace>DepthsBelowContent</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="images\soldier.png">
|
<Compile Include="images\soldier.png">
|
||||||
<Name>soldier</Name>
|
<Name>soldier</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="maps\test.tmx">
|
<Compile Include="maps\test.tmx">
|
||||||
<Name>test</Name>
|
<Name>test</Name>
|
||||||
<Importer>TmxImporter</Importer>
|
<Importer>TmxImporter</Importer>
|
||||||
<Processor>MapProcessor</Processor>
|
<Processor>MapProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\TiledLib\TiledLib\TiledLib.csproj">
|
<ProjectReference Include="..\..\TiledLib\TiledLib\TiledLib.csproj">
|
||||||
<Project>{EC3F6988-459C-4783-89E9-F34C0CC731C7}</Project>
|
<Project>{EC3F6988-459C-4783-89E9-F34C0CC731C7}</Project>
|
||||||
<Name>TiledLib</Name>
|
<Name>TiledLib</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\DepthsBelowContentPipeline\DepthsBelowContentPipeline.csproj">
|
<ProjectReference Include="..\DepthsBelowContentPipeline\DepthsBelowContentPipeline.csproj">
|
||||||
<Project>{D054E3A6-7E05-4255-984F-69FE40D9137F}</Project>
|
<Project>{D054E3A6-7E05-4255-984F-69FE40D9137F}</Project>
|
||||||
<Name>DepthsBelowContentPipeline</Name>
|
<Name>DepthsBelowContentPipeline</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="maps\tilesets\aztek.jpg">
|
<Compile Include="maps\tilesets\aztek.jpg">
|
||||||
<Name>aztek</Name>
|
<Name>aztek</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="images\soldier2.png">
|
<Compile Include="images\soldier2.png">
|
||||||
<Name>soldier2</Name>
|
<Name>soldier2</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="maps\tilesets\collision.png">
|
<Compile Include="maps\tilesets\collision.png">
|
||||||
<Name>collision</Name>
|
<Name>collision</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="maps\Cave.Level1.tmx">
|
<Compile Include="maps\Cave.Level1.tmx">
|
||||||
<Name>Cave.Level1</Name>
|
<Name>Cave.Level1</Name>
|
||||||
<Processor>MapProcessor</Processor>
|
<Processor>MapProcessor</Processor>
|
||||||
<Importer>TmxImporter</Importer>
|
<Importer>TmxImporter</Importer>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="maps\tilesets\cave.png">
|
<Compile Include="maps\tilesets\cave.png">
|
||||||
<Name>cave</Name>
|
<Name>cave</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="images\Monster.png">
|
<Compile Include="images\Monster.png">
|
||||||
<Name>Monster</Name>
|
<Name>Monster</Name>
|
||||||
<Importer>TextureImporter</Importer>
|
<Importer>TextureImporter</Importer>
|
||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
<ItemGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<Compile Include="images\Enter.bmp">
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
<Name>Enter</Name>
|
||||||
<Target Name="BeforeBuild">
|
<Importer>TextureImporter</Importer>
|
||||||
</Target>
|
<Processor>TextureProcessor</Processor>
|
||||||
<Target Name="AfterBuild">
|
</Compile>
|
||||||
</Target>
|
</ItemGroup>
|
||||||
-->
|
<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.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 670 B |
Reference in New Issue
Block a user