diff --git a/Assembly-CSharp-vs.csproj b/Assembly-CSharp-vs.csproj
index f69082b..4aa975f 100644
--- a/Assembly-CSharp-vs.csproj
+++ b/Assembly-CSharp-vs.csproj
@@ -49,8 +49,12 @@
+
+
+
+
diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj
index f69082b..4aa975f 100644
--- a/Assembly-CSharp.csproj
+++ b/Assembly-CSharp.csproj
@@ -49,8 +49,12 @@
+
+
+
+
diff --git a/Assets/IsoTools/Examples/Scenes/Scene5.unity b/Assets/IsoTools/Examples/Scenes/Scene5.unity
index 37fd4db..38ad1e2 100644
--- a/Assets/IsoTools/Examples/Scenes/Scene5.unity
+++ b/Assets/IsoTools/Examples/Scenes/Scene5.unity
@@ -87,6 +87,100 @@ NavMeshSettings:
cellSize: .166666672
manualCellSize: 0
m_NavMeshData: {fileID: 0}
+--- !u!1001 &194071307
+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: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ propertyPath: m_LocalPosition.z
+ value: 50
+ 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}
+ m_RemovedComponents: []
+ m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ m_IsPrefabParent: 0
+--- !u!1 &194071308 stripped
+GameObject:
+ m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ m_PrefabInternal: {fileID: 194071307}
+--- !u!114 &194071309
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 194071308}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ _isKinematic: 1
+ _interpolation: 0
+ _collisionDetectionMode: 0
+--- !u!114 &194071310
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 194071308}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ _material: {fileID: 0}
+ _isTrigger: 0
+ _size: {x: 3, y: 3, z: 0}
+ _offset: {x: 1.5, y: 1.5, z: 0}
+--- !u!114 &194071311
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 194071308}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 5528e050e2d53409f9a4f1662625b0bf, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &318480492
GameObject:
m_ObjectHideFlags: 0
@@ -187,161 +281,84 @@ MonoBehaviour:
_tileSize: 16
_minDepth: 0
_maxDepth: 100
---- !u!1001 &562183236
+--- !u!1001 &1846453512
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
+ value: 64
+ objectReference: {fileID: 0}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
+ propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
- propertyPath: m_LocalPosition.z
- value: 50
- objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
- propertyPath: _position.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x
- value: 0
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
+ propertyPath: _position.y
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
+ propertyPath: _position.z
+ value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
+ m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
---- !u!1 &562183237 stripped
+--- !u!1 &1846453513 stripped
GameObject:
- m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
- m_PrefabInternal: {fileID: 562183236}
---- !u!114 &562183238
+ m_PrefabParentObject: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
+ m_PrefabInternal: {fileID: 1846453512}
+--- !u!114 &1846453514
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 562183237}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- _material: {fileID: 0}
- _isTrigger: 0
- _size: {x: 3, y: 3, z: 0}
- _offset: {x: 1.5, y: 1.5, z: 0}
---- !u!114 &562183239
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 562183237}
+ m_GameObject: {fileID: 1846453513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3}
m_Name:
m_EditorClassIdentifier:
- _isKinematic: 1
+ _isKinematic: 0
_interpolation: 0
_collisionDetectionMode: 0
---- !u!1001 &844501808
-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: -3.59999847
- objectReference: {fileID: 0}
- - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: m_LocalPosition.y
- value: 75.8300018
- 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: 1
- objectReference: {fileID: 0}
- - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: _position.x
- value: .626875162
- objectReference: {fileID: 0}
- - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: _position.y
- value: .851875067
- objectReference: {fileID: 0}
- - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: _position.z
- value: 4
- objectReference: {fileID: 0}
- - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: _alignment
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- propertyPath: _showBounds
- value: 0
- objectReference: {fileID: 0}
- m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- m_IsPrefabParent: 0
---- !u!1 &844501809 stripped
-GameObject:
- m_PrefabParentObject: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
- m_PrefabInternal: {fileID: 844501808}
---- !u!114 &844501810
+--- !u!114 &1846453515
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 844501809}
+ m_GameObject: {fileID: 1846453513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3}
@@ -351,17 +368,3 @@ MonoBehaviour:
_isTrigger: 0
_size: {x: 1, y: 1, z: 1}
_offset: {x: .5, y: .5, z: .5}
---- !u!114 &844501811
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 844501809}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- _isKinematic: 0
- _interpolation: 0
- _collisionDetectionMode: 0
diff --git a/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs b/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs
new file mode 100644
index 0000000..5416142
--- /dev/null
+++ b/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs
@@ -0,0 +1,30 @@
+using UnityEngine;
+using System.Collections;
+
+namespace IsoTools { namespace Examples {
+ public class IsoEchoListener : MonoBehaviour {
+ void OnIsoTriggerEnter(IsoCollider iso_collider) {
+ Debug.LogFormat(
+ "OnIsoTriggerEnter. self:{0} other:{1}",
+ gameObject.name, iso_collider.gameObject.name);
+ }
+
+ void OnIsoTriggerExit(IsoCollider iso_collider) {
+ Debug.LogFormat(
+ "OnIsoTriggerExit. self:{0} other:{1}",
+ gameObject.name, iso_collider.gameObject.name);
+ }
+
+ void OnIsoCollisionEnter(IsoCollision iso_collision) {
+ Debug.LogFormat(
+ "OnIsoCollisionEnter. self:{0} other:{1}",
+ gameObject.name, iso_collision.GameObject.name);
+ }
+
+ void OnIsoCollisionExit(IsoCollision iso_collision) {
+ Debug.LogFormat(
+ "OnIsoCollisionExit. self:{0} other:{1}",
+ gameObject.name, iso_collision.GameObject.name);
+ }
+ }
+}} // namespace IsoTools::Examples
\ No newline at end of file
diff --git a/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs.meta b/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs.meta
new file mode 100644
index 0000000..ef8300c
--- /dev/null
+++ b/Assets/IsoTools/Examples/Scripts/IsoEchoListener.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5528e050e2d53409f9a4f1662625b0bf
+timeCreated: 1436185285
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/IsoTools/Scripts/IsoCollider.cs b/Assets/IsoTools/Scripts/IsoCollider.cs
index e6c8b63..25e2239 100644
--- a/Assets/IsoTools/Scripts/IsoCollider.cs
+++ b/Assets/IsoTools/Scripts/IsoCollider.cs
@@ -33,18 +33,23 @@ namespace IsoTools {
}
}
- Collider _realCollider = null;
+ GameObject _isoFakeCollider = null;
+ public GameObject IsoFakeCollider {
+ get { return _isoFakeCollider; }
+ }
+
public Collider RealCollider {
- get { return _realCollider; }
+ get { return IsoFakeCollider ? IsoFakeCollider.GetComponent() : null; }
}
void Awake() {
- var helper = IsoUtils.GetOrCreateComponent(gameObject);
- _realCollider = CreateCollider(helper.IsoFakeObject);
- if ( _realCollider ) {
- _realCollider.material = Material;
- _realCollider.isTrigger = IsTrigger;
- }
+ _isoFakeCollider = new GameObject();
+ _isoFakeCollider.transform.SetParent(
+ IsoUtils.GetOrCreateComponent(gameObject).IsoFakeObject.transform, false);
+ _isoFakeCollider.AddComponent().Init(this);
+ var real_collider = CreateCollider(_isoFakeCollider);
+ real_collider.material = Material;
+ real_collider.isTrigger = IsTrigger;
}
void OnEnable() {
@@ -60,9 +65,9 @@ namespace IsoTools {
}
void OnDestroy() {
- if ( _realCollider ) {
- Destroy(_realCollider);
- _realCollider = null;
+ if ( _isoFakeCollider ) {
+ Destroy(_isoFakeCollider);
+ _isoFakeCollider = null;
}
}
diff --git a/Assets/IsoTools/Scripts/IsoCollision.cs b/Assets/IsoTools/Scripts/IsoCollision.cs
new file mode 100644
index 0000000..3274489
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoCollision.cs
@@ -0,0 +1,26 @@
+using UnityEngine;
+
+namespace IsoTools {
+ public class IsoCollision {
+
+ public IsoCollider Collider { get; private set; }
+ public IsoContactPoint[] Contacts { get; private set; }
+ public GameObject GameObject { get; private set; }
+ public Vector3 RelativeVelocity { get; private set; }
+ public IsoRigidbody IsoRigidbody { get; private set; }
+
+ public IsoCollision(
+ IsoCollider collider,
+ IsoContactPoint[] contacts,
+ GameObject game_object,
+ Vector3 relative_velocity,
+ IsoRigidbody iso_rigidbody)
+ {
+ Collider = collider;
+ Contacts = contacts;
+ GameObject = game_object;
+ RelativeVelocity = relative_velocity;
+ IsoRigidbody = iso_rigidbody;
+ }
+ }
+} // namespace IsoTools
\ No newline at end of file
diff --git a/Assets/IsoTools/Scripts/IsoCollision.cs.meta b/Assets/IsoTools/Scripts/IsoCollision.cs.meta
new file mode 100644
index 0000000..3ccf242
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoCollision.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6a0c6ad7ad6d84258be23c24fad58b84
+timeCreated: 1436119603
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/IsoTools/Scripts/IsoContactPoint.cs b/Assets/IsoTools/Scripts/IsoContactPoint.cs
new file mode 100644
index 0000000..534bb8f
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoContactPoint.cs
@@ -0,0 +1,23 @@
+using UnityEngine;
+
+namespace IsoTools {
+ public class IsoContactPoint {
+
+ public Vector3 Normal { get; private set; }
+ public IsoCollider OtherIsoCollider { get; private set; }
+ public Vector3 Point { get; private set; }
+ public IsoCollider ThisIsoCollider { get; private set; }
+
+ public IsoContactPoint(
+ Vector3 normal,
+ IsoCollider other_iso_collider,
+ Vector3 point,
+ IsoCollider this_iso_collider)
+ {
+ Normal = normal;
+ OtherIsoCollider = other_iso_collider;
+ Point = point;
+ ThisIsoCollider = this_iso_collider;
+ }
+ }
+} // namespace IsoTools
\ No newline at end of file
diff --git a/Assets/IsoTools/Scripts/IsoContactPoint.cs.meta b/Assets/IsoTools/Scripts/IsoContactPoint.cs.meta
new file mode 100644
index 0000000..36c5c89
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoContactPoint.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 121a2248ec18d4aa4be6bec03265e86e
+timeCreated: 1436119761
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/IsoTools/Scripts/IsoFakeCollider.cs b/Assets/IsoTools/Scripts/IsoFakeCollider.cs
new file mode 100644
index 0000000..a7bb393
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoFakeCollider.cs
@@ -0,0 +1,16 @@
+using UnityEngine;
+
+namespace IsoTools {
+ public class IsoFakeCollider : MonoBehaviour {
+
+ IsoCollider _isoCollider = null;
+
+ public void Init(IsoCollider iso_collider) {
+ _isoCollider = iso_collider;
+ }
+
+ public IsoCollider IsoCollider {
+ get { return _isoCollider; }
+ }
+ }
+} // namespace IsoTools
\ No newline at end of file
diff --git a/Assets/IsoTools/Scripts/IsoFakeCollider.cs.meta b/Assets/IsoTools/Scripts/IsoFakeCollider.cs.meta
new file mode 100644
index 0000000..b488628
--- /dev/null
+++ b/Assets/IsoTools/Scripts/IsoFakeCollider.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e6013de6edf894f15b4b45e011afe2a4
+timeCreated: 1436271657
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/IsoTools/Scripts/IsoFakeObject.cs b/Assets/IsoTools/Scripts/IsoFakeObject.cs
index 3b82cae..d926e73 100644
--- a/Assets/IsoTools/Scripts/IsoFakeObject.cs
+++ b/Assets/IsoTools/Scripts/IsoFakeObject.cs
@@ -1,4 +1,6 @@
using UnityEngine;
+using System.Linq;
+using System.Collections.Generic;
namespace IsoTools {
public class IsoFakeObject : MonoBehaviour {
@@ -16,6 +18,48 @@ namespace IsoTools {
get { return _isoObject; }
}
+ IsoCollider ConvertCollider(Collider collider) {
+ var fake_collider = collider.GetComponent();
+ return fake_collider ? fake_collider.IsoCollider : null;
+ }
+
+ IsoRigidbody ConvertRigidbody(Rigidbody rigidbody) {
+ var fake_object = rigidbody.GetComponent();
+ var iso_object = fake_object ? fake_object.IsoObject : null;
+ return iso_object ? iso_object.GetComponent() : null;
+ }
+
+ GameObject ConvertGameObject(GameObject game_object) {
+ var fake_object = game_object.GetComponent();
+ var iso_object = fake_object ? fake_object.IsoObject : null;
+ return iso_object ? iso_object.gameObject : null;
+ }
+
+ IsoContactPoint ConvertContactPoint(ContactPoint contact_point) {
+ return new IsoContactPoint(
+ contact_point.normal,
+ ConvertCollider(contact_point.otherCollider),
+ contact_point.point,
+ ConvertCollider(contact_point.thisCollider));
+ }
+
+ IsoContactPoint[] ConvertContactPoints(ContactPoint[] points) {
+ var iso_points = new IsoContactPoint[points.Length];
+ for ( var i = 0; i < points.Length; ++i ) {
+ iso_points[i] = ConvertContactPoint(points[i]);
+ }
+ return iso_points;
+ }
+
+ IsoCollision ConvertCollision(Collision collision) {
+ return new IsoCollision(
+ ConvertCollider(collision.collider),
+ ConvertContactPoints(collision.contacts),
+ ConvertGameObject(collision.gameObject),
+ collision.relativeVelocity,
+ ConvertRigidbody(collision.rigidbody));
+ }
+
void FixedUpdate() {
if ( !IsoUtils.Vec3Approximately(_lastPosition, IsoObject.Position) ) {
transform.position = IsoObject.Position;
@@ -26,27 +70,27 @@ namespace IsoTools {
}
void OnTriggerEnter(Collider collider) {
- Debug.LogFormat("OnTriggerEnter: {0}-{1}", gameObject.name, collider.gameObject.name);
+ var iso_collider = ConvertCollider(collider);
+ IsoObject.gameObject.SendMessage(
+ "OnIsoTriggerEnter", iso_collider, SendMessageOptions.DontRequireReceiver);
}
void OnTriggerExit(Collider collider) {
- Debug.LogFormat("OnTriggerExit: {0}-{1}", gameObject.name, collider.gameObject.name);
- }
-
- void OnTriggerStay(Collider collider) {
- Debug.LogFormat("OnTriggerStay: {0}-{1}", gameObject.name, collider.gameObject.name);
+ var iso_collider = ConvertCollider(collider);
+ IsoObject.gameObject.SendMessage(
+ "OnIsoTriggerExit", iso_collider, SendMessageOptions.DontRequireReceiver);
}
void OnCollisionEnter(Collision collision) {
- Debug.LogFormat("OnCollisionEnter: {0}-{1}", gameObject.name, collision.gameObject.name);
+ var iso_collision = ConvertCollision(collision);
+ IsoObject.gameObject.SendMessage(
+ "OnIsoCollisionEnter", iso_collision, SendMessageOptions.DontRequireReceiver);
}
-
+
void OnCollisionExit(Collision collision) {
- Debug.LogFormat("OnCollisionExit: {0}-{1}", gameObject.name, collision.gameObject.name);
- }
-
- void OnCollisionStay(Collision collision) {
- Debug.LogFormat("OnCollisionStay: {0}-{1}", gameObject.name, collision.gameObject.name);
+ var iso_collision = ConvertCollision(collision);
+ IsoObject.gameObject.SendMessage(
+ "OnIsoCollisionExit", iso_collision, SendMessageOptions.DontRequireReceiver);
}
}
} // namespace IsoTools
\ No newline at end of file
diff --git a/Assets/IsoTools/Scripts/IsoObject.cs b/Assets/IsoTools/Scripts/IsoObject.cs
index 9b1348d..34a5cd8 100644
--- a/Assets/IsoTools/Scripts/IsoObject.cs
+++ b/Assets/IsoTools/Scripts/IsoObject.cs
@@ -6,6 +6,7 @@ using UnityEditor;
namespace IsoTools {
[ExecuteInEditMode]
+ [DisallowMultipleComponent]
public class IsoObject : MonoBehaviour {
// ------------------------------------------------------------------------
diff --git a/Assets/IsoTools/Scripts/IsoPhysicHelper.cs b/Assets/IsoTools/Scripts/IsoPhysicHelper.cs
index 7f851c6..a659895 100644
--- a/Assets/IsoTools/Scripts/IsoPhysicHelper.cs
+++ b/Assets/IsoTools/Scripts/IsoPhysicHelper.cs
@@ -1,6 +1,7 @@
using UnityEngine;
namespace IsoTools {
+ [DisallowMultipleComponent]
[RequireComponent(typeof(IsoObject))]
public class IsoPhysicHelper : MonoBehaviour {
diff --git a/Assets/IsoTools/Scripts/IsoRigidbody.cs b/Assets/IsoTools/Scripts/IsoRigidbody.cs
index 87d8a92..d8ed760 100644
--- a/Assets/IsoTools/Scripts/IsoRigidbody.cs
+++ b/Assets/IsoTools/Scripts/IsoRigidbody.cs
@@ -5,6 +5,7 @@ using UnityEditor;
#endif
namespace IsoTools {
+ [DisallowMultipleComponent]
[RequireComponent(typeof(IsoObject))]
public class IsoRigidbody : MonoBehaviour {
diff --git a/Assets/IsoTools/Scripts/IsoWorld.cs b/Assets/IsoTools/Scripts/IsoWorld.cs
index 44807d8..576d7fc 100644
--- a/Assets/IsoTools/Scripts/IsoWorld.cs
+++ b/Assets/IsoTools/Scripts/IsoWorld.cs
@@ -8,6 +8,7 @@ using UnityEditor;
namespace IsoTools {
[ExecuteInEditMode]
+ [DisallowMultipleComponent]
public class IsoWorld : MonoBehaviour {
class ObjectInfo {
diff --git a/UnityIso-csharp.sln b/UnityIso-csharp.sln
index a76d784..7cc51d6 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 1824ea1..78f0e48 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 17c79c5..7bbd2a6 100644
--- a/UnityIso.userprefs
+++ b/UnityIso.userprefs
@@ -1,14 +1,16 @@
-
-
+
+
-
-
-
+
+
-
+
+
+
+
\ No newline at end of file