示例#1
0
    // (Delay so that sound occurs when note would have arrived)
    public IEnumerator HitAfterDelay(float delay, RunState runState)
    {
        // Debug.Assert(!isResolved, "hit after delay - already resolved");
        isResolved           = true;
        transform.localScale = new Vector3(0, 0, 0);
        yield return(new WaitForSeconds(delay));

        AudioSource audioSource = gameObject.GetComponent <AudioSource>();

        audioSource.volume = this.volume;
        runState.IncreaseCombo();
        if (!IsSuppressed())
        {
            HitEffect(runState);
        }
        // show graphic effect
        Instantiate(hitPrefab, transform.position, Quaternion.identity, hitArea);
        rhythmManager.player.GetComponent <Animator>().ResetTrigger("activityFail");
        // play audio and destroy when done
        audioSource.Play();
        Destroy(gameObject, audioSource.clip.length);
    }