public void StartNewNode() { if (currentNode.IsValid()) { currentNode.NewMaterialTask(); pendingNodes.Add(currentNode); } currentNode = new GameObjectNode(); }
private void PropertiesView_PreviewDrop(object sender, DragEventArgs e) { GameObjectNode gameObjNode = _selectedObject as GameObjectNode; GameObjectRef gameObj = gameObjNode.mGameObject; gameObj.AddComponent(DragItem.DragText); BorderBrush = Brushes.Transparent; SelectedObject = null; SelectedObject = gameObjNode; }
// Log Route private void LogRoute(GameObject StartNode, int MaxPath, GameObject[] WaypointNodes, List <ACOConnection> Connections) { GameObject CurrentNode = null; foreach (GameObject GameObjectNode in WaypointNodes) { if (GameObjectNode.Equals(StartNode)) { CurrentNode = GameObjectNode; } } ACOConnection HighestPheromoneConnection = null; string Output = "Route (Q: " + Q + ", Alpha: " + Alpha + ", Beta: " + Beta + ", EvaporationFactor: " + EvaporationFactor + ", DefaultPheromone: " + DefaultPheromone + "):\n"; int PathCount = 1; while (CurrentNode != null) { List <ACOConnection> AllFromConnections = AllConnectionsFromNode(CurrentNode, Connections); if (AllFromConnections.Count > 0) { HighestPheromoneConnection = AllFromConnections[0]; foreach (ACOConnection aConnection in AllFromConnections) { if (aConnection.PheromoneLevel > HighestPheromoneConnection.PheromoneLevel) { HighestPheromoneConnection = aConnection; } } CurrentNode = HighestPheromoneConnection.ToNode; Output += "| FROM: " + HighestPheromoneConnection.FromNode.name + ", TO: " + HighestPheromoneConnection.ToNode.name + " (Pheromone Level: " + HighestPheromoneConnection.PheromoneLevel + ") | \n"; } else { CurrentNode = null; } // If the current node is the start node at this point then we have looped // through the path and should stop. if (CurrentNode != null && CurrentNode.Equals(StartNode)) { CurrentNode = null; Output += "HOME (Total Nodes:" + WaypointNodes.Length + ", Nodes in Route: " + PathCount + ").\n"; } // If the path count is greater than a max we should stop. if (PathCount > MaxPath) { CurrentNode = null; Output += "MAX PATH (Total Nodes:" + WaypointNodes.Length + ", Nodes in Route: " + PathCount + ").\n"; } PathCount++; } Debug.Log(Output); }
public void Visit(GameObjectNode gameObjectNode) { GameObjectIdentifier = gameObjectNode.Identifier; OpenScope(); foreach (GameObjectContentNode gameObjectContent in gameObjectNode.Contents) { Visit(gameObjectContent); } CloseScope(); }
protected override void CheckAlive() { GameObjectNode nowNode = headNode; while (nowNode != null && objectPoolCount != 0) { if (nowNode.mObject.GetComponent <ItemMarker>().IsObtained()) { DestoryGameObject(nowNode); } nowNode = nowNode.next; } }
override protected void CheckAlive() { GameObjectNode nowNode = headNode; while (nowNode != null && objectPoolCount != 0) { if (nowNode.mObject.GetComponent <Basic>().health <= 0) { DestoryGameObject(nowNode); } nowNode = nowNode.next; } }
public void InstantiateObject(GameObjectNode node) { GameObject gO; gO = Instantiate(node.prefab); gO.name = node.prefab.name; currentObjects.Add(gO); gO.transform.position = new Vector3(node.beginPos.x, node.beginPos.y, gO.transform.position.z); gO.transform.localEulerAngles = new Vector3(gO.transform.localEulerAngles.x, gO.transform.localEulerAngles.y, node.beginRot); gO.transform.localScale = new Vector3(node.beginScale.x, node.beginScale.y, gO.transform.localScale.z); }
protected void copy(GameObjectNode nodeToCopy) { base.copy(nodeToCopy); objectPath = nodeToCopy.objectPath; beginPosX = nodeToCopy.beginPosX; beginPosY = nodeToCopy.beginPosY; beginRot = nodeToCopy.beginRot; beginScaleX = nodeToCopy.beginScaleX; beginScaleY = nodeToCopy.beginScaleY; }
public void Visit(GameObjectNode gameObjectNode) { gameObjectNode.TypeNode.Accept(this); sb.Append(" "); sb.AppendLine(gameObjectNode.Identifier); foreach (GameObjectContentNode gameObjectContent in gameObjectNode.Contents) { indentCount += 2; Indent(); gameObjectContent.Accept(this); indentCount -= 2; } Debug.Log(sb); }
public bool IsCoincide(GameObjectNode temp) { LinkedListNode <GameObjectNode> current = GameObjectList.First; while (current != null) { if (Mathf.Abs(current.Value.x - temp.x) < (current.Value.length + temp.length) / 2 && Mathf.Abs(current.Value.z - temp.z) < (current.Value.width + temp.width) / 2) { return(true); } current = current.Next; } return(false); }
void VisitToCreateGameObjectNode_r(GameObject go) { // hierarchy를 펼쳐놓고 객체 추가하면 넣은거 또 넣을수도 있다 // 그래서 assert대신 단순 검사로 var node = new GameObjectNode(go); if (!graphNodeTable.Contains <GameObjectNode>(node.InstanceId)) { graphNodeTable.Add(node.InstanceId, node); } for (int i = 0; i < go.transform.childCount; i++) { VisitToCreateGameObjectNode_r(go.transform.GetChild(i).gameObject); } }
private void fillNodeList(List <E3DEngine.GameObjectRef> _gameObjectList, ObservableCollection <GameObjectNode> nodeList) { for (int i = 0; i < _gameObjectList.Count; i++) { if ((_gameObjectList[i].GetFlag() & E3DEngine.GameObjectFlag.HIDE_IN_HIERARCHY) != 0) { continue; } GameObjectNode node = new GameObjectNode(); node.Name = _gameObjectList[i].GetName(); node.ShowText = node.Name; node.mGameObject = _gameObjectList[i]; fillNodeList(_gameObjectList[i].GetChilds(), node.Childs); nodeList.Add(node); } }
private void PropertiesView_PreviewDragOver(object sender, DragEventArgs e) { GameObjectNode gameObjNode = _selectedObject as GameObjectNode; GameObjectRef gameObj = gameObjNode.mGameObject; if (DragItem is ScriptNode && !gameObj.GetHasComponent(DragItem.DragText)) { e.Handled = true; BorderBrush = Brushes.LightGreen; } else { e.Effects = DragDropEffects.None; BorderBrush = Brushes.Red; } }
public override void OnInspectorGUI() { GameObjectNode go = ((GameObjectNode)target); EditorGUILayout.LabelField(go != null ? go.ToString() : "no obj"); /* * if (go != null) * { * EditorGUILayout.LabelField("Object:", go.name); * if (go.components != null) for (int idx = 0; idx < go.components.Length; ++idx) * { * go.isOutput[idx] = EditorGUILayout.Toggle(go.components[idx].GetType().Name + " as output", go.isOutput[idx]); * } * }*/ }
private void objectList_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (objectList.SelectedItem == null) { return; } if (objectList.SelectedItem != null) { (objectList.SelectedItem as GameObjectNode).IsSelected = false; } properties.SelectedObject = objectList.SelectedItem; GameObjectNode node = objectList.SelectedItem as GameObjectNode; E3DEngine.SceneManageRef.GetInstance().GetCurScene().SetSelectObject(node.mGameObject); node.IsSelected = true; }
private static List <AnimCurve> CopyCurves(GameObjectNode rNewNode, List <AnimCurve> rCurves) { List <AnimCurve> rNewCurves = new List <AnimCurve>(); var rNewCurveBindings = new List <EditorCurveBinding>(AnimationUtility.GetAnimatableBindings(rNewNode.NodeGo, rNewNode.NodeGo.transform.root.gameObject)); for (int i = 0; i < rCurves.Count; i++) { var rOldCurveBinding = rCurves[i].CurveBinding; var rNewCurveBinding = rNewCurveBindings.Find((rItem) => { return(rItem.propertyName.Equals(rOldCurveBinding.propertyName)); }); AnimCurve rNewCurve = new AnimCurve() { Curve = rCurves[i].Curve, CurveBinding = rNewCurveBinding }; rNewCurves.Add(rNewCurve); } return(rNewCurves); }
public AbstractSyntaxTree BuildAst(IEnumerable <IParseTree> parseTrees) { Dictionary <string, GameObjectNode> gameObjects = new Dictionary <string, GameObjectNode>(); foreach (IParseTree parseTree in parseTrees) { DazelParser.GameObjectContext gameObjectContext = parseTree.GetChild(0) as DazelParser.GameObjectContext; GameObjectNode gameObjectNode = VisitGameObject(gameObjectContext); gameObjects.Add(gameObjectNode.Identifier, gameObjectNode); } RootNode root = new RootNode() { GameObjects = gameObjects }; return(new AbstractSyntaxTree(root)); }
public void Visit(GameObjectNode gameObjectNode) { // Line 1 Assert.That(gameObjectNode.TypeNode is ScreenNode, "gameObject.Type is ScreenType"); Assert.That(gameObjectNode.Identifier == "SampleScreen1", "gameObject.Identifier == 'SampleScreen1'"); // Contents: Map, Entities Assert.That(gameObjectNode.Contents[0].TypeNode is MapTypeNode, "gameObject.Contents[0].Type is MapType"); Assert.That(gameObjectNode.Contents[1].TypeNode is EntitiesTypeNodeNode, "gameObject.Contents[1].Type is EntitiesType"); // Map has 11 top-level statements (some statement blocks have nested statements) Assert.That(gameObjectNode.Contents[0].Statements.Count == 4, $"gameObject.Contents[0].Statements.Count == 4." + $"Found {gameObjectNode.Contents[0].Statements.Count}"); // Entities has 1 top-level statement Assert.That(gameObjectNode.Contents[1].Statements.Count == 1, $"gameObject.Contents[1].Statements.Count == 1" + $"Found {gameObjectNode.Contents[1].Statements.Count}"); gameObjectNode.Contents.ForEach(Visit); }
public void addChild(GameObjectNode gon) { if (children == null) { children = new List <GameObjectNode>(); } if (gon == null) { throw new NullReferenceException(); } if (children.Contains(gon)) { Logger.warn(Module.Framework, "GameObjectNode::addChild failed for already exist it:" + gon); return; } children.Add(gon); }
private GameObjectNode load(Resource res, GameObject parent, GameObjectNode parentGon) { Object o = Resources.Load(res.getPath()); if (o == null) { Logger.warn(Module.Resource, "Resources.Load:" + res + " failed!"); return(null); } if (res.getType() == Resource.Type.Font) { GameObjectNode g = new GameObjectNode(o as GameObject); return(g); } GameObject obj = GameObject.Instantiate(o) as GameObject; GameObjectNode gon = new GameObjectNode(obj); if (parentGon != null) { parentGon.addChild(gon); } List <Resource> ress = res.getChildren(); if (ress != null && ress.Count > 0) { foreach (Resource r in ress) { load(r, obj, gon); } } obj.transform.parent = parent.transform; obj.transform.name = subtractBracket(obj.transform.name); obj.transform.localScale = res.getScale(); obj.transform.rotation = res.getAngle();; obj.transform.localPosition = res.getPosition(); return(gon); }
private void FixParticleSystemRendererReferences(GameObject gameObject, GameObjectNode node) { if (node.copyParticles) { ParticleSystemRenderer myPSR; ParticleSystemRenderer targetPSR = null; myPSR = RecursiveSearchFunctions.ChildNodeFinderDepthFirst(gameObject.transform, node.myNode).gameObject.GetComponent <ParticleSystemRenderer>(); if (MyReferences.targetParticleSystemRenderers.ContainsKey(savedTargetPrefabNode.GetStableHashCode())) { targetPSR = MyReferences.targetParticleSystemRenderers[savedTargetPrefabNode.GetStableHashCode()]; } else { GameObject targetedNode; if (MyReferences.targetPrefabNodes.ContainsKey((node.targetPrefab + node.targetNode).GetStableHashCode())) { targetedNode = MyReferences.targetPrefabNodes[(node.targetPrefab + node.targetNode).GetStableHashCode()]; targetPSR = targetedNode.GetComponent <ParticleSystemRenderer>(); if (targetPSR != null) { MyReferences.targetParticleSystemRenderers.Add(savedTargetPrefabNode.GetStableHashCode(), targetPSR); } } else { var referencedGameObject = MyReferences.listOfAllGameObjects[node.targetPrefab.GetStableHashCode()]; targetedNode = RecursiveSearchFunctions.ChildNodeFinderDepthFirst(referencedGameObject.transform, node.targetNode).gameObject; if (targetedNode != null) { MyReferences.targetPrefabNodes.Add(savedTargetPrefabNode.GetStableHashCode(), targetedNode); targetPSR = targetedNode.GetComponent <ParticleSystemRenderer>(); } } } myPSR.sharedMaterial = targetPSR.sharedMaterial; } }
public void ApplyNodeChanges(GameObject gameObject) { //Plugin.Log.LogMessage($"Applying Node Changes for Prefab: {gameObject.name}"); if (currentNode.IsValid()) { pendingNodes.Add(currentNode); } currentNode = null; if (pendingNodes.Count > 0) { //Plugin.Log.LogMessage($"Pending Nodes Found: {pendingNodes.Count}"); foreach (GameObjectNode n in pendingNodes) { //Plugin.Log.LogMessage($"Going to Try to Fix Meshes {n.copyMesh}"); FixMeshReferences(gameObject, n); //Plugin.Log.LogMessage($"Going to Try to Fix Materials {n.copyMaterial}"); FixMaterialReferences(gameObject, n); //Plugin.Log.LogMessage($"Going to Try to Fix Particles {n.copyParticles}"); FixParticleSystemRendererReferences(gameObject, n); } WipeLists(); } }
/// <summary> /// 临时做法 /// </summary> /// <param name="path"></param> /// <param name="parent"></param> /// <returns></returns> public GameObjectNode load(string path, GameObject parent) { UnityEngine.Object o = Resources.Load(path) as GameObject; if (o == null) { Log.Logger.warn(Module.Resource, "Resources.Load:" + path + " failed!"); return(null); } GameObject obj = GameObject.Instantiate(o) as GameObject; GameObjectNode gon = new GameObjectNode(obj); //GameObjectNode parentNode = new GameObjectNode(parent); //if (parentNode != null) //{ // parentNode.addChild(gon); //} obj.transform.parent = parent.transform; obj.transform.name = Utils.subtractBracket(obj.transform.name, "(Clone)"); obj.transform.localScale = Vector3.one; //obj.transform.localPosition = Vector3.zero; return(gon); }
private static SelectedNode CreateNode(GameObject rSelectedGo) { var rSelectedNode = new SelectedNode(); rSelectedNode.Node = new GameObjectNode(rSelectedGo); rSelectedNode.Node.Curves = GetCurves(rSelectedGo); rSelectedNode.ChildNodes = new List <GameObjectNode>(); Transform[] rChildTransforms = rSelectedGo.GetComponentsInChildren <Transform>(true); for (int i = 0; i < rChildTransforms.Length; i++) { // 过滤掉自己 if (rChildTransforms[i] == rSelectedGo.transform) { continue; } var rChildNode = new GameObjectNode(rChildTransforms[i].gameObject); rChildNode.Curves = GetCurves(rChildTransforms[i].gameObject); rSelectedNode.ChildNodes.Add(rChildNode); } return(rSelectedNode); }
public override void OnBodyGUI() { GameObjectNode target = ((GameObjectNode)this.target); if (target.gameObject == null) { if (GUILayout.Button("Bind object")) { ((GameObjectNode)target).Bind(Selection.activeGameObject); } ; } else if (target.initialized) { foreach (NodePort port in target.Outputs) { NodeEditorGUILayout.PortField(port); }/* * for (int idx = 0; idx< ((GameObjectNode)target).output.Length; ++idx) * { * if (((GameObjectNode)target).isOutput[idx]) * { * NodeEditorGUILayout.PortField(target.output[idx]); * } * }*/ if (GUILayout.Button("Rebind")) { ((GameObjectNode)target).Bind(Selection.activeGameObject); } ; } else { ((GameObjectNode)target).Bind(target.gameObject, true); } }
public GameObjectEdge(GameObjectNode target, float cost) { this.target = target; this.cost = cost; }
public override void Update() { _requestObject = GameObjectNode.GetInputGameObject(_inputSocketRequestCenter, new Request()); }
internal void SetSource(GameObjectNode source) { this.source = source; }
protected GameObjectNode ScanGameObject(GameObject obj, bool scanChildren) { if (obj == null) return null; GameObjectNode thisNode = new GameObjectNode(obj, !this.buttonShowComponents.Checked); foreach (Component c in obj.GetComponents<Component>()) { ComponentNode compNode = this.ScanComponent(c); if (compNode != null) this.InsertNodeSorted(compNode, thisNode); } if (scanChildren) { foreach (GameObject c in obj.Children) { GameObjectNode childNode = this.ScanGameObject(c, scanChildren); if (childNode != null) this.InsertNodeSorted(childNode, thisNode); } } return thisNode; }
public bool Equals(Node other) { GameObjectNode node = other as GameObjectNode; return(node != null && GetInstanceID() == node.GetInstanceID()); }
void ContextCallBack(object o) { string clb = o.ToString(); if (clb.Equals("textNode")) { TextNode textNode = new TextNode(); textNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(textNode); } else if (clb.Equals("imgNode")) { ImageNode imgNode = new ImageNode(); imgNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 325); AddNode(imgNode); } else if (clb.Equals("clicNode")) { WaitForInputNode clicNode = new WaitForInputNode(); clicNode.windowRect = new Rect(mousePos.x, mousePos.y, 150, 50); AddNode(clicNode); } else if (clb.Equals("lucNode")) { LucidityAddNode lucNode = new LucidityAddNode(); lucNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(lucNode); } else if (clb.Equals("calcNode")) { SetVariableNode calcNode = new SetVariableNode(); calcNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(calcNode); } else if (clb.Equals("waitNode")) { WaitNode waitNode = new WaitNode(); waitNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(waitNode); } else if (clb.Equals("fadeNode")) { FadeNode fadeNode = new FadeNode(); fadeNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(fadeNode); } else if (clb.Equals("choiceNode")) { ChoiceNode choiceNode = new ChoiceNode(); choiceNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(choiceNode); } else if (clb.Equals("seqNode")) { GoToSequenceNode seqChoice = new GoToSequenceNode(); seqChoice.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(seqChoice); } else if (clb.Equals("destroyNode")) { DestroyNode destroyNode = new DestroyNode(); destroyNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(destroyNode); } else if (clb.Equals("conditionNode")) { ConditionNode conditionNode = new ConditionNode(); conditionNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 175); AddNode(conditionNode); } else if (clb.Equals("placeNode")) { GoToPlaceNode placeNode = new GoToPlaceNode(); placeNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(placeNode); } else if (clb.Equals("animNode")) { AnimationNode animNode = new AnimationNode(); animNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 300); AddNode(animNode); } else if (clb.Equals("exploNode")) { GoToExplorationNode exploNode = new GoToExplorationNode(); exploNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(exploNode); } else if (clb.Equals("soundNode")) { PlaySoundNode soundNode = new PlaySoundNode(); soundNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(soundNode); } else if (clb.Equals("stopNode")) { StopSoundNode stopNode = new StopSoundNode(); stopNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 150); AddNode(stopNode); } else if (clb.Equals("goNode")) { GameObjectNode goNode = new GameObjectNode(); goNode.windowRect = new Rect(mousePos.x, mousePos.y, 200, 200); AddNode(goNode); } else if (clb.Equals("setFirst")) { int selectedIndex = -1; bool clickedOnWindow = CheckClicked(out selectedIndex); if (clickedOnWindow) { sequence.firstNodeId = sequence.nodes[selectedIndex].id; } } else if (clb.Equals("makeTransition")) { int selectedIndex = -1; bool clickedOnWindow = CheckClicked(out selectedIndex); if (clickedOnWindow) { selectedNode = sequence.nodes[selectedIndex]; if (selectedNode.nextNodeId != -1) { selectedNode.nextNodeId = -1; selectedNode.nextNode.NodeDeleted(selectedNode); selectedNode.nextNode = null; } makeTransitionMode = true; } } else if (clb.Equals("makeTransition1")) { MakeTransitionChoice(0); } else if (clb.Equals("makeTransition2")) { MakeTransitionChoice(1); } else if (clb.Equals("makeTransition3")) { MakeTransitionChoice(2); } else if (clb.Equals("makeTransition4")) { MakeTransitionChoice(3); } else if (clb.Equals("makeTransitionTrue")) { MakeTransitionCondition(0); } else if (clb.Equals("makeTransitionFalse")) { MakeTransitionCondition(1); } else if (clb.Equals("deleteNode")) { int selectedIndex = -1; bool clickedOnWindow = CheckClicked(out selectedIndex); if (clickedOnWindow) { EventNode selNode = sequence.nodes[selectedIndex]; sequence.nodes.RemoveAt(selectedIndex); if (selNode.id == sequence.firstNodeId) { if (sequence.nodes.Count > 0) { sequence.firstNodeId = sequence.nodes[0].id; } else { sequence.firstNodeId = -1; } } foreach (EventNode n in sequence.nodes) { n.NodeDeleted(selNode); } } } }
public GameObjectNode(GameObject mGameObject) { mObject = mGameObject; next = null; pre = null; }