// // amount: what to decrease it by public void reduceHealth(int amount) { hp -= amount; StartCoroutine(redFlash()); // Checks if enemie's health is zero if (hp <= 0) { // Gives player certian amount of money PlayerStats.changeMoneyAmount(moneyForDefeating); // Lessens one less enemie alive in the world --WaveSpawner.EnemiesAlive; SoundManager.PlaySound(SoundManager.Sound.CashPickup); SoundManager.PlaySound(SoundManager.Sound.AlienBeam); destroy(GameAssets.SpriteToGameObject(GameAssets.i.dustCloud)).transform.position = transform.position + new Vector3(gameObject.GetComponent <Collider2D>().offset.x, gameObject.GetComponent <Collider2D>().offset.y, 0); Destroy(gameObject); } }