mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
41 lines
930 B
C#
41 lines
930 B
C#
using UnityEngine;
|
|
|
|
namespace IsoTools.Internal {
|
|
[DisallowMultipleComponent]
|
|
[RequireComponent(typeof(IsoObject))]
|
|
public class IsoPhysicHelper : MonoBehaviour {
|
|
|
|
GameObject _isoFakeObject = null;
|
|
public GameObject isoFakeObject {
|
|
get { return _isoFakeObject; }
|
|
}
|
|
|
|
int _refCounter = 0;
|
|
public void AddRefCounter() {
|
|
++_refCounter;
|
|
}
|
|
public void DropRefCounter() {
|
|
if ( --_refCounter <= 0 ) {
|
|
Destroy(this);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
void OnDestroy() {
|
|
if ( _isoFakeObject ) {
|
|
DestroyImmediate(_isoFakeObject);
|
|
_isoFakeObject = null;
|
|
}
|
|
}
|
|
}
|
|
}
|