Ejemplo n.º 1
0
        public static void GenerateAssets()
        {
            ShieldTemplate template = new ShieldTemplate();

            template.art_resource = "default";
            template.integrity = 120;

            shield_templates["default"] = template;
            
            
            ArtShieldResource art = new ArtShieldResource("particle");
            art.particle_color_start = Color.White;
            art.particle_color_end = Color.Blue;
            art.particle_count = 16;
            art.shield_particle_size_max = 1.2f;
            art.shield_particle_size_min = 0.5f;
            art.shield_particle_speed = 0.06f;
            art.shield_particle_halflife = 1.0f;
            art.reform_particle_rate = 70;

            art.particle_velocity = 0.5f;
            art.particle_life = 6f;
            //art.size_end = new Vector2(0.5f, 0.5f);

            ArtManager.shields["default"] = art;






            template = new ShieldTemplate();

            template.art_resource = "green";
            template.integrity = 100f;

            shield_templates["green"] = template;


            art = new ArtShieldResource("particle");
            art.particle_color_start = Color.White;
            art.particle_color_end = Color.LimeGreen;
            art.particle_count = 22;
            art.shield_particle_size_max = 0.8f;
            art.shield_particle_size_min = 0.3f;
            art.shield_particle_speed = 0.1f;
            art.shield_particle_halflife = 0.8f;
            art.reform_particle_rate = 60f;

            art.particle_velocity = 0.7f;
            art.particle_life = 3f;
            //art.size_end = new Vector2(0.5f, 0.5f);

            ArtManager.shields["green"] = art;


        }
Ejemplo n.º 2
0
        public ArtShield(ArtShieldResource arg_resource, int arg_count, float arg_size, float arg_radius)
        {
            resource = arg_resource;

            radius = arg_radius;
            scalar = arg_size;

            count = arg_count;

            depth = new float[count];
            speed = new float[count];
            angle = new float[count];
            alpha = new float[count];
            size = new float[count];

            reform_rate = (arg_resource.reform_particle_rate / arg_size) / GameConst.framerate;
            
            float rad_sq = Utility.Sqrt(radius);


            particle_decay = Utility.DecayConstant(resource.shield_particle_halflife * GameConst.framerate * arg_size);

            arg_size = Utility.Sqrt(arg_size);

            for (int i = 0; i < count; i++)
            {
                // this picks a radius, which is heavily encouraged to be near max
                // and will be in the outer 21%
                float r = Utility.Rand(0.00f, 0.6f);
                depth[i] = (1 - (r * r * r)) * radius;

                // particle size scalar
                float mass = Utility.Rand(1.0f);
                size[i] = arg_size * (resource.shield_particle_size_min + mass * resource.shield_particle_size_max);

                // note that the speed is an angular value
                // the speed is randomly generated, but then modified by the mass
                // this should encourage, but not force, heavy particles to be slow
                speed[i] = Utility.Rand(-resource.shield_particle_speed, resource.shield_particle_speed) / (rad_sq * (0.5f + mass));

                angle[i] = Utility.RandAngle();
            }
        }
Ejemplo n.º 3
0
        public ArtShieldPop(ArtShieldResource arg_resource, float arg_size, float shield_radius, int arg_count, Vector2 arg_center, Vector2 arg_velocity) : base(arg_resource, 1.0f, arg_count, arg_center)
        {
            alpha_decay /= arg_size;
            radius = arg_resource.particle_velocity * (1.0f / alpha_decay);
            radius += shield_radius;

            index = 0;

            cloud_velocity = arg_velocity;
        }