コード例 #1
0
ファイル: Connect.cs プロジェクト: showbufire/TicTacToe
    public void ConnectToServer()
    {
        ToastManager toastManager = FindObjectOfType <ToastManager>();
        string       nickName     = usernameInput.text;

        if (string.IsNullOrEmpty(nickName))
        {
            toastManager.Toast("Empty username");
            return;
        }
        PhotonNetwork.playerName = nickName;
        toastManager.Toast("Connecting...");
        PhotonNetwork.ConnectUsingSettings(AppVersion);
    }
コード例 #2
0
 void _OnScored(int score)
 {
     if (score > high_score)
     {
         high_score = score;
         ToastManager.Toast("New High Score: " + high_score.ToString());
     }
 }
コード例 #3
0
 private IEnumerator QueueMessage()
 {
     while (true)
     {
         ToastManager.Toast(toastList[index]);
         index = (index + 1 < toastList.Count) ? index + 1 : 0;
         yield return(new WaitForSeconds(3));
     }
 }
コード例 #4
0
ファイル: Connect.cs プロジェクト: showbufire/TicTacToe
 public override void OnJoinedRoom()
 {
     Debug.Log("On Joined Room");
     if (PhotonNetwork.room.PlayerCount == 2)
     {
         gameController.StartGame();
     }
     else
     {
         ToastManager toastManager = FindObjectOfType <ToastManager>();
         toastManager.Toast("Connected, waiting for other player to join...");
     }
 }
コード例 #5
0
 public void RestartGame()
 {
     if (PhotonNetwork.isMasterClient)
     {
         PhotonView photonView = GetComponent <PhotonView>();
         photonView.RPC("RestartGameRPC", PhotonTargets.All);
     }
     else
     {
         ToastManager toastManager = FindObjectOfType <ToastManager>();
         toastManager.Toast("Only the master client can restart a game!");
     }
 }
コード例 #6
0
 // Update is called once per frame
 void Update()
 {
     if (!startToast && shieldHealth.getHealth() <= 0)
     {
         startToast = true;
     }
     if (startToast && index < instructionList.Length && ((float)bossHealth.getHealth() / (float)bossHealth.maxHealth) >= instructionPercentages[index])
     {
         //Debug.Log((float)bossHealth.getHealth() / (float)bossHealth.maxHealth);
         ToastManager.Toast(instructionList[index]);
         ++index;
     }
 }
コード例 #7
0
 // Update is called once per frame
 void Update()
 {
     if (startToast && index < instructionList.Length && ((float)bossHealth.getHealth() / (float)bossHealth.maxHealth) <= instructionPercentages[index])
     {
         //Debug.Log((float)bossHealth.getHealth() / (float)bossHealth.maxHealth);
         ToastManager.Toast(instructionList[index]);
         for (int i = 0; i < instructionImgs.Length; ++i)
         {
             if (instructionImgs[i])
             {
                 instructionImgs[i].SetActive(false);
             }
         }
         StartCoroutine(DisableAllImgs());
         if (instructionImgs[index])
         {
             instructionImgs[index].SetActive(true);
         }
         ++index;
         if (!calledFunc && ((float)bossHealth.getHealth() / (float)bossHealth.maxHealth) <= 0.4)
         {
             calledFunc = true;
             StartCoroutine(FlashOnCommand.DoFlash());
         }
         if (!calledFunc && bossHealth.getHealth() <= 0)
         {
             calledFunc = true;
             bc.enabled = true;
         }
     }
     if (!startToast && !funcCalled && bossHealth.getHealth() <= 0)
     {
         //give the instructions for stepping on the platform if it was skipped
         ToastManager.Toast("Step on the BLUE plate to fight Pluto (easy) \n Step on the RED plate to fight Mars (harder)");
         funcCalled = true;
     }
 }
コード例 #8
0
 void _onWinning(winningEvent e)
 {
     ToastManager.Toast(e.getColor() + " wins!");
 }