예제 #1
0
        /** Updates the Player's presence in the scene. According to the data set in this class, they will be added to or removed from the scene. */
        public void UpdatePresenceInScene()
        {
            PlayerPrefab playerPrefab = KickStarter.settingsManager.GetPlayerPrefab(playerID);

            if (playerPrefab != null)
            {
                if (KickStarter.saveSystem.CurrentPlayerID == playerID)
                {
                    playerPrefab.SpawnInScene(false);
                }
                else if (SceneChanger.CurrentSceneIndex == currentScene)
                {
                    playerPrefab.SpawnInScene(false);
                }
                else
                {
                    SubScene subScene = KickStarter.sceneChanger.GetSubScene(currentScene);
                    if (subScene != null)
                    {
                        playerPrefab.SpawnInScene(subScene.gameObject.scene);
                    }
                    else
                    {
                        playerPrefab.RemoveFromScene();
                    }
                }
            }
        }