Esempio n. 1
0
        private void Clear()
        {
            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            foreach (Guid guid in this._listRGuid)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(guid);
            }
            this._listRGuid.Clear();
            if (_rPoint != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_rPoint.Guid);
                _rPoint = null;
            }
            if (_particleEffect != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_particleEffect.Guid);
                _particleEffect = null;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Handles when a <see cref="IParticleEmitter"/> is added to the <see cref="ParticleEditorForm.ParticleEffect"/>.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="emitter">The <see cref="NetGore.EventArgs{IParticleEmitter}"/> instance containing the event data.</param>
 void ParticleEffect_EmitterAdded(IParticleEffect sender, EventArgs <IParticleEmitter> emitter)
 {
     if (!lstEmitters.Items.Contains(emitter))
     {
         lstEmitters.AddItemAndReselect(emitter);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TemporaryMapParticleEffect"/> class.
        /// </summary>
        /// <param name="pe">The <see cref="IParticleEffect"/>.</param>
        /// <param name="isForeground">If true, this will be drawn in the foreground layer. If false,
        /// it will be drawn in the background layer.</param>
        /// <param name="target">The destination position.</param>
        /// <param name="speed">How fast this object moves towards the target in pixels per second.</param>
        public TemporaryMapParticleEffectSeekPosition(IParticleEffect pe, bool isForeground, Vector2 target, float speed)
            : base(pe, isForeground)
        {
            var position = pe.Position;

            speed = speed / 1000f;

            _startTime      = TickCount.Now;
            _startPosition  = position;
            _targetPosition = target;

            // Calculate the angle between the position and target
            var diff  = position - target;
            var angle = Math.Atan2(diff.Y, diff.X);

            var cos = Math.Cos(angle);
            var sin = Math.Sin(angle);

            // Multiply the normalized direction vector (the cos and sine values) by the speed to get the velocity
            // to use for each elapsed millisecond
            _velocity = -new Vector2((float)(cos * speed), (float)(sin * speed));

            // Precalculate the amount of time it will take to hit the target. This way, we can check if we have reached
            // the destination simply by checking the current time.
            var dist    = Vector2.Distance(position, target);
            var reqTime = (int)Math.Ceiling(dist / speed);

            _endTime = (TickCount)(_startTime + reqTime);
        }
        public DestroyableBase()
        {
            Revive();

            DestroyParticleEffect = Engine.ParticleManager.FindEffect("spaceship.Destruction.explosion_blue");
            ExplosionTrigger      = string.Format("enemy_explosion_0{0}", 1 + Random.Next(3));
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new PointEmitter(newOwner);

            CopyValuesTo(ret);
            return(ret);
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticleEmitter"/> class.
        /// </summary>
        /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
        protected ParticleEmitter(IParticleEffect owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            _owner = owner;

            ((ParticleEffect)owner).AddParticleEmitter(this);

            _budget    = DefaultBudget;
            _particles = new Particle[_initialParticleArraySize];

            // Set some default values
            BlendMode       = _defaultBlendMode;
            ParticleLife    = new VariableInt(2000);
            ReleaseAmount   = new VariableUShort(1);
            ReleaseColor    = new VariableColor(Color.White);
            ReleaseRate     = new VariableUShort(100);
            ReleaseRotation = new VariableFloat(0);
            ReleaseScale    = new VariableFloat(1);
            ReleaseSpeed    = new VariableFloat(50);
            Name            = DefaultName;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TemporaryMapParticleEffect"/> class.
        /// </summary>
        /// <param name="pe">The <see cref="IParticleEffect"/>.</param>
        /// <param name="isForeground">If true, this will be drawn in the foreground layer. If false,
        /// it will be drawn in the background layer.</param>
        /// <param name="target">The destination position.</param>
        /// <param name="speed">How fast this object moves towards the target in pixels per second.</param>
        public TemporaryMapParticleEffectSeekPosition(IParticleEffect pe, bool isForeground, Vector2 target, float speed)
            : base(pe, isForeground)
        {
            var position = pe.Position;

            speed = speed / 1000f;

            _startTime = TickCount.Now;
            _startPosition = position;
            _targetPosition = target;

            // Calculate the angle between the position and target
            var diff = position - target;
            var angle = Math.Atan2(diff.Y, diff.X);

            var cos = Math.Cos(angle);
            var sin = Math.Sin(angle);

            // Multiply the normalized direction vector (the cos and sine values) by the speed to get the velocity
            // to use for each elapsed millisecond
            _velocity = -new Vector2((float)(cos * speed), (float)(sin * speed));

            // Precalculate the amount of time it will take to hit the target. This way, we can check if we have reached
            // the destination simply by checking the current time.
            var dist = Vector2.Distance(position, target);
            var reqTime = (int)Math.Ceiling(dist / speed);

            _endTime = (TickCount)(_startTime + reqTime);
        }
Esempio n. 8
0
        private void Clear()
        {
            if (_rPoint != null)
            {
                d3.ObjectManager.DeleteObject(_rPoint.Guid);
                _rPoint = null;
            }
            if (_particleEffect != null)
            {
                d3.ObjectManager.DeleteObject(_particleEffect.Guid);
                _particleEffect = null;
            }

            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            _isStartAnlyse = false;
            _isPause       = false;
            foreach (Guid guid in this._renderObjs)
            {
                d3.ObjectManager.DeleteObject(guid);
            }
            this._renderObjs.Clear();
            this.timer1.Stop();
        }
Esempio n. 9
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new ConeEmitter(newOwner);
     CopyValuesTo(ret);
     ret.ConeAngle = ConeAngle;
     ret.Direction = Direction;
     return ret;
 }
Esempio n. 10
0
        /// <summary>
        /// Attaches a particle emitter object to a specific entity slot.
        /// </summary>
        /// <param name="slot">Slot.</param>
        /// <param name="emitter">Emitter.</param>
        /// <param name="scale">Scale.</param>
        public void LoadParticleEmitter(int slot, IParticleEffect emitter, float scale = 1.0f)
        {
            var sp = new SpawnParams {
                fSizeScale = scale
            };

            NativeHandle.LoadParticleEmitter(slot, emitter, sp, false, false);
        }
Esempio n. 11
0
        public DestroyableBase()
        {
            Life = MaxLife = 100;
            DestroyParticleEffect = Env.ParticleManager.FindEffect("spaceship.Destruction.explosion_blue");
            ExplosionTrigger      = string.Format("enemy_explosion_0{0}", 1 + Rand.NextInt(3));

            SubscribeToCollision();
            OnEntityCollision += Collision;
        }
Esempio n. 12
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new CircleEmitter(newOwner);
     CopyValuesTo(ret);
     ret.Perimeter = Perimeter;
     ret.Radiate = Radiate;
     ret.Radius = Radius;
     return ret;
 }
Esempio n. 13
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new ConeEmitter(newOwner);

            CopyValuesTo(ret);
            ret.ConeAngle = ConeAngle;
            ret.Direction = Direction;
            return(ret);
        }
Esempio n. 14
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new RectEmitter(newOwner);

            CopyValuesTo(ret);
            ret.Height    = Height;
            ret.Perimeter = Perimeter;
            ret.Width     = Width;
            return(ret);
        }
