public EnemyProcesser(Enemy enemy, EnemyActionBehaviourData actionData) { _ManagerList = new List <IProcesserManager> (); for (int i = 0; i < actionData.EnemyActionData.Count(); i++) { var data = actionData.EnemyActionData.ElementAt(i); var manager = new EnemyProcesserManager(enemy, actionData.EnemyActionData.Skip(i).Take(1).Select(_data => _data.ActionData)); _ManagerList.Add(manager); if (data.LoopIndex.LoopCount != 0) { if (data.LoopIndex.InfinitLoop) { var infManager = new InfiniteLoopManager(enemy, data.LoopIndex, actionData); _ManagerList.Add(infManager); break; } var repManager = new RepeatManager(enemy, data.LoopIndex, actionData); _ManagerList.Add(repManager); continue; } } _Manager = _ManagerList.GetEnumerator(); _Manager.MoveNext(); _OnComlete(enemy); }
private void _OnComplete() { _Manager.CompleteAsObservable() .Subscribe(_ => { _Manager = new RepeatManager(_Enemy, _Index, _Data); _OnComplete(); }); }
public InfiniteLoopManager(Enemy enemy, LoopIndex index, EnemyActionBehaviourData data) { _Enemy = enemy; _CompleteObserver = new Subject <Unit> (); _Index = index; _Data = data; _Manager = new RepeatManager(enemy, index, data); _OnComplete(); }