public void StartSpawning(List<Vector3> pListWaveStartPositions, List<Vector3> pListWaveEndPositions, TileMapScript pMap, NodeScript[,] pGraph, int pLevel) { _listWaveStartPositions = pListWaveStartPositions; _listWaveEndPositions = pListWaveEndPositions; _map = pMap; _graph = pGraph; _spawningStarted = true; _currentLevel = pLevel; FindObjectOfType<WaveIndicatorScript>().SetWaveIndicator(_currentWave, _levelList[_currentLevel - 1].WaveList.Count); }
// Use this for initialization void Start() { RG = GetComponent <Rigidbody>(); T = RG.transform; SS = GameObject.FindGameObjectWithTag("Sphere").GetComponent <SphereScript>(); if (Node != null) { NS = Node.GetComponent <NodeScript>(); } }
public static PlayerScript FindPlayerAtNode(double playerId, NodeScript node) { PlayerScript player = FindPlayer(playerId); if (player == null || player.connectedNode != node) { return(null); } return(player); }
void setConduitDirection(NodeScript ns, Direction direct) //TODO only works if you move one node { int x = ns.posX; int y = ns.posY; Quaternion rotation; Vector3 position; string conduitName = "Conduit_" + direct.ToString(); if (direct == Direction.NORTH) { y++; rotation = Quaternion.Euler(0, 0, 90); position = new Vector3(0, 0.5f, 0); } else if (direct == Direction.SOUTH) { y--; if (!nodeMaster.isSpaceFree(x, y)) { setConduitDirection(nodeMaster.getNode(x, y).GetComponent <NodeScript>(), Direction.NORTH); } return; } else if (direct == Direction.WEST) { x--; if (!nodeMaster.isSpaceFree(x, y)) { setConduitDirection(nodeMaster.getNode(x, y).GetComponent <NodeScript>(), Direction.EAST); } return; } else { x++; rotation = Quaternion.Euler(0, 0, 0); position = new Vector3(0.5f, 0, 0); } clearNodeConnectionDirection(ns, direct); if (!nodeMaster.isSpaceFree(x, y)) { GameObject con = Instantiate(prefabStore.emptyConduit, selectedObject.transform.position, rotation) as GameObject; con.name = conduitName; con.transform.parent = ns.gameObject.transform; con.transform.localPosition = position; ns.connection[(int)direct] = nodeMaster.getNode(x, y); nodeMaster.getNode(x, y).GetComponent <NodeScript>().connection[(int)oppositeDirection(direct)] = selectedObject; } else { ns.connection[(int)direct] = null; } }
public void drawLines() { foreach (GameObject l in lineList) { Destroy(l); } foreach (NodeScript n in nodeList) { n.resetNode(); n.neighborList.Clear(); } //draw vertical for (int i = xstart; i < xend + 1; ++i) { for (int j = ystart; j < yend; ++j) { int val = (int)(Random.value * 10000); if (val % 4 != 0) { NodeScript node1 = nodeList.Find(a => a.pos == new Vector3(i, 0, j)); NodeScript node2 = nodeList.Find(a => a.pos == new Vector3(i, 0, j + 1)); node1.neighborList.Add(node2); node2.neighborList.Add(node1); GameObject li = Instantiate(line); lineList.Add(li); LineRenderer r = li.GetComponent <LineRenderer>(); Vector3[] rA = { node1.pos, node2.pos }; r.SetPositions(rA); } } } //draw horizontal for (int i = ystart; i < yend + 1; ++i) { for (int j = xstart; j < xend; ++j) { int val = (int)(Random.value * 10000); if (val % 4 != 0) { NodeScript node1 = nodeList.Find(a => a.pos == new Vector3(j, 0, i)); NodeScript node2 = nodeList.Find(a => a.pos == new Vector3(j + 1, 0, i)); node1.neighborList.Add(node2); node2.neighborList.Add(node1); GameObject li = Instantiate(line); lineList.Add(li); LineRenderer r = li.GetComponent <LineRenderer>(); Vector3[] rA = { node1.pos, node2.pos }; r.SetPositions(rA); } } } }
void FindPath(Vector3 startPos, Vector3 targetPos) { NodeScript startNode = grid.NodeFromWorldPoint(startPos); NodeScript targetNode = grid.NodeFromWorldPoint(targetPos); List <NodeScript> openSet = new List <NodeScript>(); HashSet <NodeScript> closedSet = new HashSet <NodeScript>(); openSet.Add(startNode); while (openSet.Count > 0) { NodeScript node = openSet[0]; for (int i = 1; i < openSet.Count; i++) { if (openSet[i].fCost < node.fCost || openSet[i].fCost == node.fCost) { if (openSet[i].hCost < node.hCost) { node = openSet[i]; } } } openSet.Remove(node); closedSet.Add(node); if (node == targetNode) { RetracePath(startNode, targetNode); return; } foreach (NodeScript neighbour in grid.GetNeighbours(node)) { if (!neighbour.walkable || closedSet.Contains(neighbour)) { continue; } int newCostToNeighbour = node.gCost + GetDistance(node, neighbour); if (newCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) { neighbour.gCost = newCostToNeighbour; neighbour.hCost = GetDistance(neighbour, targetNode); neighbour.parent = node; if (!openSet.Contains(neighbour)) { openSet.Add(neighbour); } } } } }
public HeatGroup(NodeScript element, Vector3 position, float radius, MapNodeGroup cityArea) { this.elements = new NodeScript[] { element }; this.position = new Vector4(position.x, 2, position.z, 0); this.radius = radius; this.cityArea = cityArea; if (cityArea == null) { this.cityArea = GridManagerScript.mapSections[0]; } }
/// <summary> /// Returns the direction to get from the returnnode to this node. /// </summary> /// <param name="returnNode"></param> /// <returns>The direction to get from the returnnode to this node.</returns> public MovementBehaviour.Directions GetReturnPathDirection(NodeScript returnNode) { for (int i = 0; i < neighbours.Length; i++) { if (neighbours[i].GetComponent <NodeScript>() == returnNode) { return(neighbourDirections[i]); } } return(MovementBehaviour.Directions.None); }
// Use this for initialization void Start() { foreach (GameObject node in neighbors) { NodeScript scr = node.GetComponent <NodeScript>(); if (!scr.neighbors.Contains(gameObject)) { scr.neighbors.Add(gameObject); } } }
//Selects the node clicked. If already selected, deselects the node. public void SelectNode(NodeScript node) { if (selectedNode == node) { DeselectNode(); return; } selectedNode = node; selectedTurretType = null; nodeUI.SetTarget(node); }
int GetDistance(NodeScript nodeA, NodeScript nodeB) { int dstX = Mathf.Abs(nodeA.gridX - nodeB.gridX); int dstY = Mathf.Abs(nodeA.gridY - nodeB.gridY); if (dstX > dstY) { return(14 * dstY + 10 * (dstX - dstY)); } return(14 * dstX + 10 * (dstY - dstX)); }
public void SaveScript(NodeScript script, string source) { var path = Path.Combine(tmpDir, script.Id.ToString()); if (!Directory.Exists(path)) Directory.CreateDirectory(path); path = Path.Combine(path, Path.GetFileName(script.Name)); File.WriteAllText(path, source); File.SetAttributes(path, FileAttributes.Temporary | FileAttributes.ReadOnly); script.LocalFile = path; tmpFiles.Add(path); }
void QbertMove(NodeScript destNode, int _dir) { AllowInput = false; PreviousNode = CurrentCube; CurrentCube = destNode; CurrentCube.Selected = true; moveNow = true; qbertAnim.SetBool("Jump", true); qbertAnim.SetFloat("Direction", _dir); Invoke("DisableJump", 0.4f); }
public static void CodeUpdate() { // XXX: Add frame throttling control int count = callQueue.Count; for (int i = 0; i < count; i++) { NodeScript node = callQueue.Dequeue(); node.CodeUpdate(); } }
public static void CreatePacketGraphic(NodeScript source, NodeScript target) { Vector3 vrot = Random.onUnitSphere; Quaternion rot = Quaternion.Euler(vrot); GameObject packetGraphics = GameObject.Instantiate(packetPrefab, NodeGraphicManager.GetGraphic(source).transform.position, rot, gameObject.transform) as GameObject; PacketGraphicScript graphicsScript = packetGraphics.GetComponent <PacketGraphicScript>(); graphicsScript.MoveTo(target); packets.Add(graphicsScript); }
//We'll try putting this here, so that we can get this to work public float CalculateNodeData(NodeScript node, Transform goal) { float nodeWorth = 0; nodeWorth += Vector3.Distance(node.gameObject.GetComponent <Transform>().position, goal.position); //distance from player if (node.ReturnParent() != null) { nodeWorth += Vector3.Distance(node.gameObject.GetComponent <Transform>().position, node.ReturnParent().gameObject.GetComponent <Transform>().position) + node.ReturnParent().ReturnDistanceFromParent(); //to calculate the total distance travelled if we took this path so far. } return(nodeWorth); }
// Attempts to find an edge with the parameter node as the to part of the edge public EdgeScript FindEdgeTo(NodeScript node) { foreach (EdgeScript edge in edges) { if (edge.GetTo() == node) { return(edge); } } return(null); }
public string Run(NodeScript node, out string commandName) { bool success; string output = command(node, input, sourceInstruction, out success, out commandName); if (callback != null) { callback(node, input, sourceInstruction, success); } return(output); }
public float DistanceTo(NodeScript pNode) { if (pNode == null) { Debug.LogError("WTF?"); } return Vector2.Distance( new Vector2(_x, _y), new Vector2(pNode._x, pNode._y) ); }
void BuildSpline() { if (firstNode != null && firstNode.nextNode != null) { NodeScript curNode = firstNode; Vector3 vecFromNodeToNode = new Vector3(0, 0, 0); float distAlongSpline = 0.0f; while (curNode != null) { //print("\ncurNode = " + curNode.name + ", distAlongSpline = " + distAlongSpline); SplineNode newSplineNode = new SplineNode(); newSplineNode.distFromStartOfSpline = distAlongSpline; newSplineNode.up = curNode.transform.up; newSplineNode.forward = curNode.transform.forward; newSplineNode.position = curNode.transform.position; curNode.renderer.enabled = false; nodeList.Add(newSplineNode); //print("nodeList.Count = " + nodeList.Count); //look ahead if (curNode.nextNode == null) { //print("curNode.nextNode = None"); } else { //print("curNode.nextNode = " + curNode.nextNode.name); //sanity check... make sure we're not building a loop! foreach (SplineNode node in nodeList) { if (Mathf.Approximately((node.position - curNode.nextNode.transform.position).sqrMagnitude, 0.0f)) { print("Infinite Node Loop Detected! Halting execution!"); Debug.Break(); break; } } vecFromNodeToNode = curNode.nextNode.transform.position - curNode.transform.position; distAlongSpline += vecFromNodeToNode.magnitude; } curNode = curNode.nextNode; } splineLength = distAlongSpline; //print("splineLength = " + splineLength + ", nodeList.Count = " + nodeList.Count); } }
double CalculateGCost(NodeScript node, Dictionary <NodeScript, Node> nodeScriptToNode) { //distance from strt in term of edge costs float gCost = 0; while (nodeScriptToNode[node].parent != null) { gCost += nodeScriptToNode[node].parent.FindEdgeTo(node).GetCost(); node = nodeScriptToNode[node].parent; } return(gCost); }
public void SelectNode(NodeScript node) { if (SelectedNode == node) { DeselectNode(); return; } SelectedNode = node; buildingToBuild = null; NodeUI.SetTarget(node); NodeUI.Show(); }
public void SelectNode(NodeScript node) { if (selectedNode == node) { DeselectNode(); return; } BuildThisTurret = null; selectedNode = node; nodeUI.SetTarget(node); }
public void SelectNode(NodeScript node) { if (selectedTurret == node) { DeselectNode(); return; } selectedTurret = node; turretToBuild = null; nodeUI.SetTarget(node); }
void reTracePath(NodeScript startnode, NodeScript endnode) // retraces the path that has been created { NodeScript currentNode = endnode; while (currentNode != startnode) { path.Add(currentNode); currentNode = currentNode.parent; } path.Reverse(); Grid.path = path; }
public void OnModuleLoad(NodeScript debuggedModule) { // This will get called when the entrypoint breakpoint is fired because the engine sends a mod-load event // for the exe. if (m_engine.DebuggedProcess != null) { //Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId); } var ad7Module = new AD7Module(debuggedModule); //debuggedModule.Client = ad7Module; // The sample engine does not support binding breakpoints as modules load since the primary exe is the only module // symbols are loaded for. A production debugger will need to bind breakpoints when a new module is loaded. Send(new AD7ModuleLoadEvent(ad7Module, true /* this is a module load */), null); }
public void tempSet() { Random.InitState(System.DateTime.Now.Second); int a = Random.Range(0, nodeScripts.Count); start = nodeScripts[a]; int b = a; while (b == a) { b = Random.Range(0, nodeScripts.Count); } end = nodeScripts[b]; }
public void BuildTurretOn(NodeScript node) { if (PlayerStats.Money < turretToBuild.cost) { Debug.Log("Not enough money to build that"); return; } PlayerStats.Money -= turretToBuild.cost; Debug.Log("Money left: " + PlayerStats.Money); GameObject obj = (GameObject)Instantiate(turretToBuild.prefab, node.GetBuildPosition(), node.transform.rotation); node.turret = obj; }
public bool AreAllColorValuesZeroOrLessOfMyChildren() { Debug.Log("AreAllColorValuesZeroOrLessOfMyChildren"); bool allZeroOrLess = false; NodeScript left = leftGameObjectChild.GetComponent <NodeScript>(); NodeScript right = rightGameObjectChild.GetComponent <NodeScript>(); if (left.AreAllColorValuesZeroOrLess() && right.AreAllColorValuesZeroOrLess()) { allZeroOrLess = true; } Debug.Log("AreAllColorValuesZeroOrLessOfMyChildren: " + allZeroOrLess); return(allZeroOrLess); }
int getDistance(NodeScript a, NodeScript b) { int distanceX = Mathf.Abs(a.GridX - b.GridX); int distanceZ = Mathf.Abs(a.GridY - b.GridY); if (distanceX > distanceZ) { return(14 * distanceZ + 10 * (distanceX - distanceZ)); // working out the distance between the start and end node and how much ti will cost } else { return(14 * distanceX + 10 * (distanceZ - distanceX)); } }
// Use this for initialization void Start() { direction = MovementBehaviour.Directions.Up; target = null; blinking = false; eaten = false; startPhase = true; path = new ArrayList(); player = GameObject.FindGameObjectWithTag("Player"); startedYet = true; game = GameObject.Find("GameController").GetComponent <GameController>(); DeterimeSprite(); StartCoroutine(StartMoving()); }
void RetracePath(NodeScript startNode, NodeScript endNode) { List <NodeScript> path = new List <NodeScript>(); NodeScript currentNode = endNode; while (currentNode != startNode) { path.Add(currentNode); currentNode = currentNode.parent; } path.Reverse(); grid.path = path; }
/// <summary> /// Get the actual path. /// </summary> /// <param name="currentNode"></param> /// <returns></returns> private ArrayList ReconstructPath(NodeScript currentNode) { ArrayList totalPath = new ArrayList(); //totalPath.Add(currentNode); while (currentNode.previousNode != null) { totalPath.Add(currentNode); currentNode = currentNode.previousNode; } totalPath.Reverse(); return(totalPath); }
internal int GetHeight(List <GameObject> nodeObjects) { int height = 0; for (int i = 0; i < nodeObjects.Count; i++) { NodeScript nodeScript = nodeObjects[i].GetComponent <NodeScript>(); if (nodeScript.path.Length > height) { height = nodeScript.path.Length; } } return(height); }
void clearNodeConnectionDirection(NodeScript ns, Direction d) { int x = ns.posX; int y = ns.posY; if (d == Direction.SOUTH) { y--; if (!nodeMaster.isSpaceFree(x, y)) { clearNodeConnectionDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.NORTH); } return; } else if (d == Direction.WEST) { x--; if (!nodeMaster.isSpaceFree(x, y)) { clearNodeConnectionDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.EAST); } return; } if (ns.connection[(int)d] != null) { if ((int)d % 2 == 0) { GameObject con = null; try { con = ns.gameObject.transform.FindChild("Conduit_" + d.ToString()).gameObject; //TODO fix naughty code } catch { } if (con != null) { DestroyImmediate(con); } } else { } ns.connection[(int)d].GetComponent<NodeScript>().connection[(int)oppositeDirection(d)] = null; ns.connection[(int)d] = null; } }
void Awake() { EXPLORE = new ExploreMode(); PLAY = new PlayMode(); INTERACT = new InteractMode(); MOVE = new MoveMode(); startPoint = GameObject.Find("StartPosition").transform; camera = this.gameObject.transform.FindChild("Main Camera").transform; range = 0.05F; startNode = GameObject.Find("Node1").GetComponent<NodeScript>(); leftButton = GameObject.Find("LeftButton"); rightButton = GameObject.Find("RightButton"); backButton = GameObject.Find("Back"); playButton = GameObject.Find("Play"); interactButton = GameObject.Find("Interact"); }
internal string GetLocalFile(NodeScript script, bool fetchIfNotExists = false) { if (script.LocalFile == null) script.LocalFile = mappings.ToLocal(script.Name); if (script.LocalFile == null && File.Exists(script.Name)) script.LocalFile = script.Name; if (fetchIfNotExists && (script.LocalFile == null || !File.Exists(script.LocalFile))) { // fetch actual file var evt = new ManualResetEvent(false); dbg.Request("scripts", new { types = 7, ids = new[] { script.Id }, includeSource = true }, resp => { var body = resp["body"][0]; tempScriptCache.SaveScript(script, (string)body["source"]); evt.Set(); }); evt.WaitOne(200); } return script.LocalFile; }
public NodeThreadContext(JObject frame, DebuggedProcess proc) { jObject = frame; index = (int)frame["index"]; func = new NodeFunc(proc.LookupRef(frame["func"])); script = proc.JsonToScript(proc.LookupRef(frame["script"])); line = (int)frame["line"]; column = (int)frame["column"]; Args = frame["arguments"].Select(x => new Property((JObject)x, proc)).ToArray(); Locals = frame["locals"].Select(x => new Property((JObject)x, proc)).ToArray(); }
public void OnModuleUnload(NodeScript debuggedModule) { //Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId); //AD7Module ad7Module = (AD7Module)debuggedModule.Client; //Debug.Assert(ad7Module != null); //AD7ModuleLoadEvent eventObject = new AD7ModuleLoadEvent(ad7Module, false /* this is a module unload */); //Send(eventObject, null); }
internal NodeScript JsonToScript(JObject jObject) { var id = (int)jObject["id"]; var name = (string)jObject["name"]; var script = Modules.FirstOrDefault(m => m.Id == id && m.Name == name); if (script == null) { script = new NodeScript(id, name, jObject); Modules.Add(script); } return script; }
void Start() { currentState = EXPLORE; targetNode = startNode; }
/// <summary> /// <para>Create nodes on the tiles</para> /// <para>MapsizeX and MapSizeY are needed.</para> /// <para>Returns a NodeScript[,] for the Graph</para> /// </summary> public static NodeScript[,] GeneratePathfindingGraph(int pMapSizeX, int pMapSizeY) { // Initialize the array _graph = new NodeScript[pMapSizeX, pMapSizeY]; // Initialize a Node for each spot in the array for (int x = 0; x < pMapSizeX; x++) { for (int y = 0; y < pMapSizeY; y++) { _graph[x, y] = new NodeScript(); _graph[x, y].X = x; _graph[x, y].Y = y; #region create the node //GameObject node = GameObject.CreatePrimitive(PrimitiveType.Sphere); //node.transform.position = new Vector3(x, y, -1); //node.transform.localScale = new Vector3(node.transform.localScale.x/2, node.transform.localScale.y/2, node.transform.localScale.z/2); #endregion } } // Now that all the nodes exist, calculate their neighbours for (int x = 0; x < pMapSizeX; x++) { for (int y = 0; y < pMapSizeY; y++) { // This is the 4-way connection version: if (x > 0) _graph[x, y].Neighbours.Add(_graph[x - 1, y]); if (x < pMapSizeX - 1) _graph[x, y].Neighbours.Add(_graph[x + 1, y]); if (y > 0) _graph[x, y].Neighbours.Add(_graph[x, y - 1]); if (y < pMapSizeY - 1) _graph[x, y].Neighbours.Add(_graph[x, y + 1]); #region diagonal // This is the 8-way connection version (allows diagonal movement) //// Try left //if(x > 0) { // graph[x,y].neighbours.Add( graph[x-1, y] ); // if(y > 0) // graph[x,y].neighbours.Add( graph[x-1, y-1] ); // if(y < mapSizeY-1) // graph[x,y].neighbours.Add( graph[x-1, y+1] ); //} //// Try Right //if(x < mapSizeX-1) { // graph[x,y].neighbours.Add( graph[x+1, y] ); // if(y > 0) // graph[x,y].neighbours.Add( graph[x+1, y-1] ); // if(y < mapSizeY-1) // graph[x,y].neighbours.Add( graph[x+1, y+1] ); //} //// Try straight up and down //if(y > 0) // graph[x,y].neighbours.Add( graph[x, y-1] ); //if(y < mapSizeY-1) // graph[x,y].neighbours.Add( graph[x, y+1] ); #endregion } } return _graph; }
public AD7Module(NodeScript script) { m_script = script; }
void StateManagement() { if (currentState == EXPLORE) { camera.rotation = Quaternion.Slerp(camera.rotation, Quaternion.LookRotation(targetNode.transform.position - camera.position), Time.deltaTime); } if (currentState == MOVE) { prevNode = targetNode; this.gameObject.transform.position = Vector3.Lerp(this.gameObject.transform.position, endPoint.position, Time.deltaTime); camera.rotation = Quaternion.Slerp(camera.rotation, Quaternion.LookRotation(target.transform.position - camera.position), Time.deltaTime); float distance = Vector3.Distance(this.gameObject.transform.position, endPoint.position); if (distance < range) { if (target.name == "game") { currentState = PLAY; } if (target.name == "token") { currentState = INTERACT; } if(target == targetNode.ThisObject) { currentState = EXPLORE; } } } if (currentState == PLAY) { } if (currentState == INTERACT) { } }
void clearNodeConnections(NodeScript ns) { for (int i = 0; i < ns.connection.Length; i++) { clearNodeConnectionDirection(ns, (Direction)i); } }
void Update() { if (interaction == null) { interaction = GameObject.Find("Player").transform.FindChild("Main Camera").GetComponent<Core>().interaction; if (interaction != null) { interaction.addInteractionObject(leftButton, delegate() { targetNode = targetNode.Links[1]; }); interaction.addInteractionObject(rightButton, delegate() { targetNode = targetNode.Links[0]; }); interaction.addInteractionObject(backButton, delegate() { endPoint = startPoint; target = prevNode.ThisObject; currentState = MOVE; }); interaction.addInteractionObject(playButton, delegate() { print("Playing the game"); }); interaction.addInteractionObject(interactButton, delegate() { print("Interact"); }); } } StateManagement(); Debug.Log(currentState); }
void setConduits(NodeScript ns) { for (int i = 0; i < ns.connection.Length; i++) { setConduitDirection(ns, (Direction)i); } }
//TODO only works if you move one node void setConduitDirection(NodeScript ns, Direction direct) { int x = ns.posX; int y = ns.posY; Quaternion rotation; Vector3 position; string conduitName = "Conduit_" + direct.ToString(); if(direct == Direction.NORTH) { y++; rotation = Quaternion.Euler(0, 0, 90); position = new Vector3(0, 0.5f, 0); } else if(direct == Direction.SOUTH) { y--; if (!nodeMaster.isSpaceFree(x, y)) { setConduitDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.NORTH); } return; } else if (direct == Direction.WEST) { x--; if (!nodeMaster.isSpaceFree(x, y)) { setConduitDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.EAST); } return; } else { x++; rotation = Quaternion.Euler(0, 0, 0); position = new Vector3(0.5f, 0, 0); } clearNodeConnectionDirection(ns, direct); if (!nodeMaster.isSpaceFree(x, y)) { GameObject con = Instantiate(prefabStore.emptyConduit, selectedObject.transform.position, rotation) as GameObject; con.name = conduitName; con.transform.parent = ns.gameObject.transform; con.transform.localPosition = position; ns.connection[(int)direct] = nodeMaster.getNode(x, y); nodeMaster.getNode(x, y).GetComponent<NodeScript>().connection[(int)oppositeDirection(direct)] = selectedObject; } else { ns.connection[(int)direct] = null; } }
/// <summary> /// Adds a script into the modules list. /// </summary> /// <param name="id">Script identifier.</param> /// <param name="filename">Script file name.</param> private void AddModuleIfNotExist(int id, string filename) { if (_scripts.ContainsKey(id)) { return; } var module = new NodeScript(id, filename); _scripts.Add(id, module); EventHandler<ModuleLoadedEventArgs> moduleLoaded = ModuleLoaded; if (moduleLoaded == null) { return; } moduleLoaded(this, new ModuleLoadedEventArgs(module)); }