public void ApplyTo(PowerupManager car) { if (attached) { return; } attached = true; PowerupAttachable pAttachable = GetComponent <PowerupAttachable>(); PowerupEvent pEvent = GetComponent <PowerupEvent>(); PowerupBoost pBoost = GetComponent <PowerupBoost>(); PowerupStats pStats = GetComponent <PowerupStats>(); if (pAttachable != null) { appliedManager = car.Attach(pAttachable, pAttachable.attachType); } else if (pEvent != null) { appliedManager = car.AddEvent(pEvent); } else if (pBoost != null) { appliedManager = car.ApplyBoost(pBoost); } }
public void ReCalcStats() { StatPack powerupStats = new StatPack(); foreach (PowerupAttachable attachment in equippedWeapons.Values) { PowerupStats newStats = attachment.GetComponent <PowerupStats>(); if (newStats != null) { powerupStats += newStats.GetPack(); } } foreach (PowerupAttachable attachment in equippedMods.Values) { PowerupStats newStats = attachment.GetComponent <PowerupStats>(); if (newStats != null) { powerupStats += newStats.GetPack(); } } controller.GetPlayer().ReApplyStats(powerupStats); }