Ejemplo n.º 1
0
 /// <summary>\cond internal</summary>
 /// <summary>
 /// Internal method to make sure <see cref="active"/> is set to this object and that <see cref="data"/> is not null.
 /// Also calls OnEnable for the <see cref="colorSettings"/> and initializes data.userConnections if it wasn't initialized before
 ///
 /// Warning: This is mostly for use internally by the system.
 /// </summary>
 public void ConfigureReferencesInternal()
 {
     active        = this;
     data          = data ?? new AstarData();
     colorSettings = colorSettings ?? new AstarColor();
     colorSettings.PushToStatic(this);
 }
Ejemplo n.º 2
0
    private void OnDrawGizmos()
    {
        if (active == null)
        {
            active = this;
        }

        if (active != this || graphs == null)
        {
            return;
        }

        if (Event.current.type != EventType.Repaint)
        {
            return;
        }

        colorSettings.PushToStatic(this);

        AstarProfiler.StartProfile("OnDrawGizmos");

        if (workItems.workItemsInProgress || isScanning)
        {
            gizmos.DrawExisting();
        }
        else
        {
            if (showNavGraphs && !manualDebugFloorRoof)
            {
                RecalculateDebugLimits();
            }

            Profiler.BeginSample("Graph.OnDrawGizmos");
            for (int i = 0; i < graphs.Length; i++)
            {
                if (graphs[i] != null && graphs[i].drawGizmos)
                {
                    graphs[i].OnDrawGizmos(gizmos, showNavGraphs);
                }
            }
            Profiler.EndSample();

            if (showNavGraphs)
            {
                euclideanEmbedding.OnDrawGizmos();
                if (debugMode == GraphDebugMode.HierarchicalNode)
                {
                    hierarchicalGraph.OnDrawGizmos(gizmos);
                }
            }
        }

        gizmos.FinalizeDraw();

        AstarProfiler.EndProfile("OnDrawGizmos");
    }