|
|
|
@ -13,12 +13,29 @@ namespace Fungus
|
|
|
|
|
[Tooltip("A list of gameobjects containing collider components to be set active / inactive")] |
|
|
|
|
public List<GameObject> targetObjects = new List<GameObject>(); |
|
|
|
|
|
|
|
|
|
[Tooltip("All objects with this tag will have their collider set active / inactive")] |
|
|
|
|
public string targetTag; |
|
|
|
|
|
|
|
|
|
[Tooltip("Set to true to enable the collider components")] |
|
|
|
|
public BooleanData activeState; |
|
|
|
|
|
|
|
|
|
public override void OnEnter() |
|
|
|
|
{ |
|
|
|
|
foreach (GameObject go in targetObjects) |
|
|
|
|
{ |
|
|
|
|
SetColliderActive(go); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GameObject[] taggedObjects = GameObject.FindGameObjectsWithTag(targetTag); |
|
|
|
|
foreach (GameObject go in taggedObjects) |
|
|
|
|
{ |
|
|
|
|
SetColliderActive(go); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void SetColliderActive(GameObject go) |
|
|
|
|
{ |
|
|
|
|
if (go != null) |
|
|
|
|
{ |
|
|
|
@ -36,18 +53,18 @@ namespace Fungus
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSummary() |
|
|
|
|
{ |
|
|
|
|
int count = targetObjects.Count; |
|
|
|
|
count += GameObject.FindGameObjectsWithTag(targetTag).Length; |
|
|
|
|
|
|
|
|
|
if (activeState.Value) |
|
|
|
|
{ |
|
|
|
|
return "Enable " + targetObjects.Count + " collider objects."; |
|
|
|
|
return "Enable " + count + " collider objects."; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return "Disable " + targetObjects.Count + " collider objects."; |
|
|
|
|
return "Disable " + count + " collider objects."; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|