Ejemplo n.º 1
0
    void AddWaypoint(int x, int y, ref Waypoint waypointCurrent, ref Waypoint waypointPrevious)
    {
        GameObject gameObject = Instantiate(waypointObject, MapToUnityPosition(MapPositionToGridPosition(x, y)), Quaternion.identity);

        waypointCurrent = gameObject.GetComponent <Waypoint>();
        if (waypointPrevious != null)
        {
            waypointPrevious.AddNextWaypoint(waypointCurrent);
            waypointCurrent.AddPreviousWaypoint(waypointPrevious);
        }
        walkableFields.Add(waypointCurrent);
        waypointPrevious = waypointCurrent;
        waypointCurrent.transform.parent = transform;
    }