mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
fix alignment. fix child renderer. physics wip
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_5_0_1;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;UNITY_5_0_2;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn>0169</NoWarn>
|
<NoWarn>0169</NoWarn>
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Assets\IsoTools\Editor\IsoEditorWindow.cs" />
|
|
||||||
<Compile Include="Assets\IsoTools\Editor\IsoObjectEditor.cs" />
|
<Compile Include="Assets\IsoTools\Editor\IsoObjectEditor.cs" />
|
||||||
<Reference Include="UnityEngine.UI">
|
<Reference Include="UnityEngine.UI">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||||
@@ -66,6 +65,9 @@
|
|||||||
<Reference Include="UnityEditor.BB10.Extensions">
|
<Reference Include="UnityEditor.BB10.Extensions">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEditor.SamsungTV.Extensions">
|
||||||
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/STVPlayer/STVPlayer/UnityEditor.SamsungTV.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="UnityEditor.WebGL.Extensions">
|
<Reference Include="UnityEditor.WebGL.Extensions">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_5_0_1;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;UNITY_5_0_2;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn>0169</NoWarn>
|
<NoWarn>0169</NoWarn>
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Assets\IsoTools\Editor\IsoEditorWindow.cs" />
|
|
||||||
<Compile Include="Assets\IsoTools\Editor\IsoObjectEditor.cs" />
|
<Compile Include="Assets\IsoTools\Editor\IsoObjectEditor.cs" />
|
||||||
<Reference Include="UnityEngine.UI">
|
<Reference Include="UnityEngine.UI">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||||
@@ -66,6 +65,9 @@
|
|||||||
<Reference Include="UnityEditor.BB10.Extensions">
|
<Reference Include="UnityEditor.BB10.Extensions">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEditor.SamsungTV.Extensions">
|
||||||
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/STVPlayer/STVPlayer/UnityEditor.SamsungTV.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="UnityEditor.WebGL.Extensions">
|
<Reference Include="UnityEditor.WebGL.Extensions">
|
||||||
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
|
<HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_5_0_1;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;UNITY_5_0_2;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn>0169</NoWarn>
|
<NoWarn>0169</NoWarn>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_5_0_1;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;UNITY_5_0_2;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn>0169</NoWarn>
|
<NoWarn>0169</NoWarn>
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace IsoTools {
|
|
||||||
public class IsoEditorWindow : EditorWindow {
|
|
||||||
|
|
||||||
public static bool Alignment { get; private set; }
|
|
||||||
public static bool ShowBounds { get; private set; }
|
|
||||||
|
|
||||||
static string _alignmentPropName = "IsoTools.IsoEditorWindow.Alignment";
|
|
||||||
static string _showBoundsPropName = "IsoTools.IsoEditorWindow.ShowBounds";
|
|
||||||
|
|
||||||
void AlignmentSelection() {
|
|
||||||
var iso_objects = Selection.gameObjects
|
|
||||||
.Where(p => p.GetComponent<IsoObject>())
|
|
||||||
.Select(p => p.GetComponent<IsoObject>());
|
|
||||||
foreach ( var iso_object in iso_objects ) {
|
|
||||||
iso_object.Position = iso_object.TilePosition;
|
|
||||||
iso_object.FixTransform();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MenuItem("IsoTools/IsoEditor")]
|
|
||||||
static void Init() {
|
|
||||||
var window = EditorWindow.GetWindow<IsoEditorWindow>();
|
|
||||||
window.title = "IsoEditor";
|
|
||||||
window.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnGUI() {
|
|
||||||
GUILayout.Space(5);
|
|
||||||
ShowBounds = EditorGUILayout.Toggle("Show bounds", ShowBounds);
|
|
||||||
Alignment = EditorGUILayout.Toggle("Auto alignment", Alignment);
|
|
||||||
if ( GUILayout.Button("Alignment selection objects") || Alignment ) {
|
|
||||||
AlignmentSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnFocus() {
|
|
||||||
if ( EditorPrefs.HasKey(_alignmentPropName) ) {
|
|
||||||
Alignment = EditorPrefs.GetBool(_alignmentPropName);
|
|
||||||
}
|
|
||||||
if ( EditorPrefs.HasKey(_showBoundsPropName) ) {
|
|
||||||
ShowBounds = EditorPrefs.GetBool(_showBoundsPropName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLostFocus() {
|
|
||||||
EditorPrefs.SetBool(_alignmentPropName, Alignment);
|
|
||||||
EditorPrefs.SetBool(_showBoundsPropName, ShowBounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDestroy() {
|
|
||||||
EditorPrefs.SetBool(_alignmentPropName, Alignment);
|
|
||||||
EditorPrefs.SetBool(_showBoundsPropName, ShowBounds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bc6645583f19a4c99b26459ef98d0d9c
|
|
||||||
timeCreated: 1431871954
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -26,21 +26,33 @@ namespace IsoTools {
|
|||||||
}) / _positions.Count;
|
}) / _positions.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlignmentIsoObject(IsoObject iso_object) {
|
bool IsAnyAlignment {
|
||||||
if ( IsoEditorWindow.Alignment ) {
|
get { return _positions.Keys.Any(p => p.Alignment); }
|
||||||
iso_object.Position = iso_object.TilePosition;
|
}
|
||||||
iso_object.FixTransform();
|
|
||||||
|
void AlignmentSelection() {
|
||||||
|
foreach ( var iso_object in _positions.Keys ) {
|
||||||
|
AlignmentIsoObject(iso_object);
|
||||||
}
|
}
|
||||||
|
GrabPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AlignmentIsoObject(IsoObject iso_object) {
|
||||||
|
iso_object.Position = iso_object.TilePosition;
|
||||||
|
iso_object.FixTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
float ZMoveIsoObjects(float delta) {
|
float ZMoveIsoObjects(float delta) {
|
||||||
Undo.RecordObjects(_iso_zpositions.Keys.ToArray(), "Move");
|
Undo.RecordObjects(_iso_zpositions.Keys.ToArray(), "Move");
|
||||||
|
var is_any_alignment = IsAnyAlignment;
|
||||||
return _iso_zpositions.Aggregate(0.0f, (AccIn, pair) => {
|
return _iso_zpositions.Aggregate(0.0f, (AccIn, pair) => {
|
||||||
var iso_object = pair.Key;
|
var iso_object = pair.Key;
|
||||||
var iso_orig_z = pair.Value;
|
var iso_orig_z = pair.Value;
|
||||||
iso_object.PositionZ = iso_orig_z + delta;
|
iso_object.PositionZ = iso_orig_z + delta;
|
||||||
iso_object.FixTransform();
|
iso_object.FixTransform();
|
||||||
AlignmentIsoObject(iso_object);
|
if ( is_any_alignment ) {
|
||||||
|
AlignmentIsoObject(iso_object);
|
||||||
|
}
|
||||||
var z_delta = iso_object.Position.z - iso_orig_z;
|
var z_delta = iso_object.Position.z - iso_orig_z;
|
||||||
return Mathf.Abs(z_delta) > Mathf.Abs(AccIn) ? z_delta : AccIn;
|
return Mathf.Abs(z_delta) > Mathf.Abs(AccIn) ? z_delta : AccIn;
|
||||||
});
|
});
|
||||||
@@ -48,12 +60,15 @@ namespace IsoTools {
|
|||||||
|
|
||||||
Vector3 XYMoveIsoObjects(Vector3 delta) {
|
Vector3 XYMoveIsoObjects(Vector3 delta) {
|
||||||
Undo.RecordObjects(_positions.Keys.ToArray(), "Move");
|
Undo.RecordObjects(_positions.Keys.ToArray(), "Move");
|
||||||
|
var is_any_alignment = IsAnyAlignment;
|
||||||
return _positions.Aggregate(Vector3.zero, (AccIn, pair) => {
|
return _positions.Aggregate(Vector3.zero, (AccIn, pair) => {
|
||||||
var iso_object = pair.Key;
|
var iso_object = pair.Key;
|
||||||
var iso_orig_p = pair.Value;
|
var iso_orig_p = pair.Value;
|
||||||
iso_object.transform.position = iso_orig_p + delta;
|
iso_object.transform.position = iso_orig_p + delta;
|
||||||
iso_object.FixIsoPosition();
|
iso_object.FixIsoPosition();
|
||||||
AlignmentIsoObject(iso_object);
|
if ( is_any_alignment ) {
|
||||||
|
AlignmentIsoObject(iso_object);
|
||||||
|
}
|
||||||
var pos_delta = iso_object.transform.position - iso_orig_p;
|
var pos_delta = iso_object.transform.position - iso_orig_p;
|
||||||
return pos_delta.magnitude > AccIn.magnitude ? pos_delta : AccIn;
|
return pos_delta.magnitude > AccIn.magnitude ? pos_delta : AccIn;
|
||||||
});
|
});
|
||||||
@@ -111,47 +126,6 @@ namespace IsoTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTop(Vector3 pos, Vector3 size) {
|
|
||||||
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
|
|
||||||
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<IsoWorld>();
|
|
||||||
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 DrawTargetBounds() {
|
|
||||||
if ( IsoEditorWindow.ShowBounds ) {
|
|
||||||
var iso_object = target as IsoObject;
|
|
||||||
if ( iso_object ) {
|
|
||||||
DrawCube(iso_object.Position, iso_object.Size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEnable() {
|
void OnEnable() {
|
||||||
GrabPositions();
|
GrabPositions();
|
||||||
}
|
}
|
||||||
@@ -170,12 +144,14 @@ namespace IsoTools {
|
|||||||
} else {
|
} else {
|
||||||
Tools.hidden = false;
|
Tools.hidden = false;
|
||||||
}
|
}
|
||||||
DrawTargetBounds();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
public override void OnInspectorGUI() {
|
||||||
DrawDefaultInspector();
|
DrawDefaultInspector();
|
||||||
GrabPositions();
|
GrabPositions();
|
||||||
|
if ( GUILayout.Button("Alignment selection") ) {
|
||||||
|
AlignmentSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace IsoTools
|
} // namespace IsoTools
|
||||||
@@ -8,7 +8,7 @@ PhysicMaterial:
|
|||||||
m_Name: BoxPhysicMaterial
|
m_Name: BoxPhysicMaterial
|
||||||
dynamicFriction: .600000024
|
dynamicFriction: .600000024
|
||||||
staticFriction: .600000024
|
staticFriction: .600000024
|
||||||
bounciness: .400000006
|
bounciness: .800000012
|
||||||
frictionCombine: 0
|
frictionCombine: 0
|
||||||
bounceCombine: 0
|
bounceCombine: 0
|
||||||
frictionDirection2: {x: 0, y: 0, z: 0}
|
frictionDirection2: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 37.5
|
value: 50
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -308,7 +308,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 87.5
|
value: 90
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -390,7 +390,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 75
|
value: 80
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -472,7 +472,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 62.5
|
value: 70
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -550,7 +550,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 50
|
value: 60
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -738,7 +738,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 25
|
value: 40
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -832,7 +832,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 22.2222214
|
value: 30
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -926,7 +926,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 0
|
value: 20
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -946,7 +946,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
|
||||||
propertyPath: _position.x
|
propertyPath: _position.x
|
||||||
@@ -1020,7 +1020,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 12.5
|
value: 10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,12 +8,6 @@ namespace IsoTools {
|
|||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
public class IsoObject : MonoBehaviour {
|
public class IsoObject : MonoBehaviour {
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
Vector3 _lastSize = Vector3.zero;
|
|
||||||
Vector3 _lastPosition = Vector3.zero;
|
|
||||||
Vector2 _lastTransform = Vector2.zero;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Size
|
// Size
|
||||||
@@ -161,6 +155,29 @@ namespace IsoTools {
|
|||||||
get { return new Vector2(TilePositionX, TilePositionZ); }
|
get { return new Vector2(TilePositionX, TilePositionZ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// For editor
|
||||||
|
//
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
Vector3 _lastSize = Vector3.zero;
|
||||||
|
Vector3 _lastPosition = Vector3.zero;
|
||||||
|
Vector2 _lastTransform = Vector2.zero;
|
||||||
|
|
||||||
|
[SerializeField] bool _alignment = true;
|
||||||
|
[SerializeField] bool _showBounds = false;
|
||||||
|
|
||||||
|
public bool Alignment {
|
||||||
|
get { return _alignment; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShowBounds {
|
||||||
|
get { return _showBounds; }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Functions
|
// Functions
|
||||||
@@ -185,6 +202,11 @@ namespace IsoTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void FixTransform() {
|
public void FixTransform() {
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if ( Application.isEditor && !Application.isPlaying && Alignment ) {
|
||||||
|
_position = TilePosition;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
transform.position = IsoUtils.Vec3ChangeZ(
|
transform.position = IsoUtils.Vec3ChangeZ(
|
||||||
IsoWorld.IsoToScreen(Position),
|
IsoWorld.IsoToScreen(Position),
|
||||||
transform.position.z);
|
transform.position.z);
|
||||||
@@ -228,22 +250,23 @@ namespace IsoTools {
|
|||||||
MartDirtyIsoWorld();
|
MartDirtyIsoWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: now working for child sprites
|
#if UNITY_EDITOR
|
||||||
void OnBecameVisible() {
|
void OnDrawGizmos() {
|
||||||
MartDirtyIsoWorld();
|
if ( ShowBounds ) {
|
||||||
|
IsoUtils.DrawCube(Position, Size, Color.red);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if ( Application.isEditor ) {
|
if ( Application.isEditor ) {
|
||||||
if ( !IsoUtils.Vec2Approximately(_lastTransform, transform.position) ) {
|
if ( !IsoUtils.Vec3Approximately(_lastSize, _size) ) {
|
||||||
FixIsoPosition();
|
Size = _size;
|
||||||
}
|
}
|
||||||
if ( !IsoUtils.Vec3Approximately(_lastPosition, _position) ) {
|
if ( !IsoUtils.Vec3Approximately(_lastPosition, _position) ) {
|
||||||
Position = _position;
|
Position = _position;
|
||||||
}
|
}
|
||||||
if ( !IsoUtils.Vec3Approximately(_lastSize, _size) ) {
|
if ( !IsoUtils.Vec2Approximately(_lastTransform, transform.position) ) {
|
||||||
Size = _size;
|
FixIsoPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace IsoTools {
|
|||||||
void Awake() {
|
void Awake() {
|
||||||
_fakeObject = new GameObject();
|
_fakeObject = new GameObject();
|
||||||
FakeGameObject.name = "_Fake" + gameObject.name;
|
FakeGameObject.name = "_Fake" + gameObject.name;
|
||||||
FakeGameObject.hideFlags = HideFlags.HideInHierarchy;
|
//FakeGameObject.hideFlags = HideFlags.HideInHierarchy;
|
||||||
|
|
||||||
var rigidbody = FakeGameObject.AddComponent<Rigidbody>();
|
var rigidbody = FakeGameObject.AddComponent<Rigidbody>();
|
||||||
rigidbody.freezeRotation = true;
|
rigidbody.freezeRotation = true;
|
||||||
@@ -82,7 +82,7 @@ namespace IsoTools {
|
|||||||
rigidbody.collisionDetectionMode = CollisionMode;
|
rigidbody.collisionDetectionMode = CollisionMode;
|
||||||
|
|
||||||
AddBoxCollider();
|
AddBoxCollider();
|
||||||
AddHelperSpheres();
|
//AddHelperSpheres();
|
||||||
|
|
||||||
_lastPosition = IsoObject.Position;
|
_lastPosition = IsoObject.Position;
|
||||||
FakeGameObject.transform.position = IsoObject.Position;
|
FakeGameObject.transform.position = IsoObject.Position;
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ using System;
|
|||||||
namespace IsoTools {
|
namespace IsoTools {
|
||||||
public static class IsoUtils {
|
public static class IsoUtils {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Consts
|
// Consts
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
public static Vector3 Vec2OneX { get { return new Vector2(1.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 Vec2OneY { get { return new Vector2(0.0f, 1.0f); } }
|
||||||
@@ -21,24 +21,22 @@ namespace IsoTools {
|
|||||||
public static Vector3 Vec3OneYZ { get { return new Vector3(0.0f, 1.0f, 1.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 Vec3OneXZ { get { return new Vector3(1.0f, 0.0f, 1.0f); } }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Abs/Min/Max
|
// Abs/Min/Max
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Abs
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector2 Vec2Abs(Vector2 v) {
|
public static Vector2 Vec2Abs(Vector2 v) {
|
||||||
return new Vector2(
|
return new Vector2(
|
||||||
Mathf.Abs(v.x),
|
Mathf.Abs(v.x),
|
||||||
Mathf.Abs(v.y));
|
Mathf.Abs(v.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
public static Vector3 Vec3Abs(Vector3 v) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
Mathf.Abs(v.x),
|
Mathf.Abs(v.x),
|
||||||
@@ -46,6 +44,24 @@ namespace IsoTools {
|
|||||||
Mathf.Abs(v.z));
|
Mathf.Abs(v.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Min
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
public static float Vec2MinF(Vector2 v) {
|
||||||
|
return Mathf.Min(v.x, v.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float Vec3MinF(Vector3 v) {
|
||||||
|
return Mathf.Min(v.x, v.y, v.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 Vec3Min(Vector3 a, Vector3 b) {
|
public static Vector3 Vec3Min(Vector3 a, Vector3 b) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
Mathf.Min(a.x, b.x),
|
Mathf.Min(a.x, b.x),
|
||||||
@@ -53,6 +69,18 @@ namespace IsoTools {
|
|||||||
Mathf.Min(a.z, b.z));
|
Mathf.Min(a.z, b.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Max
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
public static float Vec2MaxF(Vector2 v) {
|
||||||
|
return Mathf.Max(v.x, v.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float Vec3MaxF(Vector3 v) {
|
||||||
|
return Mathf.Max(v.x, v.y, v.z);
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector2 Vec2Max(Vector2 a, Vector2 b) {
|
public static Vector2 Vec2Max(Vector2 a, Vector2 b) {
|
||||||
return new Vector2(
|
return new Vector2(
|
||||||
Mathf.Max(a.x, b.x),
|
Mathf.Max(a.x, b.x),
|
||||||
@@ -66,11 +94,21 @@ namespace IsoTools {
|
|||||||
Mathf.Max(a.z, b.z));
|
Mathf.Max(a.z, b.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Ceil/Floor/Round
|
// Ceil/Floor/Round
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Ceil
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
public static Vector2 Vec2Ceil(Vector2 v) {
|
||||||
|
return new Vector2(
|
||||||
|
Mathf.Ceil(v.x),
|
||||||
|
Mathf.Ceil(v.y));
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector3 Vec3Ceil(Vector3 v) {
|
public static Vector3 Vec3Ceil(Vector3 v) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
@@ -79,6 +117,16 @@ namespace IsoTools {
|
|||||||
Mathf.Ceil(v.z));
|
Mathf.Ceil(v.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Floor
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
public static Vector2 Vec2Floor(Vector2 v) {
|
||||||
|
return new Vector2(
|
||||||
|
Mathf.Floor(v.x),
|
||||||
|
Mathf.Floor(v.y));
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector3 Vec3Floor(Vector3 v) {
|
public static Vector3 Vec3Floor(Vector3 v) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
Mathf.Floor(v.x),
|
Mathf.Floor(v.x),
|
||||||
@@ -86,6 +134,16 @@ namespace IsoTools {
|
|||||||
Mathf.Floor(v.z));
|
Mathf.Floor(v.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Round
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
public static Vector2 Vec2Round(Vector2 v) {
|
||||||
|
return new Vector2(
|
||||||
|
Mathf.Round(v.x),
|
||||||
|
Mathf.Round(v.y));
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector3 Vec3Round(Vector3 v) {
|
public static Vector3 Vec3Round(Vector3 v) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
Mathf.Round(v.x),
|
Mathf.Round(v.x),
|
||||||
@@ -93,11 +151,15 @@ namespace IsoTools {
|
|||||||
Mathf.Round(v.z));
|
Mathf.Round(v.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Div/DivCeil/DivFloor/DivRound
|
// Div/DivCeil/DivFloor/DivRound
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Div
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3Div(Vector3 a, float b) {
|
public static Vector3 Vec3Div(Vector3 a, float b) {
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
@@ -113,6 +175,10 @@ namespace IsoTools {
|
|||||||
a.z / b.z);
|
a.z / b.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// DivCeil
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3DivCeil(Vector3 a, float b) {
|
public static Vector3 Vec3DivCeil(Vector3 a, float b) {
|
||||||
return Vec3Ceil(Vec3Div(a, b));
|
return Vec3Ceil(Vec3Div(a, b));
|
||||||
}
|
}
|
||||||
@@ -120,6 +186,10 @@ namespace IsoTools {
|
|||||||
public static Vector3 Vec3DivCeil(Vector3 a, Vector3 b) {
|
public static Vector3 Vec3DivCeil(Vector3 a, Vector3 b) {
|
||||||
return Vec3Ceil(Vec3Div(a, b));
|
return Vec3Ceil(Vec3Div(a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// DivFloor
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3DivFloor(Vector3 a, float b) {
|
public static Vector3 Vec3DivFloor(Vector3 a, float b) {
|
||||||
return Vec3Floor(Vec3Div(a, b));
|
return Vec3Floor(Vec3Div(a, b));
|
||||||
@@ -128,6 +198,10 @@ namespace IsoTools {
|
|||||||
public static Vector3 Vec3DivFloor(Vector3 a, Vector3 b) {
|
public static Vector3 Vec3DivFloor(Vector3 a, Vector3 b) {
|
||||||
return Vec3Floor(Vec3Div(a, b));
|
return Vec3Floor(Vec3Div(a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// DivRound
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3DivRound(Vector3 a, float b) {
|
public static Vector3 Vec3DivRound(Vector3 a, float b) {
|
||||||
return Vec3Round(Vec3Div(a, b));
|
return Vec3Round(Vec3Div(a, b));
|
||||||
@@ -137,11 +211,15 @@ namespace IsoTools {
|
|||||||
return Vec3Round(Vec3Div(a, b));
|
return Vec3Round(Vec3Div(a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// FromX
|
// Vec2From/Vec3From
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Vec2From
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector2 Vec2FromX(float x) {
|
public static Vector2 Vec2FromX(float x) {
|
||||||
return new Vector2(x, 0.0f);
|
return new Vector2(x, 0.0f);
|
||||||
@@ -154,6 +232,10 @@ namespace IsoTools {
|
|||||||
public static Vector2 Vec2FromXY(float x, float y) {
|
public static Vector2 Vec2FromXY(float x, float y) {
|
||||||
return new Vector2(x, y);
|
return new Vector2(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Vec3From
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3FromX(float x) {
|
public static Vector3 Vec3FromX(float x) {
|
||||||
return new Vector3(x, 0.0f, 0.0f);
|
return new Vector3(x, 0.0f, 0.0f);
|
||||||
@@ -179,11 +261,15 @@ namespace IsoTools {
|
|||||||
return new Vector3(x, 0.0f, z);
|
return new Vector3(x, 0.0f, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ChangeX
|
// ChangeX
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Vec2Change
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector2 Vec2ChangeX(Vector2 v, float x) {
|
public static Vector2 Vec2ChangeX(Vector2 v, float x) {
|
||||||
return new Vector2(x, v.y);
|
return new Vector2(x, v.y);
|
||||||
@@ -192,6 +278,10 @@ namespace IsoTools {
|
|||||||
public static Vector2 Vec2ChangeY(Vector2 v, float y) {
|
public static Vector2 Vec2ChangeY(Vector2 v, float y) {
|
||||||
return new Vector2(v.x, y);
|
return new Vector2(v.x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Vec3Change
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
public static Vector3 Vec3ChangeX(Vector3 v, float x) {
|
public static Vector3 Vec3ChangeX(Vector3 v, float x) {
|
||||||
return new Vector3(x, v.y, v.z);
|
return new Vector3(x, v.y, v.z);
|
||||||
@@ -217,11 +307,11 @@ namespace IsoTools {
|
|||||||
return new Vector3(x, v.y, z);
|
return new Vector3(x, v.y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Approximately
|
// Approximately
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
public static bool Vec2Approximately(Vector2 a, Vector2 b) {
|
public static bool Vec2Approximately(Vector2 a, Vector2 b) {
|
||||||
return
|
return
|
||||||
@@ -236,11 +326,18 @@ namespace IsoTools {
|
|||||||
Mathf.Approximately(a.z, b.z);
|
Mathf.Approximately(a.z, b.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// LookUpCube
|
// LookUpCube
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
public static void LookUpCube(Vector2 min, Vector2 max, Action<Vector2> act) {
|
||||||
|
for ( var y = min.y; y < max.y; ++y ) {
|
||||||
|
for ( var x = min.x; x < max.x; ++x ) {
|
||||||
|
act(new Vector2(x, y));
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
public static void LookUpCube(Vector3 min, Vector3 max, Action<Vector3> act) {
|
public static void LookUpCube(Vector3 min, Vector3 max, Action<Vector3> act) {
|
||||||
for ( var z = min.z; z < max.z; ++z ) {
|
for ( var z = min.z; z < max.z; ++z ) {
|
||||||
@@ -249,5 +346,49 @@ namespace IsoTools {
|
|||||||
act(new Vector3(x, y, z));
|
act(new Vector3(x, y, z));
|
||||||
}}}
|
}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Debug draw
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
static void DrawTop(Vector3 pos, Vector3 size) {
|
||||||
|
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
|
||||||
|
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)
|
||||||
|
};
|
||||||
|
Gizmos.DrawLine(points[0], points[1]);
|
||||||
|
Gizmos.DrawLine(points[1], points[2]);
|
||||||
|
Gizmos.DrawLine(points[2], points[3]);
|
||||||
|
Gizmos.DrawLine(points[3], points[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawVert(Vector3 pos, Vector3 size) {
|
||||||
|
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
|
||||||
|
if ( iso_world ) {
|
||||||
|
Gizmos.DrawLine(
|
||||||
|
iso_world.IsoToScreen(pos),
|
||||||
|
iso_world.IsoToScreen(pos + IsoUtils.Vec3FromZ(size.z)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawCube(Vector3 pos, Vector3 size, Color color) {
|
||||||
|
Gizmos.color = color;
|
||||||
|
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), size);
|
||||||
|
DrawVert(pos - IsoUtils.Vec3FromZ(0.5f) + IsoUtils.Vec3FromX(size.x), size);
|
||||||
|
DrawVert(pos - IsoUtils.Vec3FromZ(0.5f) + IsoUtils.Vec3FromY(size.y), size);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,18 +39,19 @@ namespace IsoTools {
|
|||||||
public List<int> Objects = new List<int>();
|
public List<int> Objects = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _dirty = true;
|
bool _dirty = true;
|
||||||
float _lastTileSize = 0.0f;
|
float _lastTileSize = 0.0f;
|
||||||
float _lastMinDepth = 0.0f;
|
float _lastMinDepth = 0.0f;
|
||||||
float _lastMaxDepth = 0.0f;
|
float _lastMaxDepth = 0.0f;
|
||||||
|
|
||||||
List<SectorInfo> _sectors = new List<SectorInfo>();
|
List<SectorInfo> _sectors = new List<SectorInfo>();
|
||||||
List<ObjectInfo> _objects = new List<ObjectInfo>();
|
List<ObjectInfo> _objects = new List<ObjectInfo>();
|
||||||
List<int> _depends = new List<int>();
|
List<int> _depends = new List<int>();
|
||||||
float _objsSectorSize = 0.0f;
|
HashSet<IsoObject> _visibles = new HashSet<IsoObject>();
|
||||||
Vector3 _objsMinNumPos = Vector3.zero;
|
float _objsSectorSize = 0.0f;
|
||||||
Vector3 _objsMaxNumPos = Vector3.zero;
|
Vector3 _objsMinNumPos = Vector3.zero;
|
||||||
Vector3 _objsNumPosCount = Vector3.zero;
|
Vector3 _objsMaxNumPos = Vector3.zero;
|
||||||
|
Vector3 _objsNumPosCount = Vector3.zero;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public float _tileSize = 32.0f;
|
public float _tileSize = 32.0f;
|
||||||
@@ -263,31 +264,36 @@ namespace IsoTools {
|
|||||||
return a_yesno;
|
return a_yesno;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupSectorSize(IsoObject[] iso_objects) {
|
void SetupVisibles(IsoObject[] iso_objects) {
|
||||||
|
var new_visibles = new HashSet<IsoObject>(
|
||||||
|
iso_objects.Where(p => IsIsoObjectVisible(p)));
|
||||||
|
if ( !_visibles.IsSupersetOf(new_visibles) ) {
|
||||||
|
MarkDirty();
|
||||||
|
}
|
||||||
|
_visibles = new_visibles;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupSectorSize() {
|
||||||
_objsSectorSize = 0.0f;
|
_objsSectorSize = 0.0f;
|
||||||
var objsSum = 0;
|
var objsSum = 0;
|
||||||
foreach ( var obj in iso_objects ) {
|
foreach ( var obj in _visibles ) {
|
||||||
if ( IsIsoObjectVisible(obj) ) {
|
++objsSum;
|
||||||
++objsSum;
|
_objsSectorSize += Mathf.Max(obj.Size.x, obj.Size.y, obj.Size.z);
|
||||||
_objsSectorSize += Mathf.Max(obj.Size.x, obj.Size.y, obj.Size.z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_objsSectorSize = Mathf.Round(Mathf.Max(3.0f, _objsSectorSize / objsSum));
|
_objsSectorSize = Mathf.Round(Mathf.Max(3.0f, _objsSectorSize / objsSum));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupObjects(IsoObject[] iso_objects) {
|
void SetupObjects() {
|
||||||
_objects.Clear();
|
_objects.Clear();
|
||||||
_objsMinNumPos = Vector3.zero;
|
_objsMinNumPos = Vector3.zero;
|
||||||
_objsMaxNumPos = Vector3.one;
|
_objsMaxNumPos = Vector3.one;
|
||||||
foreach ( var obj in iso_objects ) {
|
foreach ( var obj in _visibles ) {
|
||||||
if ( IsIsoObjectVisible(obj) ) {
|
var max_size = IsoUtils.Vec3Max(Vector3.one, obj.Size);
|
||||||
var max_size = IsoUtils.Vec3Max(Vector3.one, obj.Size);
|
var min_npos = IsoUtils.Vec3DivFloor(obj.Position, _objsSectorSize);
|
||||||
var min_npos = IsoUtils.Vec3DivFloor(obj.Position, _objsSectorSize);
|
var max_npos = IsoUtils.Vec3DivCeil(obj.Position + max_size, _objsSectorSize);
|
||||||
var max_npos = IsoUtils.Vec3DivCeil(obj.Position + max_size, _objsSectorSize);
|
_objsMinNumPos = IsoUtils.Vec3Min(_objsMinNumPos, min_npos);
|
||||||
_objsMinNumPos = IsoUtils.Vec3Min(_objsMinNumPos, min_npos);
|
_objsMaxNumPos = IsoUtils.Vec3Max(_objsMaxNumPos, max_npos);
|
||||||
_objsMaxNumPos = IsoUtils.Vec3Max(_objsMaxNumPos, max_npos);
|
_objects.Add(new ObjectInfo(_objects.Count, obj, min_npos, max_npos));
|
||||||
_objects.Add(new ObjectInfo(_objects.Count, obj, min_npos, max_npos));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_objsNumPosCount = _objsMaxNumPos - _objsMinNumPos;
|
_objsNumPosCount = _objsMaxNumPos - _objsMinNumPos;
|
||||||
}
|
}
|
||||||
@@ -359,10 +365,11 @@ namespace IsoTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StepSort() {
|
void StepSort() {
|
||||||
|
var iso_objects = GameObject.FindObjectsOfType<IsoObject>();
|
||||||
|
SetupVisibles(iso_objects);
|
||||||
if ( _dirty ) {
|
if ( _dirty ) {
|
||||||
var iso_objects = GameObject.FindObjectsOfType<IsoObject>();
|
SetupSectorSize();
|
||||||
SetupSectorSize(iso_objects);
|
SetupObjects();
|
||||||
SetupObjects(iso_objects);
|
|
||||||
SetupSectors();
|
SetupSectors();
|
||||||
SetupObjectDepends();
|
SetupObjectDepends();
|
||||||
PlaceAllObjects();
|
PlaceAllObjects();
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ PlayerSettings:
|
|||||||
psp2NPTrophyPackPath:
|
psp2NPTrophyPackPath:
|
||||||
psp2NPSupportGBMorGJP: 0
|
psp2NPSupportGBMorGJP: 0
|
||||||
psp2NPAgeRating: 12
|
psp2NPAgeRating: 12
|
||||||
|
psp2NPTitleDatPath:
|
||||||
psp2NPCommsID:
|
psp2NPCommsID:
|
||||||
psp2NPCommunicationsID:
|
psp2NPCommunicationsID:
|
||||||
psp2NPCommsPassphrase:
|
psp2NPCommsPassphrase:
|
||||||
@@ -222,6 +223,7 @@ PlayerSettings:
|
|||||||
psp2PatchOriginalPackage:
|
psp2PatchOriginalPackage:
|
||||||
psp2PackagePassword:
|
psp2PackagePassword:
|
||||||
psp2KeystoneFile:
|
psp2KeystoneFile:
|
||||||
|
psp2MemoryExpansionMode: 0
|
||||||
psp2DRMType: 0
|
psp2DRMType: 0
|
||||||
psp2StorageType: 0
|
psp2StorageType: 0
|
||||||
psp2MediaCapacity: 0
|
psp2MediaCapacity: 0
|
||||||
@@ -357,6 +359,7 @@ PlayerSettings:
|
|||||||
XboxOnePackagingOverridePath:
|
XboxOnePackagingOverridePath:
|
||||||
XboxOneAppManifestOverridePath:
|
XboxOneAppManifestOverridePath:
|
||||||
XboxOnePackageEncryption: 0
|
XboxOnePackageEncryption: 0
|
||||||
|
XboxOnePackageUpdateGranularity: 2
|
||||||
XboxOneDescription:
|
XboxOneDescription:
|
||||||
XboxOneIsContentPackage: 0
|
XboxOneIsContentPackage: 0
|
||||||
XboxOneEnableGPUVariability: 0
|
XboxOneEnableGPUVariability: 0
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 5.0.1f1
|
m_EditorVersion: 5.0.2f1
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Global
|
|||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(MonoDevelopProperties) = preSolution
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
StartupItem = Assembly-CSharp.csproj
|
StartupItem = Assembly-CSharp.csproj
|
||||||
Policies = $0
|
Policies = $0
|
||||||
$0.TextStylePolicy = $1
|
$0.TextStylePolicy = $1
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Global
|
|||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(MonoDevelopProperties) = preSolution
|
GlobalSection(MonoDevelopProperties) = preSolution
|
||||||
StartupItem = Assembly-CSharp.csproj
|
StartupItem = Assembly-CSharp.csproj
|
||||||
Policies = $0
|
Policies = $0
|
||||||
$0.TextStylePolicy = $1
|
$0.TextStylePolicy = $1
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="MonoDevelop.Default" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoRigidbody.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoObject.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="Assets/IsoTools/Scripts/IsoRigidbody.cs" Line="80" Column="52" />
|
<File FileName="Assets/IsoTools/Scripts/IsoObject.cs" Line="170" Column="44" />
|
||||||
<File FileName="Assets/IsoTools/Examples/Scripts/IsoController.cs" Line="14" Column="50" />
|
<File FileName="Assets/IsoTools/Scripts/IsoRigidbody.cs" Line="1" Column="1" />
|
||||||
|
<File FileName="Assets/IsoTools/Scripts/IsoUtils.cs" Line="388" Column="51" />
|
||||||
|
<File FileName="Assets/IsoTools/Scripts/IsoWorld.cs" Line="256" Column="29" />
|
||||||
</Files>
|
</Files>
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
|
|||||||
Reference in New Issue
Block a user