Example #1
0
    void DisplayButtonPrompt(RhythmEvent eventToDisplay)
    {
        string buttonToDisplay = eventToDisplay.key;

        initialClosingCircleTimer = closingCircleTimer = eventToDisplay.timeToFail;

        // Show the prompt
        switch (buttonToDisplay)
        {
        case "A":
            buttonPromptRenderer.sprite = buttonSprites[0];
            break;

        case "B":
            buttonPromptRenderer.sprite = buttonSprites[1];
            break;

        case "X":
            buttonPromptRenderer.sprite = buttonSprites[2];
            break;

        case "Y":
            buttonPromptRenderer.sprite = buttonSprites[3];
            break;

        default:
            Debug.Log("What the hell is button " + buttonToDisplay);
            break;
        }
    }
        /// <summary>
        /// Register a method to receive events for a specific Feature type and a specific Track name.
        /// </summary>
        /// <typeparam name="T">The Feature type.</typeparam>
        /// <param name="action">The method.</param>
        /// <param name="trackName">The Track name.</param>
        public void Register <T>(Action <T> action, string trackName) where T : IFeature
        {
            int hash = GetHashCode(typeof(T), trackName);

            RhythmEvent <T> rhythmEvent;

            if (_events.ContainsKey(hash))
            {
                rhythmEvent = _events[hash] as RhythmEvent <T>;
            }
            else
            {
                rhythmEvent = new RhythmEvent <T>(trackName);
                _events.Add(hash, rhythmEvent);
            }

            rhythmEvent.Register(action);
        }
Example #3
0
        public Scoring GenerateScoring(double inputTime, RhythmEvent source)
        {
            double absTimeDelta = Math.Abs(inputTime - source.Time.Seconds);
            var    givenRank    = Scoring.Rank.Miss;

            if (absTimeDelta <= marvThreshold)
            {
                givenRank = Scoring.Rank.Marv;
            }
            else if (absTimeDelta <= perfThreshold)
            {
                givenRank = Scoring.Rank.Perf;
            }
            else if (absTimeDelta <= goodThreshold)
            {
                givenRank = Scoring.Rank.Good;
            }
            return(new Scoring(inputTime - source.Time.Seconds, givenRank, source));
        }
    public void RegisterEvent(RhythmEvent e)
    {
        float noteLength = GetNoteLength(e.noteDivision);
        int   measure    = e.measureSeparation;

        // Add measure key to measure list
        if (!measureKeys.Contains(measure))
        {
            measureKeys.Add(measure);
        }
        // Instantiate potentially null containers
        if (!measureTimeKeys.ContainsKey(measure))
        {
            measureTimeKeys[measure] = new List <float>();
        }
        List <float> timeKeysList = measureTimeKeys[measure];

        // Associate timekey to a measure
        if (!timeKeysList.Contains(noteLength))
        {
            timeKeysList.Add(noteLength);
        }
        // Instantiate potentially null containers
        if (!events.ContainsKey(measure))
        {
            events[measure] = new SortedDictionary <float, List <RhythmEvent> >();
        }
        SortedDictionary <float, List <RhythmEvent> > eventsAtMeasure = events[measure];

        if (!eventsAtMeasure.ContainsKey(noteLength))
        {
            eventsAtMeasure[noteLength] = new List <RhythmEvent>();
        }
        List <RhythmEvent> eventList = eventsAtMeasure[noteLength];

        // Finally, we add the event
        eventList.Add(e);
    }
Example #5
0
 public Scoring(double timeDelta, Rank ranking, RhythmEvent source)
 {
     TimeDelta = timeDelta;
     Ranking   = ranking;
     Source    = source;
 }