Пример #1
0
    // Update is called once per frame
    void Update()
    {
        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;

        if (noSound)
        {
            GetComponent <AudioSource>().volume = 0;
        }
        if (!noSound)
        {
            GetComponent <AudioSource>().volume = 1f;
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
            //			GameObject.Find("PauseButton").GetComponent<clickButton>().OnMouseDown();
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            // creatorBall.AddMesh();
        }
        if (gameOver && !gameOverShown)
        {
            gameOverShown = true;
            //isGameOver = true;
            //	return;
        }

        if (GameEvent.Instance.GameStatus == GameState.WinProccess)
        {
            //isGameOver = true;
            //   return;
        }



        if (Time.time > dropDownTime && dropDownTime != 0f)
        {
            //dropingDown = false;
            dropDownTime = 0;
            StartCoroutine(getBallsForMesh());
        }
        if (LevelData.GetTarget() != TargetType.Round && LevelData.CheckTargetComplete() && (GameEvent.Instance.GameStatus == GameState.Playing || GameEvent.Instance.GameStatus == GameState.BlockedGame))
        {
            isGameOver = true;
            GameEvent.Instance.GameStatus = GameState.WinProccess;
        }
        else if (GameEvent.Instance.GameStatus == GameState.Playing && !block /* || GameEvent.Instance.GameStatus == GameState.BlockedGame*/)
        {
            //Debug.Log("Between Turns");
            if (LevelData.GetTarget() != TargetType.Round && LevelData.CheckTargetComplete())
            {
                isGameOver = true;
                GameEvent.Instance.GameStatus = GameState.WinProccess;
            }
            else if (LevelData.GetTarget() == TargetType.Round && LevelData.CheckTargetComplete() && GameEvent.Instance.GameStatus == GameState.WaitForTarget2)
            {
                isGameOver = true;
                GameEvent.Instance.GameStatus = GameState.WinProccess;
            }
            else if (LevelData.LimitAmount <= 0 && newBall == null && !LevelData.CheckTargetComplete())
            {
                isGameOver = true;
                GameEvent.Instance.GameStatus = GameState.OutOfMoves;
            }
        }
        ProgressBarScript.Instance.UpdateDisplay((float)score * 100f / ((float)LevelData.star1 / ((LevelData.star1 * 100f / LevelData.star3)) * 100f) / 100f);

        if (score >= LevelData.star1 && stars <= 0)
        {
            stars = 1;
        }
        if (score >= LevelData.star2 && stars <= 1)
        {
            stars = 2;
        }
        if (score >= LevelData.star3 && stars <= 2)
        {
            stars = 3;
        }

        if (score >= LevelData.star1)
        {
            starsObject[0].SetActive(true);
        }
        if (score >= LevelData.star2)
        {
            starsObject[1].SetActive(true);
        }
        if (score >= LevelData.star3)
        {
            starsObject[2].SetActive(true);
        }
    }