public void HandleCollision(Hero hero) { if (hero == null) return; else if (hero.hasPowerup && this.PickupType!=Type.SpeedPad) { Debug.Log (hero.name + " could not pick up: " + this.PickupType.ToString ()); return; } else { Debug.Log (hero.name + " picked up: " + this.PickupType.ToString ()); hero.hasPowerup = true; hero.SetPowerup (this); } switch (this.PickupType) { case Type.Shield: { ShieldBuff.AddToHero (hero); // TODO: Change the shieldbuff class break; } case Type.MassiveAccel: { hero.TimeTillNotPowered = Time.time + secTillResetPowerup; hero.scalarAccelerationModifier = MassiveAccelerationValue; break; } case Type.MassiveDecel: { hero.TimeTillNotPowered = Time.time + secTillResetPowerup; hero.scalarAccelerationModifier = MassiveDecelerationValue; break; } case Type.StickyPad: { break; } case Type.GrapplingHook: { break; } case Type.StopGun: { break; } case Type.AlterThreshold: { hero.TimeTillNotPowered = Time.time + secTillResetPowerup; hero.ThresholdModifier = this.AlteredThresholdModifier; break; } case Type.SpeedPad: { if(this.transform.position.x > 1) hero.velocity.x -= 120; if(this.transform.position.y > 1) hero.velocity.y -= 80; hero.velocity.x += 40; hero.velocity.y += 40; this.ExpirationTime = 0.0f; break; } } GameObject.Destroy (this.gameObject); }