@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Dreamteck.Splines {
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class SplineUser : MonoBehaviour, ISerializationCallbackReceiver, ISampleModifier
|
||||
{
|
||||
@@ -10,7 +11,8 @@ namespace Dreamteck.Splines {
|
||||
|
||||
public SplineComputer spline
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
return _spline;
|
||||
}
|
||||
set
|
||||
@@ -104,7 +106,7 @@ namespace Dreamteck.Splines {
|
||||
if (value != _loopSamples)
|
||||
{
|
||||
_loopSamples = value;
|
||||
if(!_loopSamples && _clipTo < _clipFrom)
|
||||
if (!_loopSamples && _clipTo < _clipFrom)
|
||||
{
|
||||
double temp = _clipTo;
|
||||
_clipTo = _clipFrom;
|
||||
@@ -218,7 +220,7 @@ namespace Dreamteck.Splines {
|
||||
|
||||
protected Transform trs
|
||||
{
|
||||
get { return _trs; }
|
||||
get { return _trs; }
|
||||
}
|
||||
protected bool hasTransform
|
||||
{
|
||||
@@ -252,7 +254,8 @@ namespace Dreamteck.Splines {
|
||||
}
|
||||
#endif
|
||||
|
||||
protected virtual void Awake() {
|
||||
protected virtual void Awake()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_isPlaying = Application.isPlaying;
|
||||
if (!_isPlaying)
|
||||
@@ -272,7 +275,8 @@ namespace Dreamteck.Splines {
|
||||
if (buildOnAwake && Application.isPlaying)
|
||||
{
|
||||
RebuildImmediate();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSamples();
|
||||
}
|
||||
@@ -438,6 +442,8 @@ namespace Dreamteck.Splines {
|
||||
/// <param name="sampleComputer">Should the SplineUser sample the SplineComputer</param>
|
||||
public virtual void Rebuild()
|
||||
{
|
||||
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
|
||||
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
|
||||
#if UNITY_EDITOR
|
||||
if (!_hasTransform)
|
||||
{
|
||||
@@ -505,7 +511,7 @@ namespace Dreamteck.Splines {
|
||||
LateRun();
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
if(!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
|
||||
if (!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
|
||||
{
|
||||
Run();
|
||||
RunUpdate();
|
||||
@@ -550,7 +556,7 @@ namespace Dreamteck.Splines {
|
||||
{
|
||||
PostBuild();
|
||||
EmptySplineHandler postBuildHandler = onPostBuild;
|
||||
if(postBuildHandler != null)
|
||||
if (postBuildHandler != null)
|
||||
{
|
||||
postBuildHandler();
|
||||
}
|
||||
@@ -682,19 +688,22 @@ namespace Dreamteck.Splines {
|
||||
if (_clipFrom != 0.0)
|
||||
{
|
||||
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
_clipFromSample = _sampleCollection.samples[0];
|
||||
}
|
||||
|
||||
if(_clipTo != 1.0)
|
||||
if (_clipTo != 1.0)
|
||||
{
|
||||
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
_clipToSample = _sampleCollection.samples[_sampleCollection.length - 1];
|
||||
}
|
||||
|
||||
|
||||
int start, end;
|
||||
_sampleCount = _sampleCollection.GetClippedSampleCount(_clipFrom, _clipTo, out start, out end);
|
||||
double lerp;
|
||||
|
||||
Reference in New Issue
Block a user