Exemplo n.º 1
0
        // The 'constructor' of the player
        // Call 'constructors' in other components
        void Start()
        {
            view = PhotonView.Get(this);

            playerState = GetComponent <PlayerState>();
            playerState.StartAfterPlayerNetwork();

            // The player is not controlled by the client
            if (!isLocal)
            {
                // Remove camera and behaviour
                Destroy(GetComponentInChildren <Camera>().gameObject);
                Destroy(GetComponent <Player>());
                Destroy(GetComponent <PlayerMaster>());
                Destroy(GetComponent <PlayerSlave>());
            }
            else
            {
                Destroy(GameObject.Find("Camera a detruire"));
                local = this;

                // Remove labels
                Destroy(GetComponentInChildren <LookToCam>().gameObject);

                // Remove the master / slave if necessary
                if (PhotonNetwork.IsMasterClient)
                {
                    PlayerMaster.instance = GetComponent <PlayerMaster>();
                    Destroy(GetComponent <PlayerSlave>());
                }
                else
                {
                    Destroy(GetComponent <PlayerMaster>());
                }

                // Start player component
                var p = GetComponent <Player>();
                p.net = this;
                GetComponent <Player>().StartAfterPlayerNetwork();
            }

            // Append this player to the players in game list
            RegisterPlayer(gameObject);
        }
Exemplo n.º 2
0
 // Whether the priority is higher for this player
 public bool HasPriority(PlayerNetwork player)
 {
     // < because we want that the master has always the priority
     return(id < player.id);
 }