Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* Added Dimension.cs
* Added more properties to Entity.cs
  • Loading branch information
coder2000 committed Aug 23, 2012
1 parent b9cb499 commit 2d9b9af
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SharpCraft.sln
@@ -1,5 +1,5 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCraft", "SharpCraft\SharpCraft.csproj", "{653D89FB-8ADD-4EB1-885A-B139138AAD8A}"
EndProject
Expand Down
10 changes: 10 additions & 0 deletions SharpCraft/Common/Dimension.cs
@@ -0,0 +1,10 @@
namespace SharpCraft.Common
{
public enum Dimension
{
Nether = -1,
Overworld = 0,
TheEnd = 1
}
}

60 changes: 60 additions & 0 deletions SharpCraft/Common/Entity.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
using SharpCraft.World;

namespace SharpCraft.Common
{
Expand All @@ -10,6 +11,9 @@ public abstract class Entity : INotifyPropertyChanged
private Vector3 _location;
private Vector3 _rotation;
private Vector3 _velocity;
private Vector3 _headRotation;
private Dimension _dimension;
private int _worldIndex;

protected Entity(Vector3 location = null)
{
Expand Down Expand Up @@ -92,6 +96,28 @@ public Vector3 Location
}
}

public Vector3 Rotation
{
get { return _rotation; }
set
{
if (!Equals(_rotation, value))
OnPropertyChanged("Rotation");
_rotation = value;
}
}

public Vector3 HeadRotation
{
get { return _headRotation; }
set
{
if (!Equals(_headRotation, value))
OnPropertyChanged("HeadRotation");
_headRotation = value;
}
}

/// <summary>
/// Velocity of the entity.
/// </summary>
Expand All @@ -106,6 +132,33 @@ public Vector3 Velocity
}
}

public Dimension OldDimension { get; set; }

public Dimension Dimension
{
get { return _dimension; }
set
{
if (!Equals(_dimension, value))
{
OldDimension = _dimension;
OnPropertyChanged("Dimension");
}
_dimension = value;
}
}

public int WorldIndex
{
get { return _worldIndex; }
set
{
if (!Equals(_worldIndex, value))
OnPropertyChanged("WorldIndex");
_worldIndex = value;
}
}

#region INotifyPropertyChanged Members

/// <summary>
Expand All @@ -120,5 +173,12 @@ protected virtual void OnPropertyChanged(string propertyName)
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}

public virtual void ScheduledUpdate(Map world) {}

public virtual void Tick(Map world)
{

}
}
}
2 changes: 1 addition & 1 deletion SharpCraft/SharpCraft.cs
Expand Up @@ -26,7 +26,7 @@ public class SharpCraft

private static readonly string SettingsFile =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SharpCraft", "settings.yml");

private static TcpListener _listener;
private static Timer _network;
private static Timer _ticks;
Expand Down
10 changes: 6 additions & 4 deletions SharpCraft/SharpCraft.csproj
Expand Up @@ -9,13 +9,14 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SharpCraft</RootNamespace>
<AssemblyName>SharpCraft</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -24,7 +25,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand Down Expand Up @@ -56,6 +57,7 @@
<Compile Include="Settings.cs" />
<Compile Include="SharpCraft.cs" />
<Compile Include="World\Map.cs" />
<Compile Include="Common\Dimension.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
11 changes: 6 additions & 5 deletions SharpCraftTest/SharpCraftTest.csproj
Expand Up @@ -9,14 +9,15 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SharpCraftTest</RootNamespace>
<AssemblyName>SharpCraftTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -25,7 +26,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
Expand Down Expand Up @@ -79,7 +80,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpCraft\SharpCraft.csproj">
<Project>{653d89fb-8add-4eb1-885a-b139138aad8a}</Project>
<Project>{653D89FB-8ADD-4EB1-885A-B139138AAD8A}</Project>
<Name>SharpCraft</Name>
</ProjectReference>
</ItemGroup>
Expand Down

0 comments on commit 2d9b9af

Please sign in to comment.