mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 09:16:08 +07:00
multiple worlds support done
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IsoTools.Internal {
|
||||
public abstract class IsoBehaviour<T> : MonoBehaviour
|
||||
where T : IsoBehaviour<T>
|
||||
{
|
||||
static IsoAssocList<T> _behaviours = new IsoAssocList<T>();
|
||||
static List<IsoWorld> _tempWorlds = new List<IsoWorld>();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
@@ -16,6 +18,20 @@ namespace IsoTools.Internal {
|
||||
return isActiveAndEnabled && gameObject.activeInHierarchy;
|
||||
}
|
||||
|
||||
protected IsoWorld FindFirstActiveParentWorld() {
|
||||
IsoWorld ret_value = null;
|
||||
GetComponentsInParent<IsoWorld>(false, _tempWorlds);
|
||||
for ( int i = 0, e = _tempWorlds.Count; i < e; ++i ) {
|
||||
var iso_world = _tempWorlds[i];
|
||||
if ( iso_world.IsActive() ) {
|
||||
ret_value = iso_world;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_tempWorlds.Clear();
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
protected static int AllBehaviourCount {
|
||||
get { return _behaviours.Count; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user