Skip to content

Animation and Particle Triggers

1. 概要

Animation and Particle Trigger は、Animator と ParticleSystem 関連の Unity コールバックを Observable に変換する R3.Unity のファクトリメソッドです。GameObjectComponent の両方に拡張メソッドが用意されています。

2. API 一覧

API対象発行値
OnAnimatorIKAsObservable()GameObject / Componentint
OnAnimatorMoveAsObservable()GameObject / ComponentUnit
OnParticleCollisionAsObservable()GameObject / ComponentGameObject
OnParticleTriggerAsObservable()GameObject / ComponentUnit

3. マーブルダイアグラム

Animation and Particle Triggers のマーブルダイアグラム

対応する Unity コールバックが呼ばれるたびに、イベント引数または Unit が発行されます。

4. サンプルコード

csharp
this.OnAnimatorMoveAsObservable()
    .Subscribe(_ => ApplyRootMotion())
    .AddTo(this);

this.OnParticleCollisionAsObservable()
    .Subscribe(other => Hit(other))
    .AddTo(this);