2019-09-12 20:25:52 +00:00
|
|
|
{
|
2021-01-12 17:36:13 +00:00
|
|
|
"MaxCount": 300,
|
2019-09-12 20:25:52 +00:00
|
|
|
"Drawable": {
|
|
|
|
"Type": "SkCircleDrawable",
|
2021-01-12 17:36:13 +00:00
|
|
|
"Radius": 3
|
2019-09-12 20:25:52 +00:00
|
|
|
},
|
2021-02-01 19:47:30 +00:00
|
|
|
"Code": [
|
2019-09-12 20:25:52 +00:00
|
|
|
"void effectSpawn(inout Effect effect) {",
|
2021-01-12 17:36:13 +00:00
|
|
|
" // Phase one: Launch",
|
|
|
|
" effect.lifetime = 4;",
|
2019-09-25 15:24:50 +00:00
|
|
|
" effect.rate = 120;",
|
2020-02-10 18:45:22 +00:00
|
|
|
" float a = radians(mix(-20, 20, rand(effect.seed)) - 90);",
|
|
|
|
" float s = mix(200, 220, rand(effect.seed));",
|
2019-09-25 15:24:50 +00:00
|
|
|
" effect.vel.x = cos(a) * s;",
|
|
|
|
" effect.vel.y = sin(a) * s;",
|
2020-02-10 18:45:22 +00:00
|
|
|
" effect.color.rgb = float3(rand(effect.seed), rand(effect.seed), rand(effect.seed));",
|
2019-09-25 15:24:50 +00:00
|
|
|
" effect.pos.x = 0;",
|
|
|
|
" effect.pos.y = 0;",
|
2021-01-12 17:36:13 +00:00
|
|
|
" effect.scale = 0.25; // Also used as particle behavior flag",
|
2019-09-12 20:25:52 +00:00
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"void effectUpdate(inout Effect effect) {",
|
2021-01-12 17:36:13 +00:00
|
|
|
" if (effect.age > 0.5 && effect.rate > 0) {",
|
|
|
|
" // Phase two: Explode",
|
|
|
|
" effect.rate = 0;",
|
|
|
|
" effect.burst = 50;",
|
|
|
|
" effect.scale = 1;",
|
|
|
|
" } else {",
|
|
|
|
" effect.vel.y += dt * 90;",
|
|
|
|
" }",
|
2019-09-12 20:25:52 +00:00
|
|
|
"}",
|
2021-02-01 19:47:30 +00:00
|
|
|
"",
|
2019-09-12 20:25:52 +00:00
|
|
|
"void spawn(inout Particle p) {",
|
2021-01-12 17:36:13 +00:00
|
|
|
" bool explode = p.scale == 1;",
|
|
|
|
"",
|
|
|
|
" p.lifetime = explode ? (2 + rand(p.seed) * 0.5) : 0.5;",
|
2020-02-10 18:45:22 +00:00
|
|
|
" float a = radians(rand(p.seed) * 360);",
|
2021-01-12 17:36:13 +00:00
|
|
|
" float s = explode ? mix(90, 100, rand(p.seed)) : mix(5, 10, rand(p.seed));",
|
2019-09-12 20:25:52 +00:00
|
|
|
" p.vel.x = cos(a) * s;",
|
|
|
|
" p.vel.y = sin(a) * s;",
|
|
|
|
"}",
|
|
|
|
"",
|
|
|
|
"void update(inout Particle p) {",
|
|
|
|
" p.color.a = 1 - p.age;",
|
2021-01-12 17:36:13 +00:00
|
|
|
" if (p.scale == 1) {",
|
|
|
|
" p.vel.y += dt * 50;",
|
|
|
|
" }",
|
2019-09-12 20:25:52 +00:00
|
|
|
"}",
|
|
|
|
""
|
|
|
|
],
|
2021-01-12 17:36:13 +00:00
|
|
|
"Bindings": []
|
2019-09-12 20:25:52 +00:00
|
|
|
}
|