public void DispatchShouldExecuteReducer() { var expected = new EmptyAction(); _store.Dispatch(expected); Assert.AreSame(expected, _fakeReducer.Action); }
public static void PhysicsProcess(this MonoBehaviour monoBehaviour, float duration, EmptyAction repeatingAction, EmptyAction postAction = null) { monoBehaviour.StartCoroutine(PhysicsProcessRoutine(duration, repeatingAction, postAction)); }
public void ReduceShouldApplyMiddleware() { var fakeState = new FakeState(); var emptyAction = new EmptyAction(); _rootReducer.Reduce(fakeState, emptyAction); Assert.AreEqual(fakeState, _middleware.State); Assert.AreEqual(emptyAction, _middleware.Action); }
/// <summary> /// sets the all actions for this ship to be default action /// </summary> public void populateDefaultActions() { for (int i = 0; i < MAX_HEALTH; i++) { if (actions[i] == null) { actions[i] = new EmptyAction(-1, this, 6); } } }
public void ReduceShouldExecuteEachReducer() { var action = new EmptyAction(); var oldState = new FakeState(); var newState = _rootReducer.Reduce(oldState, action); Assert.AreSame(action, _actionReducer.Action); Assert.AreSame(oldState, _actionReducer.PreviousState); Assert.AreNotSame(newState, oldState); }
public static IEnumerator MoveRoutine(Transform movingObj, Vector3 targetPos, EmptyAction postAction = null, float dampTime = .15f) { Vector3 speed = Vector3.zero; while (Vector3.SqrMagnitude(movingObj.position - targetPos) > .001f) { movingObj.position = Vector3.SmoothDamp(movingObj.position, targetPos, ref speed, dampTime); yield return(new WaitForEndOfFrame()); } postAction?.Invoke(); }
private static IEnumerator PhysicsProcessRoutine(float duration, EmptyAction repeatingAction, EmptyAction postAction) { float timer = 0; while (timer < duration) { timer += Time.fixedDeltaTime; repeatingAction?.Invoke(); yield return(new WaitForFixedUpdate()); } postAction?.Invoke(); }
public void DispatchShouldTriggerReducerFlowAndUpdateState() { var initialState = new EmptyState(); var newState = new EmptyState(); var action = new EmptyAction(); _rootReducer.Setup(r => r.Reduce(It.IsAny <EmptyState>(), It.IsAny <IAction>())) .Returns(newState); _store.Dispatch(action); _store.State.Should().BeSameAs(newState); _rootReducer.Verify(r => r.Reduce(It.IsAny <EmptyState>(), It.IsAny <IAction>()), Times.Once()); _storageMock.Verify(s => s.Save(newState), Times.Once()); _devToolsMock.Verify(s => s.Send(action, newState), Times.Once()); }
/// <summary> /// Loads the grid definition. /// </summary> public override bool LoadGridDefinition() { if (GridView.Columns.Count == 0) { using (Table filterTable = new Table()) { filter.Controls.Clear(); // Clear all columns from the grid view UniGridView.Columns.Clear(); UniGridView.GridLines = GridLines.Horizontal; if (!LoadXmlConfiguration()) { return false; } // Load options if (GridOptions != null) { LoadOptionsDefinition(GridOptions, filterTable); } if (GridActions == null && ShowActionsMenu) { EmptyAction emptyAction = new EmptyAction(); GridActions = new UniGridActions(); GridActions.Actions.Add(emptyAction); } // Actions if (GridActions != null) { LoadActionsDefinition(GridActions); } // Load pager configuration if (PagerConfig != null) { LoadPagerDefinition(PagerConfig); } // Set direct page control id from viewstate if (ViewState["DirectPageControlID"] != null) { Pager.DirectPageControlID = ViewState["DirectPageControlID"].ToString(); } // Raise load columns event RaiseLoadColumns(); // Load columns if (GridColumns != null) { foreach (Column col in GridColumns.Columns) { // Load column definition LoadColumnDefinition(col, filterTable); } } if (displayFilter) { // Finish filter form with "Show" button CreateFilterButton(filterTable); } } } return true; }
/// <summary> /// Loads the grid definition. /// </summary> public override bool LoadGridDefinition() { if (GridView.Columns.Count == 0) { using (Panel filterPanel = new Panel()) { filterPanel.CssClass = "form-horizontal form-filter"; plcFilter.Controls.Clear(); // Clear all columns from the grid view GridView.Columns.Clear(); if (!LoadXmlConfiguration()) { return false; } // Load options if (GridOptions != null) { LoadOptionsDefinition(GridOptions, filterPanel); } if ((GridActions == null) && ShowActionsMenu) { EmptyAction emptyAction = new EmptyAction(); GridActions = new UniGridActions(); GridActions.Actions.Add(emptyAction); } // Actions if (GridActions != null) { LoadActionsDefinition(GridActions); } // Load pager configuration if (PagerConfig != null) { LoadPagerDefinition(PagerConfig); } // Raise load columns event RaiseLoadColumns(); // Load columns if (GridColumns != null) { foreach (Column col in GridColumns.Columns) { col.DataBind(); // Load column definition LoadColumnDefinition(col, filterPanel); } } if (displayFilter) { // Finish filter form with "Show" button CreateFilterButton(filterPanel); } } } return true; }
public AIController() { aigoals = new List <AIGoal>(); EmptyAction action = new EmptyAction(); }
public static void DelayedAction(this MonoBehaviour monoBehaviour, float time, EmptyAction action) { monoBehaviour.StartCoroutine(DelayedActionRoutine(time, action)); }
public static void MoveWithAction(this MonoBehaviour monoBehaviour, Vector3 targetPos, EmptyAction postAction, float dampTime = .15f) { monoBehaviour.StartCoroutine(MoveRoutine(monoBehaviour.transform, targetPos, postAction, dampTime)); }
private static IEnumerator DelayedActionRoutine(float time, EmptyAction action) { yield return(new WaitForSeconds(time)); action?.Invoke(); }
static GAction() { Empty = new EmptyAction(); }