Example #1
0
    public bool Move(Point destination)
    {
        UpdatePathingData();
        if (!Distances.ContainsKey(destination))
        {
            return(false);
        }
        if (Path.Count != 0)
        {
            return(false);
        }

        IsMoving = true;

        Point prev = destination;

        Path.Push(destination);
        while (Paths[prev] != Position)
        {
            Path.Push(Paths[prev]);
            prev = Paths[prev];
        }

        Directions CardDirection = Position.GetDirection(Path.Peek());

        _deathEvent.OnFacingChanged(CardDirection);
        Previous = Path.Peek();
        Dest     = Path.Pop().ToWorldPoint();

        this.PostNotification(Notifications.ACTOR_LEFT_POINT, Position);

        Position = destination;

        this.PostNotification(Notifications.ACTOR_ENTERED_POINT, Position);

        return(true);
    }