You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
|
|
namespace Fungus.Examples |
|
{ |
|
public class FPDemoPriorityRouter : MonoBehaviour |
|
{ |
|
public Behaviour[] componentEnabledOutsideFungusPriority; |
|
public Behaviour[] componentEnabledInsideFungusPriority; |
|
|
|
void OnEnable() |
|
{ |
|
Fungus.FungusPrioritySignals.OnFungusPriorityStart += FungusPrioritySignals_OnFungusPriorityStart; |
|
Fungus.FungusPrioritySignals.OnFungusPriorityEnd += FungusPrioritySignals_OnFungusPriorityEnd; |
|
} |
|
|
|
void OnDisable() |
|
{ |
|
Fungus.FungusPrioritySignals.OnFungusPriorityStart -= FungusPrioritySignals_OnFungusPriorityStart; |
|
Fungus.FungusPrioritySignals.OnFungusPriorityEnd -= FungusPrioritySignals_OnFungusPriorityEnd; |
|
} |
|
|
|
private void FungusPrioritySignals_OnFungusPriorityEnd() |
|
{ |
|
foreach (var item in componentEnabledOutsideFungusPriority) |
|
{ |
|
item.enabled = true; |
|
} |
|
foreach (var item in componentEnabledInsideFungusPriority) |
|
{ |
|
item.enabled = false; |
|
} |
|
} |
|
|
|
private void FungusPrioritySignals_OnFungusPriorityStart() |
|
{ |
|
foreach (var item in componentEnabledOutsideFungusPriority) |
|
{ |
|
item.enabled = false; |
|
} |
|
foreach (var item in componentEnabledInsideFungusPriority) |
|
{ |
|
item.enabled = true; |
|
} |
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
} |
|
} |