Inheritance: MonoBehaviour
    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);
    }
Exemplo n.º 2
0
        public void ShouldReturnExceptionOutOfCoordinates(string input)
        {
            var navigationInput = new NavigationInputs(input);
            var movingAction    = new MovingAction(navigationInput);

            Assert.Throws <CustomException>(() => movingAction.ExecuteMoving());
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 /// <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();
     }
 }
Exemplo n.º 5
0
 void OnEnable()
 {
     m_Target        = target as MovingAction;
     m_SpeedProperty = serializedObject.FindProperty("speed");
 }
Exemplo n.º 6
0
 public MovingAction(MovingAction other)
 {
     dr = other.dr;
     dc = other.dc;
 }