Ejemplo n.º 1
0
    public void HandleClick(Vector3 mousePosition)
    {
        Vector3 mapPosition     = mousePosition - transform.position;
        Vector2 mousePosition2D = new Vector2(mapPosition.x, mapPosition.y);

        MapPoint            destinationPoint = MapLayout.MapPointFromWorldPoint(mousePosition2D);
        List <MovementStep> progression      = controller.map.GeneratePath(playerPersonController.CurrentPosition, destinationPoint);

        if (progression == null)
        {
            Debug.LogError("No path to " + destinationPoint);
            return;
        }

        playerPersonController.MoveAlongPath(progression, null);
    }