Exemple #1
0
    void EventRain(int StartRain, int EndRain)
    {
        if (ScrollSnapRect.StateInt == 2)
        {
            if (Score == StartRain || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                audio.volume += 0.05f;
                if (!audio.isPlaying)
                {
                    //  MB.SetTrigger("PlanNight");
                    SoundsControllerRain.PlaySound(soundsGameRain.Fade);
                    aniHN.SetTrigger("HNTT");
                }
                aniHN.SetTrigger("HNstartrain");

                ObjRain.SetActive(true);
            }
            if (Score == StartRain + 1 || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.5f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.5f; Bird.GetComponent <Rigidbody2D>().gravityScale = 1.5f; RainDrop.SetActive(true); RainD.SetTrigger("StartRainDrop");
            }
            if (Score == EndRain || Score == EndRain + 100 || Score == EndRain + 200 || Score == EndRain + 300 || Score == EndRain + 400 || Score == EndRain + 500 || Score == EndRain + 600 || Score == EndRain + 700 || Score == EndRain + 800 || Score == EndRain + 900 || Score == EndRain + 1000)
            {
                Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird.GetComponent <Rigidbody2D>().gravityScale = 1.2f;
            }

            if (Score >= EndRain || Score >= EndRain + 100 || Score >= EndRain + 200 || Score >= EndRain + 300 || Score >= EndRain + 400 || Score >= EndRain + 500 || Score >= EndRain + 600 || Score >= EndRain + 700 || Score >= EndRain + 800 || Score >= EndRain + 900 || Score >= EndRain + 1000)
            {
                if (audio.isPlaying)
                {
                    audio.volume -= Time.deltaTime / 10;
                    ObjRain.GetComponent <ParticleSystem>().maxParticles -= 5;
                }
                if (audio.volume < 0.2f)
                {
                    audio.Stop();
                }
                if (ObjRain.GetComponent <ParticleSystem>().maxParticles < 400)
                {
                    ObjRain.SetActive(false);
                    // MB.SetTrigger("PlainNor");
                    Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.2f;
                    Bird.GetComponent <Rigidbody2D>().gravityScale  = 1.2f; RainDrop.SetActive(false); RainD.SetTrigger("RainDropNor");
                    aniHN.SetTrigger("HNnor");
                }
            }
        }
        if (ScrollSnapRect.StateInt == 1)
        {
            if (Score == StartRain || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                audio.volume += 0.05f;
                if (!audio.isPlaying)
                {
                    //  MB.SetTrigger("PlanNight");
                    SoundsControllerRain.PlaySound(soundsGameRain.Fade);
                    aniMT.SetTrigger("MTTT");
                }
                aniMT.SetTrigger("MTstartrain");

                ObjRain.SetActive(true);
            }
            if (Score == StartRain + 1 || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.5f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.5f; Bird.GetComponent <Rigidbody2D>().gravityScale = 1.5f; RainDrop.SetActive(true); RainD.SetTrigger("StartRainDrop");
            }
            if (Score == EndRain || Score == EndRain + 100 || Score == EndRain + 200 || Score == EndRain + 300 || Score == EndRain + 400 || Score == EndRain + 500 || Score == EndRain + 600 || Score == EndRain + 700 || Score == EndRain + 800 || Score == EndRain + 900 || Score == EndRain + 1000)
            {
                Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird.GetComponent <Rigidbody2D>().gravityScale = 1.2f;
            }

            if (Score >= EndRain || Score >= EndRain + 100 || Score >= EndRain + 200 || Score >= EndRain + 300 || Score >= EndRain + 400 || Score >= EndRain + 500 || Score >= EndRain + 600 || Score >= EndRain + 700 || Score >= EndRain + 800 || Score >= EndRain + 900 || Score >= EndRain + 1000)
            {
                if (audio.isPlaying)
                {
                    audio.volume -= Time.deltaTime / 10;
                    ObjRain.GetComponent <ParticleSystem>().maxParticles -= 5;
                }
                if (audio.volume < 0.2f)
                {
                    audio.Stop();
                }
                if (ObjRain.GetComponent <ParticleSystem>().maxParticles < 400)
                {
                    ObjRain.SetActive(false);
                    // MB.SetTrigger("PlainNor");
                    Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.2f;
                    Bird.GetComponent <Rigidbody2D>().gravityScale  = 1.2f; RainDrop.SetActive(false); RainD.SetTrigger("RainDropNor");
                    aniMT.SetTrigger("HNnor");
                }
            }
        }

        if (ScrollSnapRect.StateInt == 0)
        {
            if (Score == StartRain || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                audio.volume += 0.05f;
                if (!audio.isPlaying)
                {
                    //  MB.SetTrigger("PlanNight");
                    SoundsControllerRain.PlaySound(soundsGameRain.Fade);
                    aniSG.SetTrigger("SGTT");
                }
                aniSG.SetTrigger("SGstartrain");

                ObjRain.SetActive(true);
            }
            if (Score == StartRain + 1 || Score == StartRain + 100 || Score == StartRain + 200 || Score == StartRain + 300 || Score == StartRain + 400 || Score == StartRain + 500 || Score == StartRain + 600 || Score == StartRain + 700 || Score == StartRain + 800)
            {
                Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.8f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.8f; Bird.GetComponent <Rigidbody2D>().gravityScale = 1.8f; RainDrop.SetActive(true); RainD.SetTrigger("StartRainDrop");
            }

            if (Score >= EndRain || Score >= EndRain + 100 || Score >= EndRain + 200 || Score >= EndRain + 300 || Score >= EndRain + 400 || Score >= EndRain + 500 || Score >= EndRain + 600 || Score >= EndRain + 700 || Score >= EndRain + 800 || Score >= EndRain + 900 || Score >= EndRain + 1000)
            {
                if (audio.isPlaying)
                {
                    audio.volume -= Time.deltaTime / 10;
                    ObjRain.GetComponent <ParticleSystem>().maxParticles -= 5;
                }
                if (audio.volume < 0.2f)
                {
                    audio.Stop();
                }
                if (ObjRain.GetComponent <ParticleSystem>().maxParticles < 400)
                {
                    ObjRain.SetActive(false);
                    // MB.SetTrigger("PlainNor");
                    Bird1.GetComponent <Rigidbody2D>().gravityScale = 1.2f; Bird2.GetComponent <Rigidbody2D>().gravityScale = 1.2f;
                    Bird.GetComponent <Rigidbody2D>().gravityScale  = 1.2f; RainDrop.SetActive(false); RainD.SetTrigger("RainDropNor");
                    aniSG.SetTrigger("SGnor");
                }
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     instance = this;
 }