private void ResetMovement() { destination = new MovementDestination(); destination.destinyTile = null; destination.movementPhases = null; destination.rotOrientation = CW_CCW.CW; destination.characterDestinyOrientation = CurrentOrientation; destination.initialYRotation = null; ExecutingAction = false; }
/// <summary> /// Pathfinding logic to get this actor to the specified position. /// </summary> /// <param name = "newPosition">The new position to move to.</param> private void MoveToPosition(MovementDestination <Point> newPosition) { PathFinder <Point> pathFinder = Global.PathFinder; if (newPosition.PointToMoveTo == _position && newPosition.MovementDestinationType == MovementDestinationType.SinglePoint) { Directions.Clear(); } else if (newPosition.MovementDestinationType == MovementDestinationType.MultiPoint && newPosition.PointsAcceptable.Contains(_position)) { Directions.Clear(); } else { PathfindRequest <Point> newrequest = null; switch (newPosition.MovementDestinationType) { case MovementDestinationType.SinglePoint: newrequest = new PathfindRequest <Point>(_position, newPosition.PointToMoveTo, this); break; case MovementDestinationType.MultiPoint: newrequest = new PathfindRequest <Point>(_position, this, newPosition.PointsAcceptable); break; default: throw new Exception("Can not move to an unaccessable position."); } pathFinder.NewSearch(newrequest); if (pathFinder.SearchStep(999) == SearchState.SearchStateSucceeded) { PathfindAnswer theAnswer = pathFinder.FinalResult(); Directions = theAnswer.Directions; } else { throw new Exception("Unable to path to that position."); } } }
public void Add(int playerId, MovementDestination movement) { _movements[playerId] = movement; }
/// <summary> /// Initialises a new instance of the ActorStateMove class, with a destination point. /// </summary> /// <param name="myActor">The actor who this state belongs to.</param> /// <param name="pointToMoveTo">The final position to move to.</param> /// <param name="owner">The owning game world.</param> public ActorStateMove(Actor myActor, Point pointToMoveTo, GameWorld owner) : base(myActor, owner, true) { ActionType = "movement"; _movementDestination = new MovementDestination <Point>(pointToMoveTo); }