Exemple #1
0
        public void OnPhotonInstantiate(PhotonMessageInfo info)
        {
            states = GetComponent <StateManager>();
            states.InitReferences();
            mTransform = this.transform;
            object[] data = photonView.InstantiationData;

            states.photonId = (int)data[0];
            string modelId = (string)data[2];

            states.LoadCharacterModel(modelId);

            MultiplayerManager m = MultiplayerManager.singleton;

            this.transform.parent = m.GetMRef().referencesParent;

            PlayerHolder playerHolder = m.GetMRef().GetPlayer(states.photonId);

            playerHolder.states = states;

            string weaponId = (string)data[1];

            Debug.Log("Weapon ID: " + weaponId);
            states.inventory.weaponID = weaponId;

            if (photonView.IsMine)
            {
                states.isLocal = true;
                states.SetCurrentState(local);
                initLocalPlayer.Execute(states);
            }
            else
            {
                states.isLocal = false;
                states.SetCurrentState(client);
                initClientPlayer.Execute(states);
                states.multiplayerListener = this;
            }
        }