コード例 #1
0
    public void Update()
    {
        if (CameraMain != null)
        {
            CameraMain.fieldOfView = Mathf.Min(CameraMain.fieldOfView * 1.5f, Mathf.Lerp(CameraMain.fieldOfView, fieldOfView + Mathf.Max(0, _Player.avrVel) * .2f + Mathf.Max(0, _Player.velm - _Player.avrVel) * .5f, Time.deltaTime * 3));
        }

        if (online)
        {
            //AudioListener.pause = Time.timeSinceLevelLoad < 2;
            if (listOfPlayers.Where(a => a != null).Count(a => !a.enabled) > 2 && Time.timeSinceLevelLoad > 5)
            {
                Debug.LogException(new Exception("server sync error"));
            }
        }

        if (Input2.GetKeyDown(KeyCode.F3))
        {
            Player.VoteKick(Player.kickPlayer);
        }



        if (KeyDebug(KeyCode.R, "Restart level"))
        {
            CallRPC(SetTimeCount, 0f);
        }

#if !UNITY_WP8 && VOICECHAT
        if (Input.GetKeyDown(KeyCode.Y) && !room.disableVoiceChat)
        {
            //_GameGui.CallRPC(_GameGui.Chat, _Loader.playerName + Tr(" voice chat"));
            print("Voice Chat: " + Application.HasUserAuthorization(UserAuthorization.Microphone));
            if (!VoiceChatRecorder.Instance.enabled)
            {
                StartCoroutine(InitMicrophone());
            }
        }
#endif

        //if (Input2.GetKeyDown(KeyCode.N))
        //ToggleWindow(AllyWindow);
        if (Loader.errorCount > 100 && !isDebug)
        {
            _Loader.ignoredRooms.Add(room.name);
            LeaveRoom();
        }
        UpdateBots();

        if (Input2.GetKeyUp(KeyCode.Return))
        {
            _ChatGui.EnableChat();
        }

        if (Input2.GetKeyDown(KeyCode.C))
        {
            MainCamera.Next();
        }
        if (Input2.GetKeyDown(KeyCode.Tab))
        {
            ShowScoreBoard();
        }
        if (Input2.GetKeyUp(KeyCode.Tab))
        {
            CloseWindow();
        }

        UpdateGameState();
        if (SecureInt.detected)
        {
            ext.Block(" hack");
        }

        SetSecure("life", (int)_Player.life);
        SetSecure("bullets", (int)_Player.curWeapon.bullets);
        SetSecure("bullets2", (int)_Player.machineGun.bullets);
        room.Update();
    }