Пример #1
0
    void Update()
    {
        if (Modules.pauseGame)
        {
            return;
        }
        SetDataStateBar();
        if (Modules.scoreScene >= Modules.scoreNeed && !win)
        {
            Modules.PlayAudio("win", 3);
            Win();
            return;
        }
        CalcuLevel();
        if (beLost)
        {
            LostBox.SetActive(true);
            return;
        }
        if (Modules.keepItem)
        {
            Modules.countBeChoise = 0;
        }
        else
        {
            Modules.CalcuItemBeChoise(listLocal);
        }

        timeGame         += Time.deltaTime;
        textTimePlay.text = "Time: " + (int)timeGame;

        timeSpawn += Time.deltaTime;
        if (timeSpawn > TimeSpawn)
        {
            Modules.Spawn(listLocal);
            timeSpawn = 0;
        }
        else
        {
            Modules.isSpawning = false;
        };
        Modules.SetChoisePosition(goChoise, listLocal);
        if (Input.GetMouseButtonDown(0))
        {
            if (!Modules.keepItem)
            {
                if (listLocal[Modules.localMouse - 1].childCount > 0)
                {
                    Modules.PickItem(Modules.localMouse - 1, listPick, rows, goChoise, listLocal);
                }

                else
                {
                    Modules.PlayAudio("nullItem", 0.3f);
                }
            }
            else
            if (FindObjectOfType <ItemImage>())
            {
                Modules.ThrowItem(Modules.localMouse - 1, rows, listPick, listLocal);
                Modules.isCanPick = false;
                StartCoroutine(Modules.WaitIsCanPick());
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            rows[0].items.Clear();
        }
        loadRows -= Time.deltaTime;
        if (loadRows <= 0)
        {
            for (int i = 0; i < rows.Length; i++)
            {
                Modules.Row(i, rows, listLocal);
            }
        }
    }
Пример #2
0
    void Update()
    {
        SetDataButtonPause();

        if (Input.GetKey(KeyCode.R))
        {
            Modules.ResetLeaderBoard();
        }
        SetDataInfogame();
        if (Modules.pauseGame)
        {
            return;
        }
        CalcuLevel();
        if (beLost)
        {
            lostBox.SetActive(true);
            return;
        }

        if (Modules.keepItem)
        {
            Modules.countBeChoise = 0;
        }
        else
        {
            Modules.CalcuItemBeChoise(listLocal);
        }
        timeGame += Time.deltaTime;
        if (timeGame >= 0.5f)
        {
            if (timeGame < 0.6f)
            {
                timeGame = Modules.timeNowFree;
            }
        }
        timeSpawn += Time.deltaTime;
        if (timeSpawn > TimeSpawn)
        {
            Modules.Spawn(listLocal);
            timeSpawn = 0;
        }
        else
        {
            Modules.isSpawning = false;
        }
        Modules.SetChoisePosition(goChoise, listLocal);
        if (Input.GetMouseButtonDown(0))
        {
            if (!Modules.keepItem)
            {
                if (listLocal[Modules.localMouse - 1].childCount > 0)
                {
                    Modules.PickItem(Modules.localMouse - 1, listPick, rows, goChoise, listLocal);
                }
                else
                {
                    Modules.PlayAudio("nullItem", 0.3f);
                }
            }
            else
            if (FindObjectOfType <ItemImage>())
            {
                Modules.ThrowItem(Modules.localMouse - 1, rows, listPick, listLocal);
                Modules.isCanPick = false;
                StartCoroutine(Modules.WaitIsCanPick());
            }
        }
        loadRows -= Time.deltaTime;
        if (loadRows <= 0)
        {
            for (int i = 0; i < rows.Length; i++)
            {
                Modules.Row(i, rows, listLocal);
            }
            loadRows = 0.5f;
        }
    }