public override System.Collections.Generic.IEnumerator<string> Run(Bot bot) { var r = new Random(); var chosenCombo = (from combo in bot.getComboList() where combo.Score > 0 && combo.Type.HasFlag(ComboType.GROUND) orderby combo.Score descending select combo).Take(5); if (chosenCombo.Count() == 0) { _reason = "No combos?"; yield break; } var c = chosenCombo.ElementAt(r.Next(chosenCombo.Count())); var timer = 0; while(Math.Abs(bot.myState.XDistance) > c.XMax || bot.enemyState.ActiveCancelLists.Contains("REVERSAL") || bot.enemyState.ScriptName.Contains("UPWARD")) { bot.pressButton("6"); if (timer++ > 10) { _reason = "Rerolling"; yield break; } yield return "Getting in range"+timer; } var substate = new SequenceState(c.Input); while(!substate.isFinished()) yield return substate.Process(bot); }
public override void Dock(Actor dockableActor, Dockable dockable, Actor dockActor, Dock dock) { isDocking = true; Setup(dockableActor, dockable, dockActor, dock); QueueChild(new Move(dockableActor, dockEntry, WDist.Zero)); state = SequenceState.Move; }
public bool ValidateDataBlock(IDataBlockBuilder dataBlockBuilder, long startOffset, long endOffset) { if (!IsValidResult()) { return(false); } dataBlockBuilder.DataFormat = _state.IsMpeg2() ? CodecID.Mpeg2Video : CodecID.Mpeg1Video; dataBlockBuilder.IsFullFile = IsFullFile(); dataBlockBuilder.IsFragmented = _state.IsFragmented; // Trim zero byte stuffing from last header (if any) if (_state.LastHeaderZeroByteStuffing > 0) { dataBlockBuilder.EndOffset = endOffset - _state.LastHeaderZeroByteStuffing; } if (_state.ReferenceHeader != null) { dataBlockBuilder.ReferenceHeaderOffset = _state.ReferenceHeaderPosition - startOffset; dataBlockBuilder.ReferenceHeader = _state.ReferenceHeader; } if (_state.Sequence.Initialized) { var sequenceState = new SequenceState(); _state.Sequence.CopyTo(sequenceState); _scanContext.ReferenceHeader = sequenceState; } return(true); }
public RuntimeStatusInfo(SessionStateHandle stateHandle, ulong statusIndex, List <string> failedInfos, IDictionary <IVariable, string> watchDatas) { this.Properties = new SerializableMap <string, object>(Constants.DefaultRuntimeSize); this.SessionId = stateHandle.Session; this.CallStacks = new List <ICallStack>(stateHandle.SequenceCount); this.SequenceState = new List <RuntimeState>(stateHandle.SequenceCount); this.StatusIndex = statusIndex; this.StartGenTime = stateHandle.StartGenTime; this.EndGenTime = stateHandle.EndGenTime; this.StartTime = stateHandle.StartTime; this.ElapsedTime = stateHandle.ElapsedTime; this.CurrentTime = stateHandle.CurrentTime; if (null != stateHandle.Performance) { this.MemoryUsed = stateHandle.Performance.MemoryUsed; this.MemoryAllocated = stateHandle.Performance.MemoryAllocated; this.ProcessorTime = stateHandle.Performance.ProcessorTime; } this.State = stateHandle.State; for (int i = 0; i < stateHandle.SequenceCount; i++) { CallStacks.Add(stateHandle[i].RunStack); SequenceState.Add(stateHandle[i].State); } this.FailedInfos = failedInfos; this.WatchDatas = watchDatas; }
public virtual void Init() { currentState = SequenceState.Idle; Button[] shortcutButt = TutoManager.s_instance.shortcutButton.GetComponentsInChildren <Button>(); ColorBlock cb; foreach (Button b in shortcutButt) { cb = b.colors; cb.disabledColor = Color.white; b.colors = cb; b.interactable = false; } Button endTurnButt = TutoManager.s_instance.endTurnButton.GetComponentInChildren <Button>(); cb = endTurnButt.colors; cb.disabledColor = Color.white; endTurnButt.colors = cb; endTurnButt.interactable = false; foreach (Button b in GameManager.Instance.Ui.GoActionPanelQ.GetComponentsInChildren <Button>()) { cb = b.colors; cb.disabledColor = Color.white; b.colors = cb; b.interactable = false; } }
public IEnumerator Sequence() { sequenceState = SequenceState.ProgressingOngoingTasks; ClearTaskRoutines(); List <QuestsTrackerTask> visibleTasks = new List <QuestsTrackerTask>(); List <QuestsTrackerTask> newTasks = new List <QuestsTrackerTask>(); foreach (QuestsTrackerTask task in taskEntries.Values) { if (task.gameObject.activeSelf) { visibleTasks.Add(task); } else { newTasks.Add(task); } } //Progress of currently visible tasks for (int i = 0; i < visibleTasks.Count; i++) { tasksRoutines.Add(StartCoroutine(visibleTasks[i].ProgressAndCompleteSequence())); } yield return(WaitForTaskRoutines()); OnLayoutRebuildRequested?.Invoke(); sequenceState = SequenceState.ShowingNewTasks; //Play "new task" sound if (newTasks.Count > 0) { newTaskAudioEvent.Play(); } //Show and progress of new tasks for (int i = 0; i < newTasks.Count; i++) { newTasks[i].gameObject.SetActive(true); newTasks[i].SetIsNew(true); tasksRoutines.Add(StartCoroutine(newTasks[i].ProgressAndCompleteSequence())); } OnLayoutRebuildRequested?.Invoke(); yield return(WaitForTaskRoutines()); if (taskEntries.Count == 0) { animator.SetTrigger(ANIMATION_TRIGGER_OUT); yield return(WaitForSecondsCache.Get(0.5f)); Destroy(gameObject); OnDestroyed?.Invoke(section.id); } sequenceState = SequenceState.Finished; }
// start level public void StartLevel() { player.startup = true; GetComponent <LevelAudio>().PlayMusicBgm(); sequenceState = SequenceState.None; BeginTeleportIn(); }
void GotoState(SequenceState state) { switch (state) { case SequenceState.SHOWING_DIALOG: controller = leftController; switch (curSequence.dialogType) { case DialogStructure.LEFT: controller = leftController; break; case DialogStructure.RIGHT: controller = rightController; break; } controller.Initialize(curSequence); controller.ShowDialog(() => { GotoState(SequenceState.PRINTING); }); break; case SequenceState.PRINTING: curSequenceCharacterIndex = 0; timeSinceCharAdded = 0; controller.DialogTextArea.text = ""; // Clear the text for printing scrollSpeed = curSequence.scrollSpeed; curSequence.OnSequenceStart(); controller.PlayPortraitEmotionAnim(curSequence.emotionState); break; case SequenceState.PRINTING_FAST: scrollSpeed *= 2; // Double the scroll speed for fast printing break; case SequenceState.WAITING_FOR_PROMPT: elapsedAdvanceWaitTime = 0.0f; break; case SequenceState.HIDING_DIALOG: controller.DialogTextArea.text = ""; // Clear the text before hiding controller.HideDialog(() => { curSequence.OnSequenceEnd(); GotoState(SequenceState.SHOWING_DIALOG); }); break; case SequenceState.FINISHED: controller.DialogTextArea.text = ""; // Clear the text before hiding controller.HideDialog(() => { CompleteNarrativeSequence(); }); break; } curState = state; }
void Update() { time_ms += Time.deltaTime; deadzoneTime_ms += Time.deltaTime; Debug.Log("sequenceState: " + System.Enum.GetName(typeof(SequenceState), sequenceState)); if (sequenceState == SequenceState.Playing) { sequenceWindowClosure = SequenceWindowClosure.Open; sequenceTime_ms += Time.deltaTime; timeSinceLastPress_ms += Time.deltaTime; // If we have enough keys to assess whether the sequence can be validated, do so. if (currentKeySequenceLogs["Event"].Count == keysToPress.GetLength(0)) { sequenceWindowClosure = SequenceWindowClosure.ClosedByInputThreshold; SequenceData sequenceData = CheckCapturedKeys(); InputData inputData = new InputData(); inputData.validity = InputValidity.Rejected; inputData.confidence = 0; inputData.inputNumber = sequenceData.sequenceNumber; inputData.type = InputType.KeySequence; if (sequenceData.sequenceValidity == SequenceValidity.Accepted) { inputData.validity = InputValidity.Accepted; inputData.confidence = 1; } //if (state == SequenceValidity.Accepted) { onKeySequenceFinished.Invoke(sequenceData, inputData); onInputFinished.Invoke(inputData); //} sequenceState = SequenceState.Stopped; } else if (deadzoneTime_ms > deadzoneTimeLimit_ms) { sequenceWindowClosure = SequenceWindowClosure.ClosedByDeadzone; Debug.Log("No key pressed for " + deadzoneTimeLimit_ms + "seconds, sequence stopped."); SequenceData sequenceData = CheckCapturedKeys(); InputData inputData = new InputData(); inputData.validity = InputValidity.Rejected; inputData.confidence = 0; inputData.inputNumber = sequenceData.sequenceNumber; inputData.type = InputType.KeySequence; //if (state == SequenceValidity.Accepted) { onKeySequenceFinished.Invoke(sequenceData, inputData); onInputFinished.Invoke(inputData); //} sequenceState = SequenceState.Stopped; } } else { sequenceTime_ms = 0f; timeSinceLastPress_ms = 0f; } }
public SequenceState FindSequenceByName(string name) { SequenceState state = SequenceStates.FirstOrDefault(s => s.Name == name); if (state == default(SequenceState)) { string message = string.Format("Sequence Manager has no thread named {0}.", name); DebugMessage(message, DebuggableBehavior.LogLevel.LogicError); } return(state); }
void Thread_Run() { while (true) { // 상태 값 체크 switch (MainSequenceState) { case SequenceState.Init: // 하드웨어 설정 및 좌표계 생성, 모션 초기화 if (Control_Coordinate.IsSetAllHardWare) { MainSequenceState = SequenceState.Ready; nTicktime = 0; sw.Restart(); } break; case SequenceState.Ready: // 모션 생성 Control_Coordinate.CalculateNextStepMotion(nTicktime, nCycleTime); InitializeTickTime(); if (Control_Coordinate.IsMakeAllProfile) { MainSequenceState = SequenceState.Processing; nTicktime = 0; sw.Stop(); Console.WriteLine("Time: " + sw.ElapsedMilliseconds.ToString() + "msec"); } break; case SequenceState.Processing: if (false == Control_Coordinate.IsSetAllHardWare) { MainSequenceState = SequenceState.Init; } break; case SequenceState.Done: break; } // 1. input // 2. process 진행 // 3. output Thread.Sleep(1); } }
public override System.Collections.Generic.IEnumerator<string> Run(Bot bot) { while(Math.Abs(bot.myState.XDistance) > 1) { bot.pressButton("6"); yield return "Getting in range"; } if(!bot.enemyState.ActiveCancelLists.Contains("REVERSAL")) { var substate = new SequenceState("1LP.W18.*2HP.2MPHP.W10.6.2.3HP"); while(!substate.isFinished()) yield return substate.Process(bot); } yield break; }
public override System.Collections.Generic.IEnumerator <string> Run(Bot bot) { var chosenCombo = (from combo in bot.getComboList() where combo.Score >= 100 orderby combo.Score descending select combo).Take(1); var c = chosenCombo.First(); var substate = new SequenceState(c.Input); while (!substate.isFinished()) { yield return(substate.Process(bot)); } }
public void IncrementSequence(string name, int amount = 1) { SequenceState state = SequenceStates.FirstOrDefault(s => s.Name == name); if (state == default(SequenceState)) { string message = string.Format("Sequence Manager has no thread named {0}. Creating and initializing it.", name); DebugMessage(message, DebuggableBehavior.LogLevel.Warning); state = new SequenceState { Name = name, Counter = 0 }; } state.Counter++; DebugMessage("Raised thread " + name + " to state #" + state.Counter); }
public override IEnumerator <string> Run(Bot bot) { var timer = 0; while (Math.Abs(bot.myState.XDistance) > combo.XMax || bot.enemyState.ActiveCancelLists.Contains("REVERSAL") || bot.enemyState.ScriptName.Contains("UPWARD")) { bot.pressButton("6"); yield return("Getting in range"); } var substate = new SequenceState(combo.Input); while (!substate.isFinished()) { yield return(substate.Process(bot)); } }
public override System.Collections.Generic.IEnumerator <string> Run(Bot bot) { while (Math.Abs(bot.myState.XDistance) > 1) { bot.pressButton("6"); yield return("Getting in range"); } if (!bot.enemyState.ActiveCancelLists.Contains("REVERSAL")) { var substate = new SequenceState("1LP.W18.*2HP.2MPHP.W10.6.2.3HP"); while (!substate.isFinished()) { yield return(substate.Process(bot)); } } yield break; }
private void UpdateState() { var current = Config.Sequence[_sequenceIndex]; var ticks = Environment.TickCount; if (_state == SequenceState.Hold && ticks - _stateStart > current.HoldTime) { _sequenceIndex = (_sequenceIndex + 1) % Config.Sequence.Count; _state = SequenceState.Transition; _stateStart = ticks; } else if (_state == SequenceState.Transition && ticks - _stateStart > current.TransitionTime) { _state = SequenceState.Hold; _stateStart = ticks; } }
public void SwithiPanel() { var rectTrans = GetComponent <RectTransform>(); var subSequence = DOTween.Sequence(); // 呼び出しで強制呼び出しモード() if (_state == SequenceState.STAY_HIDE) { subSequence.Append(rectTrans.DOAnchorPosX(_showPos_x, _duration)); subSequence.AppendCallback(() => { _state = SequenceState.LOCKED_SHOW; }); } if (_state == SequenceState.LOCKED_SHOW) { subSequence.Append(rectTrans.DOAnchorPosX(_hidePos_x, _duration)); subSequence.AppendCallback(() => { _state = SequenceState.STAY_HIDE; }); } }
void Start() { var rectTrans = GetComponent <RectTransform>(); var stock = GetComponent <SlimeStock>(); // スライムを吸引したときの処理 _sequence = DOTween.Sequence(); _sequence.Append(rectTrans.DOAnchorPosX(_showPos_x, _duration)); _sequence.AppendCallback(() => { _state = SequenceState.STAY_SHOW; }); _sequence.AppendInterval(_duration * 3); _sequence.AppendCallback(() => { _state = SequenceState.MOVE_LEFT; }); _sequence.Append(rectTrans.DOAnchorPosX(_hidePos_x, _duration)); _sequence.AppendCallback(() => { _state = SequenceState.STAY_HIDE; }); _sequence.SetAutoKill(false); _sequence.Pause(); rectTrans.anchoredPosition = new Vector2(rectTrans.anchoredPosition.x, rectTrans.anchoredPosition.y); // スライムが増減した時 stock.ObserveEveryValueChanged(x => x.GetSlimeAmount()) .Skip(1) .DistinctUntilChanged() .Subscribe(_stock => { // テキストコンポーネントを取得し、スライムの数を入れる foreach (var slime in stock.SlimeStockList) { var image = transform.Find(slime.Key.name.ToString()); var text = image.Find("Num").GetComponent <Text>(); text.text = "× " + slime.Value.ToString(); _oldAmmount = stock.GetSlimeAmount(); } // 隠れているときだけポップ表示ON if (_state == SequenceState.STAY_HIDE || _state == SequenceState.MOVE_LEFT) { _sequence.Restart(); _state = SequenceState.MOVE_RIGHT; } }); }
public override bool Tick(Actor self) { if (state == SequenceState.Move) { if (shouldCancel) { return(true); } if ((dockableActor.World.Map.CellContaining(dockableActor.CenterPosition) - dockEntry).Length != 0) { QueueChild(new Move(dockableActor, dockEntry, WDist.Zero)); } else { QueueChild(new Turn(dockableActor, dock.Info.Facing)); state = SequenceState.Turn; } return(false); } if (state == SequenceState.Turn) { if (shouldCancel) { return(true); } QueueChild(new Drag(dockableActor, dockableActor.World.Map.CenterOfCell(dockEntry), dockTarget, distance / speed)); state = SequenceState.Drag; return(false); } if (state == SequenceState.Drag) { state = SequenceState.Done; return(false); } return(true); }
public override System.Collections.Generic.IEnumerator <string> Run(Bot bot) { var chosenCombo = (from combo in bot.getComboList() where combo.Score >= 100 && combo.Type.HasFlag(ComboType.STUFF) orderby combo.Score descending select combo).ToList(); if (chosenCombo.Count() == 0) { yield break; } var c = chosenCombo.First(); var substate = new SequenceState(c.Input); while (!substate.isFinished()) { yield return(substate.Process(bot)); } }
public void Populate(QuestSection newSection) { sequenceState = SequenceState.NotStarted; ClearTaskRoutines(); section = newSection; QuestTask[] allTasks = section.tasks; titleContainer.SetActive(!string.IsNullOrEmpty(section.name)); sectionTitle.text = section.name; bool hasCompletedTasksToShow = false; List <string> entriesToRemove = taskEntries.Keys.ToList(); for (int index = 0; index < allTasks.Length; index++) { QuestTask task = allTasks[index]; //We only show completed quests that has been just completed to show the progress if (!taskEntries.ContainsKey(task.id) && (task.status == QuestsLiterals.Status.BLOCKED || (task.progress >= 1 && !task.justProgressed))) { continue; } entriesToRemove.Remove(task.id); if (!taskEntries.TryGetValue(task.id, out QuestsTrackerTask taskEntry)) { taskEntry = CreateTask(); //New tasks are invisible taskEntry.gameObject.SetActive(!task.justUnlocked); taskEntries.Add(task.id, taskEntry); } taskEntry.Populate(task); taskEntry.transform.SetSiblingIndex(index); } for (int index = 0; index < entriesToRemove.Count; index++) { DestroyTaskEntry(entriesToRemove[index]); } OnLayoutRebuildRequested?.Invoke(); }
public RuntimeStatusInfo(SessionStateHandle stateHandle, ulong statusIndex, Dictionary <int, string> failedInfos, IDictionary <IVariable, string> watchDatas, PerformanceData performance, Dictionary <ICallStack, StepResult> stepResults) { this.Properties = new SerializableMap <string, object>(Constants.DefaultRuntimeSize); this.SessionId = stateHandle.Session; this.CallStacks = new List <ICallStack>(stateHandle.SequenceCount); this.SequenceState = new List <RuntimeState>(stateHandle.SequenceCount); this.StatusIndex = statusIndex; this.StartGenTime = stateHandle.StartGenTime; this.EndGenTime = stateHandle.EndGenTime; this.StartTime = stateHandle.StartTime; this.ElapsedTime = stateHandle.ElapsedTime; this.CurrentTime = stateHandle.CurrentTime; if (null != performance) { this.MemoryUsed = performance.MemoryUsed; this.MemoryAllocated = performance.MemoryAllocated; this.ProcessorTime = performance.ProcessorTime; } this.State = stateHandle.State; foreach (int sequenceIndex in stateHandle.SequenceIndexes) { CallStacks.Add(stateHandle[sequenceIndex].RunStack); SequenceState.Add(stateHandle[sequenceIndex].State); } if (null != failedInfos) { this.FailedInfos = new Dictionary <int, IFailedInfo>(failedInfos.Count); foreach (KeyValuePair <int, string> keyValuePair in failedInfos) { this.FailedInfos.Add(keyValuePair.Key, new FailedInfo(keyValuePair.Value)); } } StepResults = stepResults; this.WatchDatas = watchDatas; }
void OnGUI() { Event e = Event.current; if (e == null) { return; } if (e.isKey) { if (e.keyCode == KeyCode.None) { return; } if (Event.current.type == EventType.KeyDown) { if (e.keyCode == lastKey || e.keyCode == lastKey2) { // If we detect a new key, but its the same as the previous key, then discard it. return; } Debug.Log("Key is " + e.keyCode.ToString()); // TODO: Log EventType.KeyUp too Debug.Log("Detected key code: " + e.keyCode + " time:" + time_ms); currentKeySequenceLogs["Date"].Add(System.DateTime.Now.ToString("yyyy-MM-dd")); currentKeySequenceLogs["Timestamp"].Add(System.DateTime.Now.ToString("HH:mm:ss.ffff")); currentKeySequenceLogs["Event"].Add("KeyDown"); currentKeySequenceLogs["KeyCode"].Add(e.keyCode.ToString()); currentKeySequenceLogs["SequenceTime_ms"].Add(sequenceTime_ms.ToString()); currentKeySequenceLogs["TimeSinceLastKey_ms"].Add(timeSinceLastPress_ms.ToString()); timeSinceLastPress_ms = 0f; sequenceState = SequenceState.Playing; deadzoneTime_ms = 0f; lastKey2 = lastKey; lastKey = e.keyCode; onKeyDown.Invoke(e.keyCode); } } }
public override System.Collections.Generic.IEnumerator <string> Run(Bot bot) { var r = new Random(); var chosenCombo = (from combo in bot.getComboList() where combo.Score > 0 && combo.Type.HasFlag(ComboType.GROUND) orderby combo.Score descending select combo).Take(5); if (chosenCombo.Count() == 0) { _reason = "No combos?"; yield break; } var c = chosenCombo.ElementAt(r.Next(chosenCombo.Count())); var timer = 0; while (Math.Abs(bot.myState.XDistance) > c.XMax || bot.enemyState.ActiveCancelLists.Contains("REVERSAL") || bot.enemyState.ScriptName.Contains("UPWARD")) { bot.pressButton("6"); if (timer++ > 10) { _reason = "Rerolling"; yield break; } yield return("Getting in range" + timer); } var substate = new SequenceState(c.Input); while (!substate.isFinished()) { yield return(substate.Process(bot)); } }
private void LateUpdate() { var playerAnimator = player.GetComponent <Animator>(); switch (sequenceState) { case SequenceState.TeleportIn: if (player.obstacleDetector.collisions.below) { player.morphing = true; sequenceState = SequenceState.MorphIn; } else { player.frozen = true; player.teleporting = true; player.morphing = false; } break; case SequenceState.MorphIn: { var info = playerAnimator.GetCurrentAnimatorClipInfo(0); var clipLength = info[0].clip.length; var coroutine = MorphInEndRoutine(clipLength); StartCoroutine(coroutine); sequenceState = SequenceState.None; } break; } }
public bool Command(Command c) { SequenceState newState = SequenceState.PAUSED; switch (c) { case global::Command.NONE: return(false); case global::Command.PLAY: newState = SequenceState.PLAYING; break; case global::Command.PAUSE: newState = SequenceState.PAUSED; break; case global::Command.STOP: newState = SequenceState.STOPPED; break; default: throw new ArgumentOutOfRangeException(nameof(c), c, null); } if (newState == state) { return(false); } switch (newState) { case SequenceState.STOPPED: if (loop != null) { StopCoroutine(loop); currentTime = startTime; } break; case SequenceState.PLAYING: if (state == SequenceState.PAUSED) { break; } loop = StartCoroutine(Loop()); break; case SequenceState.PAUSED: if (loop != null) { StopCoroutine(loop); } break; default: throw new ArgumentOutOfRangeException(nameof(newState), newState, null); } state = newState; return(true); }
public ColorSequenceEffect(ColorSequenceEffectConfig config) : base(config) { _state = SequenceState.Hold; _stateStart = Environment.TickCount; _sequenceIndex = 0; }
public override IEnumerator<string> Run(Bot bot) { var timer = 0; while (Math.Abs(bot.myState.XDistance) > combo.XMax || bot.enemyState.ActiveCancelLists.Contains("REVERSAL") || bot.enemyState.ScriptName.Contains("UPWARD")) { bot.pressButton("6"); yield return "Getting in range"; } var substate = new SequenceState(combo.Input); while (!substate.isFinished()) yield return substate.Process(bot); }
void BeginTeleportIn() { sequenceState = SequenceState.TeleportIn; StartCoroutine(TeleportInRoutine()); }
private void InitMachine() { Log.Info("InitMachine"); // if (saveLoadWinPos == null) // saveLoadWinPos = new SaveLoadWinPos(); // Create the states initial = new InitialState("Init", _machine); settings = new SettingState("Settings", _machine); sequence = new SequenceState("Sequence", _machine); launch = new LaunchState("Launch", _machine); launched = new LaunchedState("Launched", _machine); finish = new KFSMState("Finish"); // Add events to the states var go2Finish = new KFSMEvent("Finish") { GoToStateOnEvent = finish, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; var go2Settings = new KFSMEvent("Settings") { GoToStateOnEvent = settings, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; initial.AddEvent(go2Settings); var go2Init = new KFSMEvent("Init") { GoToStateOnEvent = initial, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; settings.AddEvent(go2Init); sequence.AddEvent(go2Init); finish.AddEvent(go2Init); var go2Sequence = new KFSMEvent("Sequence") { GoToStateOnEvent = sequence, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; initial.AddEvent(go2Sequence); var go2Launch = new KFSMEvent("Launch") { GoToStateOnEvent = launch, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; initial.AddEvent(go2Launch); launch.AddEvent(go2Init); launch.AddEvent(go2Finish); var go2Launched = new KFSMEvent("Launched") { GoToStateOnEvent = launched, updateMode = KFSMUpdateMode.MANUAL_TRIGGER }; launch.AddEvent(go2Launched); initial.AddEvent(go2Finish); launched.AddEvent(go2Finish); // Add states to the state machine _machine.AddState(initial); _machine.AddState(settings); _machine.AddState(sequence); _machine.AddState(launch); _machine.AddState(finish); }
/// <summary> /// /// </summary> public void NextStep() { State = SequenceState.Pause; m_UpdateOnlyOneStep = true; m_IsOnPause = true; }
/// <summary> /// /// </summary> public void Resume() { State = SequenceState.Running; m_UpdateOnlyOneStep = false; m_IsOnPause = false; m_MustStop = false; if (m_LastExecution != null) { m_LastExecution.Slot.Node.IsProcessing = false; } }
/// <summary> /// /// </summary> public void Pause() { State = SequenceState.Pause; m_IsOnPause = true; }
/// <summary> /// /// </summary> public void Stop() { State = SequenceState.Stop; m_MustStop = true; m_IsOnPause = false; m_UpdateOnlyOneStep = false; }
/// <summary> /// /// </summary> private void ProcessLoop(bool sleep_ = true) { bool processing = true; while (processing == true && m_MustStop == false) { if (m_IsOnPause == false) { processing = DoOneStep(); if (processing == true) { State = SequenceState.Running; } } else if (m_UpdateOnlyOneStep == true) { m_UpdateOnlyOneStep = false; processing = DoOneStep(); if (processing == true) { State = SequenceState.Pause; } } if (sleep_ == true) { // Do sleep else all WPF bindings will block the UI thread // 5ms else the UI is not enough responsive System.Threading.Thread.Sleep(5); } }; State = SequenceState.Stop; m_LastExecution = null; foreach (ProcessingContext c in m_CallStacks) { c.SequenceBase.ResetNodes(); } }
public override void Undock(Actor dockableActor, Dockable dockable, Actor dockActor, Dock dock) { Setup(dockableActor, dockable, dockActor, dock); QueueChild(new Drag(dockableActor, dockTarget, dockableActor.World.Map.CenterOfCell(dockEntry), distance / speed)); state = SequenceState.Drag; }
public override System.Collections.Generic.IEnumerator<string> Run(Bot bot) { var chosenCombo = (from combo in bot.getComboList() where combo.Score >= 100 orderby combo.Score descending select combo).Take(1); var c = chosenCombo.First(); var substate = new SequenceState(c.Input); while(!substate.isFinished()) yield return substate.Process(bot); }
public override System.Collections.Generic.IEnumerator<string> Run(Bot bot) { var chosenCombo = (from combo in bot.getComboList() where combo.Score >= 100 && combo.Type.HasFlag(ComboType.STUFF) orderby combo.Score descending select combo).ToList(); if (chosenCombo.Count() == 0) { yield break; } var c = chosenCombo.First(); var substate = new SequenceState(c.Input); while (!substate.isFinished()) yield return substate.Process(bot); }