Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        /// <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);
            }
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
0
        public override void Dispose()
        {
            envEffect = null;

            base.Dispose();
        }
Ejemplo n.º 7
0
 set => SetValue(EnvironmentProperty, value);