Esempio n. 15
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new CircleEmitter(newOwner);

            CopyValuesTo(ret);
            ret.Perimeter = Perimeter;
            ret.Radiate   = Radiate;
            ret.Radius    = Radius;
            return(ret);
        }
        public void Add(IParticleEffect effect, string key)
        {
            var mercuryEffect = effect as MercuryParticleEffect;
            
            if(mercuryEffect == null) throw new ArgumentException("Effect must be Mercury particle effect");

            particles.Add(key, mercuryEffect);

            particleEngine.Add(mercuryEffect.ParticleEffect);
        }
Esempio n. 17
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new LineEmitter(newOwner);

            CopyValuesTo(ret);
            ret.Angle        = Angle;
            ret.EmitBothWays = EmitBothWays;
            ret.Length       = Length;
            ret.Rectilinear  = Rectilinear;
            return(ret);
        }
Esempio n. 18
0
        /// <summary>
        /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
        /// </summary>
        /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
        public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
        {
            var ret = new PolygonEmitter(newOwner);

            CopyValuesTo(ret);
            ret.Closed = Closed;
            ret.Points.AddRange(Points);
            ret.PolygonOrigin = PolygonOrigin;
            ret.Rotation      = Rotation;
            ret.Scale         = Scale;
            return(ret);
        }
