internal void OnUpdate(out AtsHandles vehicleOperations, AtsVehicleState vehicleState, IntPtr panelArray, IntPtr soundArray) { PanelOperations.SetSource(panelArray); SoundOperations.SetSource(soundArray); LastStates.CopyFrom(CurrentStates); if (WasJustInitialized) { LastStates.SetVehicleState(vehicleState); } CurrentStates.SetVehicleState(vehicleState); this.UpdateVelocityFromDeltaLocation(); ControlHandle.Update(); foreach (var behaviour in BehaviourArray) { behaviour.Update(); } LastKeyStates.CopyFrom(CurrentKeyStates); vehicleOperations = ControlHandle.Operation; WasJustInitialized = false; }
/// <summary> /// Päivittää stateja /// </summary> public void Update() { foreach (ButtonProvider cacher in Cachers) { cacher.Update(); } OldStates = (GamePadState[])CurrentStates.Clone(); GetNewState(); }
/// <summary> /// Add new state, this method check if the /// state <see cref="T"/> exists, if not /// add the state. /// </summary> /// <param name="state"></param> public void AddState(NfaState <Q> state) { if (!IsExists(state.Id)) { if (state.StateType == StateType.StartState) { CurrentStates.Add(state); } States.Add(state); } }
public void PaintStates() { var mood = CalculateStatesMood(); float?mostNegative = mood.Values.Min(); float?mostPositive = mood.Values.Max(); for (int i = 0; i < CurrentStates.Count(); i++) { PaitPolygons(CurrentStates[i], GetColor(CurrentStates[i].weight /*, mostNegative, mostPositive*/)); } }
private void PopChoice() { CurrentStates[0].ClearState(); CurrentStates.Clear(); if (_statesStack.Count == 0) { throw new Exception("Choice stack is empty. Unable to fallback to another state."); } StateMemento memento = _statesStack.Pop(); _inx = memento.TokenIndex; _move = memento.Move + 1; CurrentStates.Add(memento.State); }
internal void OnDoorStateChanged(bool isClosed) { if (isClosed) { CurrentStates.SetDoorState(AtsSimulationStates.DoorStateType.Close); } else { CurrentStates.SetDoorState(AtsSimulationStates.DoorStateType.Open); } foreach (IAtsBehaviour behaviour in Behaviours) { behaviour.OnDoorStateChanged(CurrentStates.DoorState); } }
internal void OnUpdate(out AtsHandles vehicleOperations, AtsVehicleState vehicleState, IntPtr panelArray, IntPtr soundArray) { PanelOperations.SetSource(panelArray); SoundOperations.SetSource(soundArray); LastStates.CopyFrom(CurrentStates); CurrentStates.SetVehicleState(vehicleState); foreach (IAtsBehaviour behaviour in Behaviours) { behaviour.Update(); } LastKeyStates.CopyFrom(CurrentKeyStates); vehicleOperations = ControlHandle.Handles; }
public void PerformStep() { ProcessedWord += Word[CurrentPosition]; char symbol = Word[CurrentPosition]; var possibleNextStates = new List <State>(); foreach (var state in CurrentStates) { var nextStates = state.PossibleNextStates .Where(x => x.Value.Invoke(symbol)) .Select(pair => pair.Key); nextStates .ForEach(s => possibleNextStates.Add(s)); } CurrentStates.Clear(); foreach (var state in possibleNextStates) { CurrentStates.Add(state); } //foreach (var state in CurrentStates) //{ // for (int i = 0; i < StateTraces.Count; i++) // { // var trace = StateTraces[i]; // var brandNewTrace = new StateTrace(trace); // brandNewTrace.Add(state); // if (!StateTraces.Contains(brandNewTrace)) // StateTraces.Add(trace); // } //} CurrentPosition++; }
/// <summary> /// Set state type /// </summary> /// <param name="key">The state key</param> /// <param name="type">The type to be set</param> public void SetStateType(Q key, StateType type) { NfaState <Q> state = null; if ((state = GetState(key)) != null) { state.StateType = type; if (state.StateType == StateType.StartState) { CurrentStates.Add(state); } else { CurrentStates.RemoveState(key); } } else { throw new Exception("State doesn't exists"); } }
private void UpdateDisplay(CurrentStates newState, DisplayActions displayAction) { ShowLoading(); if (!displayWorker.IsBusy) { displayState.CurrentState = newState; var request = new DisplayRequest() { DisplayState = displayState, CurrentDisplayItem = ItemScroller.CurrentDataItem, DisplayAction = displayAction }; displayWorker.RunWorkerAsync(request); } else { Beep(); } }
public void PrepareState() { CurrentStates.Clear(); CurrentSpeed = Speed; CurrentDamage = Damage; }
/// <summary> /// Reset the the start states to its origin /// </summary> public void ResetStartStates() { CurrentStates.Clear(); CurrentStates.AddRange( States.FindAll(st => st.StateType == StateType.StartState)); }
//save state that reset will revert to public void SaveGrid() { CurrentStates.CopyTo(StartStates, 0); }