public override void DoAction() { PlayerTank owner = null; EnvironmentProperty envprop = Game.EnvironmentEffects.GetEffect(environmentEffectId); if (envprop != null) { owner = envprop.Owner; } if (this.isDestroyed) { if (owner != null) { string message = owner.Name + " destroyed the " + Game.Bases.GetBase(baseId).BaseColor.ToString().ToLower() + " base!"; Game.Chat.AddMessage(message, Color.Chartreuse); } Game.Bases.DestroyBase(baseId); } else { Game.Bases.DamageBase(baseId, damage); } }
public SpawnEnvironmentEffectEvent(VTankBot _game, int id, int typeId, VTankObject.Point location, int ownerId) : base(_game) { this.id = id; this.typeId = typeId; this.location = location; this.ownerId = ownerId; envEffect = WeaponLoader.GetEnvironmentProperty(typeId); }
public override void DoAction() { envEffect = WeaponLoader.GetEnvironmentProperty(typeId); creationPosition = this.GetPosition(); if (Game.Players.ContainsKey(ownerId)) { envEffect.Owner = Game.Players[ownerId]; } Game.EnvironmentEffects.AddEffect(envEffect, id, creationPosition); }
/// <summary> /// Load a single environment property from the XML /// </summary> /// <param name="environmentPropertyChildNodes"></param> private static void LoadEnvironmentProperty(XmlNodeList environmentPropertyChildNodes) { Dictionary <string, string> rawEnvironmentPropertyValues = new Dictionary <string, string>() { { "id", "" }, { "name", "" }, { "triggersUponImpactWithEnvironment", "" }, { "triggersUponImpactWithPlayer", "" }, { "triggersUponExpiration", "" }, { "soundEffect", "" }, { "particleEffect", "" }, { "duration", "" }, { "interval", "" }, { "areaOfEffectRadius", "" }, { "areaOfEffectDecay", "" }, { "minDamage", "" }, { "maxDamage", "" } }; //Copy collection's values so we can modify the first. List <string> rawValuesList = new List <string>(); foreach (string key in rawEnvironmentPropertyValues.Keys) { rawValuesList.Add(key); } foreach (XmlNode environmentPropertyNode in environmentPropertyChildNodes) { foreach (string key in rawValuesList) { if (environmentPropertyNode.Name.Equals(key, StringComparison.OrdinalIgnoreCase)) { rawEnvironmentPropertyValues[key] = GetXMLValue(environmentPropertyNode, key); } } } EnvironmentProperty environmentPropertyEntry = GetEnvironmentPropertyFromStrings(rawEnvironmentPropertyValues); if (environmentPropertyEntry != null) { environmentProperties.Add(environmentPropertyEntry.ID, environmentPropertyEntry); } }
/// <summary> /// Add an effect to the collection of EnvironmentProperties /// </summary> /// <param name="envProp">The environment property.</param> /// <param name="id">The environment property's Id</param> /// <param name="position">The position to add it in the scene.</param> public void AddEffect(EnvironmentProperty envProp, int id, Vector3 position) { if (envProps.ContainsKey(id)) { RemoveEffect(id); } ParticleEmitter emitter = new ParticleEmitter(envProp.ParticleEffectName); ParticleEmitterSettings settings = emitter.Settings; settings.Radius = (int)Math.Floor(envProp.AoERadius); ParticleEmitter __emitterCopy = new ParticleEmitter(settings); __emitterCopy.Position = position; envProp.RenderID = ServiceManager.Scene.Add(__emitterCopy, 3); envProp.SetCreationTime(); envProps[id] = envProp; }
public override void Dispose() { envEffect = null; base.Dispose(); }
set => SetValue(EnvironmentProperty, value);