public void RobotReset() { Robot.transform.position = DefaultPos; RobotRb.velocity = Vector3.zero; CollisionSwitch = false; Move.RunStart(LearningMovePoint(false)); }
void ItemMove() { Move.RunStart(this.gameObject.transform.position); }
// Update is called once per frame void Update() { AutoCameraScroll(); float xAngle = View.transform.eulerAngles.x; float yAngle = View.transform.eulerAngles.y; int touchCount = Input.touches. Count(t => t.phase != TouchPhase.Ended && t.phase != TouchPhase.Canceled); if (touchCount == 1) { t = Input.touches.First(); switch (t.phase) { case TouchPhase.Moved: TouchMove = true; ButtonTouch = false; RotateAuto = false; //移動量に応じて角度計算 float x = -t.deltaPosition.x * scrollSpeed; float y = t.deltaPosition.y * scrollSpeed; //回転 //View.transform.Rotate(y, x, 0); View.transform.eulerAngles = new Vector3(y + xAngle, x + yAngle, 0); //Debug.Log(xAngle); //Debug.Log(yAngle); break; case TouchPhase.Began: break; case TouchPhase.Stationary: if (TouchMove == false) { ButtonTouch = true; } break; } } else if (touchCount == 2) { Debug.Log("二本"); } else if (touchCount == 0) { if ((ButtonTouch == true) && (TouchMove == false)) { //タッチしていた位置からRayを飛ばす Ray ray = Camera.main.ScreenPointToRay(t.position); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit)) { //Rayを飛ばしてあたったオブジェクトが地面だったら if ((hit.collider.gameObject.layer == groundLayer) && (CameraMove == false)) { RotateAuto = false; var runPoint = new Vector3(hit.point.x, View.transform.position.y, hit.point.z); Trans.RunStart(runPoint); CameraMove = true; //Debug.Log(hit.point); } } ButtonTouch = false; } else if (TouchMove) { TouchMove = false; } } }