コード例 #1
0
    void Update()
    {
        if (Time.time - lastUpdate >= 1f)
        {
            lastUpdate = Time.time;
            UI.matchTimer--;
            PlayerPhysics.invincible--;
            Multiplayer.CheckForInternetConnection();
            Multiplayer.ui.setLeaderBoardData();
            if (FBHolder.isLoggedIn)
            {
                FindObjectOfType <UI>().cashPanel.SetActive(true);
            }
            else
            {
                FindObjectOfType <UI>().cashPanel.SetActive(false);
            }

            if (life <= 0 && Multiplayer.oppLife <= 0)
            {
                running = false;
            }


            if (UI.matchTimer == 0)
            {
                Multiplayer.ui.startMultiPlayer();
            }

            if (Multiplayer.state == Multiplayer.State.Finished)
            {
                Multiplayer.ui.showWinner();
            }

            if (Multiplayer.connection != Multiplayer.Connection.Offline && (Multiplayer.state == Multiplayer.State.Pairing ||
                                                                             Multiplayer.state == Multiplayer.State.Waiting))
            {
                //  mp.checkPairStatus();
            }


            if (running)
            {
                if (life > 0)
                {
                    score++;
                }

                if (score % 20 == 0 && difficulty < 12)
                {
                    PlatformPhysics.speed *= 1.05f;
                    UI.scrollSpeed        *= 1.05f;
                    difficulty++;

                    Debug.Log("Difficulty:" + difficulty + " UI Speed:" + UI.scrollSpeed + " Platform Speed:" + PlatformPhysics.speed);
                }
                if (score % bladeInterval == 0 && score >= bladeStart)
                {
                    Instantiate(blades, new Vector3(0, 0, 0), Quaternion.identity, GameObject.FindGameObjectWithTag("Panel").transform);
                }
            }
        }
    }