Started work on ramp generation, still needs work.

develop
Japa 2013-07-22 19:05:09 +05:30
parent 0bd627a6f6
commit 279c4a48dc
25 changed files with 143 additions and 405 deletions

@ -0,0 +1,12 @@
*.sln
*.userprefs
*.csproj
*.pidb
*.unityproj
.DS_Store
/Library/FailedAssetImports.txt
/Library/cache/
/Library/previews/
/Library/ScriptAssemblies
/obj
/Temp

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp-Editor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Editor\MapBlockEditor.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Assembly-CSharp-vs.csproj">
<Project>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</Project> <Name>Assembly-CSharp-vs</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp-Editor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Editor\MapBlockEditor.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Assembly-CSharp.csproj">
<Project>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</Project> <Name>Assembly-CSharp</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\DFHack\isoworldremote.pb.cs" />
<Compile Include="Assets\GameWindow.cs" />
<Compile Include="Assets\HUDFPS.cs" />
<Compile Include="Assets\MapGen\GameMap.cs" />
<Compile Include="Assets\MapGen\MapBlock.cs" />
<Compile Include="Assets\RemoteClient\Basic.cs" />
<Compile Include="Assets\RemoteClient\BasicApi.cs" />
<Compile Include="Assets\RemoteClient\ColorText.cs" />
<Compile Include="Assets\RemoteClient\CoreProtocol.cs" />
<Compile Include="Assets\RemoteClient\RemoteClient.cs" />
<Compile Include="Assets\RemoteClient\Tools.cs" />
<Compile Include="Assets\TestScript.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_1_5;UNITY_4_1;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\DFHack\isoworldremote.pb.cs" />
<Compile Include="Assets\GameWindow.cs" />
<Compile Include="Assets\HUDFPS.cs" />
<Compile Include="Assets\MapGen\GameMap.cs" />
<Compile Include="Assets\MapGen\MapBlock.cs" />
<Compile Include="Assets\RemoteClient\Basic.cs" />
<Compile Include="Assets\RemoteClient\BasicApi.cs" />
<Compile Include="Assets\RemoteClient\ColorText.cs" />
<Compile Include="Assets\RemoteClient\CoreProtocol.cs" />
<Compile Include="Assets\RemoteClient\RemoteClient.cs" />
<Compile Include="Assets\RemoteClient\Tools.cs" />
<Compile Include="Assets\TestScript.cs" />
<None Include="Assets\VertexColor.shader" />
<Reference Include="protobuf-net">
<HintPath>Assets\protobuf-net.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

@ -10,6 +10,37 @@
// Generated from: isoworldremote.proto // Generated from: isoworldremote.proto
namespace isoworldremote namespace isoworldremote
{ {
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ColorDefinition")]
public partial class ColorDefinition : global::ProtoBuf.IExtensible
{
public ColorDefinition() {}
private int _red;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"red", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int red
{
get { return _red; }
set { _red = value; }
}
private int _green;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"green", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int green
{
get { return _green; }
set { _green = value; }
}
private int _blue;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"blue", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int blue
{
get { return _blue; }
set { _blue = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EmbarkTileLayer")] [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EmbarkTileLayer")]
public partial class EmbarkTileLayer : global::ProtoBuf.IExtensible public partial class EmbarkTileLayer : global::ProtoBuf.IExtensible
{ {
@ -36,6 +67,13 @@ namespace isoworldremote
get { return _tile_shape_table; } get { return _tile_shape_table; }
} }
private readonly global::System.Collections.Generic.List<isoworldremote.ColorDefinition> _tile_color_table = new global::System.Collections.Generic.List<isoworldremote.ColorDefinition>();
[global::ProtoBuf.ProtoMember(7, Name=@"tile_color_table", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<isoworldremote.ColorDefinition> tile_color_table
{
get { return _tile_color_table; }
}
private global::ProtoBuf.IExtension extensionObject; private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); } { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
@ -306,7 +344,13 @@ namespace isoworldremote
WALL = 3, WALL = 3,
[global::ProtoBuf.ProtoEnum(Name=@"FLOOR", Value=4)] [global::ProtoBuf.ProtoEnum(Name=@"FLOOR", Value=4)]
FLOOR = 4 FLOOR = 4,
[global::ProtoBuf.ProtoEnum(Name=@"RAMP_UP", Value=5)]
RAMP_UP = 5,
[global::ProtoBuf.ProtoEnum(Name=@"RAMP_DOWN", Value=6)]
RAMP_DOWN = 6
} }
} }

