Example #1
0
    public void InitGraphManager(string algorithmName, string graphStructure, string edgeType, bool isShortestPath, Dictionary <string, int> rngDict, ListVisual listVisual, int minEdgeCost, int maxEdgeCost)
    {
        this.algorithmName  = algorithmName;
        this.graphStructure = graphStructure;
        this.edgeType       = edgeType;
        this.isShortestPath = isShortestPath;
        this.rngDict        = rngDict;
        this.listVisual     = listVisual;
        this.minEdgeCost    = minEdgeCost;
        this.maxEdgeCost    = maxEdgeCost;

        // Init edges
        edges = new List <GameObject>();

        // Cleanup?
        GraphMain graphMain = GetComponentInParent <GraphMain>();

        nodePrefab                  = graphMain.nodePrefab;
        undirectedEdgePrefab        = graphMain.undirectedEdgePrefab;
        directedEdgePrefab          = graphMain.directedEdgePrefab;
        symmetricDirectedEdgePrefab = graphMain.symmetricDirectedEdgePrefab;

        nodeContainerObject = graphMain.nodeContainerObject;
        edgeContainerObject = graphMain.edgeContainerObject;
    }
Example #2
0
    private void Awake()
    {
        // Set ID's
        nodeID      = NODE_ID++;
        NodeAlphaID = UtilGraph.ConvertIDToAlphabet(nodeID);

        // Name shown in the editor
        name = NodeType + nodeID + "(" + nodeAlphaID + ")";

        animator = GetComponentInChildren <Animator>();

        // Get textmesh pros
        Component[] textHolders = GetComponentsInChildren(typeof(TextMeshPro));
        textNodeID   = textHolders[0].GetComponent <TextMeshPro>();
        textNodeDist = textHolders[1].GetComponent <TextMeshPro>();


        // Find player object and its camera
        positionManager = FindObjectOfType <PositionManager>();
        graphMain       = FindObjectOfType <GraphMain>();
        audioManager    = FindObjectOfType <AudioManager>();

        // "Set"
        edges = new List <Edge>();
        ResetNode();
    }
Example #3
0
    public void InitGraphAlgorithm(GraphMain graphMain, string graphStructure, float algorithmSpeed, bool shortestPathOnToAll)
    {
        InitTeachingAlgorithm(algorithmSpeed);

        this.graphMain           = graphMain;
        this.graphStructure      = graphStructure;
        this.shortestPathOnToAll = shortestPathOnToAll;

        startNodeAlpha = 's';
        node1Alpha     = 'w';
        node2Alpha     = 'v';
    }
Example #4
0
 /// <summary>Occurs each time the Timer ticks (Once per-second).</summary>
 private void TimerGraph_Tick(object sender, EventArgs e)
 {
     // Update the GUI
     GraphMain.Invalidate();
 }