mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-16 14:09:00 +07:00
physics to addons
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoFakeCollider : MonoBehaviour {
|
||||
IsoCollider _isoCollider = null;
|
||||
|
||||
public IsoFakeCollider Init(IsoCollider iso_collider) {
|
||||
_isoCollider = iso_collider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IsoCollider isoCollider {
|
||||
get { return _isoCollider; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6013de6edf894f15b4b45e011afe2a4
|
||||
timeCreated: 1436271657
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,26 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoFakeCollisionListener : MonoBehaviour {
|
||||
GameObject _realGameObject = null;
|
||||
|
||||
public IsoFakeCollisionListener Init(IsoCollisionListener iso_listener) {
|
||||
_realGameObject = iso_listener.gameObject;
|
||||
return this;
|
||||
}
|
||||
|
||||
void OnCollisionEnter(Collision collision) {
|
||||
_realGameObject.SendMessage(
|
||||
"OnIsoCollisionEnter",
|
||||
new IsoCollision(collision),
|
||||
SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
|
||||
void OnCollisionExit(Collision collision) {
|
||||
_realGameObject.SendMessage(
|
||||
"OnIsoCollisionExit",
|
||||
new IsoCollision(collision),
|
||||
SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3ba702b17e9f4b85aad7b29b1a06eed
|
||||
timeCreated: 1461097028
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoFakeObject : MonoBehaviour {
|
||||
|
||||
IsoObject _isoObject = null;
|
||||
Vector3 _lastPosition = Vector3.zero;
|
||||
|
||||
public void Init(IsoObject iso_object) {
|
||||
_isoObject = iso_object;
|
||||
_lastPosition = iso_object.position;
|
||||
transform.position = iso_object.position;
|
||||
}
|
||||
|
||||
public IsoObject isoObject {
|
||||
get { return _isoObject; }
|
||||
}
|
||||
|
||||
void CheckLayers() {
|
||||
var iso_object_layer = isoObject.gameObject.layer;
|
||||
if ( gameObject.layer != iso_object_layer ) {
|
||||
gameObject.layer = iso_object_layer;
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
CheckLayers();
|
||||
if ( !IsoUtils.Vec3Approximately(_lastPosition, isoObject.position) ) {
|
||||
_lastPosition = transform.position = isoObject.position;
|
||||
} else if ( !IsoUtils.Vec3Approximately(_lastPosition, transform.position) ) {
|
||||
_lastPosition = isoObject.position = transform.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84780b4561da348638be7996e45f96aa
|
||||
timeCreated: 1434281884
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoFakeRigidbody : MonoBehaviour {
|
||||
IsoRigidbody _isoRigidbody = null;
|
||||
|
||||
public IsoFakeRigidbody Init(IsoRigidbody iso_rigidbody) {
|
||||
_isoRigidbody = iso_rigidbody;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IsoRigidbody isoRigidbody {
|
||||
get { return _isoRigidbody; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c68ba79b8c53c4643b17ed586ffbbab8
|
||||
timeCreated: 1436374575
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,26 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoFakeTriggerListener : MonoBehaviour {
|
||||
GameObject _realGameObject = null;
|
||||
|
||||
public IsoFakeTriggerListener Init(IsoTriggerListener iso_listener) {
|
||||
_realGameObject = iso_listener.gameObject;
|
||||
return this;
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider collider) {
|
||||
_realGameObject.SendMessage(
|
||||
"OnIsoTriggerEnter",
|
||||
IsoUtils.IsoConvertCollider(collider),
|
||||
SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider collider) {
|
||||
_realGameObject.SendMessage(
|
||||
"OnIsoTriggerExit",
|
||||
IsoUtils.IsoConvertCollider(collider),
|
||||
SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85a92cf713a8c4da68454e88e803bbce
|
||||
timeCreated: 1461097013
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(IsoObject))]
|
||||
public class IsoPhysicHelper : MonoBehaviour {
|
||||
|
||||
GameObject _isoFakeObject = null;
|
||||
public GameObject isoFakeObject {
|
||||
get { return _isoFakeObject; }
|
||||
}
|
||||
|
||||
void Awake() {
|
||||
hideFlags = HideFlags.HideInInspector;
|
||||
var iso_object = GetComponent<IsoObject>();
|
||||
if ( iso_object ) {
|
||||
_isoFakeObject = new GameObject("_Fake" + gameObject.name);
|
||||
_isoFakeObject.AddComponent<IsoFakeObject>().Init(iso_object);
|
||||
_isoFakeObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.NotEditable;
|
||||
GameObject.DontDestroyOnLoad(_isoFakeObject);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
if ( _isoFakeObject ) {
|
||||
DestroyImmediate(_isoFakeObject);
|
||||
_isoFakeObject = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02be875c33a5b4b2799ff198d4c93806
|
||||
timeCreated: 1434298128
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,25 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public class IsoPhysicHelperHolder : MonoBehaviour {
|
||||
|
||||
static List<IsoPhysicHelperHolder> _tmpHolders = new List<IsoPhysicHelperHolder>(7);
|
||||
|
||||
protected GameObject fakeObject {
|
||||
get { return physicHelper.isoFakeObject; }
|
||||
}
|
||||
|
||||
protected IsoPhysicHelper physicHelper {
|
||||
get { return IsoUtils.GetOrCreateComponent<IsoPhysicHelper>(gameObject); }
|
||||
}
|
||||
|
||||
protected void DestroyUnnecessaryCheck() {
|
||||
GetComponents<IsoPhysicHelperHolder>(_tmpHolders);
|
||||
if ( _tmpHolders.Count == 1 && _tmpHolders[0] == this ) {
|
||||
Destroy(physicHelper);
|
||||
}
|
||||
_tmpHolders.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24e253f6697d448229f535a2e796f72b
|
||||
timeCreated: 1461163442
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user