//判定を見るよう private void vecTest() { //コンポーネント取得 wa = hitObject.GetComponent <WallAbility>(); float x = hitPoint.x; float y = hitPoint.y; x *= 10; y *= 10; x = Mathf.Floor(x) / 10; y = Mathf.Floor(y) / 10; Debug.Log(wa.Width(true)); Debug.Log(wa.Width(false)); Debug.Log(wa.Height(true)); Debug.Log(wa.Height(false)); Debug.Log(hitPoint); }
//滑る床 private void SripAction(GameObject col) { if (wa.Height(true) - (Scale.y / 2) >= gameObject.transform.position.y - (Scale.y / 2)) { if (wa.Height(false) + (Scale.y / 2) <= gameObject.transform.position.y + (Scale.y / 2)) { if (gameObject.transform.position.x > col.gameObject.transform.position.x) { playerRig.velocity = new Vector3(0, playerRig.velocity.y, 0); } else { playerRig.velocity = new Vector3(0, playerRig.velocity.y, 0); } } else { playerRig.velocity = new Vector3(playerRig.velocity.x, 0, 0); } } else { if (wa.Width(true) - (Scale.x / 2) <= gameObject.transform.position.x - (Scale.x / 2) || wa.Width(false) + (Scale.x / 2) >= gameObject.transform.position.x + (Scale.x / 2)) { if (gameObject.transform.position.x > col.gameObject.transform.position.x) { playerRig.velocity = new Vector3(0, playerRig.velocity.y, 0); } else { playerRig.velocity = new Vector3(0, playerRig.velocity.y, 0); } } else { playerRig.velocity = new Vector3(playerRig.velocity.x, 0, 0); } } }
//回転の判定 private void test() { //コンポーネント取得 wa = hitObject.GetComponent <WallAbility>(); float x = hitPoint.x; float y = hitPoint.y; x *= 10; y *= 10; x = Mathf.Floor(x) / 10; y = Mathf.Floor(y) / 10; //どの位置にあたったか判定し回転する if (y == wa.Height(true) || y + 0.1f == wa.Height(true) || y - 0.1f == wa.Height(true)) { if (wa.colObjs[0] == null) { playerRot = Vector3.forward * 0; //Debug.Log("UP"); } else { // Debug.Log("UPだけどむり"); coltest(); } } else if (y == wa.Height(false) || y + 0.1f == wa.Height(false) || y - 0.1f == wa.Height(false)) { if (wa.colObjs[1] == null) { playerRot = Vector3.forward * 180; // Debug.Log("Down"); } else { // Debug.Log("Downだけどむり"); coltest(); } } else if (x == wa.Width(true) || x + 0.1f == wa.Width(true) || x - 0.1f == wa.Width(true)) { if (wa.colObjs[2] == null) { playerRot = Vector3.forward * 270; // Debug.Log("right"); } else { // Debug.Log("rightだけど無理"); coltest(); } } else if (x == wa.Width(false) || x + 0.1f == wa.Width(false) || x - 0.1f == wa.Width(false)) { if (wa.colObjs[3] == null) { playerRot = Vector3.forward * 90; // Debug.Log("left"); } else { // Debug.Log("leftだけど無理"); coltest(); } } else { // Debug.Log("何も該当していない"); coltest(); } wallNum = wa.abilityNumber; }