Ejemplo n.º 1
0
    public void GoTo(Hexagon hexagonGoal)
    {
        Path = pathfinding.ComputePathBetweenHexagons(CurrentHexagon, hexagonGoal, HexagonManager);
        if (Path.Count <= 1)
        {
            return;
        }
        Vector2 pos = new Vector2();

        pos.x = Path[1].transform.position.x; // Random.Range(Path[0].transform.position.x + localOffsetBegin.x, Path[0].transform.position.x + localOffsetEnd.x);
        pos.y = Path[1].transform.position.y; //Random.Range(Path[0].transform.position.y + localOffsetBegin.y, Path[0].transform.position.y + localOffsetEnd.y);

        Goal      = pos;
        Direction = Goal - transform.position;
        Direction.Normalize();
    }