Beispiel #1
0
        /**
         * <summary>Spawns a new instance of the Player if one is not currently present, and places them in a specific scene.  This will not be the active Player.</summary>
         * <param name = "scene">The scene to place the instance in.</param>
         */
        public void SpawnInScene(Scene scene)
        {
            if (playerOb)
            {
                Player sceneInstance = GetSceneInstance(true);

                UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene(sceneInstance.gameObject, scene);

                PlayerData playerData = KickStarter.saveSystem.GetPlayerData(ID);
                if (playerData != null)
                {
                    sceneInstance.LoadData(playerData);
                }
            }
        }
Beispiel #2
0
        /**
         * <summary>Spawns a new instance of the Player if one is not currently present.</summary>
         * <param name = "makeActivePlayer">If True, the Player will be made the active Player afterwards</param>
         */
        public void SpawnInScene(bool makeActivePlayer)
        {
            if (playerOb)
            {
                Player sceneInstance = GetSceneInstance(true);

                if (makeActivePlayer)
                {
                    KickStarter.player = sceneInstance;
                }

                PlayerData playerData = KickStarter.saveSystem.GetPlayerData(ID);
                if (playerData != null)
                {
                    sceneInstance.LoadData(playerData);
                }
            }
        }