// Correct Virtual Button Poses. public static bool CorrectPoses(VirtualButtonBehaviour[] vbs) { bool posesUpdated = false; foreach (VirtualButtonBehaviour vb in vbs) { // Check if Virtual Button pose has changed in scene or has never // been updated if (vb.mPrevTransform != vb.transform.localToWorldMatrix || (vb.transform.parent != null && vb.mPrevParent != vb.transform.parent.gameObject) || !vb.mHasUpdatedPose) { // Update the buttons pose if (vb.UpdatePose()) { // The button area has changed, need to serialize: posesUpdated = true; } vb.mPrevTransform = vb.transform.localToWorldMatrix; vb.mPrevParent = vb.transform.parent ? vb.transform.parent.gameObject : null; } } return posesUpdated; }
// Called when the virtual button has just been pressed: public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("OnButtonPressed"); if (!IsValid()) { return; } // Add the material corresponding to this virtual button // to the active material list: switch (vb.VirtualButtonName) { case "red": mActiveMaterials.Add(m_TeapotMaterials[0]); break; case "blue": mActiveMaterials.Add(m_TeapotMaterials[1]); break; case "yellow": mActiveMaterials.Add(m_TeapotMaterials[2]); break; case "green": mActiveMaterials.Add(m_TeapotMaterials[3]); break; } // Apply the new material: if (mActiveMaterials.Count > 0) mTeapot.renderer.material = mActiveMaterials[mActiveMaterials.Count - 1]; }
// Called when the virtual button has just been released: public void OnButtonReleased(VirtualButtonBehaviour vb) { if (!IsValid()) { return; } // Remove the material corresponding to this virtual button // from the active material list: switch (vb.VirtualButtonName) { case "red": mActiveMaterials.Remove(m_TeapotMaterials[0]); break; case "blue": mActiveMaterials.Remove(m_TeapotMaterials[1]); break; case "yellow": mActiveMaterials.Remove(m_TeapotMaterials[2]); break; case "green": mActiveMaterials.Remove(m_TeapotMaterials[3]); break; } // Apply the next active material, or apply the default material: if (mActiveMaterials.Count > 0) mTeapot.renderer.material = mActiveMaterials[mActiveMaterials.Count - 1]; else mTeapot.renderer.material = m_TeapotMaterials[4]; }
/*Assets/Scripts/Project/VirtualButtonsController.cs(6,14): error CS0738: `VirtualButtonsController ' does not implement interface member `IVirtualButtonEventHandler.OnButtonReleased(VirtualButtonBehaviour)' and the best implementing candidate `VirtualButtonsController.OnButtonPressed(VirtualButtonBehaviour) ' return type `void' does not match interface member return type `void'*/ public void OnButtonPressed (VirtualButtonBehaviour vb) { Debug.Log("OnButtonPressed"); sliderControl.slider.Value = sliderControl.DefaultScale; DisabledProjects(); switch(vb.VirtualButtonName) { case "projecto1": projects[0].SetActive( true ); break; case "projecto2": projects[1].SetActive( true ); break; case "projecto3": projects[2].SetActive(true); break; case "projecto4": projects[3].SetActive(true); break; case "projecto5": projects[4].SetActive( true ); break; } }
/*Assets/Scripts/Project/VirtualButtonsController.cs(6,14): error CS0738: `VirtualButtonsController ' does not implement interface member `IVirtualButtonEventHandler.OnButtonReleased(VirtualButtonBehaviour)' and the best implementing candidate `VirtualButtonsController.OnButtonPressed(VirtualButtonBehaviour) ' return type `void' does not match interface member return type `void'*/ public void OnButtonPressed (VirtualButtonBehaviour vb) { Debug.Log("HAS BEEN PRESSED " + vb.VirtualButtonName); if(vb.VirtualButtonName.Contains("next")) { if(currentProject == this.projects.Count - 1) { currentProject = 0; } else { currentProject++; } } else if(vb.VirtualButtonName.Contains("back")) { if(currentProject == 0) { currentProject = this.projects.Count - 1; } else { currentProject--; } } SetCurrentProject(); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("Button pressed!"); RIP2 = GameObject.Find("bug1"); animation.Play("Bug2bugRyg"); }
// Called when the virtual button has just been released. public void OnButtonReleased(VirtualButtonBehaviour vb) { /*if(mTrackableBehaviour.CurrentStatus == TrackableBehaviour.Status.TRACKED) { Debug.Log(vb.VirtualButtonName + " Released!"); transform.FindChild("Cube").renderer.material.color = Color.white; }*/ }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("Button pressed!"); Debug.Log("button released!"); RIP3 = GameObject.Find("door"); animation.Play("doorAnimation"); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("Button pressed!"); Debug.Log("button released!"); RIP8 = GameObject.Find("PixolTo3D#005_MeshPart0"); animation.Play("stjerne_animation_open"); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("Button pressed!"); Debug.Log("button released!"); RIP5 = GameObject.Find("deksel"); animation.Play("deksel_1_open"); }
void OnDisabled() { mVirtualButtonBehavior = this.GetComponent<VirtualButtonBehaviour>(); if (mVirtualButtonBehavior!=null) { mVirtualButtonBehavior.UnregisterEventHandler(this); } }
// Create a mesh with size 1, 1. public static void CreateVBMesh(VirtualButtonBehaviour vb) { GameObject vbObject = vb.gameObject; MeshFilter meshFilter = vbObject.GetComponent<MeshFilter>(); if (!meshFilter) { meshFilter = vbObject.AddComponent<MeshFilter>(); } // Setup vertex positions. Vector3 p0 = new Vector3(-0.5f, 0, -0.5f); Vector3 p1 = new Vector3(-0.5f, 0, 0.5f); Vector3 p2 = new Vector3(0.5f, 0, -0.5f); Vector3 p3 = new Vector3(0.5f, 0, 0.5f); Mesh mesh = new Mesh(); mesh.vertices = new Vector3[] { p0, p1, p2, p3 }; mesh.triangles = new int[] { 0,1,2, 2,1,3 }; // Add UV coordinates. mesh.uv = new Vector2[]{ new Vector2(0,0), new Vector2(1,0), new Vector2(0,1), new Vector2(1,1) }; // Add empty normals array. mesh.normals = new Vector3[mesh.vertices.Length]; // Automatically calculate normals. mesh.RecalculateNormals(); mesh.name = "VBPlane"; meshFilter.sharedMesh = mesh; MeshRenderer meshRenderer = vbObject.GetComponent<MeshRenderer>(); if (!meshRenderer) { meshRenderer = vbObject.AddComponent<MeshRenderer>(); } meshRenderer.sharedMaterial = (Material)AssetDatabase.LoadAssetAtPath( QCARUtilities.GlobalVars.VIRTUAL_BUTTON_MATERIAL_PATH, typeof(Material)); EditorUtility.UnloadUnusedAssets(); }
// Called when the virtual button has just been pressed: public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("OnButtonPressed"); if (!IsValid()) { return; } // Add the material corresponding to this virtual button // to the active material list: switch (vb.VirtualButtonName) { case "red": mActiveMaterials.Add(m_TeapotMaterials[0]); break; case "blue": mActiveMaterials.Add(m_TeapotMaterials[1]); break; case "yellow": mActiveMaterials.Add(m_TeapotMaterials[2]); break; case "green": mActiveMaterials.Add(m_TeapotMaterials[3]); break; case "playVideo": VideoPlaybackBehaviour[] videos = (VideoPlaybackBehaviour[]) FindObjectsOfType(typeof(VideoPlaybackBehaviour)); foreach (VideoPlaybackBehaviour video in videos) { video.VideoPlayer.Play(false, 0); } break; } // Apply the new material: if (mActiveMaterials.Count > 0) mTeapot.renderer.material = mActiveMaterials[mActiveMaterials.Count - 1]; }
// Called when the virtual button has just been released: public void OnButtonReleased(VirtualButtonBehaviour vb) { if (!IsValid()) { return; } // Remove the material corresponding to this virtual button // from the active material list: switch (vb.VirtualButtonName) { case "red": mActiveMaterials.Remove(m_TeapotMaterials[0]); break; case "blue": mActiveMaterials.Remove(m_TeapotMaterials[1]); break; case "yellow": mActiveMaterials.Remove(m_TeapotMaterials[2]); break; case "green": mActiveMaterials.Remove(m_TeapotMaterials[3]); break; case "playVideo": VideoPlaybackBehaviour[] videos = (VideoPlaybackBehaviour[]) FindObjectsOfType(typeof(VideoPlaybackBehaviour)); foreach (VideoPlaybackBehaviour video in videos) { video.VideoPlayer.Stop(); } break; } // Apply the next active material, or apply the default material: if (mActiveMaterials.Count > 0) mTeapot.renderer.material = mActiveMaterials[mActiveMaterials.Count - 1]; else mTeapot.renderer.material = m_TeapotMaterials[4]; }
// Assign default material to Virtual Button. public static void CreateMaterial(VirtualButtonBehaviour vb) { // Load reference material string referenceMaterialPath = QCARUtilities.GlobalVars.VIRTUAL_BUTTON_MATERIAL_PATH; Material referenceMaterial = (Material)AssetDatabase.LoadAssetAtPath(referenceMaterialPath, typeof(Material)); if (referenceMaterial == null) { Debug.LogError("Could not find reference material at " + referenceMaterialPath + " please reimport Unity package."); return; } // If the texture is null we simply assign a default material vb.renderer.sharedMaterial = referenceMaterial; // Cleanup assets that have been created temporarily. EditorUtility.UnloadUnusedAssets(); }
bool IEditorImageTargetBehaviour.TryGetVirtualButtonBehaviourByID(int id, out VirtualButtonBehaviour virtualButtonBehaviour) { return mVirtualButtonBehaviours.TryGetValue(id, out virtualButtonBehaviour); }
// Was number of scene elements reduced? private bool ElementsDeleted(TrackableBehaviour[] trackables, VirtualButtonBehaviour[] vbs) { bool elementsDeleted = false; if (trackables.Length < mLastNumTrackables || vbs.Length < mLastNumVirtualButtons) { elementsDeleted = true; } mLastNumTrackables = trackables.Length; mLastNumVirtualButtons = vbs.Length; return elementsDeleted; }
public void OnButtonPressed(VirtualButtonBehaviour vb) { houseAni.Play("houseanimation"); Debug.Log("BTN Pressed"); }
/// <summary> /// Create a mesh outline for the virtual button. /// </summary> private void CreateVBMesh(VirtualButtonBehaviour vb) { GameObject vbObject = vb.gameObject; MeshFilter meshFilter = vbObject.GetComponent<MeshFilter>(); if (!meshFilter) { meshFilter = vbObject.AddComponent<MeshFilter>(); } // Setup vertex positions. Vector3 p0 = new Vector3(-0.5f, 0, -0.5f); Vector3 p1 = new Vector3(-0.5f, 0, 0.5f); Vector3 p2 = new Vector3(0.5f, 0, -0.5f); Vector3 p3 = new Vector3(0.5f, 0, 0.5f); Mesh mesh = new Mesh(); mesh.vertices = new Vector3[] { p0, p1, p2, p3 }; mesh.triangles = new int[] { 0,1,2, 2,1,3 }; // Add UV coordinates. mesh.uv = new Vector2[]{ new Vector2(0,0), new Vector2(1,0), new Vector2(0,1), new Vector2(1,1) }; // Add empty normals array. mesh.normals = new Vector3[mesh.vertices.Length]; // Automatically calculate normals. mesh.RecalculateNormals(); mesh.name = "VBPlane"; meshFilter.sharedMesh = mesh; MeshRenderer meshRenderer = vbObject.GetComponent<MeshRenderer>(); if (!meshRenderer) { meshRenderer = vbObject.AddComponent<MeshRenderer>(); } meshRenderer.sharedMaterial = mVirtualButtonMaterial; }
void IVirtualButtonEventHandler.OnButtonReleased(VirtualButtonBehaviour vb) { }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("button2 release"); }
// Sets position and scale in the transform component of the Virtual Button // game object. The values are calculated from rectangle values (top-left // and bottom-right corners). // Returns false if Virtual Button is not child of an Image Target. public static bool SetPosAndScaleFromButtonArea(Vector2 topLeft, Vector2 bottomRight, ImageTargetBehaviour it, VirtualButtonBehaviour vb) { if (it == null) { return false; } float itScale = it.transform.lossyScale[0]; Vector2 pos = (topLeft + bottomRight) * 0.5f; Vector2 scale = new Vector2(bottomRight[0] - topLeft[0], topLeft[1] - bottomRight[1]); Vector3 vbPosITSpace = new Vector3(pos[0] / itScale, VirtualButtonBehaviour.TARGET_OFFSET, pos[1] / itScale); Vector3 vbScaleITSpace = new Vector3(scale[0], (scale[0] + scale[1]) * 0.5f, scale[1]); vb.transform.position = it.transform.TransformPoint(vbPosITSpace); // Image Target scale is canceled out (included in both scales) vb.transform.localScale = vbScaleITSpace / vb.transform.parent.lossyScale[0]; // Done: return true; }
public void OnButtonPressed(VirtualButtonBehaviour vb) { cubeAni.Play("model_animation"); Debug.Log("Button pressed"); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { player.Play("WalkRight"); Debug.Log("BTN Pressed"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { player.Play("none"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { AscendingRoof.SetActive(false); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { AscendingRoof.SetActive(true); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { houseAni.Play("none"); Debug.Log("BTN Released"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("Video Button released"); }
// This method checks if the Virtual Button already contains a mesh // component. private static bool IsVBMeshCreated(VirtualButtonBehaviour vb) { GameObject vbObject = vb.gameObject; MeshFilter meshFilter = vbObject.GetComponent<MeshFilter>(); MeshRenderer meshRenderer = vbObject.GetComponent<MeshRenderer>(); if (meshFilter == null || meshRenderer == null || meshFilter.sharedMesh == null) { return false; } return true; }
public void OnButtonReleased(VirtualButtonBehaviour vb) { frameCounter = 0; }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("BTN Realesed"); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { anima.SetTrigger("sayhi"); mySound.Play(); Debug.Log("Pressed"); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { ResourseStore.wood += resorce; Debug.Log("BTN Pressed"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log(vb.VirtualButtonName + " btn released"); pressed = false; }
void IVirtualButtonEventHandler.OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("catch"); cube.transform.position += new Vector3(-0.1f, 0, 0); }
public virtual void OnButtonReleased(VirtualButtonBehaviour vb) { //throw new System.NotImplementedException(); //Debug.Log("Release"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { }
public void OnButtonReleased(VirtualButtonBehaviour vb) { anim.Play("FreeVoxelGirl-idle", -1, 0f); Debug.Log("Button released"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { //message.gameObject.SetActive(false); change = false; }
public void OnButtonReleased(VirtualButtonBehaviour virtualButtonBehaviour) { Debug.Log("Released"); //plane.SetActive(false); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { switch (vb.VirtualButtonName) { case "btn1": a2.Stop(); a3.Stop(); a4.Stop(); a5.Stop(); a6.Stop(); a7.Stop(); a1.Play(); break; case "btn2": a1.Stop(); a3.Stop(); a4.Stop(); a5.Stop(); a6.Stop(); a7.Stop(); a2.Play(); break; case "btn3": a2.Stop(); a1.Stop(); a4.Stop(); a5.Stop(); a6.Stop(); a7.Stop(); a3.Play(); break; case "btn4": a2.Stop(); a3.Stop(); a1.Stop(); a5.Stop(); a6.Stop(); a7.Stop(); a4.Play(); break; case "btn5": a2.Stop(); a3.Stop(); a4.Stop(); a1.Stop(); a6.Stop(); a7.Stop(); a5.Play(); break; case "btn6": a2.Stop(); a3.Stop(); a4.Stop(); a5.Stop(); a1.Stop(); a7.Stop(); a6.Play(); break; case "btn7": a2.Stop(); a3.Stop(); a4.Stop(); a5.Stop(); a6.Stop(); a1.Stop(); a7.Play(); break; default: break; } }
public void OnButtonPressed(VirtualButtonBehaviour vb) { anim.Play("FreeVoxelGirl-jump", -1, 0f); sound_2.Play(); Debug.Log("Button pressed"); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { moveStatus = false; rotateStatus = false; }
/// <summary> /// Called when the virtual button has just been pressed: /// </summary> public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("OnButtonPressed"); KickSoccerball(); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("button released!"); RIP2 = GameObject.Find("bug1"); StartCoroutine(WaitAndPlay(3.0f,animation)); }
public void OnButtonReleased (VirtualButtonBehaviour vb) { Debug.Log("OnButtonPressed"); }
// Registers a Virtual Button at native code. This method is called // implicitly by the ImageTargetBehaviour.CreateVirtualButton method. This // method should not be called by user code. public bool RegisterVirtualButton(VirtualButtonBehaviour vb, string imageTargetName) { VirtualButtonBehaviour.RectangleData rectData = new VirtualButtonBehaviour.RectangleData(); Vector2 leftTop, rightBottom; vb.CalculateButtonArea(out leftTop, out rightBottom); rectData.leftTopX = leftTop.x; rectData.leftTopY = leftTop.y; rectData.rightBottomX = rightBottom.x; rectData.rightBottomY = rightBottom.y; IntPtr rectPtr = Marshal.AllocHGlobal( Marshal.SizeOf(typeof(VirtualButtonBehaviour.RectangleData))); Marshal.StructureToPtr(rectData, rectPtr, false); bool registerWorked = (imageTargetCreateVirtualButton(DataSetPtr, imageTargetName, vb.VirtualButtonName, rectPtr) != 0); if (registerWorked) { int id = virtualButtonGetId(DataSetPtr, imageTargetName, vb.VirtualButtonName); // Initialize the id of the button: vb.InitializeID(id); // Check we don't have an entry for this id: if (!mVBBehaviourDict.ContainsKey(id)) { // Add: mVBBehaviourDict.Add(id, vb); } } return registerWorked; }
/// <summary> /// Associates existing virtual button behaviour with virtualbuttons and creates new VirtualButtons if necessary /// </summary> void IEditorImageTargetBehaviour.AssociateExistingVirtualButtonBehaviour(VirtualButtonBehaviour virtualButtonBehaviour) { VirtualButton virtualButton = mImageTarget.GetVirtualButtonByName(virtualButtonBehaviour.VirtualButtonName); if (virtualButton == null) { Vector2 leftTop, rightBottom; virtualButtonBehaviour.CalculateButtonArea(out leftTop, out rightBottom); VirtualButton.RectangleData area = new VirtualButton.RectangleData { leftTopX = leftTop.x, leftTopY = leftTop.y, rightBottomX = rightBottom.x, rightBottomY = rightBottom.y }; virtualButton = mImageTarget.CreateVirtualButton(virtualButtonBehaviour.VirtualButtonName, area); // Create the virtual button if (virtualButton != null) { Debug.Log("Successfully created virtual button " + virtualButtonBehaviour.VirtualButtonName + " at startup"); virtualButtonBehaviour.UnregisterOnDestroy = true; } else { Debug.LogError("Failed to create virtual button " + virtualButtonBehaviour.VirtualButtonName + " at startup"); } } if (virtualButton != null) { // Duplicate check: if (!mVirtualButtonBehaviours.ContainsKey(virtualButton.ID)) { // OK: IEditorVirtualButtonBehaviour editorVirtualButtonBehaviour = virtualButtonBehaviour; editorVirtualButtonBehaviour.InitializeVirtualButton(virtualButton); mVirtualButtonBehaviours.Add(virtualButton.ID, virtualButtonBehaviour); Debug.Log("Found VirtualButton named " + virtualButtonBehaviour.VirtualButton.Name + " with id " + virtualButtonBehaviour.VirtualButton.ID); // Handle any changes to the virtual button in the scene // that are not reflected in the config file virtualButtonBehaviour.UpdatePose(); if (!virtualButtonBehaviour.UpdateAreaRectangle() || !virtualButtonBehaviour.UpdateSensitivity()) { Debug.LogError("Failed to update virtual button " + virtualButtonBehaviour.VirtualButton.Name + " at startup"); } else { Debug.Log("Updated virtual button " + virtualButtonBehaviour.VirtualButton.Name + " at startup"); } } } }
private void AddVirtualButtons(VirtualButtonBehaviour[] vbBehaviours) { for (int i = 0; i < vbBehaviours.Length; ++i) { VirtualButtonBehaviour virtualButton = vbBehaviours[i]; if (virtualButton.VirtualButtonName == null) { Debug.LogError("VirtualButton at " + i + " has no name."); continue; } ImageTargetBehaviour imageTarget = virtualButton.GetImageTarget(); if (imageTarget == null) { Debug.LogError("VirtualButton named " + virtualButton.VirtualButtonName + " is not attached to an ImageTarget."); continue; } // Image Target is not part of this data set. if (!imageTarget.References(this)) { continue; } int id = virtualButtonGetId(DataSetPtr, imageTarget.TrackableName, virtualButton.VirtualButtonName); if (id == -1) { // Create the virtual button if (RegisterVirtualButton(virtualButton, imageTarget.TrackableName)) { Debug.Log("Successfully created virtual button " + virtualButton.VirtualButtonName + " at startup"); virtualButton.UnregisterOnDestroy = true; id = virtualButtonGetId(DataSetPtr, imageTarget.TrackableName, virtualButton.VirtualButtonName); } else { Debug.LogError("Failed to create virtual button " + virtualButton.VirtualButtonName + " at startup"); } } if (id != -1) { // Duplicate check: if (!mVBBehaviourDict.ContainsKey(id)) { // OK: virtualButton.InitializeID(id); mVBBehaviourDict.Add(id, virtualButton); Debug.Log("Found VirtualButton named " + virtualButton.VirtualButtonName + " with id " + virtualButton.ID); // Handle any changes to the virtual button in the scene // that are not reflected in the config file virtualButton.UpdatePose(); if (!virtualButton.UpdateAreaRectangle(this) || !virtualButton.UpdateSensitivity(this)) { Debug.LogError("Failed to update virtual button " + virtualButton.VirtualButtonName + " at startup"); } else { Debug.Log("Updated virtual button " + virtualButton.VirtualButtonName + " at startup"); } } } } }
private bool CreateNewVirtualButtonFromBehaviour(VirtualButtonBehaviour newVBB) { // Calculate the button area: Vector2 leftTop, rightBottom; newVBB.CalculateButtonArea(out leftTop, out rightBottom); VirtualButton.RectangleData area = new VirtualButton.RectangleData { leftTopX = leftTop.x, leftTopY = leftTop.y, rightBottomX = rightBottom.x, rightBottomY = rightBottom.y }; VirtualButton virtualButton = mImageTarget.CreateVirtualButton(newVBB.VirtualButtonName, area); if (virtualButton == null) { Destroy(newVBB.gameObject); return false; } IEditorVirtualButtonBehaviour newEditorVBB = newVBB; newEditorVBB.InitializeVirtualButton(virtualButton); mVirtualButtonBehaviours.Add(virtualButton.ID, newVBB); return true; }
public void OnButtonReleased(VirtualButtonBehaviour vb) { isRotating = false; }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("attack"); action.attack(); }
public void OnButtonPressed(VirtualButtonBehaviour vb) { Application.OpenURL("https://www.youtube.com/watch?v=C0D12KZE7PY"); Debug.Log("Video Button Down"); }
public bool TryGetVirtualButtonByID(int id, out VirtualButtonBehaviour vb) { return mVBBehaviourDict.TryGetValue(id, out vb); }
public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("attacks"); }
// Unregister a Virtual Button at native code. This method is called // implicitly by the ImageTargetBehaviour.DestroyVirtualButton method. This // method should not be called by user code. public bool UnregisterVirtualButton(VirtualButtonBehaviour vb, string imageTargetName) { int id = virtualButtonGetId(DataSetPtr, imageTargetName, vb.VirtualButtonName); bool unregistered = false; if (imageTargetDestroyVirtualButton(DataSetPtr, imageTargetName, vb.VirtualButtonName) != 0) { if (mVBBehaviourDict.Remove(id)) { unregistered = true; } } if (!unregistered) { Debug.LogError("UnregisterVirtualButton: Failed to destroy " + "the Virtual Button."); } return unregistered; }
public void OnButtonPressed(VirtualButtonBehaviour vb) { cubeAni.Play("RotateCube"); Debug.Log("Button pressed"); }
// Associates existing VirtualButtonBehaviours with VirtualButtons private void AssociateVirtualButtonBehaviours(VirtualButtonBehaviour[] vbBehaviours, DataSet dataSet) { for (int i = 0; i < vbBehaviours.Length; ++i) { VirtualButtonBehaviour virtualButtonBehaviour = vbBehaviours[i]; if (virtualButtonBehaviour.VirtualButtonName == null) { Debug.LogError("VirtualButton at " + i + " has no name."); continue; } ImageTargetBehaviour imageTargetBehaviour = virtualButtonBehaviour.GetImageTargetBehaviour(); if (imageTargetBehaviour == null) { Debug.LogError("VirtualButton named " + virtualButtonBehaviour.VirtualButtonName + " is not attached to an ImageTarget."); continue; } // Image Target is not part of this data set. if (!dataSet.Contains(imageTargetBehaviour.Trackable)) { continue; } ((IEditorImageTargetBehaviour)imageTargetBehaviour).AssociateExistingVirtualButtonBehaviour(virtualButtonBehaviour); } }
public void OnButtonPressed(VirtualButtonBehaviour vb) { isRotating = true; }