示例#1
0
    // Update is called once per frame
    void Update()
    {
        actualOrderTime += Time.deltaTime;
        if (active)
        {
            if (actualOrderTime >= maxOrderTime - 0.1)
            {
                //No Cumplio

                //Cambiar
                if (hasToMove && orderPlayers.Contains(OnlineGameManager2.instance.playerName))
                {
                    if (PhotonNetwork.LocalPlayer.CustomProperties.ContainsKey("Lifes"))
                    {
                        ExitGames.Client.Photon.Hashtable newProperties = new ExitGames.Client.Photon.Hashtable();
                        newProperties.Add("Lifes", ((int)PhotonNetwork.LocalPlayer.CustomProperties["Lifes"]) - 1);
                        PhotonNetwork.LocalPlayer.SetCustomProperties(newProperties);
                    }
                }
                else
                {
                    active = false;
                    gameManager.UpdatePlayersScore(100);
                    audioSource.clip = audio1;
                    audioSource.Play();
                    completed = true;
                    StopTracking();
                }
                //Cambiar
                active = false;
            }
            if (CalculateDirection() == direction)
            {
                //Cumplio
                if (hasToMove && orderPlayers.Contains(OnlineGameManager2.instance.playerName))
                {
                    active = false;
                    gameManager.UpdatePlayersScore(100);
                    audioSource.clip = audio1;
                    audioSource.Play();
                    completed = true;
                    StopTracking();
                }
                else
                {
                    if (PhotonNetwork.LocalPlayer.CustomProperties.ContainsKey("Lifes"))
                    {
                        ExitGames.Client.Photon.Hashtable newProperties = new ExitGames.Client.Photon.Hashtable();
                        newProperties.Add("Lifes", ((int)PhotonNetwork.LocalPlayer.CustomProperties["Lifes"]) - 1);
                        PhotonNetwork.LocalPlayer.SetCustomProperties(newProperties);
                    }
                    //Cambiar
                    active = false;
                }
            }
        }
    }