上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
949 B

using System; // require keep for Windows Universal App
using UnityEngine;
namespace UniRx.Triggers
{
[DisallowMultipleComponent]
public class ObservableFixedUpdateTrigger : ObservableTriggerBase
{
Subject<Unit> fixedUpdate;
/// <summary>This function is called every fixed framerate frame, if the MonoBehaviour is enabled.</summary>
void FixedUpdate()
{
if (fixedUpdate != null) fixedUpdate.OnNext(Unit.Default);
}
/// <summary>This function is called every fixed framerate frame, if the MonoBehaviour is enabled.</summary>
public IObservable<Unit> FixedUpdateAsObservable()
{
return fixedUpdate ?? (fixedUpdate = new Subject<Unit>());
}
protected override void RaiseOnCompletedOnDestroy()
{
if (fixedUpdate != null)
{
fixedUpdate.OnCompleted();
}
}
}
}