Beispiel #1
0
        public bool KeyOn()
        {
#if SEQUENCER_PARANOIA
            Debug.LogFormat(
                Time.frameCount.ToString("X4") +
                " Sequencer.KeyOn: {0} {1}",
                emitter.name, emitter.patches[index] ? emitter.patches[index].name : "???");
#endif
            if (Randomizer.zeroToOne <= emitter.randomization.chance)
            {
                if (emitter.auxiliary.source)
                {
                    if (!emitter.patches[index].hasTimings)
                    {
                        Synthesizer.KeyOn(emitter.patches[index], emitter.auxiliary.source, 0f, emitter.volume);
                    }
                }
                else
                {
                    var t =
                        emitter.attachment.useListenerTransform ? Heartbeat.listenerTransform :
                        emitter.attachment.transform ? emitter.attachment.transform :
                        emitter.transform;
                    float r = emitter.randomization.distance.GetRandomValue();
                    var   p = Vector3.zero;
                    if (!Mathf.Approximately(r, 0f))
                    {
                        float a = Randomizer.plusMinusOne * Mathf.PI * 2f;
                        r  *= emitter.zone.radius;
                        p.x = Mathf.Sin(a) * r;
                        p.z = Mathf.Cos(a) * r;
                    }
                    float v;
                    UpdateModVolume(out v, 1000f);
                    keyHandle = Synthesizer.KeyOn(
                        out looping, emitter.patches[index], t, p, 0f, emitter.volume, v);
                }
            }
            return(emitter.patches[index].GetCueInfo(out totalTime, out repeatCount) || looping);
        }
Beispiel #2
0
        public void KeyOn(Animator a)
        {
            bool looping;

            handle = Synthesizer.KeyOn(out looping, patch, a.transform, offset, delay);
        }