diff --git a/Assembly-CSharp-Editor-vs.csproj b/Assembly-CSharp-Editor-vs.csproj index 47b0939..a367b6a 100644 --- a/Assembly-CSharp-Editor-vs.csproj +++ b/Assembly-CSharp-Editor-vs.csproj @@ -48,6 +48,7 @@ + /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll diff --git a/Assembly-CSharp-Editor.csproj b/Assembly-CSharp-Editor.csproj index fff4965..c4eaa15 100644 --- a/Assembly-CSharp-Editor.csproj +++ b/Assembly-CSharp-Editor.csproj @@ -48,6 +48,7 @@ + /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll diff --git a/Assembly-CSharp-vs.csproj b/Assembly-CSharp-vs.csproj index b29d7eb..4175c9f 100644 --- a/Assembly-CSharp-vs.csproj +++ b/Assembly-CSharp-vs.csproj @@ -50,6 +50,7 @@ + diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index b29d7eb..4175c9f 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -50,6 +50,7 @@ + diff --git a/Assets/IsoTools/Editor/IsoAlignmentWindow.cs b/Assets/IsoTools/Editor/IsoAlignmentWindow.cs index 94bd6ac..f5eb83c 100644 --- a/Assets/IsoTools/Editor/IsoAlignmentWindow.cs +++ b/Assets/IsoTools/Editor/IsoAlignmentWindow.cs @@ -24,10 +24,6 @@ namespace IsoTools { window.Show(); } - static IsoAlignmentWindow() { - Alignment = true; - } - void OnGUI() { GUILayout.Space(5); Alignment = EditorGUILayout.Toggle("Auto alignment", Alignment); diff --git a/Assets/IsoTools/Editor/IsoObjectEditor.cs b/Assets/IsoTools/Editor/IsoObjectEditor.cs index 6788aba..aa436d8 100644 --- a/Assets/IsoTools/Editor/IsoObjectEditor.cs +++ b/Assets/IsoTools/Editor/IsoObjectEditor.cs @@ -83,7 +83,11 @@ namespace IsoTools { } void XYMoveRectangle() { - Handles.color = IsoUtils.ColorChangeA(Handles.zAxisColor, 0.3f); + Handles.color = new Color( + Handles.zAxisColor.r, + Handles.zAxisColor.g, + Handles.zAxisColor.b, + 0.3f); Handles.DotCap( 0, _viewCenter, diff --git a/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs b/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs new file mode 100644 index 0000000..5ee3212 --- /dev/null +++ b/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs @@ -0,0 +1,49 @@ +using UnityEngine; +using UnityEditor; +using System.Linq; +using System.Collections.Generic; + +namespace IsoTools { + [CustomEditor(typeof(IsoRigidbody)), CanEditMultipleObjects] + class IsoRigidbodyEditor : Editor { + void DrawTop(Vector3 pos, Vector3 size) { + var iso_world = GameObject.FindObjectOfType(); + if ( iso_world ) { + var points = new Vector3[]{ + iso_world.IsoToScreen(pos), + iso_world.IsoToScreen(pos + IsoUtils.Vec3FromX(size.x)), + iso_world.IsoToScreen(pos + IsoUtils.Vec3FromXY(size.x, size.y)), + iso_world.IsoToScreen(pos + IsoUtils.Vec3FromY(size.y)), + iso_world.IsoToScreen(pos) + }; + Handles.DrawPolyLine(points); + } + } + + void DrawVert(Vector3 pos, Vector3 size) { + var iso_world = GameObject.FindObjectOfType(); + if ( iso_world ) { + Handles.DrawLine( + iso_world.IsoToScreen(pos), + iso_world.IsoToScreen(pos + IsoUtils.Vec3FromZ(size.z))); + } + } + + void DrawCube(Vector3 pos, Vector3 size) { + Handles.color = Color.green; + DrawTop (pos - IsoUtils.Vec3FromZ(0.5f), size); + DrawTop (pos + IsoUtils.Vec3FromZ(size.z - 0.5f), size); + DrawVert(pos - IsoUtils.Vec3FromZ(0.5f), size); + DrawVert(pos - IsoUtils.Vec3FromZ(0.5f) + IsoUtils.Vec3FromX(size.x), size); + DrawVert(pos - IsoUtils.Vec3FromZ(0.5f) + IsoUtils.Vec3FromY(size.y), size); + } + + void OnSceneGUI() { + var iso_rigidbody = target as IsoRigidbody; + var iso_object = iso_rigidbody.GetComponent(); + if ( iso_object ) { + DrawCube(iso_object.Position, iso_object.Size); + } + } + } +} // namespace IsoTools \ No newline at end of file diff --git a/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs.meta b/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs.meta new file mode 100644 index 0000000..ea31161 --- /dev/null +++ b/Assets/IsoTools/Editor/IsoRigidbodyEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80c086762f3ba4f369819009dd52e46f +timeCreated: 1431880115 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial b/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial new file mode 100644 index 0000000..e1292ce --- /dev/null +++ b/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: BoxPhysicMaterial + dynamicFriction: .600000024 + staticFriction: .600000024 + bounciness: .400000006 + frictionCombine: 0 + bounceCombine: 0 + frictionDirection2: {x: 0, y: 0, z: 0} + dynamicFriction2: 0 + staticFriction2: 0 diff --git a/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial.meta b/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial.meta new file mode 100644 index 0000000..f9bbb53 --- /dev/null +++ b/Assets/IsoTools/Examples/Prefabs/BoxPhysicMaterial.physicMaterial.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 867b8c31d245f45d482bfe52123a0c6d +timeCreated: 1431888298 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/Examples/Prefabs/Cube_1x1x1.prefab b/Assets/IsoTools/Examples/Prefabs/Cube_1x1x1.prefab index 30c0d35..97f9ea3 100644 --- a/Assets/IsoTools/Examples/Prefabs/Cube_1x1x1.prefab +++ b/Assets/IsoTools/Examples/Prefabs/Cube_1x1x1.prefab @@ -10,6 +10,7 @@ GameObject: - 4: {fileID: 417528} - 212: {fileID: 21217528} - 114: {fileID: 11417528} + - 114: {fileID: 11422542} m_Layer: 0 m_Name: Cube_1x1x1 m_TagString: Untagged @@ -42,7 +43,20 @@ MonoBehaviour: m_EditorClassIdentifier: _position: {x: 0, y: 0, z: 0} _size: {x: 1, y: 1, z: 1} - _alignment: 1 +--- !u!114 &11422542 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 117528} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b6f23cf97dc1d49d89a2556193c4f2e2, type: 3} + m_Name: + m_EditorClassIdentifier: + IsStatic: 0 + IsTrigger: 0 + PhysicMaterial: {fileID: 13400000, guid: 867b8c31d245f45d482bfe52123a0c6d, type: 2} --- !u!212 &21217528 SpriteRenderer: m_ObjectHideFlags: 1 @@ -52,15 +66,19 @@ SpriteRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 - m_LightmapIndex: 255 - m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} m_Materials: - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} m_SubsetIndices: m_StaticBatchRoot: {fileID: 0} m_UseLightProbes: 0 - m_LightProbeAnchor: {fileID: 0} + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: dda1716486a64604ba1c99ad9655eeb2, type: 3} @@ -76,4 +94,3 @@ Prefab: m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 117528} m_IsPrefabParent: 1 - m_IsExploded: 1 diff --git a/Assets/IsoTools/Examples/Prefabs/Cube_1x3x1.prefab b/Assets/IsoTools/Examples/Prefabs/Cube_1x3x1.prefab index 1fb4c34..c31d72f 100644 --- a/Assets/IsoTools/Examples/Prefabs/Cube_1x3x1.prefab +++ b/Assets/IsoTools/Examples/Prefabs/Cube_1x3x1.prefab @@ -10,6 +10,7 @@ GameObject: - 4: {fileID: 453620} - 212: {fileID: 21253620} - 114: {fileID: 11453620} + - 114: {fileID: 11416990} m_Layer: 0 m_Name: Cube_1x3x1 m_TagString: Untagged @@ -29,6 +30,20 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 +--- !u!114 &11416990 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 153620} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b6f23cf97dc1d49d89a2556193c4f2e2, type: 3} + m_Name: + m_EditorClassIdentifier: + IsStatic: 0 + IsTrigger: 0 + PhysicMaterial: {fileID: 13400000, guid: 867b8c31d245f45d482bfe52123a0c6d, type: 2} --- !u!114 &11453620 MonoBehaviour: m_ObjectHideFlags: 1 @@ -42,7 +57,6 @@ MonoBehaviour: m_EditorClassIdentifier: _position: {x: 0, y: 0, z: 0} _size: {x: 1, y: 3, z: 1} - _alignment: 1 --- !u!212 &21253620 SpriteRenderer: m_ObjectHideFlags: 1 @@ -52,17 +66,21 @@ SpriteRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 - m_LightmapIndex: 255 - m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} m_Materials: - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} m_SubsetIndices: m_StaticBatchRoot: {fileID: 0} m_UseLightProbes: 0 - m_LightProbeAnchor: {fileID: 0} + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 - m_SortingOrder: 0 + m_SortingOrder: -3 m_Sprite: {fileID: 21300000, guid: 134a5af3424cf9f45b3c527e6d44d71b, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} --- !u!1001 &100100000 @@ -76,4 +94,3 @@ Prefab: m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 153620} m_IsPrefabParent: 1 - m_IsExploded: 1 diff --git a/Assets/IsoTools/Examples/Prefabs/Cube_3x1x1.prefab b/Assets/IsoTools/Examples/Prefabs/Cube_3x1x1.prefab index cd8aae2..bc79905 100644 --- a/Assets/IsoTools/Examples/Prefabs/Cube_3x1x1.prefab +++ b/Assets/IsoTools/Examples/Prefabs/Cube_3x1x1.prefab @@ -10,6 +10,7 @@ GameObject: - 4: {fileID: 462204} - 212: {fileID: 21262204} - 114: {fileID: 11462204} + - 114: {fileID: 11483544} m_Layer: 0 m_Name: Cube_3x1x1 m_TagString: Untagged @@ -40,9 +41,24 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9a9c584f9a39449438abc7ba59a68778, type: 3} m_Name: m_EditorClassIdentifier: - _position: {x: -0, y: -0, z: 0} + _position: {x: 0, y: 0, z: 0} _size: {x: 3, y: 1, z: 1} - _alignment: 1 +--- !u!114 &11483544 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 162204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b6f23cf97dc1d49d89a2556193c4f2e2, type: 3} + m_Name: + m_EditorClassIdentifier: + IsTrigger: 0 + IsKinematic: 1 + Interpolation: 0 + CollisionMode: 0 + PhysicMaterial: {fileID: 13400000, guid: 867b8c31d245f45d482bfe52123a0c6d, type: 2} --- !u!212 &21262204 SpriteRenderer: m_ObjectHideFlags: 1 @@ -52,15 +68,19 @@ SpriteRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 - m_LightmapIndex: 255 - m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} m_Materials: - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} m_SubsetIndices: m_StaticBatchRoot: {fileID: 0} m_UseLightProbes: 0 - m_LightProbeAnchor: {fileID: 0} + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: 3459d1c3ed403234288c562aeede56d0, type: 3} @@ -76,4 +96,3 @@ Prefab: m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 162204} m_IsPrefabParent: 1 - m_IsExploded: 1 diff --git a/Assets/IsoTools/Examples/Prefabs/Floor_3x3.prefab b/Assets/IsoTools/Examples/Prefabs/Floor_3x3.prefab index f4517e1..7edd1af 100644 --- a/Assets/IsoTools/Examples/Prefabs/Floor_3x3.prefab +++ b/Assets/IsoTools/Examples/Prefabs/Floor_3x3.prefab @@ -10,6 +10,7 @@ GameObject: - 4: {fileID: 453404} - 212: {fileID: 21253404} - 114: {fileID: 11453404} + - 114: {fileID: 11462190} m_Layer: 0 m_Name: Floor_3x3 m_TagString: Untagged @@ -42,7 +43,22 @@ MonoBehaviour: m_EditorClassIdentifier: _position: {x: 0, y: 0, z: 0} _size: {x: 3, y: 3, z: 0} - _alignment: 1 +--- !u!114 &11462190 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 153404} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b6f23cf97dc1d49d89a2556193c4f2e2, type: 3} + m_Name: + m_EditorClassIdentifier: + IsTrigger: 0 + IsKinematic: 1 + Interpolation: 0 + CollisionMode: 0 + PhysicMaterial: {fileID: 13400000, guid: 867b8c31d245f45d482bfe52123a0c6d, type: 2} --- !u!212 &21253404 SpriteRenderer: m_ObjectHideFlags: 1 @@ -52,15 +68,19 @@ SpriteRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 - m_LightmapIndex: 255 - m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} m_Materials: - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} m_SubsetIndices: m_StaticBatchRoot: {fileID: 0} m_UseLightProbes: 0 - m_LightProbeAnchor: {fileID: 0} + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: 03252686d19205e4d8a6ef5127d6f46d, type: 3} @@ -76,4 +96,3 @@ Prefab: m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 153404} m_IsPrefabParent: 1 - m_IsExploded: 1 diff --git a/Assets/IsoTools/Examples/Scenes/Scene5.unity b/Assets/IsoTools/Examples/Scenes/Scene5.unity index 195720d..b30839a 100644 --- a/Assets/IsoTools/Examples/Scenes/Scene5.unity +++ b/Assets/IsoTools/Examples/Scenes/Scene5.unity @@ -87,64 +87,6 @@ NavMeshSettings: cellSize: .166666672 manualCellSize: 0 m_NavMeshData: {fileID: 0} ---- !u!1001 &274776129 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalPosition.y - value: 16 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalPosition.z - value: 14.2857141 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: _position.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: _position.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: m_Name - value: Floor_3x4 - objectReference: {fileID: 0} - - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - propertyPath: _position.z - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - m_IsPrefabParent: 0 --- !u!1 &318480492 GameObject: m_ObjectHideFlags: 0 @@ -225,11 +167,11 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 318480492} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalPosition: {x: 0, y: 53.7000008, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 5 --- !u!114 &318480498 MonoBehaviour: m_ObjectHideFlags: 0 @@ -242,9 +184,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _tileSize: 16 - _minDepth: 0 - _maxDepth: 100 ---- !u!1001 &375090642 +--- !u!1001 &485514980 Prefab: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -253,15 +193,15 @@ Prefab: m_Modifications: - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.x - value: -32 + value: -48 objectReference: {fileID: 0} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.y - value: 16 + value: 72 objectReference: {fileID: 0} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.z - value: 57.1428566 + value: 0 objectReference: {fileID: 0} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalRotation.x @@ -285,310 +225,252 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: _position.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.y - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_Name - value: Cube_1x1x3 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _alignment - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - m_IsPrefabParent: 0 ---- !u!1001 &409886624 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.y - value: 32 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.z - value: 71.4285736 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_RootOrder value: 3 objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.x - value: 2 - objectReference: {fileID: 0} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: _position.y - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _alignment - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_Name - value: Cube_1x1x4 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - m_IsPrefabParent: 0 ---- !u!1001 &1197576131 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.y - value: 16 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_Name - value: Cube_1x1x5 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.z - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - m_IsPrefabParent: 0 ---- !u!1001 &1454547313 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.z - value: 28.5714283 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_Name - value: Cube_1x1x2 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - m_IsPrefabParent: 0 ---- !u!1001 &1818595414 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.x - value: 32 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.y - value: 16 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalPosition.z - value: 42.8571434 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: m_RootOrder value: 6 objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.x - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _alignment + - target: {fileID: 11422542, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} + propertyPath: IsKinematic value: 1 objectReference: {fileID: 0} - - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - propertyPath: _position.z - value: 0 - objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} m_IsPrefabParent: 0 ---- !u!1001 &2146784705 +--- !u!1001 &645158917 Prefab: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalPosition.z - value: 85.7142868 + value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: m_RootOrder - value: 2 + value: 0 objectReference: {fileID: 0} - - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 11453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: _position.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + - target: {fileID: 11453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} propertyPath: _position.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 11416990, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: IsKinematic + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 153620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_Name + value: Cube_1x3x2 + objectReference: {fileID: 0} + - target: {fileID: 21253620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_SortingOrder + value: -2 + objectReference: {fileID: 0} m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + m_ParentPrefab: {fileID: 100100000, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + m_IsPrefabParent: 0 +--- !u!1001 &1506134427 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.x + value: .841789246 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.y + value: -10.5253239 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 11462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: _position.x + value: -.605221629 + objectReference: {fileID: 0} + - target: {fileID: 11462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: _position.y + value: -.657833457 + objectReference: {fileID: 0} + - target: {fileID: 11462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: _position.z + value: -.0263051987 + objectReference: {fileID: 0} + - target: {fileID: 162204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_Name + value: Cube_3x1x3 + objectReference: {fileID: 0} + - target: {fileID: 21262204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_SortingOrder + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + m_IsPrefabParent: 0 +--- !u!1001 &1517863249 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalPosition.y + value: 64 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: m_RootOrder + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 11453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: _position.x + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 11453620, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: _position.y + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 11416990, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + propertyPath: IsKinematic + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: dbd21aa1b9a2cdf4a944f50e64d145a1, type: 2} + m_IsPrefabParent: 0 +--- !u!1001 &1919115803 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.x + value: -80 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.y + value: 72 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 11462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: _position.x + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 11462204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: _position.y + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 162204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_Name + value: Cube_3x1x2 + objectReference: {fileID: 0} + - target: {fileID: 21262204, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} + propertyPath: m_SortingOrder + value: -2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: fb3806e9ed7ada045b1b57419ac1ee53, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/IsoTools/Scripts/IsoObject.cs b/Assets/IsoTools/Scripts/IsoObject.cs index 340f369..adc31ac 100644 --- a/Assets/IsoTools/Scripts/IsoObject.cs +++ b/Assets/IsoTools/Scripts/IsoObject.cs @@ -6,6 +6,7 @@ using UnityEditor; namespace IsoTools { [ExecuteInEditMode] + [RequireComponent(typeof(SpriteRenderer))] public class IsoObject : MonoBehaviour { #if UNITY_EDITOR @@ -17,24 +18,6 @@ namespace IsoTools { [SerializeField] Vector3 _position = Vector3.zero; - /// Isometric object position X. - public float PositionX { - get { return Position.x; } - set { Position = IsoUtils.Vec3ChangeX(Position, value); } - } - - /// Isometric object position Y. - public float PositionY { - get { return Position.y; } - set { Position = IsoUtils.Vec3ChangeY(Position, value); } - } - - /// Isometric object position Z. - public float PositionZ { - get { return Position.z; } - set { Position = IsoUtils.Vec3ChangeZ(Position, value); } - } - /// Isometric object position. public Vector3 Position { get { return _position; } @@ -44,9 +27,51 @@ namespace IsoTools { } } + /// Isometric object position X. + public float PositionX { + get { return Position.x; } + set { Position = IsoUtils.Vec3ChangeX(Position, value); } + } + + /// Isometric object position Y. + public float PositionY { + get { return Position.y; } + set { Position = IsoUtils.Vec3ChangeY(Position, value); } + } + + /// Isometric object position Z. + public float PositionZ { + get { return Position.z; } + set { Position = IsoUtils.Vec3ChangeZ(Position, value); } + } + + /// Isometric object position XY. + public Vector2 PositionXY { + get { return new Vector2(PositionX, PositionY); } + } + + /// Isometric object position YZ. + public Vector2 PositionYZ { + get { return new Vector2(PositionY, PositionZ); } + } + + /// Isometric object position XZ. + public Vector2 PositionXZ { + get { return new Vector2(PositionX, PositionZ); } + } + [SerializeField] Vector3 _size = Vector3.one; + /// Isometric object size. + public Vector3 Size { + get { return _size; } + set { + _size = IsoUtils.Vec3Max(value, Vector3.zero); + FixTransform(); + } + } + /// Isometric object size X. public float SizeX { get { return Size.x; } @@ -65,27 +90,60 @@ namespace IsoTools { set { Size = IsoUtils.Vec3ChangeZ(Size, value); } } - /// Isometric object size. - public Vector3 Size { - get { return _size; } - set { - _size = IsoUtils.Vec3Max(value, Vector3.zero); - FixTransform(); - } + /// Isometric object size XY. + public Vector2 SizeXY { + get { return new Vector2(SizeX, SizeY); } + } + + /// Isometric object size YZ. + public Vector2 SizeYZ { + get { return new Vector2(SizeY, SizeZ); } + } + + /// Isometric object size XZ. + public Vector2 SizeXZ { + get { return new Vector2(SizeX, SizeZ); } } - [SerializeField] /// Isometric object tile position. public Vector3 TilePosition { - get { - return new Vector3( - Mathf.Round(Position.x), - Mathf.Round(Position.y), - Mathf.Round(Position.z)); - } + get { return IsoUtils.Vec3Round(Position); } set { Position = value; } } + /// Isometric object tile position X. + public float TilePositionX { + get { return TilePosition.x; } + set { TilePosition = IsoUtils.Vec3ChangeX(TilePosition, value); } + } + + /// Isometric object tile position Y. + public float TilePositionY { + get { return TilePosition.y; } + set { TilePosition = IsoUtils.Vec3ChangeY(TilePosition, value); } + } + + /// Isometric object tile position Z. + public float TilePositionZ { + get { return TilePosition.z; } + set { TilePosition = IsoUtils.Vec3ChangeZ(TilePosition, value); } + } + + /// Isometric object tile position XY. + public Vector2 TilePositionXY { + get { return new Vector2(TilePositionX, TilePositionY); } + } + + /// Isometric object tile position YZ. + public Vector2 TilePositionYZ { + get { return new Vector2(TilePositionY, TilePositionZ); } + } + + /// Isometric object tile position XZ. + public Vector2 TilePositionXZ { + get { return new Vector2(TilePositionX, TilePositionZ); } + } + IsoWorld _iso_world = null; public IsoWorld IsoWorld { get { @@ -104,24 +162,25 @@ namespace IsoTools { } public void FixTransform() { - Vector3 trans = IsoWorld.IsoToScreen(Position); - trans.z = transform.position.z; - transform.position = trans; + transform.position = IsoUtils.Vec3ChangeZ( + IsoWorld.IsoToScreen(Position), + transform.position.z); FixLastProperties(); MartDirtyIsoWorld(); MarkEditorObjectDirty(); } public void FixIsoPosition() { - Vector2 trans = transform.position; - Position = IsoWorld.ScreenToIso(trans, Position.z); + Position = IsoWorld.ScreenToIso( + transform.position, + PositionZ); } void FixLastProperties() { #if UNITY_EDITOR _lastTransform = transform.position; - _lastPosition = Position; - _lastSize = Size; + _lastPosition = Position; + _lastSize = Size; #endif } @@ -153,9 +212,7 @@ namespace IsoTools { #if UNITY_EDITOR void Update() { if ( Application.isEditor ) { - if ( !Mathf.Approximately(_lastTransform.x, transform.position.x) || - !Mathf.Approximately(_lastTransform.y, transform.position.y)) - { + if ( !IsoUtils.Vec2Approximately(_lastTransform, transform.position) ) { FixIsoPosition(); } if ( _lastPosition != _position ) Position = _position; diff --git a/Assets/IsoTools/Scripts/IsoRigidbody.cs b/Assets/IsoTools/Scripts/IsoRigidbody.cs new file mode 100644 index 0000000..7dbcd8f --- /dev/null +++ b/Assets/IsoTools/Scripts/IsoRigidbody.cs @@ -0,0 +1,55 @@ +using UnityEngine; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace IsoTools { + [RequireComponent(typeof(IsoObject))] + public class IsoRigidbody : MonoBehaviour { + + public bool IsTrigger = false; + public bool IsKinematic = false; + public RigidbodyInterpolation Interpolation = RigidbodyInterpolation.None; + public CollisionDetectionMode CollisionMode = CollisionDetectionMode.Discrete; + public PhysicMaterial PhysicMaterial = null; + + IsoObject _iso_object = null; + GameObject _fake_object = null; + Rigidbody _rigid_body = null; + BoxCollider _box_collider = null; + + public Rigidbody Rigidbody { + get { return _rigid_body; } + } + + void Awake() { + _iso_object = GetComponent(); + if ( !_iso_object ) { + throw new UnityException("IsoRigidbody. IsoObject not found!"); + } + _fake_object = new GameObject(); + _fake_object.name = "_Fake" + gameObject.name; + + _rigid_body = _fake_object.AddComponent(); + _rigid_body.freezeRotation = true; + _rigid_body.isKinematic = IsKinematic; + _rigid_body.interpolation = Interpolation; + _rigid_body.collisionDetectionMode = CollisionMode; + + _box_collider = _fake_object.AddComponent(); + _box_collider.center = IsoUtils.Vec3SwapYZ(_iso_object.Size / 2.0f); + _box_collider.size = IsoUtils.Vec3SwapYZ(_iso_object.Size); + _box_collider.isTrigger = IsTrigger; + _box_collider.material = PhysicMaterial; + + _fake_object.transform.position = IsoUtils.Vec3SwapYZ(_iso_object.Position); + } + + void FixedUpdate() { + if ( _iso_object ) { + _iso_object.Position = IsoUtils.Vec3SwapYZ(_fake_object.transform.position); + } + } + } +} // namespace IsoTools \ No newline at end of file diff --git a/Assets/IsoTools/Scripts/IsoRigidbody.cs.meta b/Assets/IsoTools/Scripts/IsoRigidbody.cs.meta new file mode 100644 index 0000000..aa88282 --- /dev/null +++ b/Assets/IsoTools/Scripts/IsoRigidbody.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b6f23cf97dc1d49d89a2556193c4f2e2 +timeCreated: 1431879880 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/Scripts/IsoUtils.cs b/Assets/IsoTools/Scripts/IsoUtils.cs index be6cb5c..cd7b385 100644 --- a/Assets/IsoTools/Scripts/IsoUtils.cs +++ b/Assets/IsoTools/Scripts/IsoUtils.cs @@ -2,66 +2,63 @@ using System; namespace IsoTools { - public class IsoUtils { - public static Vector3 Vec2OneX { - get { return new Vector2(1.0f, 0.0f); } - } + public static class IsoUtils { - public static Vector3 Vec2OneY { - get { return new Vector2(0.0f, 1.0f); } - } + // ------------------------------------------------------------------------ + // + // Consts + // + // ------------------------------------------------------------------------ - public static Vector3 Vec3OneX { - get { return new Vector3(1.0f, 0.0f, 0.0f); } - } + public static Vector3 Vec2OneX { get { return new Vector2(1.0f, 0.0f); } } + public static Vector3 Vec2OneY { get { return new Vector2(0.0f, 1.0f); } } + public static Vector3 Vec2OneXY { get { return new Vector2(1.0f, 1.0f); } } - public static Vector3 Vec3OneY { - get { return new Vector3(0.0f, 1.0f, 0.0f); } - } + public static Vector3 Vec3OneX { get { return new Vector3(1.0f, 0.0f, 0.0f); } } + public static Vector3 Vec3OneY { get { return new Vector3(0.0f, 1.0f, 0.0f); } } + public static Vector3 Vec3OneZ { get { return new Vector3(0.0f, 0.0f, 1.0f); } } + public static Vector3 Vec3OneXY { get { return new Vector3(1.0f, 1.0f, 0.0f); } } + public static Vector3 Vec3OneYZ { get { return new Vector3(0.0f, 1.0f, 1.0f); } } + public static Vector3 Vec3OneXZ { get { return new Vector3(1.0f, 0.0f, 1.0f); } } - public static Vector3 Vec3OneZ { - get { return new Vector3(0.0f, 0.0f, 1.0f); } - } + // ------------------------------------------------------------------------ + // + // Swap + // + // ------------------------------------------------------------------------ - public static Vector2 Vec2FromX(float x) { - return new Vector2(x, 0.0f); + public static Vector2 Vec2SwapXY(Vector2 v) { + return new Vector2(v.y, v.x); } - public static Vector2 Vec2FromY(float y) { - return new Vector2(0.0f, y); + public static Vector3 Vec3SwapXY(Vector3 v) { + return new Vector3(v.y, v.x, v.z); + } + + public static Vector3 Vec3SwapYZ(Vector3 v) { + return new Vector3(v.x, v.z, v.y); + } + + public static Vector3 Vec3SwapXZ(Vector3 v) { + return new Vector3(v.z, v.y, v.x); } - public static Vector3 Vec3FromX(float x) { - return new Vector3(x, 0.0f, 0.0f); + // ------------------------------------------------------------------------ + // + // Abs/Min/Max + // + // ------------------------------------------------------------------------ + + public static Vector2 Vec2Abs(Vector2 v) { + return new Vector2( + Mathf.Abs(v.x), + Mathf.Abs(v.y)); } - public static Vector3 Vec3FromY(float y) { - return new Vector3(0.0f, y, 0.0f); - } - - public static Vector3 Vec3FromZ(float z) { - return new Vector3(0.0f, 0.0f, z); - } - - public static int Sign(float v) { - return v > 0.0f ? 1 : (v == 0.0f ? 0 : -1); - } - - public static void LookUpCube(Vector3 min, Vector3 max, Action act) { - for ( var z = min.z; z < max.z; ++z ) { - for ( var y = min.y; y < max.y; ++y ) { - for ( var x = min.x; x < max.x; ++x ) { - act(new Vector3(x, y, z)); - } - } - } - } - - public static bool Vec3Approximately(Vector3 a, Vector3 b) { - return - Mathf.Approximately(a.x, b.x) && - Mathf.Approximately(a.y, b.y) && - Mathf.Approximately(a.z, b.z); + public static Vector2 Vec2Min(Vector2 a, Vector2 b) { + return new Vector2( + Mathf.Min(a.x, b.x), + Mathf.Min(a.y, b.y)); } public static Vector3 Vec3Abs(Vector3 v) { @@ -71,20 +68,46 @@ namespace IsoTools { Mathf.Abs(v.z)); } + public static Vector3 Vec3Min(Vector3 a, Vector3 b) { + return new Vector3( + Mathf.Min(a.x, b.x), + Mathf.Min(a.y, b.y), + Mathf.Min(a.z, b.z)); + } + + public static Vector2 Vec2Max(Vector2 a, Vector2 b) { + return new Vector2( + Mathf.Max(a.x, b.x), + Mathf.Max(a.y, b.y)); + } + + public static Vector3 Vec3Max(Vector3 a, Vector3 b) { + return new Vector3( + Mathf.Max(a.x, b.x), + Mathf.Max(a.y, b.y), + Mathf.Max(a.z, b.z)); + } + + // ------------------------------------------------------------------------ + // + // Ceil/Floor/Round + // + // ------------------------------------------------------------------------ + public static Vector3 Vec3Ceil(Vector3 v) { return new Vector3( Mathf.Ceil(v.x), Mathf.Ceil(v.y), Mathf.Ceil(v.z)); } - + public static Vector3 Vec3Floor(Vector3 v) { return new Vector3( Mathf.Floor(v.x), Mathf.Floor(v.y), Mathf.Floor(v.z)); } - + public static Vector3 Vec3Round(Vector3 v) { return new Vector3( Mathf.Round(v.x), @@ -92,13 +115,19 @@ namespace IsoTools { Mathf.Round(v.z)); } + // ------------------------------------------------------------------------ + // + // Div/DivCeil/DivFloor/DivRound + // + // ------------------------------------------------------------------------ + public static Vector3 Vec3Div(Vector3 a, float b) { return new Vector3( a.x / b, a.y / b, a.z / b); } - + public static Vector3 Vec3Div(Vector3 a, Vector3 b) { return new Vector3( a.x / b.x, @@ -113,63 +142,134 @@ namespace IsoTools { public static Vector3 Vec3DivCeil(Vector3 a, Vector3 b) { return Vec3Ceil(Vec3Div(a, b)); } - + public static Vector3 Vec3DivFloor(Vector3 a, float b) { return Vec3Floor(Vec3Div(a, b)); } - + public static Vector3 Vec3DivFloor(Vector3 a, Vector3 b) { return Vec3Floor(Vec3Div(a, b)); } - + public static Vector3 Vec3DivRound(Vector3 a, float b) { return Vec3Round(Vec3Div(a, b)); } - + public static Vector3 Vec3DivRound(Vector3 a, Vector3 b) { return Vec3Round(Vec3Div(a, b)); } - - public static Vector3 Vec3Min(Vector3 a, Vector3 b) { - return new Vector3( - Mathf.Min(a.x, b.x), - Mathf.Min(a.y, b.y), - Mathf.Min(a.z, b.z)); + + // ------------------------------------------------------------------------ + // + // FromX + // + // ------------------------------------------------------------------------ + + public static Vector2 Vec2FromX(float x) { + return new Vector2(x, 0.0f); } - public static Vector3 Vec3Max(Vector3 a, Vector3 b) { - return new Vector3( - Mathf.Max(a.x, b.x), - Mathf.Max(a.y, b.y), - Mathf.Max(a.z, b.z)); + public static Vector2 Vec2FromY(float y) { + return new Vector2(0.0f, y); + } + + public static Vector2 Vec2FromXY(float x, float y) { + return new Vector2(x, y); + } + + public static Vector3 Vec3FromX(float x) { + return new Vector3(x, 0.0f, 0.0f); + } + + public static Vector3 Vec3FromY(float y) { + return new Vector3(0.0f, y, 0.0f); + } + + public static Vector3 Vec3FromZ(float z) { + return new Vector3(0.0f, 0.0f, z); + } + + public static Vector3 Vec3FromXY(float x, float y) { + return new Vector3(x, y, 0.0f); + } + + public static Vector3 Vec3FromYZ(float y, float z) { + return new Vector3(0.0f, y, z); + } + + public static Vector3 Vec3FromXZ(float x, float z) { + return new Vector3(x, 0.0f, z); } + // ------------------------------------------------------------------------ + // + // ChangeX + // + // ------------------------------------------------------------------------ + + public static Vector2 Vec2ChangeX(Vector2 v, float x) { + return new Vector2(x, v.y); + } + + public static Vector2 Vec2ChangeY(Vector2 v, float y) { + return new Vector2(v.x, y); + } + public static Vector3 Vec3ChangeX(Vector3 v, float x) { return new Vector3(x, v.y, v.z); } - + public static Vector3 Vec3ChangeY(Vector3 v, float y) { return new Vector3(v.x, y, v.z); } - + public static Vector3 Vec3ChangeZ(Vector3 v, float z) { return new Vector3(v.x, v.y, z); } - - public static Color ColorChangeR(Color c, float r) { - return new Color(r, c.g, c.b, c.a); + + public static Vector3 Vec3ChangeXY(Vector3 v, float x, float y) { + return new Vector3(x, y, v.z); + } + + public static Vector3 Vec3ChangeYZ(Vector3 v, float y, float z) { + return new Vector3(v.x, y, z); + } + + public static Vector3 Vec3ChangeXZ(Vector3 v, float x, float z) { + return new Vector3(x, v.y, z); } - public static Color ColorChangeG(Color c, float g) { - return new Color(c.r, g, c.b, c.a); + // ------------------------------------------------------------------------ + // + // Approximately + // + // ----------------------------------------------------------------------- + + public static bool Vec2Approximately(Vector2 a, Vector2 b) { + return + Mathf.Approximately(a.x, b.x) && + Mathf.Approximately(a.y, b.y); } - public static Color ColorChangeB(Color c, float b) { - return new Color(c.r, c.g, b, c.a); + public static bool Vec3Approximately(Vector3 a, Vector3 b) { + return + Mathf.Approximately(a.x, b.x) && + Mathf.Approximately(a.y, b.y) && + Mathf.Approximately(a.z, b.z); } - public static Color ColorChangeA(Color c, float a) { - return new Color(c.r, c.g, c.b, a); + // ------------------------------------------------------------------------ + // + // LookUpCube + // + // ------------------------------------------------------------------------ + + public static void LookUpCube(Vector3 min, Vector3 max, Action act) { + for ( var z = min.z; z < max.z; ++z ) { + for ( var y = min.y; y < max.y; ++y ) { + for ( var x = min.x; x < max.x; ++x ) { + act(new Vector3(x, y, z)); + }}} } } } \ No newline at end of file diff --git a/Assets/IsoTools/Scripts/IsoWorld.cs b/Assets/IsoTools/Scripts/IsoWorld.cs index 954353a..4d0c4dd 100644 --- a/Assets/IsoTools/Scripts/IsoWorld.cs +++ b/Assets/IsoTools/Scripts/IsoWorld.cs @@ -1,5 +1,6 @@ using UnityEngine; using System; +using System.Linq; using System.Collections.Generic; #if UNITY_EDITOR @@ -39,6 +40,7 @@ namespace IsoTools { } bool _dirty = true; + float _lastTileSize = 0.0f; List _sectors = new List(); List _objects = new List(); @@ -48,10 +50,6 @@ namespace IsoTools { Vector3 _objsMaxNumPos = Vector3.zero; Vector3 _objsNumPosCount = Vector3.zero; - float _lastTileSize = 0.0f; - float _lastMinDepth = 0.0f; - float _lastMaxDepth = 0.0f; - [SerializeField] public float _tileSize = 32.0f; /// Isometric tile size. @@ -62,28 +60,6 @@ namespace IsoTools { ChangeSortingProperty(); } } - - [SerializeField] - public float _minDepth = 0.0f; - /// Min sorting depth value. - public float MinDepth { - get { return _minDepth; } - set { - _minDepth = value; - ChangeSortingProperty(); - } - } - - [SerializeField] - public float _maxDepth = 100.0f; - /// Max sorting depth value. - public float MaxDepth { - get { return _maxDepth; } - set { - _maxDepth = value; - ChangeSortingProperty(); - } - } // ------------------------------------------------------------------------ /// @@ -103,7 +79,7 @@ namespace IsoTools { // ------------------------------------------------------------------------ public void MarkDirty(IsoObject obj) { if ( obj ) { - var renderer = obj.GetComponent(); + var renderer = obj.GetComponent(); if ( renderer && renderer.isVisible ) { MarkDirty(); } @@ -146,9 +122,9 @@ namespace IsoTools { /// 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; - return iso_pos; + return IsoUtils.Vec3ChangeZ( + ScreenToIso(new Vector2(pos.x, pos.y - iso_z * TileSize)), + iso_z); } void MarkEditorWorldDirty() { @@ -174,8 +150,6 @@ namespace IsoTools { MarkDirty(); FixAllTransforms(); _lastTileSize = TileSize; - _lastMinDepth = MinDepth; - _lastMaxDepth = MaxDepth; } int SectorIndex(Vector3 num_pos) { @@ -206,7 +180,6 @@ namespace IsoTools { var ms = FindSector(num_pos); if ( ms != null ) { act(ms); - var s1 = FindSector(num_pos + new Vector3(-1, 0, 0)); var s2 = FindSector(num_pos + new Vector3( 0, -1, 0)); var s3 = FindSector(num_pos + new Vector3(-1, -1, 0)); @@ -235,14 +208,44 @@ namespace IsoTools { bool IsDepends(Vector3 a_min, Vector3 a_size, Vector3 b_min, Vector3 b_size) { var a_max = a_min + a_size; var b_max = b_min + b_size; - return a_max.x > b_min.x && a_max.y > b_min.y && b_max.z > a_min.z; + var a_yesno = a_max.x > b_min.x && a_max.y > b_min.y && b_max.z > a_min.z; + var b_yesno = b_max.x > a_min.x && b_max.y > a_min.y && a_max.z > b_min.z; + if ( a_yesno && b_yesno ) { + var da_p = new Vector3(a_max.x - b_min.x, a_max.y - b_min.y, a_max.z - b_min.z); + var db_p = new Vector3(b_max.x - a_min.x, b_max.y - a_min.y, b_max.z - a_min.z); + var dd_p = IsoUtils.Vec3Abs(da_p - db_p); + + Debug.LogFormat("CoefDB: {0}:::{1}:::{2}", dd_p.x, dd_p.y, dd_p.z); + Debug.LogFormat("----------------------------"); + + if ( dd_p.z > dd_p.x || dd_p.z > dd_p.y ) { + Debug.Log("by z"); + return da_p.z < db_p.z; + } else if ( dd_p.x > dd_p.y && dd_p.x > dd_p.z ) { + Debug.Log("by x"); + return da_p.x > db_p.x; + } else if ( dd_p.y > dd_p.x && dd_p.y > dd_p.z) { + Debug.Log("by y"); + return da_p.y > db_p.y; + } + + /* + if ( dd_p.x < dd_p.y ) { + Debug.Log("by y"); + return da_p.y > db_p.y; + } else { + Debug.Log("by x"); + return da_p.x > db_p.x; + }*/ + } + return a_yesno; } void SetupSectorSize(IsoObject[] iso_objects) { _objsSectorSize = 0.0f; var objsSum = 0; foreach ( var obj in iso_objects ) { - var renderer = obj.GetComponent(); + var renderer = obj.GetComponent(); if ( renderer && renderer.isVisible ) { ++objsSum; _objsSectorSize += Mathf.Max(obj.Size.x, obj.Size.y, obj.Size.z); @@ -256,7 +259,7 @@ namespace IsoTools { _objsMinNumPos = Vector3.zero; _objsMaxNumPos = Vector3.one; foreach ( var obj in iso_objects ) { - var renderer = obj.GetComponent(); + var renderer = obj.GetComponent(); if ( renderer && renderer.isVisible ) { var max_size = IsoUtils.Vec3Max(Vector3.one, obj.Size); var min_npos = IsoUtils.Vec3DivFloor(obj.Position, _objsSectorSize); @@ -307,7 +310,7 @@ namespace IsoTools { } void PlaceAllObjects() { - var depth = MinDepth; + var depth = 0; foreach ( var info in _objects ) { depth = PlaceObject(info, depth); } @@ -316,12 +319,16 @@ namespace IsoTools { _depends.Clear(); } - void PlaceObject(IsoObject obj, float depth) { - var trans = obj.gameObject.transform; - trans.position = new Vector3(trans.position.x, trans.position.y, depth); + void PlaceObject(IsoObject obj, int depth) { + //var trans = obj.gameObject.transform; + //trans.position = new Vector3(trans.position.x, trans.position.y, depth); + var renderer = obj.GetComponent(); + if ( renderer ) { + renderer.sortingOrder = depth; + } } - float PlaceObject(ObjectInfo info, float depth) { + int PlaceObject(ObjectInfo info, int depth) { if ( info.Visited ) { return depth; } @@ -332,7 +339,7 @@ namespace IsoTools { depth = PlaceObject(obj, depth); } PlaceObject(info.IsoObject, depth); - return depth + (MaxDepth - MinDepth) / _objects.Count; + return depth - 1; } void StepSort() { @@ -355,8 +362,6 @@ namespace IsoTools { void LateUpdate() { if ( Application.isEditor ) { if ( !Mathf.Approximately(_lastTileSize, _tileSize) ) TileSize = _tileSize; - if ( !Mathf.Approximately(_lastMinDepth, _minDepth) ) MinDepth = _minDepth; - if ( !Mathf.Approximately(_lastMaxDepth, _maxDepth) ) MaxDepth = _maxDepth; } StepSort(); } diff --git a/UnityIso-csharp.sln b/UnityIso-csharp.sln index 9049961..d4dd7a8 100644 --- a/UnityIso-csharp.sln +++ b/UnityIso-csharp.sln @@ -23,7 +23,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 d158333..8f2fc19 100644 --- a/UnityIso.sln +++ b/UnityIso.sln @@ -23,7 +23,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 c63945d..716902c 100644 --- a/UnityIso.userprefs +++ b/UnityIso.userprefs @@ -1,8 +1,17 @@  - + - + + + + + + + + + +