public void DecideAndQueueAction() { if (!this.IsActive) { return; } foreach (var beh in AIBehaviors.GetComponents <AIBehavior>()) { if (beh == activeBehavior) { if (beh.ShouldDeactivate()) { continue; } else { break; } } if (beh.ShouldActivate()) { Debug.LogFormat("[{0}] ({1}) activated", this.Name, beh.GetType().Name); activeBehavior = beh; break; } } Debug.LogFormat("[{0}] ({1}) deciding", this.Name, activeBehavior.GetType().Name); activeBehavior.DecideAndQueueAction(); }