Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        grad_used.SetKeys(new GradientColorKey[] { new GradientColorKey(new Color(0.0f, 0.0f, 0.0f), 0.0f),
                                                   new GradientColorKey(new Color(0.0f, 0.01f, 0.0f), 1.0f) },
                          new GradientAlphaKey[] { new GradientAlphaKey(0.0f, 0.0f), new GradientAlphaKey(0.0f, 0.0f),
                                                   new GradientAlphaKey(0.0f, 0.53f),
                                                   new GradientAlphaKey(0.0f, 1.0f) });

        used = new AnimationCurve(new Keyframe[] { new Keyframe(0f, 0.0f),
                                                   new Keyframe(0.5f, 0.0f),
                                                   new Keyframe(1f, 0.0f) });

        //för att komma åt change_smoke
        change_smoke_script = smoke.GetComponent <change_smoke>();

        ps  = this.GetComponent <ParticleSystem>();
        ps1 = fire1.GetComponent <ParticleSystem>();
        ps2 = fire2.GetComponent <ParticleSystem>();
        ps3 = fire3.GetComponent <ParticleSystem>();
        ps4 = fire4.GetComponent <ParticleSystem>();

        //för ljudet
        _audio      = GetComponent <AudioSource>();
        _audio.clip = Microphone.Start(null, true, 10, 44100); //deviceName, loop bool, secounds, frequency
        _audio.loop = true;
        _audio.mute = true;
        while (!(Microphone.GetPosition(null) > 0))
        {
        }
        _audio.Play();
    }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        //elden är kvar här även om jag kommenterar bort här...
        ps  = this.GetComponent <ParticleSystem>();
        ps1 = fire1.GetComponent <ParticleSystem>();
        ps2 = fire2.GetComponent <ParticleSystem>();
        ps3 = fire3.GetComponent <ParticleSystem>();
        ps4 = fire4.GetComponent <ParticleSystem>();
        ps5 = fire5.GetComponent <ParticleSystem>();
        ps6 = fire6.GetComponent <ParticleSystem>();
        ps7 = fire7.GetComponent <ParticleSystem>();
        ps8 = fire8.GetComponent <ParticleSystem>();

        play = false;
        have_been_playnig = false;

        _toDie(ps);
        _toDie(ps1);
        _toDie(ps2);
        _toDie(ps3);
        _toDie(ps4);
        _toDie(ps5);
        _toDie(ps6);
        _toDie(ps7);
        _toDie(ps8);

        activ = 0;
        ps.Stop();
        ps1.Stop();
        ps2.Stop();
        ps3.Stop();
        ps4.Stop();
        ps5.Stop();
        ps6.Stop();
        ps7.Stop();
        ps8.Stop();


        grad_used.SetKeys(new GradientColorKey[] { new GradientColorKey(new Color(0.0f, 0.0f, 0.0f), 0.0f),
                                                   new GradientColorKey(new Color(0.0f, 0.01f, 0.0f), 1.0f) },
                          new GradientAlphaKey[] { new GradientAlphaKey(0.0f, 0.0f), new GradientAlphaKey(0.0f, 0.0f),
                                                   new GradientAlphaKey(0.0f, 0.53f),
                                                   new GradientAlphaKey(0.0f, 1.0f) });

        used = new AnimationCurve(new Keyframe[] { new Keyframe(0f, 0.0f),
                                                   new Keyframe(0.5f, 0.0f),
                                                   new Keyframe(1f, 0.0f) });

        used2 = new AnimationCurve(new Keyframe[] { new Keyframe(0f, 0.0f),
                                                    new Keyframe(0.5f, 0.0f),
                                                    new Keyframe(1f, 0.0f) });
        used3 = new AnimationCurve(new Keyframe[] { new Keyframe(0f, 0.0f),
                                                    new Keyframe(0.5f, 0.0f),
                                                    new Keyframe(1f, 0.0f) });

        change_smoke_script = smoke.GetComponent <change_smoke>();

        _audio      = GetComponent <AudioSource>();
        _audio.clip = Microphone.Start(null, true, 10, 44100); //deviceName, loop bool, secounds, frequency
        _audio.loop = true;
        _audio.mute = true;
        while (!(Microphone.GetPosition(null) > 0))
        {
        }
        _audio.Play();
    }