mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
fix disabled iso object bug
This commit is contained in:
@@ -208,24 +208,20 @@ namespace IsoTools {
|
||||
IsoWorld _isoWorld = null;
|
||||
public IsoWorld isoWorld {
|
||||
get {
|
||||
if ( (object)_isoWorld == null ) {
|
||||
if ( !_isoWorld ) {
|
||||
_isoWorld = GameObject.FindObjectOfType<IsoWorld>();
|
||||
}
|
||||
return _isoWorld;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetWorld() {
|
||||
_isoWorld = null;
|
||||
}
|
||||
|
||||
public void FixTransform() {
|
||||
#if UNITY_EDITOR
|
||||
if ( !Application.isPlaying && isAlignment ) {
|
||||
_position = tilePosition;
|
||||
}
|
||||
#endif
|
||||
if ( (object)isoWorld != null ) {
|
||||
if ( isoWorld ) {
|
||||
transform.position = IsoUtils.Vec3ChangeZ(
|
||||
isoWorld.IsoToScreen(position),
|
||||
transform.position.z);
|
||||
@@ -235,7 +231,7 @@ namespace IsoTools {
|
||||
}
|
||||
|
||||
public void FixIsoPosition() {
|
||||
if ( (object)isoWorld != null ) {
|
||||
if ( isoWorld ) {
|
||||
position = isoWorld.ScreenToIso(
|
||||
transform.position,
|
||||
positionZ);
|
||||
@@ -251,7 +247,7 @@ namespace IsoTools {
|
||||
}
|
||||
|
||||
void MartDirtyIsoWorld() {
|
||||
if ( (object)isoWorld != null ) {
|
||||
if ( isoWorld ) {
|
||||
isoWorld.MarkDirty(this);
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
@@ -275,14 +271,14 @@ namespace IsoTools {
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
if ( (object)isoWorld != null ) {
|
||||
if ( isoWorld ) {
|
||||
isoWorld.AddIsoObject(this);
|
||||
}
|
||||
MartDirtyIsoWorld();
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
if ( (object)isoWorld != null ) {
|
||||
if ( isoWorld ) {
|
||||
isoWorld.RemoveIsoObject(this);
|
||||
}
|
||||
}
|
||||
@@ -299,7 +295,7 @@ namespace IsoTools {
|
||||
}
|
||||
|
||||
void OnDrawGizmos() {
|
||||
if ( isShowBounds && (object)isoWorld != null ) {
|
||||
if ( isShowBounds && isoWorld ) {
|
||||
IsoUtils.DrawCube(isoWorld, position + size * 0.5f, size, Color.red);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user