示例#1
0
    // Update is called once per frame
    void Update()
    {
        //updateStaticVaribles
        Player._posKar_x = transform.position.x;

        //flame
        FlameUpdateControl();

        //controllers
        if (!blockAllControls)
        {
            if (isKeyboard)
            {
                PlayerControlKeyboard();
            }
        }

        //bodyCarAction
        if (destroyOn)
        {
            DestroyAction();
        }

        //
        if (resurectionOn)
        {
            ResurectionOnUpdateAction();
        }

        //life correcotr
        if (CorrectLife.getLife() < 0)
        {
            Debug.Log("GAME OVER");
        }
    }
    void Update()
    {
        //foreach (GameObject forBall in GameObject.FindGameObjectsWithTag("Ball")) {

        //Instantiate(respawnPrefab, respawn.transform.position, respawn.transform.rotation) as GameObject;
        //}
        if (GameObject.FindGameObjectsWithTag("Ball").Length == 0 && GameObject.FindGameObjectsWithTag("SmallBall").Length == 0)
        {
            //Говорим прощай жизнь и создаем мячик


            timer -= Time.deltaTime;
            if (timer < 0)
            {
                if (CorrectLife.getLife() > 0)
                {
                    GameObject newBall = Instantiate(createBall) as GameObject;
                    newBall.gameObject.tag = "Ball";
                    newBall.gameObject.GetComponent <BallV2>().isResetBall = true;
                    //Выводим надпись предупреждающую

                    CorrectLife.decLife();
                }
                else
                {
                    //Сообщаем что игра закончена и предлагаем переиграть... т.е. выводим меню
                    EndGame.WinLoseAction(false);
                }

                timer = 0.5f;
            }
        }
    }
示例#3
0
 private void AddLife()
 {
     CorrectLife.incLife();
 }