Exemple #1
0
        public virtual void Update()
        {
            BeatController.Update();

            if (!BeatController.BeatMatched.HasValue || State.HandledMouseOnThisUpdate)
            {
                return;
            }

            SoundManager.ButtonHit.Play();
            var touch = new ButtonTouch
            {
                TouchType = TouchType.Allowed,
                TouchNumber = BeatController.CurrentBeatNumber,
                PeakCoefficient = BeatController.PatternGenerator.Radius,
                Button =
                    InputManager.IsKeyTriggered(Keys.A)
                        ? ButtonType.Left
                        : ButtonType.Right
            };

            if (TouchIsValid(touch))
            {
                OnMactch(touch);
            }
            else
            {
                OnFail(touch);
            }
        }
        protected override void OnMactch(ButtonTouch touch)
        {
            _lastMatchedTouchIndex = touch.TouchNumber;

            MatchCoefficient += _coeffDelta * (1 - touch.PeakCoefficient / BeatController.AcceptableDerivationRadius * IncreseMatchCoefficient);

            //System.Diagnostics.Debug.WriteLine(string.Format("Match!\r\nCoefficient: {0}\r\nLast touch index: {1}", MatchCoefficient, _lastMatchedTouchIndex ));

            base.OnMactch(touch);
        }
        /// <summary>
        /// Returns false if it's out of the beat radius, if touchese were performed not on sequential beats, if 4-touches combination cannot be executed
        /// </summary>
        /// <param name="touch"></param>
        /// <returns></returns>
        protected override bool TouchIsValid(ButtonTouch touch)
        {
            bool beatMatched = base.TouchIsValid(touch);
            if (beatMatched && !State.ReactionProgress.IsReactionInProgress)
            {
                _touchService.Push(touch);

                if (!_touchService.ContainsValidSequence())
                {
                    return false;
                }

                if (_touchService.Touches.Count == 4)
                {
                    bool validInput = State.Level.HandleInput(State, _touchService.Touches);
                    _touchService.Reset();
                    return validInput;
                }
                return true;
            }
            return false;
        }
 protected override bool TouchIsValid(ButtonTouch touch)
 {
     return base.TouchIsValid(touch) &&
            touch.TouchNumber > _lastMatchedTouchIndex &&
            _touchesPattern[touch.TouchNumber] == touch.Button;
 }
 protected override void OnFail(ButtonTouch touch)
 {
     //System.Diagnostics.Debug.WriteLine(string.Format("Fail!\r\nCoefficient: {0}\r\nLast touch index: {1}", MatchCoefficient, _lastMatchedTouchIndex));
     MatchCoefficient -= _coeffDelta*DecreaseMatchCoefficient;
     base.OnFail(touch);
 }
Exemple #6
0
 protected virtual bool TouchIsValid(ButtonTouch touch)
 {
     return BeatController.BeatMatched == true;
 }
Exemple #7
0
 protected virtual void OnMactch(ButtonTouch touch)
 {
     Matched.Fire(this, () => EventArgs.Empty);
 }
Exemple #8
0
 protected virtual void OnFail(ButtonTouch touch)
 {
     Failed.Fire(this, () => EventArgs.Empty);
 }
Exemple #9
0
 public void Push(ButtonTouch touch)
 {
     _userTouches.Add(touch);
 }
Exemple #10
0
 protected override void OnFail(ButtonTouch touch)
 {
     _touchService.Reset();
     base.OnFail(touch);
 }