/// <summary> /// <see cref="Ricordanza.Core.Behaviors.IBehavior"/>を実行します。 /// </summary> /// <param name="behavior">実行したい<see cref="Ricordanza.Core.Behaviors.IBehavior"/></param> public static void Execute(IBehavior behavior) { if (behavior == null) return; try { // 初期化処理の実行 behavior.Initalize(); // メイン処理の実行 behavior.Invoke(); } finally { // 終了処理の実行 behavior.Terminate(); } }
/// <summary> /// Stop the <paramref name="behavior"/>. /// </summary> /// <param name="behavior">The <see cref="IBehavior"/> we want to stop.</param> /// <param name="status">The status to stop the behavior with.</param> public void StopBehaviour(IBehavior behavior, Behavior.Status status) { behavior.Terminate(status); _activeBehaviors.Remove(behavior); }