Beispiel #1
0
    public void SetOrganOffset(OrganName organName, float offsetPercentage)
    {
        BeatChannel activeChannel           = m_NameToBeatChannel[organName];
        float       originalIntervalSeconds = (60f / activeChannel.organDataGetter().bpm);

        activeChannel.beatIntervalSeconds = originalIntervalSeconds + (offsetPercentage / 100) * originalIntervalSeconds;
    }
Beispiel #2
0
    private IEnumerator updateRoutine(BeatChannel channel)
    {
        while (m_isPlaying)
        {
            //if (Time.time < channel.organTimeToStart)
            if (Time.time < channel.organTimeToStart + (channel.effectiveOffsetPercentage / 100) * channel.beatIntervalSeconds) // added from original above
            {
                //yield return new WaitForSeconds(channel.organTimeToStart - Time.time);
                yield return(new WaitForSeconds((channel.organTimeToStart - Time.time) + (channel.effectiveOffsetPercentage / 100) * channel.beatIntervalSeconds)); // added from original above
            }

            //Debug.Log("beat reached" + channel.organDataGetter().organName);
            channel.lastBeatTime = Time.time;
            channel.OnBeatReached?.Invoke();


            // To update the resume game by the heart beat ;)

/*            if (channel.organDataGetter().organName == OrganName.Heart_Right)
 *          {
 *              GameEventMessage.SendEvent("HeartBeat");
 *          }*/

            yield return(new WaitForSeconds(channel.beatIntervalSeconds));
        }
    }
Beispiel #3
0
    protected virtual void Start()
    {
        m_BeatChannel = BeatLevelManager.instance.GetOrganChannel(m_OrganName);
        m_BeatChannel.OnUserClicked += OnUserClicked;
        m_BeatChannel.OnBeatReached += OnBeat;

        m_organRenderer = organGameObject.GetComponent <Renderer>();
        ResetOrganColor();
    }
Beispiel #4
0
    public float timeSinceRoundStarted = 0; // for the death text / scoreboard
    private void Awake()
    {
        timeSinceRoundStarted = 0;
        if (BeatLevelManager.instance == null)
        {
            instance = this;
        }

        m_BeatChannels = new List <BeatChannel>();
        foreach (Organ organ in m_levelConfig.levelOrgans)
        {
            Organ       tempOrgan = organ;
            BeatChannel channel   = new BeatChannel(() => { return(tempOrgan); });
            channel.lastBeatTime = Time.time - channel.beatIntervalSeconds;

            m_NameToBeatChannel.Add(organ.organName, channel);
            StartCoroutine(updateRoutine(channel));
        }

        m_BeatChannels.AddRange(m_NameToBeatChannel.Values);
    }