Predicted State Node
Overrides
Snippet
public class AttackState : PredictedStateNode<MyInput, MyState>
{
public override void Enter() { /* start attack windup */ }
protected override void StateSimulate(in MyInput i, ref MyState s, float dt)
{
// simulate attack timing using only s and i
s.attackTimer = Mathf.Max(0, s.attackTimer - dt);
if (s.attackTimer == 0) machine.SetState(nextState);
}
public override void ViewEnter(bool verified)
{ /* play VFX/SFX, camera shake, etc */ }
}Last updated