Add state-based effect.
This commit is contained in:
@@ -60,7 +60,9 @@ namespace Cryville.Crtr {
|
||||
var effect = e.Value;
|
||||
etor.ContextCascadeInsert();
|
||||
etor.ContextCascadeUpdate(EffectInstance._VAR_EFFECT_INDEX, PropSrc.Error);
|
||||
etor.Optimize(effect.duration);
|
||||
foreach(var s in effect.states) {
|
||||
etor.Optimize(s.Value.duration);
|
||||
}
|
||||
effect.elements.Optimize(etor);
|
||||
etor.ContextCascadeDiscard();
|
||||
}
|
||||
@@ -99,10 +101,30 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
|
||||
public class EffectDefinition {
|
||||
public PdtExpression duration;
|
||||
static Identifier _ident_init = new Identifier("init");
|
||||
#pragma warning disable IDE1006
|
||||
public PdtExpression duration {
|
||||
set {
|
||||
EffectState s;
|
||||
if (!states.TryGetValue(_ident_init, out s))
|
||||
throw new InvalidOperationException("Cannot set duration and states at the same time");
|
||||
s.duration = value;
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
public Identifier init = _ident_init;
|
||||
public Dictionary<Identifier, EffectState> states = new Dictionary<Identifier, EffectState> {
|
||||
{ _ident_init, new EffectState() { rewind = _ident_init } }
|
||||
};
|
||||
public SkinElement elements;
|
||||
}
|
||||
|
||||
public class EffectState {
|
||||
public PdtExpression duration;
|
||||
public Identifier rewind;
|
||||
public Identifier next;
|
||||
}
|
||||
|
||||
public class AnimationSpan {
|
||||
[ElementList]
|
||||
public Dictionary<Clip, AnimationSpan> spans
|
||||
|
Reference in New Issue
Block a user