Esempio n. 19
0
        private void LoadParticleEffect()
        {
            if (particleEffect == null)
            {
                particleEffect = this.axRenderControl1.ObjectManager.CreateParticleEffect(rootId);
                string fileName = (strMediaPath + @"\png\water.png");
                particleEffect.ImageName                = fileName;
                particleEffect.EmissionMaxMoveSpeed     = 200;
                particleEffect.EmissionMinMoveSpeed     = 0;
                particleEffect.EmissionMinRate          = 600;
                particleEffect.EmissionMaxRate          = 7300;
                particleEffect.ParticleMaxLifeTime      = 5.5;
                particleEffect.ParticleMinLifeTime      = 1.5;
                particleEffect.ParticleBillboardType    = gviParticleBillboardType.gviParticleBillboardOrientedCamera;
                particleEffect.WindDirection            = 0;
                particleEffect.WindAcceleration         = 0.2;
                particleEffect.ParticleBirthColor       = System.Drawing.Color.White;
                particleEffect.ParticleDeathColor       = System.Drawing.Color.Blue;
                particleEffect.EmissionMinScaleSpeed    = 1;
                particleEffect.EmissionMaxScaleSpeed    = 2;
                particleEffect.VerticalAcceleration     = 0;
                particleEffect.EmissionMaxAngle         = 0.078536816339744828;
                particleEffect.EmissionMinAngle         = 0;
                particleEffect.EmissionMinParticleSize  = 0.2;
                particleEffect.EmissionMaxParticleSize  = 0.6;
                particleEffect.EmissionMinRotationSpeed = 0;
                particleEffect.EmissionMaxRotationSpeed = 0;
                particleEffect.Damping             = 0.5;
                particleEffect.MaxVisibleDistance  = 10000;
                particleEffect.ParticleAspectRatio = 1;
                angle.Set(0, 90, 0);
                particleEffect.EmissionDirectionEulerAngle = angle;
                particleEffect.SetTextureTileRange(0, 0, 0, 0);
                particleEffect.Start(-1);
                particleEffect.MaxVisibleDistance = 10000;

                IPoint pTemp = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                pTemp.SpatialCRS = new CRSFactory().CreateFromWKT(this.axRenderControl1.GetCurrentCrsWKT()) as ISpatialCRS;
                IPoint p = line.GetPoint(0).Clone() as IPoint;
                p.Project(pTemp.SpatialCRS);
                pTemp.SetCoords(p.X, p.Y, p.Z, 0, 0);
                particleEffect.SetPointEmitter(pTemp);

                // 绑定到运动路径
                IMotionable m = particleEffect as IMotionable;
                //position.Set(4.3, -7, 0);
                position.Set(0, 0, 0);
                m.Bind(motionPath, position, 0, 90, 0);
            }
        }
Esempio n. 20
0
 public virtual void Draw()
 {
     try
     {
         if (this.particleEffect == null)
         {
             this.particleEffect = CommonUnity.RenderHelper.ObjectManager.CreateParticleEffect(_Guid);
         }
     }
     catch (COMException ex)
     {
         System.Diagnostics.Trace.WriteLine(ex.Message);
         return;
     }
 }
Esempio n. 21
0
        public static DefaultAmmo Create(Vec3 pos, Vec3 speed, bool isHostile, IParticleEffect weaponTrailParticleEffect, IParticleEffect weaponSmokeParticleEffect)
        {
            var ammo = Entity.Instantiate <DefaultAmmo> (pos, Quat.Identity, 0.5f, "objects/default/primitive_sphere.cgf");

            ammo.LifeTime  = 3f;
            ammo.Speed     = speed;
            ammo.IsHostile = isHostile;
            ammo.WeaponSmokeParticleEffect  = weaponSmokeParticleEffect;
            ammo.WeaponBulletParticleEffect = weaponTrailParticleEffect;

            // Causes geometry not to be rendered, as the entity particle effect is used as bullet
            ammo.SetSlotFlag(0, EEntitySlotFlags.ENTITY_SLOT_RENDER_NEAREST);
            ammo.SpawnParticles();
            GamePool.AddObjectToPool(ammo);
            return(ammo);
        }
Esempio n. 22
0
        public void RebuildList(IParticleEffect pe)
        {
            try
            {
                BeginUpdate();

                var selected = SelectedItem;
                Items.Clear();
                Items.AddRange(pe.Emitters.ToArray <object>());

                SelectedItem = selected;
            }
            finally
            {
                EndUpdate();
            }
        }
