/** Create a new text panel and a arrow to do the link with the selected object. */ private void addObject() { if (objectSelected == null) { return; } //Create object AddAction addAction = new AddAction("Prefab/Panel", new Vector3(0, 0, -8)); base.managerListener.doAction(addAction); GameObject objectCreated = addAction.GameObject; //create tuve GameObject tubeObject = GameObject.Instantiate(Resources.Load("Prefab/Tube") as GameObject); TubeArrow tube = tubeObject.GetComponent<TubeArrow>(); tube.link(objectSelected, objectCreated); }
private void addObject() { //Create object AddAction addAction = new AddAction("Prefab/Panel", new Vector3(0, 0, -8)); base.managerListener.doAction(addAction); GameObject objectCreated = addAction.GameObject; //create tuve GameObject tubeObject = GameObject.Instantiate(Resources.Load("Prefab/Tube") as GameObject); TubeArrow tube = tubeObject.GetComponent<TubeArrow>(); tube.link(select, objectCreated); this.nodeCourant.Add(new Node(addAction.GameObject)); }
public void onGamePadEvent(ref Event e) { if (writeMode) { updateWriteMode(ref e); print("writemode"); return; } // Rename Action else if (UnityEngine.Input.GetKey(KeyCode.Joystick1Button1)) // A button { textMesh = select.GetComponentInChildren<TextMesh>(); renameAction = new RenameAction(textMesh); writeMode = true; } else if (UnityEngine.Input.GetKey(KeyCode.Joystick1Button6)) { // LT button InputLeftControlAction(); } else { if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button3)) // Y button { AddAction addAction = new AddAction(PrimitiveType.Cube, new Vector3(0, 0, -8)); base.managerListener.doAction(addAction); print("action: add"); this.nodeCourant.Add(new Node(addAction.GameObject)); } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button2) && !deleteMode) // B button { RemoveAction removeAction = new RemoveAction(ref this.nodeCourant); base.managerListener.doAction(removeAction); print("action: remove"); this.nodeCourant = removeAction.NodeCourant; if (this.nodeCourant == null) { Select(instance); } else { Select(nodeCourant.Gameobject); } deleteMode = true; } else if (UnityEngine.Input.GetKeyUp(KeyCode.Joystick1Button2) && deleteMode) // B button { deleteMode = false; } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button5)) // RB button { base.managerListener.undoAction(); print("action: undo"); } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button4)) // LB button { base.managerListener.redoAction(); print("action: redo"); } else { InputMoveAction(); } } }