public void Update(GameTime gameTime) { // Check CurrentComboNode Input if (_checkCurrentInput) { if (InputManager.OnKeyDown(_current.Key) || InputManager.OnButtonDown(_current.Button)) { // Makes it so that when Animation ends, the Check for next start. _sprite.SetOnAnimationEnd(_current.Animation, () => { _checkCurrentInput = false; _sprite.SetAnimation(EAnimation.Idle); }); _sprite.SetAnimation(_current.Animation); _passedMillis = 0; } } // Check CurrentComboNode.Next Input else { _passedMillis += gameTime.ElapsedGameTime.Milliseconds; // TimeIntervall exceeded. if (_passedMillis > _current.TimeIntervall.End) { _checkCurrentInput = true; _current = _root; } // Inside TimeIntervall. else if (_passedMillis > _current.TimeIntervall.Start && _passedMillis < _current.TimeIntervall.End) { // Check for Input for Next foreach (Keys k in _current.Next.Keys) { if (InputManager.OnKeyDown(k)) { _current = _current.Next[k]; _sprite.SetAnimation(_current.Animation); _checkCurrentInput = true; } } } } }
public Combo(ComboNode root, AnimatedSprite sprite) { _root = root; _current = _root; _sprite = sprite; }