Example #1
0
        private void OnPhotonInstantiate(PhotonMessageInfo messageInfo)
        {
            states            = GetComponent <StateAction.StateManager> ();
            transformInstance = this.transform;
            object[] data = photonView.instantiationData;
            states.photonID = (int)data[0];

            MultiplayerManager multiplayerManager = MultiplayerManager.Singleton;

            this.gameObject.transform.parent = multiplayerManager.MultiplayerReferences.referencesTransform;

            PlayerHolder playerHolder = multiplayerManager.MultiplayerReferences.GetPlayer(states.photonID);

            playerHolder.states = states;

            if (photonView.isMine)
            {
                states.currentState.isLocal = true;
                states.SetCurrentState(localState);
                initLocalPlayer.Execute(states);
            }
            else
            {
                string weaponID = (string)data[1];
                states.inventory.weaponID = weaponID;

                states.currentState.isLocal = false;
                states.SetCurrentState(clientState);
                initClientPlayer.Execute(states);
                states.multiplayerListener = this;
            }
        }
Example #2
0
        private void OnPhotonInstantiate(PhotonMessageInfo info)
        {
            MultiplayerManager multiplayerManager = MultiplayerManager.Singleton;

            photonId = photonView.ownerId;
            isLocal  = photonView.isMine;
            multiplayerManager.AddNewPlayer(this);
        }
Example #3
0
        private void OnPhotonInstantiate(PhotonMessageInfo info)
        {
            Singleton = this;
            DontDestroyOnLoad(this.gameObject);
            MultiplayerReferences = new MultiplayerReferences();
            DontDestroyOnLoad(MultiplayerReferences.referencesTransform.gameObject);

            InstantiateNetworkPrint();
        }
 private void Awake()
 {
     name = "MultiplayerManager";
     if (Singleton == null)
     {
         Singleton = this;
     }
     else
     {
         Destroy(Singleton.gameObject);
         Singleton = this;
     }
     DontDestroyOnLoad(gameObject);
 }