protected override void Awake() { base.Awake(); shield = Resources.Load <MasochistShield>("Prefabs/MasochistShield"); auraPrefab = Resources.Load <MasochistAura>("Prefabs/MasochistAura"); }
//Opted for a discrete method of doing a damage multiplier //Open to discuss the possibility of implementing a continuous method instead public override void TakeDamage(float damageIn) { base.TakeDamage(damageIn); //Determine the current damage multiplier float remainingHealthRatio = health / maxHealth; //50% health remaining -> 50% damage increase if (remainingHealthRatio <= 0.5f && damageMultiplier == 1) { damageMultiplier = 1.5f; SoundManager.instance.Play("ActivateAura", 1); curAura = Instantiate(auraPrefab, transform.position, new Quaternion()) as MasochistAura; curAura.playerShip = this; } else if (remainingHealthRatio > 0.5f && damageMultiplier == 1.5f) { Destroy(curAura.gameObject); damageMultiplier = 1f; } }