public GenericMovementBehavior(int moveSpeed, UnitMoverType moveType, GridPoint spawnPos = null)
    {
        _moveSpeed = moveSpeed;
        _moveType = moveType;
        _currentLocation =
        _targetLocation = null;

        if (spawnPos == null) _currentLocation = NavigationController.Instance.FirstTile;
        else _currentLocation = spawnPos;

        // pathing stuff
        _pathToTraverse = null;
        _pendingPath = null;
        _ratioAlongCurrentStep = 0f;
        _currentPathNode = null;
        _currentStepLength = 0.0f;
        _nodesRemaining = -1;
    }
        public static IMovementBehavior SpawnBehavior(UnitMoverType moverType, int speed, GridPoint spawnPos = null)
        {
            IMovementBehavior movementBehavior;
            switch (moverType)
            {
                case UnitMoverType.Flyer:
                    movementBehavior = new GenericMovementBehavior(speed, UnitMoverType.Flyer, spawnPos);
                    break;
                case UnitMoverType.Walker:
                    movementBehavior = new GenericMovementBehavior(speed, UnitMoverType.Walker, spawnPos);
                    break;
                case UnitMoverType.NoMovement:
                    movementBehavior = new NoMovementBehavior(spawnPos);
                    break;
                default:
                    movementBehavior = new GenericMovementBehavior(speed, UnitMoverType.Walker, spawnPos);
                    break;
            }

            return movementBehavior;
        }
Ejemplo n.º 3
0
 public LinkedList<GridPoint> FindAPath(GridPoint start, GridPoint dest, UnitMoverType moveType)
 {
     return _pather.Search(start, dest, moveType);
 }