private void CheckBallPosition() { if (Math.Abs(ballPosition.x - midPoint.position.x) < 0.05f) { //Debug.Log("MidPoint"); ball.ChangeDirection(-1); } else if (ballPosition.x >= leftPoint.position.x && ballPosition.x <= midPoint.position.x) { var degreeVector = CalculateLeftDirection(); if (thisType == PlayerType.PC) { degreeVector.y *= -1; } ball.ChangeDirection(degreeVector); //Debug.Log("Left Point"); } else if (ballPosition.x <= rightPoint.position.x && ballPosition.x > midPoint.position.x) { //Debug.Log("Right Point");//Right var degreeVector = CalculateRightDirection(); if (thisType == PlayerType.PC)//Y direction different player { degreeVector.y *= -1; } ball.ChangeDirection(degreeVector); } }
private void Update() { SetBall(); if (!CheckTrigger()) { return; } if (!isEnter) { return; } StartCoroutine(CheckEnter()); var dir = ball.Direction; //Debug.Log(dir); dir.x *= -1; ball.ChangeDirection(dir); }