GPU Instanced Bullet System for Unity
Used in MoriyaRhythm
Collider and a Component inheriting IBulletCollider is required to detect bullet collision.
public class BulletCollisionTarget : MonoBehaviour, InstancedDanmaku.IBulletCollider
{
public bool DeleteBullet => true;
public void Collide(Bullet bullet)
{
// Collision!
}
}Inherit IBulletBehaviour to make new behaviours for bullets. We can make more complex behaviours by writing new update method.
public class SetVelocity : IBulletBehaviour
{
public void UpdateBullet(ref Bullet bullet)
{
//update a bullet
}
}