public void GetAllControllers() { if (bonusController == null) { var bonus = Core.GetCore.GetController <BonusController>(); if (bonus != null) { bonusController = bonus; } } if (paddleController == null) { var paddle = Core.GetCore.GetController <PaddleController>(); if (paddle != null) { paddleController = paddle; } } if (ballController == null) { var ball = Core.GetCore.GetController <BallController>(); if (ball != null) { ballController = ball; } } isNeedControllers = false; }
public BonusController(Sprite[] bonusSprites, GameObject bonusPrefab) { spriteDict = new Dictionary <int, Sprite>() { { 0, bonusSprites[0] }, { 1, bonusSprites[1] }, { 2, bonusSprites[2] }, { 3, bonusSprites[3] }, }; bonusActions = new Dictionary <int, Action <Bonus> >() { { 0, ExtraBall }, { 1, IncreasePaddleLenght }, { 2, SpeedUpBalls }, { 3, SLowDownBalls }, }; this.bonusPrefab = bonusPrefab; currentBonuses = new List <Bonus>(); poolBonuses = new Queue <Bonus>(); coreUI = Core.GetCoreUI; var core = Core.GetCore; paddleController = core.GetController <PaddleController>(); gameController = core.GetController <GameController>(); ballController = core.GetController <BallController>(); }
private void Awake() { _scoreController = FindObjectOfType <ScoreController>(); _canvasTransform = GameObject.FindGameObjectWithTag("GameCanvas").transform; _ball = FindObjectOfType <BallController>(); }
private void Awake() { _ball = FindObjectOfType <BallController>(); _gameStatus = FindObjectOfType <GameStatus>(); _startYPos = transform.position.y; }