public AsteroidController(AsteroidData _asteroid, AsteroidView _asteroidView) { this.asteroid = _asteroid; this.asteroidView = _asteroidView; asteroidView.SetDamage(asteroid.Damage); resetHP = _asteroid.HP; }
private void OnTriggerEnter2D(Collider2D collision) { // столкновение с астероидом if (collision.tag == "Asteroid") { AsteroidView asteroid = collision.GetComponent <AsteroidView>(); HpEvent?.Invoke(asteroid.GetAsteroidDamage()); asteroid.KillAsteroid(); } }