void OnGUI() { if (GUI.Button(new Rect(20, 20, 150, 40), "Aircraft On/Off")) { if (!isOn) { shaderGlow gls = elCubo.GetComponent <shaderGlow>(); gls.lightOn(); isOn = true; } else { shaderGlow gls = elCubo.GetComponent <shaderGlow>(); gls.lightOff(); isOn = false; } } }
void Update() { if (Application.isEditor) { if (Input.GetMouseButtonDown(0)) { ButtonPressed(Input.mousePosition); } } else { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { ButtonPressed(Input.GetTouch(0).position); } } if (!QuizController.instance.quizStarted) { return; } RaycastHit hit; Transform objectHit = null; Ray ray = ARCamera.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0)); if (Physics.Raycast(ray, out hit)) { objectHit = hit.transform; } shaderGlow glowObj = null; // I have no idea why i removed this, might be breaking everything by not being there. // TODO: check if (objectHit != null) { if (QuizController.instance.questionCurrentlyGoing && objectHit.tag == "QuizObject") { return; } if (!QuizController.instance.questionCurrentlyGoing && objectHit.tag == "AnswerObject") { return; } } if (objectHit != null) { glowObj = objectHit.GetComponent <shaderGlow>(); } if (currentlyGlowing != glowObj) { if (currentlyGlowing != null) { currentlyGlowing.lightOff(); } if (glowObj != null) { glowObj.lightOn(); } } currentlyGlowing = glowObj; }
// Update is called once per frame void Update() { //#if ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) // if (Input.touchCount == 1) // { // // Touch touch = Input.touches[0]; // // ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent<Camera>().ScreenPointToRay(Input.touches[0].position); // if (touch.phase == TouchPhase.Stationary && Physics.Raycast(ray.origin, ray.direction, out hit)) // { // // if (hit.collider.gameObject.name.Contains("ATM") ) // { // FeetHitten = true; // if (ShowBancomat != null) // { // ShaderGlow.lightOn(); // ShowBancomat.SelectBancomat(); // } // // } // // // Debug.Log(hit.collider.gameObject.name); // // } // else // if ((touch.phase == TouchPhase.Ended && FeetHitten)) // { // // // FeetHitten = false; // // } // // // } //#else //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); if (hit.collider.gameObject.name.Contains("ATM")) { // Debug.Log("It's working!"); FeetHitten = true; if (ShowBancomat != null) { AudioSource.Play(); ShaderGlow.lightOn(); ShowBancomat.SelectBancomat(); } } else { //Debug.Log("nopz"); } } else { // Debug.Log("No hit"); } } //#endif }
// Update is called once per frame void Update() { //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); switch (hit.collider.gameObject.name) { case "Smarticall_9": FeetHitten = true; if (ShowSmartphone != null) { AudioSource.Play(); FrameSmarticall_9.SetActive(true); PhoneSmarticall_9.lightOn(); ShowSmartphone.SelectSmartical(); CommonData.currentUser.data.SmarticallBuy = true; } break; case "Smartphone_Smart": FeetHitten = true; if (ShowSmartphone != null) { AudioSource.Play(); FrameSmarticall_9.SetActive(true); PhoneSmarticall_9.lightOn(); ShowSmartphone.SelectSmartical(); CommonData.currentUser.data.SmarticallBuy = true; } break; case "Communata_8": FeetHitten = true; if (ShowSmartphone != null) { AudioSource.Play(); PhoneCommunata_8.lightOn(); FrameCommunata_8.SetActive(true); ShowSmartphone.SelectCommunata(); } break; case "Smartphone_Communata": FeetHitten = true; if (ShowSmartphone != null) { AudioSource.Play(); PhoneCommunata_8.lightOn(); FrameCommunata_8.SetActive(true); ShowSmartphone.SelectCommunata(); } break; case "Phone_1_Black": FeetHitten = true; if (animationCompleet && ShowSmartphone != null) { AudioSource.Play(); PhoneGlow_1.lightOn(); ShowSmartphone.SelectPhone_1(); } break; case "Phone_2_White": FeetHitten = true; if (animationCompleet && ShowSmartphone != null) { AudioSource.Play(); PhoneGlow_2.lightOn(); ShowSmartphone.SelectPhone_2(); } break; case "Phone_3_Metalic": FeetHitten = true; if (animationCompleet && ShowSmartphone != null) { AudioSource.Play(); PhoneGlow_3.lightOn(); ShowSmartphone.SelectPhone_3(); } break; case "Phone_4_Gold": FeetHitten = true; if (animationCompleet && ShowSmartphone != null) { AudioSource.Play(); PhoneGlow_4.lightOn(); ShowSmartphone.SelectPhone_4(); } break; } } else { // Debug.Log("No hit"); } } }
// Update is called once per frame void Update() { //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); switch (hit.collider.gameObject.name) { case "deer_head_case": FeetHitten = true; if (ShowAcssesorShop != null) { AudioSource.Play(); ShaderGlowCase.lightOn(); ShowAcssesorShop.SelectCase(); CommonData.currentUser.data.contAcssesur++; // hit.collider.gameObject.SetActive(false); } break; case "charger": FeetHitten = true; if (ShowAcssesorShop != null) { AudioSource.Play(); ShaderGlowChenge.lightOn(); ShowAcssesorShop.SelectCharge(); CommonData.currentUser.data.contAcssesur++; // hit.collider.gameObject.SetActive(false); } break; case "Powerbank": FeetHitten = true; if (ShowAcssesorShop != null) { AudioSource.Play(); ShaderGlowPowerBAnk_1.lightOn(); ShaderGlowPowerBAnk_2.lightOn(); ShowAcssesorShop.SelectPowerBank(); CommonData.currentUser.data.contAcssesur++; // hit.collider.gameObject.SetActive(false); } break; case "Headphones_b_prefab": FeetHitten = true; if (ShowAcssesorShop != null) { AudioSource.Play(); ShaderGlowPhone.lightOn(); ShowAcssesorShop.SelectPhone(); CommonData.currentUser.data.contAcssesur++; // hit.collider.gameObject.SetActive(false); } break; } } else { // Debug.Log("No hit"); } } }
// Update is called once per frame void Update() { //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); switch (hit.collider.gameObject.name) { case "Insuramore": FeetHitten = true; if (ShowInsuranceeProvider != null) { AudioSource.Play(); CommonData.prefabs.gameobjectLookup[StringConstants.PrefabArrowInsuranceBox].SetActive(false); FrameInsuramore.SetActive(true); ShowInsuranceeProvider.SelecInsuramore(); } break; case "Planetsure": FeetHitten = true; if (ShowInsuranceeProvider != null) { AudioSource.Play(); CommonData.prefabs.gameobjectLookup[StringConstants.PrefabArrowInsuranceBox].SetActive(false); FramePlanetsure.SetActive(true); ShowInsuranceeProvider.SelecPlanetsure(); } break; case "Phone_1_64": FeetHitten = true; if (animationCompleet && ShowInsuranceeProvider != null) { AudioSource.Play(); PhoneGlow_1.lightOn(); ShowInsuranceeProvider.SelectPhone_1(); } break; case "Phone_2_128": FeetHitten = true; if (animationCompleet && ShowInsuranceeProvider != null) { AudioSource.Play(); PhoneGlow_2.lightOn(); ShowInsuranceeProvider.SelectPhone_2(); } break; case "Phone_3_256": FeetHitten = true; if (animationCompleet && ShowInsuranceeProvider != null) { AudioSource.Play(); PhoneGlow_3.lightOn(); ShowInsuranceeProvider.SelectPhone_3(); } break; } } else { // Debug.Log("No hit"); } } }
// Update is called once per frame void Update() { //#if ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) // if (Input.touchCount == 1) // { // // Touch touch = Input.touches[0]; // // ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent<Camera>().ScreenPointToRay(Input.touches[0].position); // if (touch.phase == TouchPhase.Stationary && Physics.Raycast(ray.origin, ray.direction, out hit)) // { // // switch (hit.collider.gameObject.name) // { // case "ConnectaPhone": // // FeetHitten = true; // if (ShowServiceProvider != null) // { // // FrameConnectaPhone.SetActive(true); // ShowServiceProvider.SelecConnectaPhone(); // } // break; // case "Polacon": // FeetHitten = true; // // if (ShowServiceProvider != null) // { // FramePolacone.SetActive(true); // ShowServiceProvider.SelecPolacon(); // } // break; // } // // // Debug.Log(hit.collider.gameObject.name); // // } // else // if ((touch.phase == TouchPhase.Ended && FeetHitten)) // { // // // FeetHitten = false; // // } // // // } //#else //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup[StringConstants.ARCamera].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); switch (hit.collider.gameObject.name) { case "ConnectaPhone": FeetHitten = true; if (animationCompleet && ShowServiceProvider != null) { AudioSource.Play(); FrameConnectaPhone.SetActive(true); ShowServiceProvider.SelecConnectaPhone(); } break; case "Polacon": FeetHitten = true; if (animationCompleet && ShowServiceProvider != null) { AudioSource.Play(); FramePolacone.SetActive(true); ShowServiceProvider.SelecPolacon(); } break; case "Smartphone_Big": FeetHitten = true; if (animationCompleet && ShowServiceProvider != null) { AudioSource.Play(); Smartphone_Big_Glow.lightOn(); ShowServiceProvider.SelecPhone_Big(); animationCompleet = false; } break; case "Smartphone_Small": FeetHitten = true; if (animationCompleet && ShowServiceProvider != null) { AudioSource.Play(); Smartphone_Small_Glow.lightOn(); ShowServiceProvider.SelecPhone_Small(); animationCompleet = false; } break; } } else { // Debug.Log("No hit"); } } //#endif }
// Update is called once per frame void Update() { //Mouse if (Input.GetMouseButtonDown(0)) { ray = CommonData.prefabs.gameobjectLookup["ARCamera"].GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Debug.Log("It's working!"); if (hit.collider.gameObject.name.Contains("spine1_hiResSpine1")) { if (ShowElephant != null) { countHit++; ShaderGlow.lightOn(); AudioSource.Play(); if (countHit == 3) { countHit = 0; ColliderCheck.enabled = false; GetComponent <Animator>().SetTrigger("FightIdle"); AudioSource.clip = SoundElephant; AudioSource.Play(); StartCoroutine(HideShaderGlow_End()); } else { StartCoroutine(HideShaderGlowHit()); } } Debug.Log("It's Baby"); } else { if (ShowElephant != null) { Debug.Log("No Baby_2"); AudioSource.Play(); ShowElephant.ShowMiss(); } Debug.Log("No Baby"); } } else { if (ShowElephant != null) { Debug.Log("No hit_2"); AudioSource.Play(); ShowElephant.ShowMiss(); } Debug.Log("No hit"); } } }