//开始游戏
    void StartGaming()
    {
        state = BallGameState.gaming;

        GameObject obj = Network.Instantiate(prefab_ball, new Vector3(0, 1, 0), Quaternion.identity, 0) as GameObject;

        myBall = obj.GetComponent <Rigidbody>();
    }
    //游戏状态逻辑
    void OnGaming()
    {
        //控制自己的球体
        float x = Input.GetAxis("Horizontal");
        float y = Input.GetAxis("Vertical");

        myBall.AddForce(new Vector3(x, 0, y));

        //出界则失败
        if (myBall.transform.position.y < -5)
        {
            Network.Destroy(myBall.GetComponent <NetworkView>().viewID);
            state = BallGameState.lose;
        }
    }
 //大厅逻辑状态
 void OnLobby()
 {
     if (GUILayout.Button("建立服务器"))
     {
         NetworkConnectionError error = Network.InitializeServer(10, Port, false);
         if (error == NetworkConnectionError.NoError)
         {
             state = BallGameState.idle;
         }
     }
     GUILayout.Label("=============================================================");
     GUILayout.BeginHorizontal();
     GUILayout.Label("服务器IP地址:");
     IP = GUILayout.TextField(IP);
     GUILayout.EndHorizontal();
     if (GUILayout.Button("连接服务器"))
     {
         NetworkConnectionError error = Network.Connect(IP, Port);
         if (error == NetworkConnectionError.NoError)
         {
             state = BallGameState.idle;
         }
     }
 }