public static void AddBall() { if (session == null)//При переходе между уровнями должно будет вызываться само { session = new GameSession(SceneManager.GetActiveScene()); } session.AddBall(); }
/* Start is called before the first frame update */ void Start() { gameSession = FindObjectOfType <GameSession>(); gameSession.AddBall(); myAudioSource = GetComponent <AudioSource>(); myRigidBody2D = GetComponent <Rigidbody2D>(); if (gameSession.GetNumberOfBalls() > 1) { hasStarted = true; myRigidBody2D.velocity = new Vector2(xPush, yPush); } paddleToBallVector = transform.position - paddle1.transform.position; }
// Use this for initialization void Start() { gameSession = FindObjectOfType <GameSession>(); SFXPlayer = FindObjectOfType <SoundSystem>(); //if (SFXPlayer) print("Ball: SFXPlayer assigned"); if (gameSession) { basePaddleBallRelation = gameSession.basePaddleBallRelation; } PaddleBallRelation = basePaddleBallRelation; //print("PaddleBallRelation: " + PaddleBallRelation.ToString()); if (gameSession) { gameSession.AddBall(); } ManageFireballOnStart(); if (isOtherBallPresent()) { hasStarted = true; } }