Add rewind and tick mechanism for skin component.
This commit is contained in:
@@ -10,6 +10,7 @@ namespace Cryville.Crtr {
|
||||
readonly EffectDefinition _def;
|
||||
readonly SkinContainer _skinContainer;
|
||||
public Transform RootTransform { get; private set; }
|
||||
readonly SkinComponent[] _comps;
|
||||
public EffectInstance(EffectDefinition def) {
|
||||
_def = def;
|
||||
_skinContainer = new SkinContainer(this, _def.elements);
|
||||
@@ -18,11 +19,14 @@ namespace Cryville.Crtr {
|
||||
ChartPlayer.etor.ContextCascadeInsertBlock();
|
||||
_skinContainer.MatchStatic();
|
||||
ChartPlayer.etor.ContextCascadeDiscardBlock();
|
||||
foreach (var i in RootTransform.GetComponentsInChildren<SkinComponent>())
|
||||
i.Init();
|
||||
_comps = RootTransform.GetComponentsInChildren<SkinComponent>();
|
||||
foreach (var i in _comps) i.Init();
|
||||
_indexSrc = new PropSrc.Float(() => Index);
|
||||
_durationOp = new PropOp.Float(v => _duration = v);
|
||||
}
|
||||
public void Rewind(double time) {
|
||||
foreach (var i in _comps) i.Rewind(time);
|
||||
}
|
||||
private float m_index;
|
||||
public float Index {
|
||||
get { return m_index; }
|
||||
@@ -38,8 +42,8 @@ namespace Cryville.Crtr {
|
||||
float _duration;
|
||||
readonly PropOp _durationOp;
|
||||
public double EndTime { get { return _startTime + _duration; } }
|
||||
public void Tick() {
|
||||
_skinContainer.MatchDynamic(1);
|
||||
public void Tick(double time) {
|
||||
foreach (var i in _comps) i.Tick(_skinContainer, time);
|
||||
}
|
||||
public void OnEmit(double time) {
|
||||
_startTime = time;
|
||||
|
Reference in New Issue
Block a user