Ejemplo n.º 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);
    }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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...");
     }
 }
Ejemplo n.º 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!");
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 8
0
 void _onWinning(winningEvent e)
 {
     ToastManager.Toast(e.getColor() + " wins!");
 }