Пример #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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        /// <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;
        }
Пример #4
0
 protected override bool TouchIsValid(ButtonTouch touch)
 {
     return base.TouchIsValid(touch) &&
            touch.TouchNumber > _lastMatchedTouchIndex &&
            _touchesPattern[touch.TouchNumber] == touch.Button;
 }
Пример #5
0
 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);
 }
Пример #6
0
 protected virtual bool TouchIsValid(ButtonTouch touch)
 {
     return BeatController.BeatMatched == true;
 }
Пример #7
0
 protected virtual void OnMactch(ButtonTouch touch)
 {
     Matched.Fire(this, () => EventArgs.Empty);
 }
Пример #8
0
 protected virtual void OnFail(ButtonTouch touch)
 {
     Failed.Fire(this, () => EventArgs.Empty);
 }
Пример #9
0
 public void Push(ButtonTouch touch)
 {
     _userTouches.Add(touch);
 }
Пример #10
0
 protected override void OnFail(ButtonTouch touch)
 {
     _touchService.Reset();
     base.OnFail(touch);
 }