Beispiel #1
0
 public void LoadNextOne()
 {
     OnPut[Indice].SetActive(false);
     OnPut[k].SetActive(false);
     OnPut[j].SetActive(false);
     score.AddStar();
     if (Indice < Object.Length - 1)
     {
         Indice++;
         reIanisialise();
         for (int i = 0; i < Object.Length; i++)
         {
             Object[i].SetActive(false);
         }
         Object[Indice].SetActive(true);
     }
     else
     {
         Winning.SetActive(true);
         Gamex.SetActive(false);
         finish       = true;
         add_Score_Db = FindObjectOfType <Add_Score_db>();
         if (PlayerPrefs.GetInt("id_user") != 0)
         {
             add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 17, 0, timer_to_finish);
         }
     }
 }
Beispiel #2
0
    //Pour passer d'une image à une autre
    public void nextPhoto()
    {
        photosWithoutCl[curIndice].SetActive(false);
        photoWithColers[curIndice].SetActive(false);
        score.AddStar();
        if (curIndice < photosWithoutCl.Count - 1)
        {
            curIndice++;
            photoWithColers[curIndice] = Instantiate(photoWithColers[curIndice], new Vector2(photosWithoutCl[curIndice].transform.position.x - 7.5f, photosWithoutCl[curIndice].transform.position.y), Quaternion.identity);;
            photosWithoutCl[curIndice].SetActive(true);
            updateList();
        }
        else if (!finish)
        {
            fin2.SetActive(false);

            winning.SetActive(true);
            finish       = true;
            add_Score_Db = FindObjectOfType <Add_Score_db>();
            if (PlayerPrefs.GetInt("id_user") != 0)
            {
                add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 16, 0, timer_to_finish);
            }
        }
    }
Beispiel #3
0
    void Update()
    {
        if (!finish)
        {
            timer_of_finish += Time.deltaTime;
        }
        check();
        int i = 0;

        foreach (bool bb in checkList)
        {
            if (bb)
            {
                True[i].SetActive(true);
            }
            i++;
        }
        bool EvrybodyLOcked = true;

        foreach (bool bb in checkList)
        {
            if (!bb)
            {
                EvrybodyLOcked = false;
            }
            i++;
        }
        if (EvrybodyLOcked && !finish)
        {
            Timer -= Time.deltaTime;
        }
        if (Timer <= 0)
        {
            Timer = 1;
            score.AddStar();
            if (level < 12)
            {
                level += 3;

                Start();
            }
            else
            {
                finish = true;

                add_Score_Db = FindObjectOfType <Add_Score_db>();
                if (PlayerPrefs.GetInt("id_user") != 0)
                {
                    add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 13, 0, timer_of_finish);
                }
                for (int j = 0; j < win.Length; j++)
                {
                    win[j].SetActive(true);
                }
            }
        }
    }
Beispiel #4
0
    // Start is called before the first frame update
    void Start()
    {
        if (level < 10 && !finish)
        {
            if (level == 0)
            {
                score = FindObjectOfType <Score>();
                score.initialiserStars(10);
            }
            monikoFalse.SetActive(false);
            monikoFalse.SetActive(false);


            for (int i = 0; i < posi.Count; i++)
            {
                posi[i].GetComponent <SpriteRenderer>().sprite = null;
            }

            for (int i = 0; i < Buttons.Length; i++)
            {
                Buttons[i].SetActive(true);
            }
            NbrItems = Random.Range(1, posi.Count);
            int x = Random.Range(0, A.Count);
            for (int i = 0; i < NbrItems; i++)
            {
                posi[i].GetComponent <SpriteRenderer>().sprite = A[x];
            }
            displayit();
            inisialiserButtons();
            level++;
        }
        else if (!finish)
        {
            finish       = true;
            add_Score_Db = FindObjectOfType <Add_Score_db>();
            if (PlayerPrefs.GetInt("id_user") != 0)
            {
                add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 15, 0, Timer_to_finish);
            }
        }
    }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        if (level < 10)
        {
            score = FindObjectOfType <Score>();
            score.initialiserStars(10);

            monikoFalse.SetActive(false);
            monikoVrai.SetActive(false);

            int falseTxt   = Random.Range(0, txt.Length);
            int indiceTree = Random.Range(0, txt.Length);
            while (falseTxt == indiceTree)
            {
                indiceTree = Random.Range(0, txt.Length);
            }
            butn[0].GetComponent <RawImage>().texture = txt[falseTxt];
            butn[1].GetComponent <RawImage>().texture = txt[indiceTree];
            butn[2].GetComponent <RawImage>().texture = txt[indiceTree];
            butn[3].GetComponent <RawImage>().texture = txt[indiceTree];

            randomIt();

            foreach (GameObject btn in butn)
            {
                btn.transform.localScale = Vector2.zero;
            }
            foreach (GameObject btn in butn)
            {
                btn.LeanScale(new Vector2(2, 2), 1);
            }
        }

        if (level == 10)
        {
            finish       = true;
            add_Score_Db = FindObjectOfType <Add_Score_db>();
            add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 18, 0, timer_to_finish);
        }
    }
Beispiel #6
0
    // Update is called once per frame
    void Update()
    {
        if (!finish)
        {
            timer_to_finish += Time.deltaTime;
        }

        if (right)
        {
            timer -= Time.deltaTime;
        }

        if (timer <= 0)
        {
            if (level < ListOfPhotos.Count - 1)
            {
                level++;
                timer = 2;
                right = false;
                ListOfPhotos[CurIndice].SetActive(false);
                CurIndice++;
                Start();
            }
            else
            {
                timer  = 2;
                finish = true;
            }
            if (finish)
            {
                add_Score_Db = FindObjectOfType <Add_Score_db>();
                if (PlayerPrefs.GetInt("id_user") != 0)
                {
                    add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 20, 0, timer_to_finish);
                }
                finish = false;
            }
        }
    }
