private void Start() { _animator = GetComponent <Animator>(); if (_animator == null) { Debug.LogError("Animator is NULL."); } _collider = GetComponent <BoxCollider2D>(); if (_collider == null) { Debug.LogError("BoxCollider2D is NULL."); } _audioSource = GetComponent <AudioSource>(); if (_audioSource == null) { Debug.LogError("Audio Source on Enemy is NULL."); } _health = GetComponent <Health>(); if (_health == null) { Debug.LogError("Health on enemy is NULL."); } _health.OnLivesChange += OnLivesChange; _gameManager = ManagersAggregator.Get <GameManager>(); }
private void Start() { _gameManager = ManagersAggregator.Get <GameManager>(); _powerupsController = GetComponent <PowerupsController>(); _powerupsController.SpeedMultiplierStateChanges += ChangeSpeed; _player = GetComponent <Player>(); }
// Start is called before the first frame update void Start() { _spawnManager = ManagersAggregator.Get <SpawnManager>(); _collider = GetComponent <CircleCollider2D>(); if (_collider == null) { Debug.LogError("Collider is Null."); } _spriteRenderer = GetComponent <SpriteRenderer>(); if (_spriteRenderer == null) { Debug.LogError("Sprite Renderer on Asteroid is NULL."); } _health = GetComponent <Health>(); if (_health == null) { Debug.LogError("Health on Asteroid is NULL."); } _health.OnLivesChange += OnLivesChanged; }