public void Init(float maxHealth, RocketType rocketType) { RocketData rocketData = new RocketData(); RocketCharacteristics rocketCharacteristics = rocketData.GetCharacteristics(rocketType); countdown = rocketCharacteristics.Cooldown; rocketImageButton.sprite = rocketCharacteristics.sprite; rocketButton.onClick.AddListener(ClickRocketButton); healthBarSlider.maxValue = maxHealth; healthBarSlider.value = maxHealth; }
public void Init(int id, IPlanetController planetController, int planetID, int rocketID) { this.ID = id; this.planetID = planetID; this.rocketID = rocketID; this.planetController = planetController; rocketCharacteristics = planetController.GetRocketCharacteristics(); cooldown = rocketCharacteristics.Cooldown; planetController.OnDied += () => { OnDied?.Invoke(id); }; planetController.OnHealthChanged += ChangeHealth; planetController.SimpleUpdate += Update; //planetController.TakeDamage(0); }