// Use this for initialization void Awake() { interactive = GetComponent <VRInteractiveItem>(); interactive.OnOver += StartPowerOn; interactive.OnOut += EndPowerOn; originalSize = powerOnTimer.rectTransform.sizeDelta; }
private void OnEnable() { item = GetComponent <VRInteractiveItem>(); boxCollider = GetComponent <BoxCollider>(); rectTransform = GetComponent <RectTransform>(); if (frame != null) { frame.SetActive(false); } if (fill != null) { fill.fillAmount = 0f; } if (item == null) { Debug.Log("VRInteractiveItem not found at " + gameObject.name); } else { item.OnOver += HandleOver; item.OnOut += HandleOut; item.OnDown += HandleDown; item.OnUp += HandleUp; } }
protected override void OnEnable() { if (m_InteractiveItem != null) { m_InteractiveItem.OnOver += HandleOver; m_InteractiveItem.OnOut += HandleOut; m_InteractiveItem.OnClick += ActivateButton; } else { m_InteractiveItem = gameObject.GetComponent <VRInteractiveItem>(); m_InteractiveItem.OnOver += HandleOver; m_InteractiveItem.OnOut += HandleOut; m_InteractiveItem.OnClick += ActivateButton; } if (m_selector == null) { m_selector = GameObject.Find("Gaze_GUI").GetComponent("SelectionRadial") as AbstractSelector; //Dialog.Assert(m_selector != null, "BaseButton.OnEnable() could not find OVRCameraRig's SelectionRadial.", AssertLevel.Level_1); } // Invoke should NOT be called if the button is inactive (!interactable) this.onClick.AddListener(OnClick); if (m_selector != null) { m_selector.OnSelectionComplete += HandleSelectionComplete; } }
void OnDisable() { VRInteractiveItem item = gameObject.GetComponent <VRInteractiveItem>(); item.OnClick -= InvokeEvents; item.OnDoubleClick -= InvokeDoubleClickEvents; }
private void OnEnable() { item = GetComponent <VRInteractiveItem>(); ColorDictionary = new Dictionary <string, Vector4>(); colorBlocksDict = new Dictionary <int, Dictionary <string, Vector4> >(); if (item == null) { Debug.Log("VRInteractiveItem not found at " + gameObject.name); } else { item.OnOver += HandleOver; item.OnOut += HandleOut; item.OnDown += HandleDown; item.OnUp += HandleUp; } ColorItem.changeFrame += ChangeFrame; GameController.sceneLoaded += () => { drawingItem = GameObject.Find("walls"); Debug.Log("Walls found"); Redraw(lastColor); }; //_dataAsset.Init(this); VRInput.instance.OnSwipe += OVR_InputHandling; }
private void Awake() { m_InteractiveItem = gameObject.GetComponent <VRInteractiveItem>(); m_SelectionRadial = GameObject.FindWithTag("MainCamera2").GetComponent <SelectionRadial>(); mpc = GameObject.Find("sphere").GetComponent <MediaPlayerCtrl>(); }
void Awake() { //get the component vrInteractive = GetComponent <VRInteractiveItem>(); transform.LookAt(Camera.main.transform.position); }
} // Public property for gazeOver private void Awake() { // Set default references gazeManager = GazeManager.Instance; interactiveItem = this.GetComponent <VRInteractiveItem>(); selectionRadial = Camera.main.GetComponent <SelectionRadial>(); }
private void Awake() { interactiveItem = GetComponent <VRInteractiveItem>(); _renderer = GetComponent <MeshRenderer>(); originColor = _renderer.material.color; door = GameObject.Find("door"); }
// Update is called once per frame void Update() { Debug.DrawRay(m_transform.position, m_transform.position + m_transform.forward * 30); Ray eyeTracker = new Ray(m_transform.position, m_transform.forward); if (Physics.Raycast(eyeTracker, out m_hit, 30, m_layerMask)) { VRInteractiveItem item = m_hit.collider.GetComponent <VRInteractiveItem>(); m_vrInput.m_isGazeOnAnItem = true; m_currentInteractiveItem = item; if (item && item != m_lastInteractiveItem) { item.Over(); } if (item != m_lastInteractiveItem) { DesactivateLastItem(); } m_lastInteractiveItem = item; } else { DesactivateLastItem(); m_vrInput.m_isGazeOnAnItem = false; m_currentInteractiveItem = null; } }
// Use this for initialization void OnEnable() { // find the interactive item if // they aren't already set if (m_InteractiveItem == null) { m_InteractiveItem = GetComponent <VRInteractiveItem>(); } // add the actions to trigger when the // interactive item is looked at m_InteractiveItem.OnOver += HandleOver; m_InteractiveItem.OnOut += HandleOut; // if there is a selection radial set it up if (m_SelectionRadial != null) { m_SelectionRadial.OnSelectionComplete += HandleSelectionComplete; if (!m_RequireClick) { //StartSelection += SelectionRadial.HandleDown; //EndSelection += SelectionRadial.HandleUp; } } }
private void Awake() { if (m_InteractiveItem == null) { m_InteractiveItem = gameObject.AddComponent <VRInteractiveItem> (); } }
// Use this for initialization void Start() { m_LevelManager = GameObject.FindObjectOfType <LevelManager>(); m_MonitorText = GameObject.Find("MonitorText").GetComponent <Text>(); m_InteractiveItem = this.GetComponent <VRInteractiveItem>(); m_InteractiveItem.OnClick += this.TutorialCompleted; }
//[SerializeField] private string pName; //[SerializeField] private string pInfo; //[SerializeField] private Texture pImg; private void Awake() { m_InteractiveItem = GetComponent <VRInteractiveItem>(); //m_Renderer = GetComponent<MeshRenderer>(); m_SelectionRadial = Camera.main.GetComponent <SelectionRadial>(); //origMaterial = m_Renderer.material; }
[SerializeField] protected VRInteractiveItem m_InteractiveItem; // The interactive item for where the user should click to load the level. // Start is called before the first frame update void Start() { if (m_InteractiveItem == null) { m_InteractiveItem = GetComponent <VRInteractiveItem>(); } }
// Use this for initialization public override void Start() { base.Start(); interactiveItem = GetComponent <VRInteractiveItem>(); interactiveItem.OnOver += HandleOver; interactiveItem.OnOut += HandleOut; }
private void Awake() { IsInfo = true; m_InteractiveItem = GetComponent <VRInteractiveItem>(); m_SelectionRadial = Camera.main.GetComponent <SelectionRadial>(); origMaterial = m_Renderer.material; }
protected override GameObject CreateObject(Vector3 position, Quaternion rotation) { GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube); go.transform.position = position; go.transform.rotation = rotation; VRInteractiveItem vrii = go.AddComponent <VRInteractiveItem>(); go.AddComponent <InitialCollisionCheck>(); InteractiveColorInterpolator ici = go.AddComponent <InteractiveColorInterpolator>(); InteractiveShakeAndFire isaf = go.AddComponent <InteractiveShakeAndFire>(); Rigidbody rb = go.AddComponent <Rigidbody>(); ici.InteractiveItem = vrii; ici.Initialize(); isaf.InteractiveItem = vrii; isaf.Selection = _SelectionRadialEyeTribe; isaf.ReticleTransform = _ReticleTransform; isaf.RigidBody = rb; isaf.Initialize(); return(go); }
void SpawnSnowflake() { // Range of spawm x and z float addXPos = Random.Range(-rangeX, rangeX); float addZPos = Random.Range(-rangeZ, rangeZ); // Scale and position of snowflake float _scale = Random.Range(0.2f, 0.8f); Vector3 spawnPos = new Vector3(addXPos, height, addZPos); falloutIndex = Random.Range(0, snowPrefabs.Length); snowflake = (GameObject)Instantiate(snowPrefabs[falloutIndex], spawnPos, Quaternion.AngleAxis(90, new Vector3(1, 0, 0))); snowflake.transform.localScale = new Vector3(_scale, _scale, _scale); snowflake.transform.Rotate(new Vector3(0, 1, 0), 10 * Time.deltaTime); snowflake.transform.parent = transform; Destroy(snowflake, _lifetime); VRInteractiveItem snowInt = snowflake.GetComponent <VRInteractiveItem>(); if (snowInt) { snowInt.OnOver += SnowflakeOver; snowInt.OnOut += SnowflakeOut; snowInt.OnClick += SnowflakeClick; } }
private void Awake() { if (_VRInteractiveItem == null) { _VRInteractiveItem = GetComponent <VRInteractiveItem>(); } }
private void Awake() { interactiveItem = GetComponent <VRInteractiveItem>(); _renderer = GetComponent <MeshRenderer>(); originColor = _renderer.material.color; self = GetComponent <Transform>(); }
void Awake() { //get the component vrInteractive = GetComponent <VRInteractiveItem>(); //is it initially visible canvas.enabled = isInitiallyVisible; }
// Use this for initialization void Awake() { if (m_InteractiveItem == null) { m_InteractiveItem = GetComponent <VRInteractiveItem>(); } myRect = GetComponent <RectTransform>(); }
/// <summary> /// Starts the countdown before activating the interaction /// </summary> /// <param name="hit">Item to interact with</param> public void StartCount(RaycastHit hit) { if (!_active) { _item = hit.collider.GetComponent <VRInteractiveItem>(); _coroutine = StartCoroutine(FillReticle()); } }
private void DeactiveLastInteractible() { if (m_LastInteractible == null) return; m_LastInteractible.Out(); m_LastInteractible = null; }
protected override void Awake() { _interactiveItem = GetComponent <VRInteractiveItem>(); _interactiveItem.OnClick += HandleVROnClick; _interactiveItem.OnOver += HandleVROnOver; base.Awake(); }
// Use this for initialization void Start() { item = GetComponent <VRInteractiveItem>(); btn = GetComponentInChildren <MenuButton>(); audioSource = GetComponent <AudioSource>(); StartCoroutine(CheckForGaze()); }
// Use this for initialization void Start() { m_sceneCamera = Camera.main; m_Rigibody = this.GetComponent <Rigidbody>(); m_InteractiveItem = this.GetComponent <VRInteractiveItem>(); m_InteractiveItem.OnClick += this.Push; m_LevelManager = GameObject.FindObjectOfType <LevelManager>(); }
private void Awake() { cameraTransfrom = Camera.main.transform; audioSource = GetComponent <AudioSource>(); vrInteractiveItem = GetComponent <VRInteractiveItem>(); mRenderer = GetComponent <Renderer>(); mCollider = GetComponent <Collider>(); }
protected void Awake() { if (m_InteractiveItem == null) { m_InteractiveItem = GetComponent <VRInteractiveItem>(); } referenceManager = ReferenceManager.Instance; }
void Awake() { //grabbing the vr interactive component vrInteractive = GetComponent <VRInteractiveItem>(); //get button button = GetComponentInChildren <Button>(); }
private void EyeRaycast() { // Show the debug ray if required if (m_ShowDebugRay) { Debug.DrawRay(m_Camera.position, m_Camera.forward * m_DebugRayLength, Color.blue, m_DebugRayDuration); } // Create a ray that points forwards from the camera. Ray ray = new Ray(m_Camera.position, m_Camera.forward); RaycastHit hit; // Do the raycast forweards to see if we hit an interactive item if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers)) { VRInteractiveItem interactible = hit.collider.GetComponent<VRInteractiveItem>(); //attempt to get the VRInteractiveItem on the hit object m_CurrentInteractible = interactible; // If we hit an interactive item and it's not the same as the last interactive item, then call Over if (interactible && interactible != m_LastInteractible) interactible.Over(); // Deactive the last interactive item if (interactible != m_LastInteractible) DeactiveLastInteractible(); m_LastInteractible = interactible; // Something was hit, set at the hit position. if (m_Reticle) m_Reticle.SetPosition(hit); if (OnRaycasthit != null) OnRaycasthit(hit); } else { // Nothing was hit, deactive the last interactive item. DeactiveLastInteractible(); m_CurrentInteractible = null; // Position the reticle at default distance. if (m_Reticle) m_Reticle.SetPosition(); } }
void Update() { //if not the local player, don't do anything as it's meaningless if (!isLocalPlayer) return; if (Input.GetKeyDown(KeyCode.E)) dbg_printInventory(); lookingObject = m_EyeRaycaster.CurrentInteractible; if (Input.GetKeyDown(KeyCode.F)) dbg_serverPrintInventory(); //if the inventory has changed in someway, redraw the inventory UI. if (invChanged) visualList(); //update the reticle to indicate the currently selected item if (activeItem == 0 && spt_playerControls.aButtonPressed()) { Fisting(); } else reticleUpdate(); //use the triggers as cycle controls through the inventory, but only allow them to register once. if ((spt_playerControls.triggers() == -1 || Input.GetKey(KeyCode.A)) && !once) { cycleLeft(); once = true; } if ((spt_playerControls.triggers() == 1 || Input.GetKey(KeyCode.D)) && !once) { cycleRight(); once = true; } if (spt_playerControls.triggers() == 0) once = false; //Prevents multiple cycles in one trigger press //ryans test stuff because his control does wierd stuff if (Input.GetKeyDown(KeyCode.A)) cycleLeft(); if (Input.GetKeyDown(KeyCode.D)) { cycleRight(); } if (Input.GetKeyDown(KeyCode.N) || Input.GetButtonDown("xButton")) sendItem(); if (Input.GetKeyDown(KeyCode.E)) dbg_printInventory(); if (Input.GetKeyDown(KeyCode.F)) dbg_serverPrintInventory(); if (Input.GetKeyDown(KeyCode.Q)) Fisting(); /* if (Input.GetKeyDown(KeyCode.Y) || Input.GetButtonDown("yButton")) inspecting = !inspecting; if (inspecting) inspectItem(); else stopInspectItem(); */ }
void Awake() { m_InteractiveItem = this.GetComponent<VRInteractiveItem>(); m_Renderer = this.GetComponent<MeshRenderer>(); }