// ギミックの近くに居るかを判定する処理 void CheckDistanceGimmick() { if (!mIsStopRaycast) { RaycastHit hit; if (Physics.Raycast(transform.position + new Vector3(0, 0.5f, 0), transform.forward, out hit, plManager.gimmickDistance)) { if (hit.collider.GetComponent <GameObjHighlight> () != null && hit.collider.GetComponent <GameObjHighlight> ().enabled != false) { gameObjHighlight = hit.collider.GetComponent <GameObjHighlight> (); gameObjHighlight.SetHighlightMaterial(); // もし左クリックしたらタグをチェックして動けるようになってます。 if (Input.GetMouseButton(0) && hit.collider.tag == "Movable") { mHoldingGO = hit.collider.gameObject; mIsStopRaycast = true; } } } else { if (!pushSkill && gameObjHighlight != null) { gameObjHighlight.SetDefaultMaterial(); gameObjHighlight = null; } } } else { gameObjHighlight = null; if (Input.GetMouseButtonUp(0)) { mIsStopRaycast = false; } // 物はプレーヤーの前にします。 Vector3 tempPos = transform.position + (transform.forward * objForward); mHoldingGO.transform.position = tempPos; } }
// Use this for initialization void Start() { _objHighlight = GetComponent <GameObjHighlight> (); r = GetComponent <Renderer> (); }