Add "emit effect on self" annotation.
This commit is contained in:
@@ -25,9 +25,9 @@ namespace Cryville.Crtr {
|
||||
_indexSrc = new PropSrc.Float(() => Index);
|
||||
_durationOp = new PropOp.Float(v => _duration = v);
|
||||
}
|
||||
public void Rewind(double time) {
|
||||
public void Rewind(double time, Transform target) {
|
||||
_startTime = time;
|
||||
foreach (var i in _comps) i.Rewind(time);
|
||||
foreach (var i in _comps) i.Rewind(time, target);
|
||||
}
|
||||
private float m_index;
|
||||
public float Index {
|
||||
@@ -38,6 +38,7 @@ namespace Cryville.Crtr {
|
||||
_indexSrc.Invalidate();
|
||||
}
|
||||
}
|
||||
Transform _currentTarget;
|
||||
Identifier _currentStateName = Identifier.Empty;
|
||||
EffectState _currentState;
|
||||
ChartEvent _ctxev;
|
||||
@@ -54,21 +55,22 @@ namespace Cryville.Crtr {
|
||||
public bool CanEmit() {
|
||||
return _currentStateName.Key == 0 || _currentState.rewind.Key != 0;
|
||||
}
|
||||
public void OnEmit(double time) {
|
||||
public void OnEmit(double time, Transform target) {
|
||||
_currentTarget = target;
|
||||
_ctxev = ChartPlayer.etor.ContextEvent;
|
||||
_ctxstate = ChartPlayer.etor.ContextState;
|
||||
if (_currentStateName.Key == 0) {
|
||||
EnterState(_def.init, time, true);
|
||||
EnterState(_def.init, time, _currentTarget, true);
|
||||
}
|
||||
else {
|
||||
if (_currentState.rewind.Key == 0) throw new InvalidOperationException("Cannot rewind");
|
||||
EnterState(_currentState.rewind, time, true);
|
||||
EnterState(_currentState.rewind, time, _currentTarget, true);
|
||||
}
|
||||
}
|
||||
void EnterState(Identifier name, double time, bool emitting) {
|
||||
void EnterState(Identifier name, double time, Transform target, bool emitting) {
|
||||
_currentStateName = name;
|
||||
_currentState = _def.states[name];
|
||||
Rewind(time);
|
||||
Rewind(time, target);
|
||||
RootTransform.gameObject.SetActive(true);
|
||||
ChartPlayer.etor.ContextCascadeInsert();
|
||||
ChartPlayer.etor.ContextCascadeUpdate(_VAR_EFFECT_INDEX, _indexSrc);
|
||||
@@ -87,7 +89,7 @@ namespace Cryville.Crtr {
|
||||
else {
|
||||
ChartPlayer.etor.ContextEvent = _ctxev;
|
||||
ChartPlayer.etor.ContextState = _ctxstate;
|
||||
EnterState(_currentState.next, EndTime, false);
|
||||
EnterState(_currentState.next, EndTime, _currentTarget, false);
|
||||
ChartPlayer.etor.ContextEvent = null;
|
||||
ChartPlayer.etor.ContextState = null;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user