Пример #1
0
    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());
     }
 }
 private IEnumerator QueueMessage()
 {
     while (true)
     {
         ToastManager.Toast(toastList[index]);
         index = (index + 1 < toastList.Count) ? index + 1 : 0;
         yield return(new WaitForSeconds(3));
     }
 }
Пример #4
0
 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!");
 }