@ -65,6 +65,12 @@ public class MapBlockEditor : Editor
case BasicShape.OPEN: case BasicShape.OPEN:
buttonIcon = "\u00A0"; buttonIcon = "\u00A0";
break; break;
case BasicShape.RAMP_UP:
buttonIcon = "▲";
break;
case BasicShape.RAMP_DOWN:
buttonIcon = "▼";
break;
default: default:
buttonIcon = "?"; buttonIcon = "?";
break; break;

@ -6,6 +6,7 @@ using isoworldremote;
public class MapBlock : MonoBehaviour public class MapBlock : MonoBehaviour
{ {
public static float floorHeight = 0.1f; public static float floorHeight = 0.1f;
public static float rampDistance = 2.0f;
DFCoord coordinates; DFCoord coordinates;
GameMap parent; GameMap parent;
@ -148,17 +149,68 @@ public class MapBlock : MonoBehaviour
return GetSingleTile(relativePosition); return GetSingleTile(relativePosition);
} }
enum Layer
{
Base,
Floor,
Top
}
float convertDistanceToOffset(float input)
{
if (input == float.MaxValue)
return 0;
input = Mathf.Pow(input, 0.5f);
input = (rampDistance - input) / rampDistance;
if (input < 0)
return 0;
return Mathf.Sin(input * Mathf.PI / 4.0f);
}
Vector3 AdjustForRamps(Vector3 input, Layer layer = Layer.Floor)
{
float nearestUpRamp = float.MaxValue;
float nearestDownRamp = float.MaxValue;
for (int x = (int)(input.x - rampDistance); x < (int)(input.x + rampDistance + 1.0f); x++)
for (int y = (int)(-input.z - rampDistance); y < (int)(-input.z + rampDistance + 1.0f); y++)
{
BasicShape tile = GetSingleTile(new DFCoord2d(x, y));
if(tile == BasicShape.RAMP_UP || tile == BasicShape.RAMP_DOWN)
{
float tempDistance = Mathf.Pow(input.x - x, 2) + Mathf.Pow(-input.z - y, 2);
if (tile == BasicShape.RAMP_DOWN && tempDistance < nearestDownRamp)
nearestDownRamp = tempDistance;
if (tile == BasicShape.RAMP_UP && tempDistance < nearestUpRamp)
nearestUpRamp = tempDistance;
}
}
nearestUpRamp = convertDistanceToOffset(nearestUpRamp);
nearestDownRamp = convertDistanceToOffset(nearestDownRamp);
if (layer == Layer.Floor)
input.y = input.y + nearestUpRamp - nearestDownRamp;
if (layer == Layer.Top)
input.y = input.y - nearestUpRamp;
return input;
}
void AddSideFace(DFCoord2d position, FaceDirection direction) void AddSideFace(DFCoord2d position, FaceDirection direction)
{ {
Layer topLayer = Layer.Top;
Layer bottomLayer = Layer.Base;
float currentFloorHeight = -0.5f; float currentFloorHeight = -0.5f;
float adjacentFloorHeight = -0.5f; float adjacentFloorHeight = -0.5f;
switch (GetSingleTile(position)) switch (GetSingleTile(position))
{ {
case BasicShape.WALL: case BasicShape.WALL:
currentFloorHeight = 0.5f; currentFloorHeight = 0.5f;
topLayer = Layer.Top;
break; break;
case BasicShape.FLOOR: case BasicShape.FLOOR:
currentFloorHeight = floorHeight - 0.5f; currentFloorHeight = floorHeight - 0.5f;
topLayer = Layer.Floor;
break; break;
default: default:
break; break;
@ -167,9 +219,11 @@ public class MapBlock : MonoBehaviour
{ {
case BasicShape.WALL: case BasicShape.WALL:
adjacentFloorHeight = 0.5f; adjacentFloorHeight = 0.5f;
bottomLayer = Layer.Top;
break; break;
case BasicShape.FLOOR: case BasicShape.FLOOR:
adjacentFloorHeight = floorHeight - 0.5f; adjacentFloorHeight = floorHeight - 0.5f;
bottomLayer = Layer.Floor;
break; break;
default: default:
break; break;
@ -181,31 +235,31 @@ public class MapBlock : MonoBehaviour
switch (direction) switch (direction)
{ {
case FaceDirection.North: case FaceDirection.North:
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f)), bottomLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f)), bottomLayer));
uvPos = position.x; uvPos = position.x;
break; break;
case FaceDirection.South: case FaceDirection.South:
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f)), bottomLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f)), bottomLayer));
uvPos = 16 - position.x; uvPos = 16 - position.x;
break; break;
case FaceDirection.East: case FaceDirection.East:
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y + 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, currentFloorHeight, -(position.y - 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y + 0.5f)), bottomLayer));
finalVertices.Add(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, adjacentFloorHeight, -(position.y - 0.5f)), bottomLayer));
uvPos = position.y; uvPos = position.y;
break; break;
case FaceDirection.West: case FaceDirection.West:
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y - 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, currentFloorHeight, -(position.y + 0.5f)), topLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y - 0.5f)), bottomLayer));
finalVertices.Add(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, adjacentFloorHeight, -(position.y + 0.5f)), bottomLayer));
uvPos = 16 - position.y; uvPos = 16 - position.y;
break; break;
default: default:
@ -232,14 +286,19 @@ public class MapBlock : MonoBehaviour
void AddTopFace(DFCoord2d position, float height) void AddTopFace(DFCoord2d position, float height)
{ {
Layer layer = Layer.Base;
if (GetSingleTile(position) == BasicShape.FLOOR)
layer = Layer.Floor;
else if (GetSingleTile(position) == BasicShape.WALL)
layer = Layer.Top;
height -= 0.5f; height -= 0.5f;
//Todo: Weld vertices that should be welded //Todo: Weld vertices that should be welded
//On second though, not with vertex colors there. //On second though, not with vertex colors there.
int startindex = finalVertices.Count; int startindex = finalVertices.Count;
finalVertices.Add(new Vector3(position.x - 0.5f, height, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, height, -(position.y - 0.5f)), layer));
finalVertices.Add(new Vector3(position.x + 0.5f, height, -(position.y - 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, height, -(position.y - 0.5f)), layer));
finalVertices.Add(new Vector3(position.x - 0.5f, height, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x - 0.5f, height, -(position.y + 0.5f)), layer));
finalVertices.Add(new Vector3(position.x + 0.5f, height, -(position.y + 0.5f))); finalVertices.Add(AdjustForRamps(new Vector3(position.x + 0.5f, height, -(position.y + 0.5f)), layer));
finalUVs.Add(new Vector2((float)(position.x) / 16.0f, -(float)(position.y) / 16.0f)); finalUVs.Add(new Vector2((float)(position.x) / 16.0f, -(float)(position.y) / 16.0f));
finalUVs.Add(new Vector2((float)(position.x + 1) / 16.0f, -(float)(position.y) / 16.0f)); finalUVs.Add(new Vector2((float)(position.x + 1) / 16.0f, -(float)(position.y) / 16.0f));

