/// <summary> /// Apply a utility to the tank. /// </summary> /// <param name="utility">The utility</param> public void ApplyUtility(VTankObject.Utility utility) { Utilities.Add(utility); ActiveUtility autil = new ActiveUtility(utility); ParticleEmitterSettings pset = Renderer.RendererAssetPool.ParticleEmitterSettings["Utility"]; pset.LifeSpan = utility.duration; pset.ParticleSystemName = utility.model; autil.Emitter = new ParticleEmitter(pset); autil.Emitter.Position = Position; autil.Emitter.MimicPosition(this, Vector3.Zero); ServiceManager.Scene.Add(autil.Emitter, 3); activeUtilities.Add(autil); }
/// <summary> /// Apply an instant health utility to the tank /// </summary> /// <param name="utility">The utility</param> public void ApplyInstantHealth(VTankObject.Utility utility) { int healthBonus = (int)(MaxHealth * utility.healthFactor) + utility.healthIncrease; if (this.Health + healthBonus > MaxHealth) { //For updating the healthbar, inflictdamage heals with negative values this.InflictDamage(-(MaxHealth - Health), false); } else { this.InflictDamage(-healthBonus, false); } ParticleEmitterSettings pset = Renderer.RendererAssetPool.ParticleEmitterSettings["Utility"]; pset.ParticleSystemName = utility.model; ParticleEmitter pemit1 = new ParticleEmitter(pset); pemit1.Position = Position; pemit1.MimicPosition(this, Vector3.Zero); pemit1.MimicRotation(this); ServiceManager.Scene.Add(pemit1, 3); }