void SetButtonToDefault() { mClickController.mIsComplete = false; mClickController.SequenceButton = 0; mClickController.ResetClickCount(); mClickController.ResetAllRectValue(); }
// Update is called once per frame void Update() { Ray ray = Camera.main.ScreenPointToRay(new Vector3(mValueX * Screen.width, TopToBtmAxis(mValueY) * Screen.height, 0.0f)); Ray ray2 = Camera.main.ScreenPointToRay(new Vector3((mValueX + mValueOffSet) * Screen.width, TopToBtmAxis((mValueY + mValueOffSet)) * Screen.height, 0.0f)); RaycastHit hit; if (Physics.Raycast(ray, out hit, RayCastDistance, layerMask) && Physics.Raycast(ray2, out hit, RayCastDistance, layerMask) && !DisableRayCast) { mClickContoller.ClickType = ClickController.TypeOfClick.CLICK_ONCE; mClickContoller.Region1.x = mValueX; mClickContoller.Region1.y = mValueY; mClickContoller.Region1.width = mValueOffSet; mClickContoller.Region1.height = mValueOffSet; mCanInteract = true; if (mClickContoller.mIsComplete) { Debug.Log(hit.collider.gameObject.tag); if (hit.collider.gameObject.tag == "Examine") { hit.collider.gameObject.GetComponent <ExamineScript>().EnabledExamine = true; } else if (hit.collider.gameObject.tag == "PickUpItem") { hit.collider.gameObject.GetComponent <PickUpItemScript>().EnabledPickUp = true; } else if (hit.collider.gameObject.tag == "SlideDoor") { hit.collider.gameObject.GetComponent <SlideDoorScript>().EnabledSlideDoor = true; } else if (hit.collider.gameObject.tag == "OpenDoor") { hit.collider.gameObject.GetComponent <WesternDoorScript>().EnabledOpenDoor = true; } else if (hit.collider.gameObject.tag == "OpenDrawer") { hit.collider.gameObject.GetComponent <ChestScript>().IsEnabled = true; } else if (hit.collider.gameObject.tag == "OpenChestBox") { hit.collider.gameObject.GetComponent <ChestBoxScript>().IsEnabled = true; hit.collider.gameObject.layer = 0; } mClickContoller.mIsComplete = false; } } else { mClickContoller.ResetAllRectValue(); mCanInteract = false; } }