Esempio n. 23
0
        public void RebuildList(IParticleEffect pe)
        {
            try
            {
                BeginUpdate();

                var selected = SelectedItem;
                Items.Clear();
                Items.AddRange(pe.Emitters.ToArray<object>());

                SelectedItem = selected;
            }
            finally
            {
                EndUpdate();
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Handles when the <see cref="ParticleEditorForm.ParticleEffect"/> property has changed.
        /// </summary>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        protected virtual void OnParticleEffectChanged(IParticleEffect oldValue, IParticleEffect newValue)
        {
            // Update the PropertyGrid
            pgEffect.SelectedObject = ParticleEffect;

            // Update the emitters list
            lstEmitters.Items.Clear();

            if (newValue != null)
            {
                lstEmitters.Items.AddRange(newValue.Emitters.Cast <object>().ToArray());

                // Select the first emitter
                if (lstEmitters.Items.Count > 0)
                {
                    lstEmitters.SelectedIndex = 0;
                }
            }
        }
Esempio n. 25
0
        public static DefaultAmmo Create(Vector3 pos, Vector3 speed, bool isHostile, IParticleEffect weaponTrailParticleEffect, IParticleEffect weaponSmokeParticleEffect)
        {
            var ammo = Entity.SpawnWithComponent <DefaultAmmo> (pos, Quaternion.Identity, 0.5f);

            ammo.Entity.LoadGeometry(0, "objects/default/primitive_sphere.cgf");

            ammo.Entity.Physics.Physicalize(0, 1, EPhysicalizationType.ePT_Rigid);

            ammo.LifeTime  = 3f;
            ammo.Speed     = speed;
            ammo.IsHostile = isHostile;
            ammo.WeaponSmokeParticleEffect  = weaponSmokeParticleEffect;
            ammo.WeaponBulletParticleEffect = weaponTrailParticleEffect;

            // Causes geometry not to be rendered, as the entity particle effect is used as bullet
            ammo.Entity.SetSlotFlag(0, EEntitySlotFlags.ENTITY_SLOT_RENDER_NEAREST);
            ammo.SpawnParticles();
            GamePool.AddObjectToPool(ammo);
            return(ammo);
        }
        /// <summary>
        /// Reads a <see cref="ParticleEmitter"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        /// <param name="owner">The <see cref="IParticleEffect"/> to add the read <see cref="ParticleEmitter"/> to.</param>
        /// <returns>
        /// The <see cref="ParticleEmitter"/> read from the <paramref name="reader"/>.
        /// </returns>
        /// <exception cref="ParticleEmitterLoadEmitterException">The <see cref="ParticleEmitter"/> could not be loaded.</exception>
        public static ParticleEmitter Read(IValueReader reader, IParticleEffect owner)
        {
            // Get the type name
            var emitterTypeString = reader.ReadString(_emitterTypeKeyName);

            // Create the instance using the type name
            ParticleEmitter emitter;
            try
            {
                emitter = (ParticleEmitter)Instance.GetTypeInstance(emitterTypeString, owner);
            }
            catch (KeyNotFoundException ex)
            {
                throw new ParticleEmitterLoadEmitterException(emitterTypeString, ex);
            }

            // Grab the reader for the emitter node, then read the values into the emitter
            var emitterReader = reader.ReadNode(_emitterNodeName);
            emitter.ReadState(emitterReader);

            return emitter;
        }
        /// <summary>
        /// Reads a <see cref="ParticleEmitter"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        /// <param name="owner">The <see cref="IParticleEffect"/> to add the read <see cref="ParticleEmitter"/> to.</param>
        /// <returns>
        /// The <see cref="ParticleEmitter"/> read from the <paramref name="reader"/>.
        /// </returns>
        /// <exception cref="ParticleEmitterLoadEmitterException">The <see cref="ParticleEmitter"/> could not be loaded.</exception>
        public static ParticleEmitter Read(IValueReader reader, IParticleEffect owner)
        {
            // Get the type name
            var emitterTypeString = reader.ReadString(_emitterTypeKeyName);

            // Create the instance using the type name
            ParticleEmitter emitter;

            try
            {
                emitter = (ParticleEmitter)Instance.GetTypeInstance(emitterTypeString, owner);
            }
            catch (KeyNotFoundException ex)
            {
                throw new ParticleEmitterLoadEmitterException(emitterTypeString, ex);
            }

            // Grab the reader for the emitter node, then read the values into the emitter
            var emitterReader = reader.ReadNode(_emitterNodeName);

            emitter.ReadState(emitterReader);

            return(emitter);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TemporaryMapParticleEffect"/> class.
 /// </summary>
 /// <param name="particleEffect">The <see cref="IParticleEffect"/>.</param>
 /// <param name="isForeground">If true, this will be drawn in the foreground layer. If false,
 /// it will be drawn in the background layer.</param>
 public TemporaryMapParticleEffect(IParticleEffect particleEffect, bool isForeground)
 {
     _isForeground   = isForeground;
     _particleEffect = particleEffect;
 }
Esempio n. 29
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new LineEmitter(newOwner);
     CopyValuesTo(ret);
     ret.Angle = Angle;
     ret.EmitBothWays = EmitBothWays;
     ret.Length = Length;
     ret.Rectilinear = Rectilinear;
     return ret;
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PolygonEmitter"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
 public PolygonEmitter(IParticleEffect owner) : base(owner)
 {
 }
Esempio n. 31
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new PolygonEmitter(newOwner);
     CopyValuesTo(ret);
     ret.Closed = Closed;
     ret.Points.AddRange(Points);
     ret.PolygonOrigin = PolygonOrigin;
     ret.Rotation = Rotation;
     ret.Scale = Scale;
     return ret;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TemporaryMapParticleEffect"/> class.
 /// </summary>
 /// <param name="particleEffect">The <see cref="IParticleEffect"/>.</param>
 /// <param name="isForeground">If true, this will be drawn in the foreground layer. If false,
 /// it will be drawn in the background layer.</param>
 public TemporaryMapParticleEffect(IParticleEffect particleEffect, bool isForeground)
 {
     _isForeground = isForeground;
     _particleEffect = particleEffect;
 }
Esempio n. 33
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <param name="newOwner">The owner of the new <see cref="ParticleEmitter"/>.</param>
 /// <returns>
 /// A deep copy of this <see cref="ParticleEmitter"/> with the <paramref name="newOwner"/> set.
 /// </returns>
 public abstract ParticleEmitter DeepCopy(IParticleEffect newOwner);
Esempio n. 34
0
 /// <summary>
 /// Handles when a <see cref="IParticleEmitter"/> is removed from the <see cref="ParticleEditorForm.ParticleEffect"/>.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="emitter">The <see cref="NetGore.EventArgs{IParticleEmitter}"/> instance containing the event data.</param>
 void ParticleEffect_EmitterRemoved(IParticleEffect sender, EventArgs<IParticleEmitter> emitter)
 {
     lstEmitters.RemoveItemAndReselect(emitter);
 }
Esempio n. 35
0
        /// <summary>
        /// Handles when the <see cref="ParticleEditorForm.ParticleEffect"/> property has changed.
        /// </summary>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        protected virtual void OnParticleEffectChanged(IParticleEffect oldValue, IParticleEffect newValue)
        {
            // Update the PropertyGrid
            pgEffect.SelectedObject = ParticleEffect;

            // Update the emitters list
            lstEmitters.Items.Clear();

            if (newValue != null)
            {
                lstEmitters.Items.AddRange(newValue.Emitters.Cast<object>().ToArray());

                // Select the first emitter
                if (lstEmitters.Items.Count > 0)
                    lstEmitters.SelectedIndex = 0;
            }
        }
Esempio n. 36
0
        private void OnFinishedDraw()
        {
            if (this._drawTool != null && this._drawTool.GeoType == DrawType.SelectOne &&
                this._drawTool.GetSelectFeatureLayerPickResult() != null && this._drawTool.GetSelectPoint() != null)
            {
                try
                {
                    IFeatureLayer fl = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer;
                    if (fl == null)
                    {
                        return;
                    }
                    FacilityClass facc = Dictionary3DTable.Instance.GetFacilityClassByDFFeatureClassID(fl.FeatureClassId.ToString());
                    if (facc == null || facc.Name != "PipeLine")
                    {
                        XtraMessageBox.Show("您选中的不是管线设施,请选择管线设施。", "提示");
                        return;
                    }
                    DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fl.FeatureClassId.ToString());
                    if (dffc == null || dffc.GetFeatureClass() == null)
                    {
                        return;
                    }
                    IImagePointSymbol ips = new ImagePointSymbol();
                    ips.Size      = SystemInfo.Instance.SymbolSize;
                    ips.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\accidentPoint.png");

                    IPoint intersectPoint = this._drawTool.GetSelectPoint();

                    _rPoint = d3.ObjectManager.CreateRenderPoint(intersectPoint, ips, d3.ProjectTree.RootID);
                    _rPoint.MinVisibleDistance = 499;
                    _rPoint.MaxVisibleDistance = 99999;

                    _particleEffect = d3.ObjectManager.CreateParticleEffect(d3.ProjectTree.RootID);
                    MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fl.FeatureClassId.ToString());
                    if (mc != null)
                    {
                        this.teCarrierType.Text = mc.ToString();
                    }
                    if (mc != null && (mc.Name == "PS" || mc.Name == "GS"))
                    {
                        _particleEffect.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\water.png");

                        _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedMoveDirection;
                        //_particleEffect.setTextureTileRange(8, 8, 63, 63);
                        _particleEffect.EmissionMinRate          = 1600;
                        _particleEffect.EmissionMaxRate          = 1300;
                        _particleEffect.EmissionMinAngle         = 0;
                        _particleEffect.EmissionMaxAngle         = 0.025 * Math.PI; // 改成一个圆
                        _particleEffect.EmissionMinMoveSpeed     = 25;
                        _particleEffect.EmissionMaxMoveSpeed     = 30;
                        _particleEffect.EmissionMinRotationSpeed = 0;
                        _particleEffect.EmissionMaxRotationSpeed = 0;

                        _particleEffect.ParticleMinLifeTime     = 4.5;
                        _particleEffect.ParticleMaxLifeTime     = 5.5;
                        _particleEffect.EmissionMinParticleSize = 0.2;
                        _particleEffect.EmissionMaxParticleSize = 0.25;

                        _particleEffect.EmissionMinScaleSpeed = 0;
                        _particleEffect.EmissionMaxScaleSpeed = 0;
                        _particleEffect.ParticleBirthColor    = 0xffffffff;
                        _particleEffect.ParticleDeathColor    = 0x00ffffff;
                        _particleEffect.VerticalAcceleration  = 5;
                        _particleEffect.Damping          = 0.5;
                        _particleEffect.WindAcceleration = 0;
                        _particleEffect.WindDirection    = 0;
                        IEulerAngle v3t = new EulerAngle();
                        v3t.Set(90, 45, 0);
                        _particleEffect.EmissionDirectionEulerAngle = v3t;
                    }
                    else
                    {
                        _particleEffect.ImageName             = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\smoke1.png");
                        _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedCamera;
                        _particleEffect.SetTextureTileRange(8, 8, 63, 63);  // 58,58位置的图有问题
                        _particleEffect.EmissionMinRate          = 20;
                        _particleEffect.EmissionMaxRate          = 30;
                        _particleEffect.EmissionMinAngle         = 0;
                        _particleEffect.EmissionMaxAngle         = 3.14 * 2.0; // 改成一个圆
                        _particleEffect.EmissionMinMoveSpeed     = 0;
                        _particleEffect.EmissionMaxMoveSpeed     = 1;
                        _particleEffect.EmissionMinRotationSpeed = -1;
                        _particleEffect.EmissionMaxRotationSpeed = 1;

                        _particleEffect.ParticleMinLifeTime     = 10;
                        _particleEffect.ParticleMaxLifeTime     = 12;
                        _particleEffect.EmissionMinParticleSize = 0.75;
                        _particleEffect.EmissionMaxParticleSize = 0.9;

                        _particleEffect.EmissionMinScaleSpeed = 1.5;
                        _particleEffect.EmissionMaxScaleSpeed = 1.85;
                        _particleEffect.ParticleBirthColor    = 0xffffffff;
                        _particleEffect.ParticleDeathColor    = 0x00ffffff;
                        _particleEffect.VerticalAcceleration  = -2;
                        _particleEffect.Damping          = 0;
                        _particleEffect.WindAcceleration = 0;
                        _particleEffect.WindDirection    = 0;
                    }
                    _particleEffect.MinVisibleDistance = 0;
                    _particleEffect.MaxVisibleDistance = 500;

                    _particleEffect.Start(-1);
                    IPoint   pttemp = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    IVector3 v3     = new Vector3();
                    v3.Set(intersectPoint.X, intersectPoint.Y, intersectPoint.Z);
                    pttemp.Position = v3;
                    _particleEffect.SetCircleEmitter(pttemp, 0);

                    this._drawTool.End();
                }
                catch (Exception ex)
                {
                }
                finally
                {
                }
            }
        }
Esempio n. 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectEmitter"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
 public RectEmitter(IParticleEffect owner) : base(owner)
 {
 }
Esempio n. 38
0
 public ParticleEvent(IParticleEffect effect, bool start = true)
 {
     Effect = effect;
     Start  = start;
 }
Esempio n. 39
0
 /// <summary>
 /// Handles when a <see cref="IParticleEmitter"/> is added to the <see cref="ParticleEditorForm.ParticleEffect"/>.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="emitter">The <see cref="NetGore.EventArgs{IParticleEmitter}"/> instance containing the event data.</param>
 void ParticleEffect_EmitterAdded(IParticleEffect sender, EventArgs<IParticleEmitter> emitter)
 {
     if (!lstEmitters.Items.Contains(emitter))
         lstEmitters.AddItemAndReselect(emitter);
 }
Esempio n. 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PointEmitter"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
 public PointEmitter(IParticleEffect owner) : base(owner)
 {
 }
Esempio n. 41
0
 internal ParticleEffect(IParticleEffect nativeHandle)
 {
     NativeHandle = nativeHandle;
 }
Esempio n. 42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConeEmitter"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
 public ConeEmitter(IParticleEffect owner) : base(owner)
 {
 }
Esempio n. 43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticleEmitter"/> class.
        /// </summary>
        /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
        protected ParticleEmitter(IParticleEffect owner)
        {
            if (owner == null)
                throw new ArgumentNullException("owner");

            _owner = owner;

            ((ParticleEffect)owner).AddParticleEmitter(this);

            _budget = DefaultBudget;
            _particles = new Particle[_initialParticleArraySize];

            // Set some default values
            BlendMode = _defaultBlendMode;
            ParticleLife = new VariableInt(2000);
            ReleaseAmount = new VariableUShort(1);
            ReleaseColor = new VariableColor(Color.White);
            ReleaseRate = new VariableUShort(100);
            ReleaseRotation = new VariableFloat(0);
            ReleaseScale = new VariableFloat(1);
            ReleaseSpeed = new VariableFloat(50);
            Name = DefaultName;
        }
Esempio n. 44
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <param name="newOwner">The owner of the new <see cref="ParticleEmitter"/>.</param>
 /// <returns>
 /// A deep copy of this <see cref="ParticleEmitter"/> with the <paramref name="newOwner"/> set.
 /// </returns>
 public abstract ParticleEmitter DeepCopy(IParticleEffect newOwner);
Esempio n. 45
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new PointEmitter(newOwner);
     CopyValuesTo(ret);
     return ret;
 }
