Example #1
0
    /// <summary>
    ///
    /// </summary>
    private void Emit()
    {
        bool    right    = Random.Range(0, 100) > 50;
        Vector3 position = right? rightEmitter.localPosition:leftEmitter.localPosition;

        CreateWave(WaveGenerator.GenerateWave(position, right));
    }
Example #2
0
        void Start()
        {
            if (!_wave.enabled)
            {
                return;
            }
            if (!_wave.isControlRate)
            {
                gameObject.AddComponent <AudioSource>();
            }

            if (_wave.waveType.ToString().Contains("FM"))
            {
                _fmod = WaveGenerator.GenerateWave(_fmWave,
                                                   new WaveGenerator.ParameterData(_fmPhase, _fmFrequency, _fmAmplitude, _fmOffset)
                                                   );
            }
            WaveGenerator.ParameterData data;
            if (_wave.waveType == WaveGenerator.Config.WaveType.Constant)
            {
                data = new WaveGenerator.ParameterData(_value);
            }
            else
            {
                data = new WaveGenerator.ParameterData(_phase,
                                                       _frequency,
                                                       _amplitude,
                                                       _offset);
            }



            if (_wave.waveType.ToString().Contains("FM"))
            {
                _osc = WaveGenerator.GenerateWave(_wave,
                                                  data,
                                                  _fmod
                                                  );
            }
            else
            {
                _osc = WaveGenerator.GenerateWave(_wave,
                                                  data
                                                  );
            }
        }