void OnTriggerEnter(Collider other) { if (other.name != "Ball") { return; } GlobalScript.IncrementScore(_isLeftDeadZonel, true); Ball.transform.SetParent(_isLeftDeadZonel ? RightPlayer.transform : LeftPlayer.transform); Ball.transform.localPosition = new Vector3(_isLeftDeadZonel ? -2.5f : 2.5f, 0); Ball.SendMessage("UpdateBallState"); RightPlayer.transform.localPosition = new Vector3(7.70f, 0); LeftPlayer.transform.localPosition = new Vector3(-7.70f, 0); }
private void OnTriggerEnter(Collider other) { if (other.name != "Ball") { return; ; } GlobalScript.IncrementScore(isLeftDeadZone); if (isLeftDeadZone) { Ball.transform.SetParent(RightPlayer.transform); } else { Ball.transform.SetParent(LeftPlayer.transform); } Ball.transform.localPosition = new Vector3(isLeftDeadZone ? -2.5f : 2.5f, 0); Ball.SendMessage("UpadateBallState"); }