Class: TonParticle

オブジェクトプーリングを使用した軽量なパーティクルシステムです。

Structures

class TonParticleParam

パーティクルの挙動を定義するパラメータクラスです。

Methods

void Register(string name, TonParticleParam param)

パーティクルの定義を名前を付けて登録します。

void Play(string name, float x, float y, int count = 1)

パーティクルを発生させます。

void Clear()

全てのパーティクルを消去します。

Sample Code

// In Initialize()
// 1. Register Particle Definition
var explosionParam = new TonParticleParam
{
    ImageName = "particle_star",
    MinLife = 500, MaxLife = 1000,
    MinSpeed = 2.0f, MaxSpeed = 5.0f,
    MinAngle = 0, MaxAngle = 6.28f, // 360 degrees
    MinScale = 0.5f, MaxScale = 1.5f,
    Gravity = 0.1f,
    StartColor = Color.Yellow, EndColor = Color.Red,
    IsAdditive = true
};
Ton.Particle.Register("explosion", explosionParam);

// In Update() (or Event Handler)
// 2. Play Particle (e.g. on impact)
if (isImpact)
{
    Ton.Particle.Play("explosion", 300, 200, 20); // Emit 20 particles
}

// 3. Update and Draw are handled automatically by Ton.Update/Ton.Draw