Code cleanup with the implementation of property store.

This commit is contained in:
2023-08-02 17:20:45 +08:00
parent e34a9cc868
commit 5393ff1451
9 changed files with 122 additions and 99 deletions

View File

@@ -453,19 +453,16 @@ namespace Cryville.Crtr.Event {
}
}
}
static float _ttime;
static Vector4 _trans;
static readonly PropSrc _ttimesrc = new PropSrc.Float(() => _ttime);
static readonly PropOp _transop = new PropOp.Vector4(v => _trans = v);
static readonly PropStores.Float _ttimest = new PropStores.Float();
static readonly PropStores.Vector4 _transst = new PropStores.Vector4();
Vector4 GetTransition(float time, PdtExpression transition) {
if (time >= 1) return Vector4.one;
if (transition == null) return new Vector4(time, time, time, time);
_ttime = time;
_ttimesrc.Invalidate();
PdtEvaluator.Instance.ContextSelfValue = _ttimesrc;
PdtEvaluator.Instance.Evaluate(_transop, transition);
_ttimest.Value = time;
PdtEvaluator.Instance.ContextSelfValue = _ttimest.Source;
PdtEvaluator.Instance.Evaluate(_transst.Target, transition);
PdtEvaluator.Instance.ContextSelfValue = null;
return _trans;
return _transst.Value;
}
public void BroadcastPreInit() {