@ -1,45 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-vs.csproj", "{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}"
EndProject
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-Editor-vs.csproj", "{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.Build.0 = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
$1.inheritsSet = null
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.TextStylePolicy = $3
$3.FileWidth = 120
$3.TabWidth = 4
$3.EolMarker = Unix
$3.inheritsSet = Mono
$3.inheritsScope = text/plain
$3.scope = text/plain
EndGlobalSection
EndGlobal

@ -1,45 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp.csproj", "{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}"
EndProject
Project("{277888DF-B633-98F9-AF58-18CFF25BE876}") = "simple_sample", "Assembly-CSharp-Editor.csproj", "{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE3AFC6C-A022-3549-CF6C-7716EC410CE6}.Release|Any CPU.Build.0 = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEF4C46B-71B7-6E0B-EF7E-154F411C7DF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
$1.inheritsSet = null
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.TextStylePolicy = $3
$3.FileWidth = 120
$3.TabWidth = 4
$3.EolMarker = Unix
$3.inheritsSet = Mono
$3.inheritsScope = text/plain
$3.scope = text/plain
EndGlobalSection
EndGlobal

@ -1,8 +0,0 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
</Properties>

@ -37,7 +37,7 @@ message EmbarkTileLayer {
repeated BasicMaterial mat_type_table = 4 [packed=true]; repeated BasicMaterial mat_type_table = 4 [packed=true];
repeated int32 mat_subtype_table = 5 [packed=true]; repeated int32 mat_subtype_table = 5 [packed=true];
repeated BasicShape tile_shape_table = 6 [packed=true]; repeated BasicShape tile_shape_table = 6 [packed=true];
repeated ColorDefinition tile_color_table = 7 [packed=true]; repeated ColorDefinition tile_color_table = 7;
} }
message EmbarkTile { message EmbarkTile {