Exemple #1
0
        void Start()
        {
            GameObject searchPlayerList = GameObject.FindGameObjectWithTag("PlayerList");

            if (searchPlayerList != null)
            {
                transform.parent = searchPlayerList.transform;
            }
            else
            {
                Debug.LogError("Scene is missing PlayerList GameObject!!");
            }
            //add physics move component and set default movespeed
            physicsMove = gameObject.GetComponent <PhysicsMove>();

            //Add player sprite controller component

            if (photonView.isMine)  //This prefab is yours, take control of it
            {
                StartCoroutine("WaitForMapLoad");
            }
            else
            {
                BoxCollider2D boxColl = gameObject.GetComponent <BoxCollider2D>();
                boxColl.isTrigger = true;
            }
            if (PhotonNetwork.connectedAndReady)
            {
                gameObject.name = photonView.owner.NickName;
            }
        }
Exemple #2
0
        void Start()
        {
            GameObject searchPlayerList = GameObject.FindGameObjectWithTag("PlayerList");

            if (searchPlayerList != null)
            {
                transform.parent = searchPlayerList.transform;
            }
            else
            {
                Debug.LogError("Scene is missing PlayerList GameObject!!");
            }
            //add physics move component and set default movespeed
            physicsMove = gameObject.GetComponent <PhysicsMove>();

            //Add player sprite controller component

            SetPlayerPrefs();

            if (photonView.isMine)
            { //This prefab is yours, take control of it
                PlayerManager.control.SetPlayerForControl(this.gameObject);
            }
        }