Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (CPUMode)
     {
         if (gameStarted)
         {
             if (CPUTurn)
             {
                 if (enemyGameData == "")
                 {
                     TakeShot();
                 }
                 if (enemyGameData.Length > 2)
                 {
                     ReceiveOurShotData();
                 }
             }
             else
             {
                 if (ourGameData.Length > 1)
                 {
                     if (time == 0f)
                     {
                         ReceiveEnemyShotData();
                     }
                     else if ((Time.time - time) > .25f)
                     {
                         time = 0f;
                         SendEnemyShotData();
                     }
                 }
             }
         }
         else
         {
             if (autoPlace)
             {
                 PlaceShips();
                 if (gameProgress.CountShips(false))
                 {
                     autoPlace   = false;
                     gameStarted = true;
                 }
             }
         }
     }
 }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (gameStarted)
     {
         if (ourTurn)
         {
             if (ourGameData.Length > 2)
             {
                 ReceiveOurShotData();
             }
         }
         else
         {
             if (time == 0f)
             {
                 ReceiveEnemyShotData();
             }
             else if ((Time.time - time) > .25f)
             {
                 time = 0f;
                 SendEnemyShotData();
             }
         }
     }
     else
     {
         if (autoPlace)
         {
             PlaceShips();
             if (gameProgress.CountShips(true))
             {
                 autoPlace = false;
             }
         }
     }
 }