Example #1
0
        public virtual void ComputeSelf()
        {
            var timeDiff = Time - CurrentGame.Time;

            if (timeDiff < CurrentGame.ApproachTime)
            {
                Status = NoteStatus.Shown;

                if (CurrentGame.AutoPlay)
                {
                    if (timeDiff <= 0)
                    {
                        if (_prevTimeDiff > 0)
                        {
                            NoteHit               = true;
                            _hitTime              = CurrentGame.Time;
                            CurrentGame.SeToPlay |= HitsoundId;
                            _scene.SetButtonHit(TouchPosition);
                            _scene.AddNoteResult(Id, timeDiff);
                        }

                        if (timeDiff < -CurrentGame.NoteDelay)
                        {
                            Status = NoteStatus.Done;
                        }
                    }
                    else
                    {
                        NoteHit = false;
                    }
                }
                else if (!CurrentGame.ButtonHandled[TouchPosition])
                {
                    HandleButton(timeDiff);
                }

                _t = MathHelper.Clamp(1 - timeDiff / CurrentGame.ApproachTime, 0, 1);
            }
            else
            {
                _t     = 0;
                Status = NoteStatus.NotShown;
            }

            _prevTimeDiff     = timeDiff;
            FrameComputed     = true;
            _computationDrawn = false;
        }