private void Update() { CheckSnakeAndBonusPosition(); if (_bonusPositionIsReached) { _bonusScoreCounter++; IncreaseScoreUI?.Invoke(_bonusScoreCounter); GameObject pickUpVFX = Instantiate(_pickUpVisualEffect, _bonusGO.transform.position, Quaternion.Euler(0, 180, 0)); Destroy(pickUpVFX, 0.5f); _pickUpAudioClip.Play(); AddBodyPart?.Invoke(); BonusSpawner._bonus.PickUp(); Destroy(_bonusGO.gameObject); _bonusGO = SpawnNewBonus?.Invoke(); } }
private void Start() { _bonusScoreCounter = 0; _bonusGO = SpawnNewBonus?.Invoke(); }