multiple worlds support done

This commit is contained in:
2016-12-19 02:30:30 +07:00
parent c5084b1596
commit 236e72d879
12 changed files with 2767 additions and 636 deletions

View File

@@ -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; }
}