/// <summary> /// An object has exited the trigger. /// </summary> /// <param name="other">The collider that entered the trigger. May or may not be a character.</param> private void OnTriggerExit(Collider other) { if (!MathUtility.InLayerMask(other.gameObject.layer, 1 << LayerManager.Character) || m_MoveWithObjectAbility == null) { return; } m_MoveWithObjectAbility.Target = null; m_MoveWithObjectAbility = null; }
/// <summary> /// Drag drop this object. /// </summary> public void Placement() { DebugManager.Instance.PrintToInfoLog("Placement" + lastMarker); if (lastMarker) { if (PersistenceManager.Instance.IsAnchor(lastMarker)) { PersistenceManager.Instance.DeleteAnchor(lastMarker); needsRepinning = true; } MoveWithObject mwo = lastMarker.gameObject.AddComponent <MoveWithObject>() as MoveWithObject; mwo.StartRunning(); gameObject.SetActive(false); } }
/// <summary> /// Teleport the character to the specified destination. /// </summary> /// <param name="other">The collider that entered the trigger. May or may not be a character.</param> private void OnTriggerEnter(Collider other) { if (!MathUtility.InLayerMask(other.gameObject.layer, 1 << LayerManager.Character)) { return; } UltimateCharacterLocomotion characterLocomotion; if ((characterLocomotion = other.GetComponentInParent <UltimateCharacterLocomotion>()) == null) { return; } m_MoveWithObjectAbility = characterLocomotion.GetAbility <MoveWithObject>(); if (m_MoveWithObjectAbility == null) { return; } m_MoveWithObjectAbility.Target = m_Transform; }
private void OnMouseUp() { // create variables view = manager.GetComponent <AppController>().view; GameObject mainMenu = view.transform.Find("MainMenu(Clone)").gameObject; // create new cube object and set it up GameObject newTarget = Instantiate(Resources.Load("Cube") as GameObject); newTarget.transform.position = mainMenu.transform.position; newTarget.transform.rotation = mainMenu.transform.rotation; newTarget.transform.SetParent(view.transform, true); // set up its SetMenu script newTarget.GetComponent <SetMenu>().Target = mainMenu; newTarget.GetComponent <SetMenu>().manager = manager; // set up its MoveWithObject script MoveWithObject newobject = newTarget.GetComponent <MoveWithObject>(); newobject.ReferenceObject = view.transform.Find("HoloLensCamera").gameObject; newobject.StartRunning(); }