37 lines
791 B
C#
37 lines
791 B
C#
using UnityEngine;
|
|||
|
|
using System.Collections;
|
||
|
|
|
||
|
|
public class OscilloscopeFunctionSampler : MonoBehaviour
|
||
|
|
{
|
||
|
|
public OscilloscopeAdapter oscilloscope;
|
||
|
|
public Plot2DFunction function;
|
||
|
|
|
||
|
|
public bool fixedUpdate;
|
||
|
|
public bool update;
|
||
|
|
|
||
|
|
// Use this for initialization
|
||
|
|
void Start () {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update () {
|
||
|
|
if (update) {
|
||
|
|
if (oscilloscope != null && function != null) {
|
||
|
|
oscilloscope.PushSample(Time.time, function.f(Time.time));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void FixedUpdate()
|
||
|
|
{
|
||
|
|
if (fixedUpdate)
|
||
|
|
{
|
||
|
|
if (oscilloscope != null && function != null)
|
||
|
|
{
|
||
|
|
oscilloscope.PushSample(Time.time, function.f(Time.time));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|