Пример #1
0
 // Color al player
 private void OnPlayerNumberingChanged()
 {
     foreach (Player p in PhotonNetwork.PlayerList)
     {
         if (p.ActorNumber == ownerId)
         {
             Debug.Log("Número: " + p.GetPlayerNumber());
             PlayerColorImage.color = LlamaradaGame.GetColor(p.GetPlayerNumber());
         }
     }
 }
Пример #2
0
        void Start()
        {
            //actualizando propiedades personalizadas
            Hashtable props = new Hashtable
            {
                { LlamaradaGame.PLAYER_LOADED_LEVEL, true }
            };

            PhotonNetwork.LocalPlayer.SetCustomProperties(props);

            optionTime   = (int)PhotonNetwork.CurrentRoom.CustomProperties["TIMER"];
            optionR_Time = (int)PhotonNetwork.CurrentRoom.CustomProperties["R_TIME"];

            if (optionTime == 0)
            {
                textTimer.enabled       = false;
                textTimerMaster.enabled = false;
            }
            else if (optionTime == 1)
            {
                textTimer.enabled = false;
            }

            if (optionR_Time > 0)
            {
                if (optionR_Time == 1)
                {
                    optionR_TimeNum = 30;
                }
                else if (optionR_Time == 2)
                {
                    optionR_TimeNum = 45;
                }
                else if (optionR_Time == 3)
                {
                    optionR_TimeNum = 60;
                }
            }

            //INSTANCIAR BOARMANAGER
            if (boarManagerPrefab == null)
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> boarManagerPrefab Reference. Please set it up in GameObject 'Game Controller'", this);
            }
            else
            {
                if (PhotonNetwork.IsMasterClient)
                {
                    PhotonNetwork.InstantiateSceneObject(boarManagerPrefab.name, Vector3.zero, Quaternion.identity);
                }
            }

            //INSTACIAR TURNSYSTEM
            if (turnSystemManager == null)
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> turnSystenManagerPrefabs Reference. Please set it up in GameObject 'Game Controller'", this);
            }
            else
            {
                if (PhotonNetwork.IsMasterClient)
                {
                    PhotonNetwork.InstantiateSceneObject(turnSystemManager.name, Vector3.zero, Quaternion.identity);
                }
            }

            //INSTANCIAR PLAYER
            if (playerPrefab == null)
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Controller'", this);
            }
            else
            {
                if (PlayerController.LocalPlayerInstance == null)
                {
                    //lista de jugadores
                    Player[] players = PhotonNetwork.PlayerList;

                    if (players.Length > 1)
                    {
                        if (!PhotonNetwork.IsMasterClient)
                        {
                            Vector3 positionPlayer = new Vector3();

                            positionPlayer = LlamaradaGame.GetPosition(PhotonNetwork.LocalPlayer.GetPlayerNumber());

                            GameObject player = PhotonNetwork.Instantiate(this.playerPrefab.name, positionPlayer, Quaternion.identity, 0);
                        }
                    }
                    else
                    {
                        Vector3 positionPlayer = new Vector3();

                        positionPlayer = LlamaradaGame.GetPosition(PhotonNetwork.LocalPlayer.GetPlayerNumber());

                        PhotonNetwork.Instantiate(this.playerPrefab.name, positionPlayer, Quaternion.identity, 0);
                    }
                }
            }


            //  TIMER - Cambiado a CronometerTimer.cs

            /*escalaDeTiempoInicial = escalaDeTiempo;                                 //  Establecer la escala de tiempo original
             * tiempoAMostrarEnSegundos = GameManager.sharedInstance.timeTurn;         //  Inicializamos la variables que acumular
             * ActualizarReloj(tiempoInicial);*/


            if (PhotonNetwork.IsMasterClient)
            {
                SetPopulationInEdifice();
            }
        }