예제 #1
0
        public Emitter Clone()
        {
            Emitter tempEmitter = base.Clone <Emitter>();

            // Justin Johnson, 04/2015 - retiring particle blueprints
            //tempEmitter.ParticleBlueprint = this.ParticleBlueprint.Clone();

            tempEmitter.mInstructions = new FlatRedBall.Instructions.InstructionList();

            tempEmitter.EmissionSettings = EmissionSettings.Clone();

            tempEmitter.EmissionBoundary = EmissionBoundary.Clone <Polygon>();

            tempEmitter.BoundedEmission = BoundedEmission;

            return(tempEmitter);
        }
예제 #2
0
        public Emitter ToEmitter(string contentManagerName)
        {
            Emitter emitter = new Emitter();

            emitter.Position = new Vector3(X, Y, Z);

            emitter.ScaleX = ScaleX;
            emitter.ScaleY = ScaleY;
            emitter.ScaleZ = ScaleZ;

            emitter.RotationX = RotationX;
            emitter.RotationY = RotationY;
            emitter.RotationZ = RotationZ;


            emitter.AreaEmission =
                FlatRedBall.Graphics.GraphicalEnumerations.TranslateAreaEmissionType(
                    AreaEmissionType);

            emitter.RemovalEvent =
                FlatRedBall.Graphics.Particle.Emitter.TranslateRemovalEvent(RemovalEvent);

            //TODO: Attachments
            emitter.Name = Name;

            // Justin Johnson, 04/2015 - retiring particle blueprints
            //emitter.ParticleBlueprint = ParticleBlueprint.ToSprite(contentManagerName);

            emitter.SecondFrequency   = SecondFrequency;
            emitter.NumberPerEmission = NumberPerEmission;
            emitter.TimedEmission     = TimedEmission;

            emitter.RelativePosition =
                new Vector3(RelativeX, RelativeY, RelativeZ);

            emitter.ParentVelocityChangesEmissionVelocity =
                ParentVelocityChangesEmissionVelocity;
            emitter.RotationChangesParticleRotation =
                RotationChangesParticleRotation;
            emitter.RotationChangesParticleAcceleration =
                RotationChangesParticleAcceleration;

            emitter.SecondsLasting = SecondsLasting;

            // This handles older emix files that stored texture in a particle blueprint.
            // To keep particles working we copy the old texture value into the
            // emission settings object. But only if the emission settings
            // doesn't already have a value.
            if (ParticleBlueprint != null &&
                !string.IsNullOrEmpty(ParticleBlueprint.Texture) &&
                string.IsNullOrEmpty(EmissionSettings.Texture))
            {
                EmissionSettings.Texture = ParticleBlueprint.Texture;
            }

            // Now that we've copied the values we can inflate with a hopefully-valid
            // texture string if one existed in either place.
            emitter.EmissionSettings = EmissionSettings.ToEmissionSettings(contentManagerName);



            emitter.BoundedEmission = BoundedEmission;
            if (EmissionBoundary != null)
            {
                emitter.EmissionBoundary = EmissionBoundary.ToPolygon();
            }
            return(emitter);
        }