// TODO : Event needed to change stage timer
        private void FindReferences()
        {
            var referenceManager = GlobalReferenceManager.ReferenceManager;

            asteroidSpawner = referenceManager.asteroidSpawner;
            currentLevel    = referenceManager.gameManager.currentLevel;
            var stage = currentLevel.stage;

            asteroidTimer = StageTimer(stage);
        }
Example #2
0
 private void FindReferences()
 {
     keyboardInputManager      = FindObjectOfType <KeyboardInputManager>();
     playerManager             = FindObjectOfType <PlayerManager>();
     powerUpRepository         = FindObjectOfType <PowerUpRepository>();
     powerUpManager            = FindObjectOfType <PowerUpManager>();
     asteroidsPooler           = FindObjectOfType <AsteroidsPooler>();
     asteroidSpawner           = FindObjectOfType <AsteroidSpawner>();
     asteroidSpritesRepository = FindObjectOfType <AsteroidSpritesRepository>();
     enemyManager = FindObjectOfType <EnemyManager>();
     uiManager    = FindObjectOfType <UiManager>();
     gameManager  = FindObjectOfType <GameManager>();
 }
        void Awake()
        {
            _rigidbody2D    = GetComponent <Rigidbody2D>();
            _spriteRenderer = GetComponentInChildren <SpriteRenderer>();
            var referenceManager = GlobalReferenceManager.ReferenceManager;

            asteroidSpawner = referenceManager.asteroidSpawner;

            var gameManager   = referenceManager.gameManager;
            var playerManager = referenceManager.playerManager;

            Hit         += gameManager.AddScore;
            ApplyDamage += playerManager.EnergyLoss;
        }