// Update is called once per frame void Update() { delay -= Time.deltaTime; if (delay < 0) { switch (type) { case PowerupType.ENERGY: target.AddFlatAmountToEnergy(amount); break; case PowerupType.SHIELDS: target.AddFlatAmountToShield(amount); break; case PowerupType.ATTACK: target.AddFlatAmountToAttackCharge(amount); break; } GameObject.Destroy(this.gameObject); } }