public void activate(GameObject player) { var p = player.GetComponent <Player>(); p.hitPoints += this.health; //TODO - armor //TODO - other activations. if (this.speedBoost > 0f) { p.speedBoost = this.speedBoost; if (p.speedBoostResetTime > Time.time) { p.speedBoostResetTime += this.activeTime; } else { p.speedBoostResetTime = Time.time + this.activeTime; } } if (this.invulnerability) { p.invulnerable = true; if (p.invulnerableResetTime > Time.time) { p.invulnerableResetTime += this.activeTime; } else { p.invulnerableResetTime = Time.time + this.activeTime; } } if (this.weapondamagemultiplier > 0f) { p.weaponDamageMultiplier += this.weapondamagemultiplier - 1f;//offset by 1 as 1 is at bottom. if (p.weaponDamageMultiplierResetTime > Time.time) { p.weaponDamageMultiplierResetTime += this.activeTime; } else { p.weaponDamageMultiplierResetTime = Time.time + this.activeTime; } } if (this.weaponspeedmultiplier > 0f) { p.weaponSpeedMultiplier += this.weaponspeedmultiplier - 1f; if (p.weaponSpeedMultiplierResetTime > Time.time) { p.weaponSpeedMultiplierResetTime += this.activeTime; } else { p.weaponSpeedMultiplierResetTime = Time.time + this.activeTime; } } this._useCount--; if (this.useCount <= 0) { if (!this.useOnPickup) { p.items[p.items.IndexOf(this.gameObject.GetComponent <IItem>())] = null; } this.gameObject.SetActive(false); } StatisticManager.calculatePowerupStatistics(p, this.type); }