Beispiel #7
0
    public void NextPhoto()
    {
        if (indicePhoto < photoKamla.Length - 1)
        {
            photoKamla[indicePhoto].SetActive(false);
            indicePhoto++;
            photoKamla[indicePhoto].SetActive(true);

            InitialisePosition();
            score.AddStar();
        }
        else
        {
            finish = true;
            wiiiA.SetActive(true);
            photoKamla[indicePhoto].SetActive(false);
            add_Score_Db = FindObjectOfType <Add_Score_db>();
            if (PlayerPrefs.GetInt("id_user") != 0)
            {
                add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 12, 0, timer_of_finish);
            }
        }
    }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        if (!finish)
        {
            timer_to_finish += Time.deltaTime;
        }

        if (nbrFaces == 2 && timer1 >= 0)
        {
            timer1 -= Time.deltaTime;
        }
        if (nbrFaces == 2 && timer1 <= 0)
        {
            if (photoFace[FirstClicked].GetComponent <RawImage>().texture == photoFace[secondClicked].GetComponent <RawImage>().texture)
            {
                truue[nbrItemsTrue].GetComponent <RawImage>().texture = photoFace[FirstClicked].GetComponent <RawImage>().texture;
                truue[nbrItemsTrue].SetActive(true);

                photoFace[FirstClicked].SetActive(false);
                photoFace[secondClicked].SetActive(false);
                nbrItemsTrue++;
                if (nbrItemsTrue == nbrPhotos)
                {
                    nextButton.SetActive(true);
                }
            }
            else
            {
                photoFace[FirstClicked].transform.localScale = photoFace[secondClicked].transform.localScale = new Vector2(0, 0);
                if (nbrPhotos == 8)
                {
                    backPhoto[FirstClicked].transform.localScale = backPhoto[secondClicked].transform.localScale = new Vector2(0.7f, 0.7f);
                }
                else
                {
                    backPhoto[FirstClicked].transform.localScale = backPhoto[secondClicked].transform.localScale = new Vector2(1, 1);
                }
            }
            timer1   = 0.5F;
            nbrFaces = 0;
        }
        if (nbrItemsTrue == nbrPhotos)
        {
            timer2 -= Time.deltaTime;
        }
        if (timer2 <= 0)
        {
            nbrItemsTrue = 0;
            next         = true;
            timer2       = 0.5f;
        }

        if (next && nbrPhotos == 2)
        {
            places[0].SetActive(false);
            nbrPhotos = 4;
            nextButton.SetActive(false);
            score.AddStar();
            Start();
            next = false;
        }

        else if (next && nbrPhotos == 4)
        {
            Destroy(places[1]);
            nbrPhotos = 6;
            nextButton.SetActive(false);
            score.AddStar();
            Start();
            next = false;
        }
        else if (next && nbrPhotos == 6)
        {
            Destroy(places[2]);
            nbrPhotos = 8;
            nextButton.SetActive(false);
            score.AddStar();
            Start();
            next = false;
        }
        else if (next && nbrPhotos == 8)
        {
            Destroy(places[3]);
            Debug.Log("you win");
            nextButton.SetActive(false);
            score.AddStar();
            Start();
            next = false;
            winScean[0].SetActive(true);
            winScean[1].SetActive(true);
            nextButton.SetActive(false);
            finish   = true;
            add_data = true;
        }

        if (add_data)
        {
            add_Score_Db = FindObjectOfType <Add_Score_db>();
            if (PlayerPrefs.GetInt("id_user") != 0)
            {
                add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 14, 0, timer_to_finish);
            }
            add_data = false;
        }
    }
Beispiel #9
0
    void Start()
    {
        if (level < 3)
        {
            score = FindObjectOfType <Score>();
            score.initialiserStars(3);
            for (int i = 0; i < items.Length; i++)
            {
                items[i].SetActive(false);
            }
            CurItems.Clear();
            placeInitiale.Clear();
            a1.Clear();
            if (level == 0)
            {
                treeItms();
            }
            if (level == 1)
            {
                fiveItems();
            }
            if (level == 2)
            {
                for (int i = 0; i < items.Length; i++)
                {
                    CurItems.Add(items[i]);
                }
            }
            for (int i = 0; i < CurItems.Count; i++)
            {
                placeInitiale.Add(CurItems[i].transform.position);

                a1.Add(CurItems[i].GetComponent <AAAAA>());
            }
            foreach (GameObject gm in CurItems)
            {
                gm.SetActive(true);
            }
        }
        else
        {
            for (int i = 0; i < scean.Length; i++)
            {
                scean[i].SetActive(false);
            }
            win.SetActive(true);
            finish       = true;
            add_Score_Db = FindObjectOfType <Add_Score_db>();

            if (timer_of_finish <= 30)
            {
                njom = 3;
                for (int i = 0; i < njom_sofar.Length; i++)
                {
                    njom_sofar[i].SetActive(true);
                }
            }
            else if (timer_of_finish <= 60 && timer_of_finish >= 30)
            {
                njom = 2;
                njom_sofar[0].SetActive(true);
                njom_sofar[1].SetActive(true);
            }
            else
            {
                njom = 1;
                njom_sofar[0].SetActive(true);
            }
            if (PlayerPrefs.GetInt("id_user") != 0)
            {
                add_Score_Db.UpdateData(PlayerPrefs.GetInt("id_user"), 11, njom, timer_of_finish);
            }
        }
    }