Example #1
0
        public virtual ParticleColorful CreateParticle()
        {
            var particle = new ParticleColorful();

            //создаем новую частицу исходя из формы
            switch (figure)
            {
            case "circle":
            {
                particle = new ParticleCircle();
                break;
            }

            case "square":
            {
                particle = new ParticleSquare();
                break;
            }

            case "star":
            {
                particle = new ParticleStar();
                break;
            }

            case "snowflake":
            {
                particle = new ParticleSnowflake();
                break;
            }
            }
            particle.FromColor = ColorFrom;
            particle.ToColor   = ColorTo;
            return(particle);
        }
Example #2
0
        //клонирование
        public override Particle Clone()
        {
            ParticleSnowflake instanse = (ParticleSnowflake)Activator.CreateInstance(this.GetType());

            instanse.Size           = this.Size;
            instanse.SpeedX         = this.SpeedX;
            instanse.SpeedY         = this.SpeedY;
            instanse.X              = this.X;
            instanse.Y              = this.Y;
            instanse.Life           = this.Life;
            instanse.FromColor      = this.FromColor;
            instanse.ToColor        = this.ToColor;
            instanse.thicknessLines = this.thicknessLines;
            return(instanse);
        }