public void Update(GameTime gameTime) { // Check CurrentComboNode Input if (_checkCurrentInput) { Log("CheckingCurrentInput"); if (InputManager.OnKeyDown(_current.Key) || InputManager.OnButtonDown(_current.Button)) { Log("Pressed " + _current.Key); // 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 { Log("CheckNextInput"); _passedMillis += gameTime.ElapsedGameTime.Milliseconds; // TimeIntervall exceeded. if (_passedMillis > _current.TimeIntervall.End) { Log("TimeIntervall exceeded"); _checkCurrentInput = true; _current = _root; } // Inside TimeIntervall. else if (_passedMillis > _current.TimeIntervall.Start && _passedMillis < _current.TimeIntervall.End) { Log("Inside TimeIntervall"); // Combo finished. if (_current.Next.Count == 0) { Log("ComboFinished"); } // Check for Input for Next foreach (Keys k in _current.Next.Keys) { if (InputManager.OnKeyDown(k)) { Log("Pressed " + k + " for next ComboNode"); _current = _current.Next[k]; _sprite.SetAnimation(_current.Animation); _checkCurrentInput = true; } } } } }
private void test(ComboNode node) { if (node == null) { return; } foreach (Keys k in node.Next.Keys) { if (InputManager.OnKeyDown(k)) { _sprite.SetAnimation(node.Animation); } } }
public Combo(ComboNode root, AnimatedSprite sprite) { _root = root; _current = _root; _sprite = sprite; }