Beispiel #1
0
 void Awake()
 {
     if (null == singleton)
     {
         singleton = this;
     }
 }
 private void OnSceneChanged(SceneChangedInfo info)
 {
     if (TeamManager.FFA)
     {
         if (this.spawnPlayerWhenSceneChanges)
         {
             PlayingObjectSpawner.MarkPlayerForSpawning(this.GetComponent <Player> ());
         }
     }
 }
 private void OnLoggedIn()
 {
     if (TeamManager.FFA)
     {
         if (this.spawnPlayerWhenHeLogsIn)
         {
             PlayingObjectSpawner.MarkPlayerForSpawning(this.GetComponent <Player> ());
         }
     }
 }
Beispiel #4
0
        public GameObject      CreateGameObjectForPlayer(Vector3 pos, Quaternion q)
        {
            Player player = this;


            var go = PlayingObjectSpawner.CreateGameObjectForPlayer(player, pos, q);

            if (null == go)
            {
                return(null);
            }

            NetworkServer.Spawn(go);

            // this must be set AFTER the object is spawned, because 'playerGameObject' is a syncvar
            player.PlayerGameObject = go;

            this.PreparePlayerObject();

            // do specific stuff for bots
            if (this.IsBot())
            {
                // Bot's object needs to be spawned explicitly, because he has no connection to
                // add player to.
                NetworkServer.Spawn(go);
            }

            if (player.conn != null)
            {
                // check if object already exists for this connection...

                NetworkServer.ReplacePlayerForConnection(player.conn, player.controllingObject, 1);
            }


            return(player.controllingObject);
        }
 void OnLoggedIn()
 {
     PlayingObjectSpawner.MarkPlayerForSpawning(this.GetComponent <Player> ());
 }
 void OnSceneChanged(SceneChangedInfo info)
 {
     PlayingObjectSpawner.MarkPlayerForSpawning(this.GetComponent <Player> ());
 }