From 16e0dfe693134ef104e7db9040d89082230b657a Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Tue, 13 Jan 2015 23:39:28 +0600 Subject: [PATCH] add function comments --- Assets/IsoTools/Scripts/IsoObject.cs | 5 +++- Assets/IsoTools/Scripts/IsoWorld.cs | 38 +++++++++++++++++++++++++--- UnityIso-csharp.sln | 2 +- UnityIso.sln | 2 +- UnityIso.userprefs | 10 +++----- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Assets/IsoTools/Scripts/IsoObject.cs b/Assets/IsoTools/Scripts/IsoObject.cs index bee10d5..583ddca 100644 --- a/Assets/IsoTools/Scripts/IsoObject.cs +++ b/Assets/IsoTools/Scripts/IsoObject.cs @@ -11,6 +11,7 @@ public class IsoObject : MonoBehaviour { [SerializeField] Vector3 _position = Vector3.zero; + /// Isometric object position. public Vector3 Position { get { return _position; } set { @@ -29,6 +30,7 @@ public class IsoObject : MonoBehaviour { [SerializeField] Vector3 _size = Vector3.one; + /// Isometric object size. public Vector3 Size { get { return _size; } set { @@ -46,7 +48,8 @@ public class IsoObject : MonoBehaviour { } [SerializeField] - bool _alignment = true; + bool _alignment = true; + /// Auto alignment position by isometric tile size. public bool Alignment { get { return _alignment; } set { diff --git a/Assets/IsoTools/Scripts/IsoWorld.cs b/Assets/IsoTools/Scripts/IsoWorld.cs index 22ca392..9a0a3fb 100644 --- a/Assets/IsoTools/Scripts/IsoWorld.cs +++ b/Assets/IsoTools/Scripts/IsoWorld.cs @@ -4,9 +4,12 @@ using System.Collections.Generic; namespace IsoTools { [ExecuteInEditMode] public class IsoWorld : MonoBehaviour { - + + /// Isometric tile size. public float TileSize = 32.0f; + /// Start sorting depth value. public float StartDepth = 0.0f; + /// Step sorting depth value. public float StepDepth = 0.1f; class ObjectInfo { @@ -28,24 +31,51 @@ public class IsoWorld : MonoBehaviour { List _depends = new List(); List _objects = new List(); float _lastTileSize = 0.0f; - + + // ------------------------------------------------------------------------ + /// + /// Marks world for resorting. + /// + // ------------------------------------------------------------------------ public void MarkDirty() { _dirty = true; } + // ------------------------------------------------------------------------ + /// + /// Convert isometric coordinates to screen coordinates + /// + /// Screen coordinates + /// Isometric coordinates. + // ------------------------------------------------------------------------ public Vector2 IsoToScreen(Vector3 pos) { return new Vector2( (pos.x - pos.y), (pos.x + pos.y) * 0.5f + pos.z) * TileSize; } - + + // ------------------------------------------------------------------------ + /// + /// Convert screen coordinates to isometric coordinates + /// + /// Isometric coordinates + /// Screen coordinates. + // ------------------------------------------------------------------------ public Vector3 ScreenToIso(Vector2 pos) { return new Vector3( (pos.x * 0.5f + pos.y), (pos.y - pos.x * 0.5f), 0.0f) / TileSize; } - + + // ------------------------------------------------------------------------ + /// + /// Convert screen coordinates to isometric coordinates with specified isometric height + /// + /// Isometric coordinates + /// Screen coordinates. + /// Point isometric height. + // ------------------------------------------------------------------------ public Vector3 ScreenToIso(Vector2 pos, float iso_z) { var iso_pos = ScreenToIso(new Vector2(pos.x, pos.y - iso_z * TileSize)); iso_pos.z = iso_z; diff --git a/UnityIso-csharp.sln b/UnityIso-csharp.sln index 4670fd3..3d9f2e7 100644 --- a/UnityIso-csharp.sln +++ b/UnityIso-csharp.sln @@ -17,7 +17,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/UnityIso.sln b/UnityIso.sln index 0dafd5a..6a04c6c 100644 --- a/UnityIso.sln +++ b/UnityIso.sln @@ -17,7 +17,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/UnityIso.userprefs b/UnityIso.userprefs index 2e712bd..87e6343 100644 --- a/UnityIso.userprefs +++ b/UnityIso.userprefs @@ -1,11 +1,9 @@  - - + + - - - - + +