예제 #1
0
 /** Start an offline server within the application and start a game  */
 public void PlayOffline()
 {
     m_offline           = true;
     m_localServerRunner = new LocalServerRunner();
     m_client            = new ClientConnectionManager();
     m_localServerRunner.StartServer(m_client);
     if (m_client.IsConnected() && m_visualManager == null)  // Check for visual manager to know if we are already in-game - Hacky!!
     {
         SceneManager.LoadScene("Scenes/CardGame");
     }
 }
예제 #2
0
 public void AiUpdate()
 {
     // See ClientConnectionInterface.Update()
     if (m_aiConMgr != null && m_aiConMgr.IsConnected())
     {
         CGCommand command = m_aiConMgr.ReceiveCommand();
         if (command != null)
         {
             command.OnReceivedAi(m_aiPlayer, m_aiConMgr);
             command.ExecuteAiCommand(m_aiPlayer, m_aiConMgr);
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (m_client != null && m_client.IsConnected())
        {
            if (m_visualManager == null)
            {
                SetUpVisualManager();
            }

            CGCommand command = m_client.ReceiveCommand();
            if (command != null)
            {
                command.m_visualManager = m_visualManager;
                command.OnReceived();
                m_visualManager.AddCommand(command);
            }
        }
        // Run AI client if it exists
        if (m_offline && m_localServerRunner != null)
        {
            m_localServerRunner.AiUpdate();
        }
    }