private IEnumerator PerformCoroutine(ActionInfo actionInfo, Action <bool> actionOverCallback) { foreach (ActionBase actionBase in actionInfo.ActionList) { switch (actionBase.Type) { case ActionType.Walk: { MovingAction ma = (MovingAction)actionBase; yield return(StartCoroutine(StartMoveTo(ma.Path, delegate(bool result) {}))); } break; case ActionType.Melee: { bool isOver = false; AttackAction aa = (AttackAction)actionBase; Attack(aa.Target, () => { isOver = true; }); yield return(new WaitUntil(() => isOver)); } break; case ActionType.Distance: { } break; } } actionOverCallback(true); }
public void ShouldReturnExceptionOutOfCoordinates(string input) { var navigationInput = new NavigationInputs(input); var movingAction = new MovingAction(navigationInput); Assert.Throws <CustomException>(() => movingAction.ExecuteMoving()); }
public void ShouldCorrectFinalPosition(string input, string correctResult) { var navigationInput = new NavigationInputs(input); var movingAction = new MovingAction(navigationInput); movingAction.ExecuteMoving(); Assert.True(movingAction.FinalDirectAndCoordinates.First().Equals(correctResult)); }
/// <summary> /// Sets a new destination to the entity. /// </summary> /// <param name="victim">The destination cell.</param> /// <param name="direction">The movement direction.</param> public void SetDestination(CellData victim, MoveDirection direction) { ExitCell(); movingAction = new MovingAction(this, victim, direction); if (onSetDestination != null) { onSetDestination(); } }
void OnEnable() { m_Target = target as MovingAction; m_SpeedProperty = serializedObject.FindProperty("speed"); }
public MovingAction(MovingAction other) { dr = other.dr; dc = other.dc; }