Esempio n. 46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemporaryMapParticleEffect"/> class.
 /// </summary>
 /// <param name="particleEffect">The <see cref="IParticleEffect"/>.</param>
 public TemporaryMapParticleEffect(IParticleEffect particleEffect)
 {
     _particleEffect = particleEffect;
 }
Esempio n. 47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LineEmitter"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="IParticleEffect"/> that owns this <see cref="IParticleEmitter"/>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="owner"/> is null.</exception>
 public LineEmitter(IParticleEffect owner) : base(owner)
 {
 }
Esempio n. 48
0
 public void OnLinkHover()
 {
     highlight = new GlyphFlash(new Glyph(Color.FromArgb(100, Color.Aqua)), 10000, Parent.Position);
     MainBus.Send(new ParticleEvent(highlight));
 }
Esempio n. 49
0
 /// <summary>
 /// Creates a deep copy of this <see cref="ParticleEmitter"/> instance.
 /// </summary>
 /// <returns>A deep copy of this <see cref="ParticleEmitter"/>.</returns>
 public override ParticleEmitter DeepCopy(IParticleEffect newOwner)
 {
     var ret = new RectEmitter(newOwner);
     CopyValuesTo(ret);
     ret.Height = Height;
     ret.Perimeter = Perimeter;
     ret.Width = Width;
     return ret;
 }
Esempio n. 50
0
 public static void Spawn(this IParticleEffect e, Vec3 pos)
 {
     e.Spawn(new ParticleLoc(pos));
 }