Example #1
0
 public PathController(ScriptableGraph Graph, IPathService pathService)
 {
     view       = new PathView(pathService);
     cameraList = Graph.cameraScriptableList;
     for (int i = 0; i < Graph.circularPath.Count; i++)
     {
         circularPath.Add(Graph.circularPath[i].path);
     }
     for (int i = 0; i < Graph.Graph.Count; i++)
     {
         Node node = new Node();
         node.node        = Graph.Graph[i].node;
         node.teleport    = Graph.Graph[i].teleport;
         node.connections = Graph.Graph[i].GetConnections();
         graph.Add(node);
     }
 }
Example #2
0
        public int DrawGraph(ScriptableGraph Graph)
        {
            nodeprefab   = Graph.nodeprefab;
            targetNode   = Graph.targetNode;
            teleportNode = Graph.teleportNode;
            SetGates(Graph.GatesEdge);
            line = Graph.line;
            for (int i = 0; i < Graph.Graph.Count; i++)
            {
                Node node = new Node();
                node.node        = Graph.Graph[i].node;
                node.teleport    = Graph.Graph[i].teleport;
                node.connections = Graph.Graph[i].GetConnections();
                graph.Add(node);

                if (graph[i].node.property == NodeProperty.TARGETNODE)
                {
                    targetNode.SetNodeID(i);
                    physicalNode.Add(GameObject.Instantiate(targetNode.gameObject, new Vector3(node.node.nodePosition.x, node.node.nodePosition.y - 0.195f, node.node.nodePosition.z), Quaternion.identity));
                }
                else if (graph[i].node.property == NodeProperty.TELEPORT)
                {
                    teleportNode.SetNodeID(i);
                    physicalNode.Add(GameObject.Instantiate(teleportNode.gameObject, new Vector3(node.node.nodePosition.x, node.node.nodePosition.y - 0.195f, node.node.nodePosition.z), Quaternion.identity));
                }
                else
                {
                    nodeprefab.SetNodeID(i);
                    physicalNode.Add(GameObject.Instantiate(nodeprefab.gameObject, new Vector3(node.node.nodePosition.x, node.node.nodePosition.y - 0.195f, node.node.nodePosition.z), Quaternion.identity));
                }
                if (graph[i].node.snipeable)
                {
                    physicalNode[physicalNode.Count - 1].GetComponent <NodeControllerView>().SetShootable();
                }
                if (node.connections[0] != -1)
                {
                    physicalPath.Add(GameObject.Instantiate(line, new Vector3(node.node.nodePosition.x, node.node.nodePosition.y - 0.195f, node.node.nodePosition.z - 2.5f), Quaternion.Euler(new Vector3(0, 90, 0))));
                }
                if (node.connections[2] != -1)
                {
                    physicalPath.Add(GameObject.Instantiate(line, new Vector3(node.node.nodePosition.x + 2.5f, node.node.nodePosition.y - 0.195f, node.node.nodePosition.z), new Quaternion(0, 0, 0, 0)));
                }
            }
            return(graph.Count);
        }
Example #3
0
 public void DrawGraph(ScriptableGraph Graph)
 {
     gates = Graph.GatesEdge;
     Stars = new List <StarData>(Graph.stars);
     shortestPathLength = view.DrawGraph(Graph);
 }
Example #4
0
 public void DrawGraph(ScriptableGraph Graph)
 {
     controller = new PathController(Graph, this);
     controller.DrawGraph(Graph);
 }