コード例 #1
0
        public override void Dispose()
        {
            _IsDisposed = true;
            if (!_vertexBuffer.IsNull)
            {
                _vertexBuffer.Instance.Dispose();
                _vertexBuffer.Invalidate();
            }

            if (!_indexBuffer.IsNull)
            {
                _indexBuffer.Instance.Dispose();
                _indexBuffer.Invalidate();
            }

            if (_effectData != null)
            {
                //_effectData.ClearEmitterData();
                _effectData.OnEmitterListChanged -= _OnEmitterListChanged;
            }
            _effectData = null;

            if (_emitterList != null)
            {
                for (int i = _emitterList.Count - 1; i >= 0; i--)
                    _emitterList[i] = null;
                _emitterList = null;
            }
            this.OnEffectStart = null;
            this.OnEffectStop = null;
            this.OnRegistered = null;
            base.Dispose();
        }
コード例 #2
0
        // Emitter-List has changed!
        private void _OnEmitterListChanged(T2DParticleEffectData effectData)
        {
            // Sanity!
            Debug.Assert(effectData == CurrentEffectData, "Notified of effect-data change but not current assigned to effect!");

            // For now, this'll stop the effect and recreate the emitters!
            // NOTE:-   The intention is to actively update the emitter-order
            //          in realtime so that we can tweak this kind of thing
            //          in an editor.
            CurrentEffectData = effectData;
        }
コード例 #3
0
        public override void CopyTo(TorqueObject obj)
        {
            base.CopyTo(obj);
            T2DParticleEffect obj2 = (T2DParticleEffect)(obj);

            // Create an actual clone of the emitters to allow runtime
            // changes to each single copy without affecting the others.

            obj2.CurrentEffectData = null;
            T2DParticleEffectData _ed = new T2DParticleEffectData();
            _ed.LifeMode = this.CurrentEffectData.LifeMode;
            _ed.Lifetime = this.CurrentEffectData.Lifetime;

            // Fetch Emitter Data List.
            foreach (T2DParticleEmitterData _p in this.CurrentEffectData.EmitterDataList)
            {
                T2DParticleEmitterData _t = new T2DParticleEmitterData(_p.Name);
                _t.AttachPositionToEmitter = _p.AttachPositionToEmitter;
                _t.AttachRotationToEmitter = _p.AttachRotationToEmitter;
                _t.BlueChannelLife = _p.BlueChannelLife;
                _t.EmissionAngleBase = _p.EmissionAngleBase;
                _t.EmissionAngleVariation = _p.EmissionAngleVariation;
                _t.EmissionArcBase = _p.EmissionArcBase;
                _t.EmissionArcVariation = _p.EmissionArcVariation;
                _t.EmissionForceBase = _p.EmissionForceBase;
                _t.EmissionForceVariation = _p.EmissionForceVariation;
                _t.EmitterArea = _p.EmitterArea;
                _t.FirstInFrontOrder = _p.FirstInFrontOrder;
                _t.FixedAreaAspect = _p.FixedAreaAspect;
                _t.FixedForceAngle = _p.FixedForceAngle;
                _t.FixedForceBase = _p.FixedForceBase;
                _t.FixedForceLife = _p.FixedForceLife;
                _t.FixedForceVariation = _p.FixedForceVariation;
                _t.FixedParticleAspect = _p.FixedParticleAspect;
                _t.GreenChannelLife = _p.GreenChannelLife;
                _t.Hidden = _p.Hidden;
                _t.InitialAge = _p.InitialAge;
                _t.LinkEmissionRotation = _p.LinkEmissionRotation;
                _t.Material = _p.Material;
                _t.MaterialRegionIndex = _p.MaterialRegionIndex;
                _t.OrientationAngleOffset = _p.OrientationAngleOffset;
                _t.OrientationRandomArc = _p.OrientationRandomArc;
                _t.ParticleLifeBase = _p.ParticleLifeBase;
                _t.ParticleLifeVariation = _p.ParticleLifeVariation;
                _t.ParticleOrientation = _p.ParticleOrientation;
                _t.ParticlePivotPoint = _p.ParticlePivotPoint;
                _t.QuantityBase = _p.QuantityBase;
                _t.QuantityVariation = _p.QuantityVariation;
                _t.RandomMotionBase = _p.RandomMotionBase;
                _t.RandomMotionLife = _p.RandomMotionLife;
                _t.RandomMotionVariation = _p.RandomMotionVariation;
                _t.RedChannelLife = _p.RedChannelLife;
                _t.SingleParticle = _p.SingleParticle;
                _t.SizeXBase = _p.SizeXBase;
                _t.SizeXLife = _p.SizeXLife;
                _t.SizeXVariation = _p.SizeXVariation;
                _t.SizeYBase = _p.SizeYBase;
                _t.SizeYLife = _p.SizeYLife;
                _t.SizeYVariation = _p.SizeYVariation;
                _t.SpeedBase = _p.SpeedBase;
                _t.SpeedLife = _p.SpeedLife;
                _t.SpeedVariation = _p.SpeedVariation;
                _t.SpinBase = _p.SpinBase;
                _t.SpinLife = _p.SpinLife;
                _t.SpinVariation = _p.SpinVariation;
                _t.TextureCoords = _p.TextureCoords;
                _t.UseEffectEmission = _p.UseEffectEmission;
                _t.VisibilityLife = _p.VisibilityLife;
                _ed.EmitterDataList.Add(_t);
            }

            obj2.CurrentEffectData = _ed;
            obj2._playOnLoad = _playOnLoad;
        }