public void Trigger(PlayerStats stats) { switch (type) { case Powerup.CREDITS: stats.AddCredits(amount); break; case Powerup.MISSILES: stats.gameObject.GetComponent<PlayerWeapons>().AddMissiles(amount); break; case Powerup.SHIELD: stats.Hurt(-amount); break; case Powerup.POWER: stats.ModEnergy(amount); break; case Powerup.ENGI: GameObject.Find("Cargo ship").GetComponent<CargoShipAI>().CurrEngi += amount; //Debug.Log(GameObject.Find("Cargo ship").GetComponent<CargoShipAI>().CurrEngi); break; } gameObject.Recycle(); }