protected virtual void Awake()
 {
     CheckForParticleSystem();
     AudioSourceLight  = new WeatherMakerLoopingAudioSource(LoopSourceLight);
     AudioSourceMedium = new WeatherMakerLoopingAudioSource(LoopSourceMedium);
     AudioSourceHeavy  = new WeatherMakerLoopingAudioSource(LoopSourceHeavy);
     UpdateInitialParticleSystemValues(ParticleSystem, (f) => InitialStartSpeed = f, (f) => InitialStartSize = f);
     UpdateInitialParticleSystemValues(ParticleSystemSecondary, (f) => InitialStartSpeedSecondary = f, (f) => InitialStartSizeSecondary = f);
     UpdateInitialParticleSystemValues(MistParticleSystem, (f) => InitialStartSpeedMist           = f, (f) => InitialStartSizeMist = f);
     Material          = InitParticleSystem(ParticleSystem);
     MaterialSecondary = InitParticleSystem(ParticleSystemSecondary);
     MistMaterial      = InitParticleSystem(MistParticleSystem);
     ExplosionMaterial = InitParticleSystem(ExplosionParticleSystem);
 }
Esempio n. 2
0
 protected virtual void Awake()
 {
     CheckForParticleSystem();
     AudioSourceLight  = new WeatherMakerLoopingAudioSource(LoopSourceLight);
     AudioSourceMedium = new WeatherMakerLoopingAudioSource(LoopSourceMedium);
     AudioSourceHeavy  = new WeatherMakerLoopingAudioSource(LoopSourceHeavy);
     UpdateInitialParticleSystemValues(ParticleSystem, (f) => InitialStartSpeed = f, (f) => InitialStartSize = f);
     UpdateInitialParticleSystemValues(ParticleSystemSecondary, (f) => InitialStartSpeedSecondary = f, (f) => InitialStartSizeSecondary = f);
     UpdateInitialParticleSystemValues(MistParticleSystem, (f) => InitialStartSpeedMist           = f, (f) => InitialStartSizeMist = f);
     Material          = new Material(ParticleSystem.GetComponent <Renderer>().sharedMaterial);
     MaterialSecondary = (ParticleSystemSecondary == null ? null : new Material(ParticleSystemSecondary.GetComponent <Renderer>().sharedMaterial));
     MistMaterial      = (MistParticleSystem == null ? null : new Material(MistParticleSystem.GetComponent <Renderer>().sharedMaterial));
     ExplosionMaterial = (ExplosionParticleSystem == null ? null : new Material(ExplosionParticleSystem.GetComponent <Renderer>().sharedMaterial));
 }
Esempio n. 3
0
        protected virtual void OnEnable()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (WeatherMakerCommandBufferManagerScript.Instance != null)
            {
                WeatherMakerCommandBufferManagerScript.Instance.RegisterPreCull(CameraPreCull, this);
                WeatherMakerCommandBufferManagerScript.Instance.RegisterPostRender(CameraPostRender, this);
            }
            ParticleSystemRenderer          = (ParticleSystem == null ? null : ParticleSystem.gameObject.GetComponent <ParticleSystemRenderer>());
            MistParticleSystemRenderer      = (MistParticleSystem == null ? null : MistParticleSystem.gameObject.GetComponent <ParticleSystemRenderer>());
            ExplosionParticleSystemRenderer = (ExplosionParticleSystem == null ? null : ExplosionParticleSystem.gameObject.GetComponent <ParticleSystemRenderer>());
            ParticleSystemSecondaryRenderer = (ParticleSystemSecondary == null ? null : ParticleSystemSecondary.gameObject.GetComponent <ParticleSystemRenderer>());
            ResumeParticleSystem(ParticleSystem);
            ResumeParticleSystem(ParticleSystemSecondary);
            ResumeParticleSystem(MistParticleSystem);
            if (AudioSourceLight == null && LoopSourceLight != null)
            {
                AudioSourceLight = new WeatherMakerLoopingAudioSource(LoopSourceLight);
            }
            if (AudioSourceMedium == null && LoopSourceMedium != null)
            {
                AudioSourceMedium = new WeatherMakerLoopingAudioSource(LoopSourceMedium);
            }
            if (AudioSourceHeavy == null && LoopSourceHeavy != null)
            {
                AudioSourceHeavy = new WeatherMakerLoopingAudioSource(LoopSourceHeavy);
            }
            if (AudioSourceLight != null)
            {
                AudioSourceLight.Resume();
            }
            if (AudioSourceMedium != null)
            {
                AudioSourceMedium.Resume();
            }
            if (AudioSourceHeavy != null)
            {
                AudioSourceHeavy.Resume();
            }
        }
Esempio n. 4
0
        public override void Initialize()
        {
            base.Initialize();

            CanPlay = true;

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            if (Parent != null)
            {
                AudioSource source = Parent.AddComponent <AudioSource>();
                source.loop        = Looping;
                source.playOnAwake = false;
                source.hideFlags   = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
                AudioSourceLoop    = new WeatherMakerLoopingAudioSource(source, 0.0f, 0.0f, Looping);
            }
        }
Esempio n. 5
0
        public override void Awake()
        {
            base.Awake();

            CanPlay = true;

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            if (AudioSourceLoop == null)
            {
                WeatherMakerScript.AssertExists();
                AudioSource source = WeatherMakerScript.Instance.gameObject.AddComponent <AudioSource>();
                source.loop        = Looping;
                source.playOnAwake = false;
                source.hideFlags   = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
                AudioSourceLoop    = new WeatherMakerLoopingAudioSource(source, 0.0f, 0.0f, Looping);
            }
        }
 private void Awake()
 {
     WindZone        = GetComponent <WindZone>();
     AudioSourceWind = new WeatherMakerLoopingAudioSource(GetComponent <AudioSource>());
 }