/// <summary> /// Method for loading planet from save. No randomization, only straight and strong values. /// </summary> public void Load(WeaponModel _weapon, float weight, float hpAmount, float hpCurrent, Color color) { UIController = GetComponent <PlanetUIController>(); weapon = _weapon; this.weight = weight; this.hpAmount = hpAmount; this.hpCurrent = hpCurrent; UIController.UpdateHpProgress(hpCurrent, hpAmount); GetComponent <Renderer>().material.color = color; shotDelay = weapon.cooldown; StartCoroutine(CooldownCoroutine(0.5f)); }
/// <summary> /// Initialization of new weapon with randomizing some values /// </summary> public void Init(WeaponModel _weapon) { UIController = GetComponent <PlanetUIController>(); // Assign random weapon to planet weapon = _weapon; weight = Random.Range(minWeight, maxWeight + 1); hpAmount = Random.Range(minHp, maxHp); hpCurrent = hpAmount; UIController.UpdateHpProgress(hpCurrent, hpAmount); // Set random color to a planet GetComponent <Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f); shotDelay = weapon.cooldown; StartCoroutine(CooldownCoroutine(0.5f)); }