Esempio n. 1
0
    // Update this hit event each song tick
    override public void update(Engine engine)
    {
        // If no input was received in time, the player missed this event.
        if (engine.getSecondTime() - engine.toSecondTime(hitSongTime) > Leniency.BARELY_TIME)
        {
            result = HIT_RESULT.MISS;
            done   = true;
            return;
        }

        // If the player presses the space bar or clicks the mouse:
        if (engine.isKeyDown())
        {
            double interval = engine.getSecondTime() - engine.toSecondTime(hitSongTime);
            //Debug.Log (interval > 0 ? "Increase offset." : "Decrease offset.");

            // If the button was clicked close enough to the event:
            interval = UnityEngine.Mathf.Abs((float)interval);

            // Change the hit result accordingly...
            if (interval < Leniency.HIT_TIME)
            {
                result = HIT_RESULT.HIT;
            }
            else if (interval < Leniency.BARELY_TIME)
            {
                result = HIT_RESULT.BARELY;
            }
            else
            {
                return;
            }

            // And we are done with this event.
            done = true;
            return;
        }
    }
Esempio n. 2
0
 public void addResult(HIT_RESULT result)
 {
     results.Add(result);
 }
Esempio n. 3
0
 public HitEvent(double songTime)
 {
     startSongTime    = songTime - 2;
     this.hitSongTime = songTime;
     this.result      = HIT_RESULT.NONE;
 }
Esempio n. 4
0
 // Event invokers
 //============================================================================================
 public void showHitResult(HIT_RESULT result)
 {
     hit.Invoke(result);
 }