Beispiel #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (!filterTags.Exists(c => c == col.gameObject.tag))
        {
            return;
        }
        if (!repeatType.HasFlag(TriggerType.Enter) && hasEntered)
        {
            return;
        }
        hasEntered = true;

        onEnterTrigger?.Invoke();
    }
Beispiel #2
0
        private static string GetTriggerString(TriggerType triggerType, bool listenSample, uint?customSampleSet)
        {
            var sb = new StringBuilder(HitSound, 23);

            if (triggerType.HasFlag(TriggerType.HitSoundNormal) ||
                triggerType.HasFlag(TriggerType.HitSoundSoft) ||
                triggerType.HasFlag(TriggerType.HitSoundDrum))
            {
                if (listenSample)
                {
                    sb.Append("All");
                }

                if (triggerType.HasFlag(TriggerType.HitSoundNormal))
                {
                    sb.Append("Normal");
                }
                else if (triggerType.HasFlag(TriggerType.HitSoundSoft))
                {
                    sb.Append("Soft");
                }
                else if (triggerType.HasFlag(TriggerType.HitSoundDrum))
                {
                    sb.Append("Drum");
                }

                if (listenSample)
                {
                    var str = sb.ToString();
                    return(str.EndsWith("All") ? HitSound : str);
                }
            }

            if (triggerType.HasFlag(TriggerType.HitSoundWhistle) ||
                triggerType.HasFlag(TriggerType.HitSoundFinish) ||
                triggerType.HasFlag(TriggerType.HitSoundClap))
            {
                if (triggerType.HasFlag(TriggerType.HitSoundWhistle))
                {
                    sb.Append("Whistle");
                }
                else if (triggerType.HasFlag(TriggerType.HitSoundFinish))
                {
                    sb.Append("Finish");
                }
                else if (triggerType.HasFlag(TriggerType.HitSoundClap))
                {
                    sb.Append("Clap");
                }
            }

            if (customSampleSet != null)
            {
                sb.Append(customSampleSet.ToString());
            }
            return(sb.ToString());
        }