Example #1
0
        private PlayerData SavePlayerData(Player player)
        {
            PlayerData playerData = new PlayerData ();

            playerData.currentScene = Application.loadedLevel;
            playerData.currentSceneName = Application.loadedLevelName;

            playerData.previousScene = KickStarter.sceneChanger.previousScene;
            playerData.previousSceneName = KickStarter.sceneChanger.previousSceneName;

            playerData.playerUpLock = KickStarter.playerInput.isUpLocked;
            playerData.playerDownLock = KickStarter.playerInput.isDownLocked;
            playerData.playerLeftlock = KickStarter.playerInput.isLeftLocked;
            playerData.playerRightLock = KickStarter.playerInput.isRightLocked;
            playerData.playerRunLock = (int) KickStarter.playerInput.runLock;
            playerData.playerFreeAimLock = KickStarter.playerInput.freeAimLock;

            KickStarter.runtimeInventory.RemoveRecipes ();
            playerData.inventoryData = CreateInventoryData (KickStarter.runtimeInventory.localItems);

            if (player == null)
            {
                playerData.playerPortraitGraphic = "";
                playerData.playerID = KickStarter.settingsManager.GetEmptyPlayerID ();
                return playerData;
            }

            playerData.playerID = player.ID;

            playerData.playerLocX = player.transform.position.x;
            playerData.playerLocY = player.transform.position.y;
            playerData.playerLocZ = player.transform.position.z;
            playerData.playerRotY = player.transform.eulerAngles.y;

            playerData.playerWalkSpeed = player.walkSpeedScale;
            playerData.playerRunSpeed = player.runSpeedScale;

            // Animation clips
            if (player.animationEngine == AnimationEngine.Sprites2DToolkit || player.animationEngine == AnimationEngine.SpritesUnity)
            {
                playerData.playerIdleAnim = player.idleAnimSprite;
                playerData.playerWalkAnim = player.walkAnimSprite;
                playerData.playerRunAnim = player.runAnimSprite;
                playerData.playerTalkAnim = player.talkAnimSprite;
            }
            else if (player.animationEngine == AnimationEngine.Legacy)
            {
                playerData.playerIdleAnim = AssetLoader. GetAssetInstanceID (player.idleAnim);
                playerData.playerWalkAnim = AssetLoader. GetAssetInstanceID (player.walkAnim);
                playerData.playerRunAnim = AssetLoader. GetAssetInstanceID (player.runAnim);
                playerData.playerTalkAnim = AssetLoader. GetAssetInstanceID (player.talkAnim);
            }
            else if (player.animationEngine == AnimationEngine.Mecanim)
            {
                playerData.playerWalkAnim = player.moveSpeedParameter;
                playerData.playerTalkAnim = player.talkParameter;
                playerData.playerRunAnim = player.turnParameter;
            }

            // Sound
            playerData.playerWalkSound = AssetLoader. GetAssetInstanceID (player.walkSound);
            playerData.playerRunSound = AssetLoader. GetAssetInstanceID (player.runSound);

            // Portrait graphic
            playerData.playerPortraitGraphic = AssetLoader. GetAssetInstanceID (player.portraitIcon.texture);
            playerData.playerSpeechLabel = player.speechLabel;

            // Rendering
            playerData.playerLockDirection = player.lockDirection;
            playerData.playerLockScale = player.lockScale;
            if (player.spriteChild && player.spriteChild.GetComponent <FollowSortingMap>())
            {
                playerData.playerLockSorting = player.spriteChild.GetComponent <FollowSortingMap>().lockSorting;
            }
            else if (player.GetComponent <FollowSortingMap>())
            {
                playerData.playerLockSorting = player.GetComponent <FollowSortingMap>().lockSorting;
            }
            else
            {
                playerData.playerLockSorting = false;
            }
            playerData.playerSpriteDirection = player.spriteDirection;
            playerData.playerSpriteScale = player.spriteScale;
            if (player.spriteChild && player.spriteChild.GetComponent <Renderer>())
            {
                playerData.playerSortingOrder = player.spriteChild.GetComponent <Renderer>().sortingOrder;
                playerData.playerSortingLayer = player.spriteChild.GetComponent <Renderer>().sortingLayerName;
            }
            else if (player.GetComponent <Renderer>())
            {
                playerData.playerSortingOrder = player.GetComponent <Renderer>().sortingOrder;
                playerData.playerSortingLayer = player.GetComponent <Renderer>().sortingLayerName;
            }

            playerData.playerActivePath = 0;
            playerData.lastPlayerActivePath = 0;
            if (player.GetPath (true))
            {
                playerData.playerTargetNode = player.GetTargetNode (true);
                playerData.playerPrevNode = player.GetPrevNode (true);
                playerData.playerIsRunning = player.isRunning;
                playerData.playerPathAffectY = player.activePath.affectY;

                if (player.GetComponent <Paths>() && player.GetPath (true) == player.GetComponent <Paths>())
                {
                    playerData.playerPathData = Serializer.CreatePathData (player.GetComponent <Paths>());
                    playerData.playerLockedPath = false;
                }
                else
                {
                    playerData.playerPathData = "";
                    playerData.playerActivePath = Serializer.GetConstantID (player.GetPath (true).gameObject);
                    playerData.playerLockedPath = player.lockedPath;
                }
            }

            if (player.GetPath (false))
            {
                playerData.lastPlayerTargetNode = player.GetTargetNode (false);
                playerData.lastPlayerPrevNode = player.GetPrevNode (false);
                playerData.lastPlayerActivePath = Serializer.GetConstantID (player.GetPath (false).gameObject);
            }

            playerData.playerIgnoreGravity = player.ignoreGravity;

            // Head target
            playerData.playerLockHotspotHeadTurning = player.lockHotspotHeadTurning;
            if (player.headFacing == HeadFacing.Manual)
            {
                playerData.isHeadTurning = true;
                playerData.headTargetX = player.headTurnTarget.x;
                playerData.headTargetY = player.headTurnTarget.y;
                playerData.headTargetZ = player.headTurnTarget.z;
            }
            else
            {
                playerData.isHeadTurning = false;
                playerData.headTargetX = 0f;
                playerData.headTargetY = 0f;
                playerData.headTargetZ = 0f;
            }

            // Camera
            MainCamera mainCamera = KickStarter.mainCamera;
            if (mainCamera.attachedCamera)
            {
                playerData.gameCamera = Serializer.GetConstantID (mainCamera.attachedCamera.gameObject);
            }
            if (mainCamera.lastNavCamera)
            {
                playerData.lastNavCamera = Serializer.GetConstantID (mainCamera.lastNavCamera.gameObject);
            }
            if (mainCamera.lastNavCamera2)
            {
                playerData.lastNavCamera2 = Serializer.GetConstantID (mainCamera.lastNavCamera2.gameObject);
            }

            mainCamera.StopShaking ();
            playerData.mainCameraLocX = mainCamera.transform.position.x;
            playerData.mainCameraLocY = mainCamera.transform.position.y;
            playerData.mainCameraLocZ = mainCamera.transform.position.z;

            playerData.mainCameraRotX = mainCamera.transform.eulerAngles.x;
            playerData.mainCameraRotY = mainCamera.transform.eulerAngles.y;
            playerData.mainCameraRotZ = mainCamera.transform.eulerAngles.z;

            playerData.isSplitScreen = mainCamera.isSplitScreen;
            if (mainCamera.isSplitScreen)
            {
                playerData.isTopLeftSplit = mainCamera.isTopLeftSplit;
                playerData.splitAmountMain = mainCamera.splitAmountMain;
                playerData.splitAmountOther = mainCamera.splitAmountOther;

                if (mainCamera.splitOrientation == MenuOrientation.Vertical)
                {
                    playerData.splitIsVertical = true;
                }
                else
                {
                    playerData.splitIsVertical = false;
                }
                if (mainCamera.splitCamera && mainCamera.splitCamera.GetComponent <ConstantID>())
                {
                    playerData.splitCameraID = mainCamera.splitCamera.GetComponent <ConstantID>().constantID;
                }
                else
                {
                    playerData.splitCameraID = 0;
                }
            }

            return playerData;
        }
Example #2
0
        public void AssignItemsToPlayer(List<InvItem> invItems, int _playerID)
        {
            string invData = CreateInventoryData (invItems);

            if (saveData != null && saveData.playerData != null)
            {
                foreach (PlayerData data in saveData.playerData)
                {
                    if (data.playerID == _playerID)
                    {
                        PlayerData newPlayerData = new PlayerData ();
                        newPlayerData.CopyData (data);
                        newPlayerData.inventoryData = invData;

                        saveData.playerData.Remove (data);
                        saveData.playerData.Add (newPlayerData);

                        return;
                    }
                }
            }

            PlayerData playerData = new PlayerData ();
            playerData.playerID = _playerID;
            playerData.inventoryData = invData;
            playerData.currentScene = -1;

            if (saveData == null)
            {
                ClearAllData ();
            }

            saveData.playerData.Add (playerData);
        }
Example #3
0
        private void ReturnMainData()
        {
            if (KickStarter.playerInput && KickStarter.runtimeInventory && KickStarter.settingsManager && KickStarter.stateHandler)
            {
                PlayerData playerData = new PlayerData ();

                if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
                {
                    if (saveData.playerData.Count > 0)
                    {
                        playerData = saveData.playerData[0];
                    }
                }
                else
                {
                    foreach (PlayerData _data in saveData.playerData)
                    {
                        if (_data.playerID == saveData.mainData.currentPlayerID)
                        {
                            playerData = _data;
                        }
                    }
                }

                ReturnPlayerData (playerData, KickStarter.player);
                ReturnCameraData (playerData);

                KickStarter.stateHandler.cursorIsOff = saveData.mainData.cursorIsOff;
                KickStarter.stateHandler.inputIsOff = saveData.mainData.inputIsOff;
                KickStarter.stateHandler.interactionIsOff = saveData.mainData.interactionIsOff;
                KickStarter.stateHandler.menuIsOff = saveData.mainData.menuIsOff;
                KickStarter.stateHandler.movementIsOff = saveData.mainData.movementIsOff;
                KickStarter.stateHandler.cameraIsOff = saveData.mainData.cameraIsOff;
                KickStarter.stateHandler.triggerIsOff = saveData.mainData.triggerIsOff;
                KickStarter.stateHandler.playerIsOff = saveData.mainData.playerIsOff;

                KickStarter.settingsManager.movementMethod = (MovementMethod) saveData.mainData.movementMethod;

                KickStarter.sceneChanger.previousScene = playerData.previousScene;

                KickStarter.playerInput.SetUpLock (playerData.playerUpLock);
                KickStarter.playerInput.isDownLocked = playerData.playerDownLock;
                KickStarter.playerInput.isLeftLocked = playerData.playerLeftlock;
                KickStarter.playerInput.isRightLocked = playerData.playerRightLock;
                KickStarter.playerInput.runLock = (PlayerMoveLock) playerData.playerRunLock;
                KickStarter.playerInput.freeAimLock = playerData.playerFreeAimLock;

                // Inventory
                KickStarter.runtimeInventory.RemoveRecipes ();
                KickStarter.runtimeInventory.localItems = AssignInventory (KickStarter.runtimeInventory, playerData.inventoryData);
                if (saveData.mainData.selectedInventoryID > -1)
                {
                    if (saveData.mainData.isGivingItem)
                    {
                        KickStarter.runtimeInventory.SelectItemByID (saveData.mainData.selectedInventoryID, SelectItemMode.Give);
                    }
                    else
                    {
                        KickStarter.runtimeInventory.SelectItemByID (saveData.mainData.selectedInventoryID, SelectItemMode.Use);
                    }
                }
                else
                {
                    KickStarter.runtimeInventory.SetNull ();
                }
                KickStarter.runtimeInventory.RemoveRecipes ();

                // Active screen arrows
                KickStarter.playerInput.RemoveActiveArrows ();
                ArrowPrompt loadedArrows = Serializer.returnComponent <ArrowPrompt> (saveData.mainData.activeArrows);
                if (loadedArrows)
                {
                    loadedArrows.TurnOn ();
                }

                // Active conversation
                KickStarter.playerInput.activeConversation = Serializer.returnComponent <Conversation> (saveData.mainData.activeConversation);
                KickStarter.playerInput.timeScale = saveData.mainData.timeScale;

                // Variables
                SaveSystem.AssignVariables (saveData.mainData.runtimeVariablesData);

                // Menus
                foreach (AC.Menu menu in PlayerMenus.GetMenus ())
                {
                    foreach (MenuElement element in menu.elements)
                    {
                        if (element is MenuInventoryBox)
                        {
                            MenuInventoryBox invBox = (MenuInventoryBox) element;
                            invBox.ResetOffset ();
                        }
                    }
                }

                AssignMenuLocks (PlayerMenus.GetMenus (), saveData.mainData.menuLockData);
                AssignMenuVisibility (PlayerMenus.GetMenus (), saveData.mainData.menuVisibilityData);
                AssignMenuElementVisibility (PlayerMenus.GetMenus (), saveData.mainData.menuElementVisibilityData);
                AssignMenuJournals (PlayerMenus.GetMenus (), saveData.mainData.menuJournalData);

                KickStarter.mainCamera.HideScene ();
                KickStarter.playerMenus.HideSaveMenus ();
                KickStarter.stateHandler.gameState = GameState.Cutscene;
                KickStarter.mainCamera.FadeIn (0.5f);

                Invoke ("ReturnToGameplay", 0.01f);
            }
            else
            {
                if (KickStarter.playerInput == null)
                {
                    Debug.LogWarning ("Load failed - no PlayerInput found.");
                }
                if (KickStarter.runtimeInventory == null)
                {
                    Debug.LogWarning ("Load failed - no RuntimeInventory found.");
                }
                if (KickStarter.sceneChanger == null)
                {
                    Debug.LogWarning ("Load failed - no SceneChanger found.");
                }
                if (KickStarter.settingsManager == null)
                {
                    Debug.LogWarning ("Load failed - no Settings Manager found.");
                }
            }
        }
Example #4
0
        private void ReturnPlayerData(PlayerData playerData, Player player)
        {
            if (player == null)
            {
                return;
            }

            player.Teleport (new Vector3 (playerData.playerLocX, playerData.playerLocY, playerData.playerLocZ));
            player.SetRotation (playerData.playerRotY);
            //player.SetLookDirection (Vector3.zero, true);

            player.walkSpeedScale = playerData.playerWalkSpeed;
            player.runSpeedScale = playerData.playerRunSpeed;

            // Animation clips
            if (player.animationEngine == AnimationEngine.Sprites2DToolkit || player.animationEngine == AnimationEngine.SpritesUnity)
            {
                player.idleAnimSprite = playerData.playerIdleAnim;
                player.walkAnimSprite = playerData.playerWalkAnim;
                player.talkAnimSprite = playerData.playerTalkAnim;
                player.runAnimSprite = playerData.playerRunAnim;
            }
            else if (player.animationEngine == AnimationEngine.Legacy)
            {
                player.idleAnim = AssetLoader.RetrieveAsset <AnimationClip> (player.idleAnim, playerData.playerIdleAnim);
                player.walkAnim = AssetLoader.RetrieveAsset <AnimationClip> (player.walkAnim, playerData.playerWalkAnim);
                player.talkAnim = AssetLoader.RetrieveAsset <AnimationClip> (player.talkAnim, playerData.playerTalkAnim);
                player.runAnim = AssetLoader.RetrieveAsset <AnimationClip> (player.runAnim, playerData.playerRunAnim);
            }
            else if (player.animationEngine == AnimationEngine.Mecanim)
            {
                player.moveSpeedParameter = playerData.playerWalkAnim;
                player.talkParameter = playerData.playerTalkAnim;
                player.turnParameter = playerData.playerRunAnim;
            }

            // Sound
            player.walkSound = AssetLoader.RetrieveAsset (player.walkSound, playerData.playerWalkSound);
            player.runSound = AssetLoader.RetrieveAsset (player.runSound, playerData.playerRunSound);

            // Portrait graphic
            player.portraitIcon.texture = AssetLoader.RetrieveAsset (player.portraitIcon.texture, playerData.playerPortraitGraphic);
            player.speechLabel = playerData.playerSpeechLabel;

            // Rendering
            player.lockDirection = playerData.playerLockDirection;
            player.lockScale = playerData.playerLockScale;
            if (player.spriteChild && player.spriteChild.GetComponent <FollowSortingMap>())
            {
                player.spriteChild.GetComponent <FollowSortingMap>().lockSorting = playerData.playerLockSorting;
            }
            else if (player.GetComponent <FollowSortingMap>())
            {
                player.GetComponent <FollowSortingMap>().lockSorting = playerData.playerLockSorting;
            }
            else
            {
                player.ReleaseSorting ();
            }

            if (playerData.playerLockDirection)
            {
                player.spriteDirection = playerData.playerSpriteDirection;
            }
            if (playerData.playerLockScale)
            {
                player.spriteScale = playerData.playerSpriteScale;
            }
            if (playerData.playerLockSorting)
            {
                if (player.spriteChild && player.spriteChild.GetComponent <Renderer>())
                {
                    player.spriteChild.GetComponent <Renderer>().sortingOrder = playerData.playerSortingOrder;
                    player.spriteChild.GetComponent <Renderer>().sortingLayerName = playerData.playerSortingLayer;
                }
                else if (player.GetComponent <Renderer>())
                {
                    player.GetComponent <Renderer>().sortingOrder = playerData.playerSortingOrder;
                    player.GetComponent <Renderer>().sortingLayerName = playerData.playerSortingLayer;
                }
            }

            // Active path
            player.Halt ();
            player.ForceIdle ();

            if (playerData.playerPathData != null && playerData.playerPathData != "" && player.GetComponent <Paths>())
            {
                Paths savedPath = player.GetComponent <Paths>();
                savedPath = Serializer.RestorePathData (savedPath, playerData.playerPathData);
                player.SetPath (savedPath, playerData.playerTargetNode, playerData.playerPrevNode, playerData.playerPathAffectY);
                player.isRunning = playerData.playerIsRunning;
                player.lockedPath = false;
            }
            else if (playerData.playerActivePath != 0)
            {
                Paths savedPath = Serializer.returnComponent <Paths> (playerData.playerActivePath);
                if (savedPath)
                {
                    player.lockedPath = playerData.playerLockedPath;

                    if (player.lockedPath)
                    {
                        player.SetLockedPath (savedPath);
                    }
                    else
                    {
                        player.SetPath (savedPath, playerData.playerTargetNode, playerData.playerPrevNode);
                    }
                }
            }

            // Previous path
            if (playerData.lastPlayerActivePath != 0)
            {
                Paths savedPath = Serializer.returnComponent <Paths> (playerData.lastPlayerActivePath);
                if (savedPath)
                {
                    player.SetLastPath (savedPath, playerData.lastPlayerTargetNode, playerData.lastPlayerPrevNode);
                }
            }

            // Head target
            player.lockHotspotHeadTurning = playerData.playerLockHotspotHeadTurning;
            if (playerData.isHeadTurning)
            {
                player.SetHeadTurnTarget (new Vector3 (playerData.headTargetX, playerData.headTargetY, playerData.headTargetZ), true);
            }
            else
            {
                player.ClearHeadTurnTarget (true);
            }

            player.ignoreGravity = playerData.playerIgnoreGravity;
        }
Example #5
0
        /**
         * <summary>Updates a PlayerData class with it's own variables that need saving.</summary>
         * <param name = "playerData">The original PlayerData class</param>
         * <returns>The updated PlayerData class</returns>
         */
        public PlayerData SavePlayerData(PlayerData playerData)
        {
            playerData.playerID = ID;

            playerData.playerLocX = transform.position.x;
            playerData.playerLocY = transform.position.y;
            playerData.playerLocZ = transform.position.z;
            playerData.playerRotY = transform.eulerAngles.y;

            playerData.playerWalkSpeed = walkSpeedScale;
            playerData.playerRunSpeed = runSpeedScale;

            // Animation clips
            if (animationEngine == AnimationEngine.Sprites2DToolkit || animationEngine == AnimationEngine.SpritesUnity)
            {
                playerData.playerIdleAnim = idleAnimSprite;
                playerData.playerWalkAnim = walkAnimSprite;
                playerData.playerRunAnim = runAnimSprite;
                playerData.playerTalkAnim = talkAnimSprite;
            }
            else if (animationEngine == AnimationEngine.Legacy)
            {
                playerData.playerIdleAnim = AssetLoader.GetAssetInstanceID (idleAnim);
                playerData.playerWalkAnim = AssetLoader.GetAssetInstanceID (walkAnim);
                playerData.playerRunAnim = AssetLoader.GetAssetInstanceID (runAnim);
                playerData.playerTalkAnim = AssetLoader.GetAssetInstanceID (talkAnim);
            }
            else if (animationEngine == AnimationEngine.Mecanim)
            {
                playerData.playerWalkAnim = moveSpeedParameter;
                playerData.playerTalkAnim = talkParameter;
                playerData.playerRunAnim = turnParameter;
            }

            // Sound
            playerData.playerWalkSound = AssetLoader.GetAssetInstanceID (walkSound);
            playerData.playerRunSound = AssetLoader.GetAssetInstanceID (runSound);

            // Portrait graphic
            playerData.playerPortraitGraphic = AssetLoader.GetAssetInstanceID (portraitIcon.texture);
            playerData.playerSpeechLabel = speechLabel;

            // Rendering
            playerData.playerLockDirection = lockDirection;
            playerData.playerLockScale = lockScale;
            if (spriteChild && spriteChild.GetComponent <FollowSortingMap>())
            {
                playerData.playerLockSorting = spriteChild.GetComponent <FollowSortingMap>().lockSorting;
            }
            else if (GetComponent <FollowSortingMap>())
            {
                playerData.playerLockSorting = GetComponent <FollowSortingMap>().lockSorting;
            }
            else
            {
                playerData.playerLockSorting = false;
            }
            playerData.playerSpriteDirection = spriteDirection;
            playerData.playerSpriteScale = spriteScale;
            if (spriteChild && spriteChild.GetComponent <Renderer>())
            {
                playerData.playerSortingOrder = spriteChild.GetComponent <Renderer>().sortingOrder;
                playerData.playerSortingLayer = spriteChild.GetComponent <Renderer>().sortingLayerName;
            }
            else if (GetComponent <Renderer>())
            {
                playerData.playerSortingOrder = GetComponent <Renderer>().sortingOrder;
                playerData.playerSortingLayer = GetComponent <Renderer>().sortingLayerName;
            }

            playerData.playerActivePath = 0;
            playerData.lastPlayerActivePath = 0;
            if (GetPath ())
            {
                playerData.playerTargetNode = GetTargetNode ();
                playerData.playerPrevNode = GetPrevNode ();
                playerData.playerIsRunning = isRunning;
                playerData.playerPathAffectY = activePath.affectY;

                if (GetComponent <Paths>() && GetPath () == GetComponent <Paths>())
                {
                    playerData.playerPathData = Serializer.CreatePathData (GetComponent <Paths>());
                    playerData.playerLockedPath = false;
                }
                else
                {
                    playerData.playerPathData = "";
                    playerData.playerActivePath = Serializer.GetConstantID (GetPath ().gameObject);
                    playerData.playerLockedPath = lockedPath;
                }
            }

            if (GetLastPath ())
            {
                playerData.lastPlayerTargetNode = GetLastTargetNode ();
                playerData.lastPlayerPrevNode = GetLastPrevNode ();
                playerData.lastPlayerActivePath = Serializer.GetConstantID (GetLastPath ().gameObject);
            }

            playerData.playerIgnoreGravity = ignoreGravity;

            // Head target
            playerData.playerLockHotspotHeadTurning = lockHotspotHeadTurning;
            if (headFacing == HeadFacing.Manual)
            {
                playerData.isHeadTurning = true;
                playerData.headTargetX = headTurnTarget.x;
                playerData.headTargetY = headTurnTarget.y;
                playerData.headTargetZ = headTurnTarget.z;
            }
            else
            {
                playerData.isHeadTurning = false;
                playerData.headTargetX = 0f;
                playerData.headTargetY = 0f;
                playerData.headTargetZ = 0f;
            }

            return playerData;
        }
Example #6
0
        private void ReturnCameraData(PlayerData playerData)
        {
            // Camera
            MainCamera mainCamera = KickStarter.mainCamera;

            if (mainCamera.isSplitScreen)
            {
                mainCamera.RemoveSplitScreen ();
            }
            mainCamera.StopShaking ();
            mainCamera.SetGameCamera (Serializer.returnComponent <_Camera> (playerData.gameCamera));
            mainCamera.lastNavCamera = Serializer.returnComponent <_Camera> (playerData.lastNavCamera);
            mainCamera.lastNavCamera2 = Serializer.returnComponent <_Camera> (playerData.lastNavCamera2);
            mainCamera.ResetMoving ();

            mainCamera.transform.position = new Vector3 (playerData.mainCameraLocX, playerData.mainCameraLocY, playerData.mainCameraLocZ);
            mainCamera.transform.eulerAngles = new Vector3 (playerData.mainCameraRotX, playerData.mainCameraRotY, playerData.mainCameraRotZ);
            mainCamera.ResetProjection ();

            if (mainCamera.attachedCamera)
            {
                mainCamera.attachedCamera.MoveCameraInstant ();
            }
            mainCamera.SnapToAttached ();

            mainCamera.isSplitScreen = playerData.isSplitScreen;
            if (mainCamera.isSplitScreen)
            {
                mainCamera.isTopLeftSplit = playerData.isTopLeftSplit;
                if (playerData.splitIsVertical)
                {
                    mainCamera.splitOrientation = MenuOrientation.Vertical;
                }
                else
                {
                    mainCamera.splitOrientation = MenuOrientation.Horizontal;
                }
                if (playerData.splitCameraID != 0)
                {
                    _Camera splitCamera = Serializer.returnComponent <_Camera> (playerData.splitCameraID);
                    if (splitCamera)
                    {
                        mainCamera.splitCamera = splitCamera;
                    }
                }
                mainCamera.StartSplitScreen (playerData.splitAmountMain, playerData.splitAmountOther);
            }
        }
Example #7
0
        /**
         * <summary>Copies values from another PlayerData instance onto itself.</summary>
         * <param name = "originalData">The PlayerData to copy</param>
         */
        public void CopyData(PlayerData originalData)
        {
            playerID = originalData.playerID;
            currentScene = originalData.currentScene;
            previousScene = originalData.previousScene;
            currentSceneName = originalData.currentSceneName;
            previousSceneName = originalData.previousSceneName;

            playerLocX = originalData.playerLocX;
            playerLocY = originalData.playerLocY;
            playerLocZ = originalData.playerLocZ;
            playerRotY = originalData.playerRotY;

            playerWalkSpeed = originalData.playerWalkSpeed;
            playerRunSpeed = originalData.playerRunSpeed;

            playerIdleAnim = originalData.playerIdleAnim;
            playerWalkAnim = originalData.playerWalkAnim;
            playerTalkAnim = originalData.playerTalkAnim;
            playerRunAnim = originalData.playerRunAnim;

            playerWalkSound = originalData.playerWalkSound;
            playerRunSound = originalData.playerRunSound;
            playerPortraitGraphic = originalData.playerPortraitGraphic;
            playerSpeechLabel = originalData.playerSpeechLabel;

            playerTargetNode = originalData.playerTargetNode;
            playerPrevNode = originalData.playerPrevNode;
            playerPathData = originalData.playerPathData;
            playerIsRunning = originalData.playerIsRunning;
            playerLockedPath = originalData.playerLockedPath;
            playerActivePath = originalData.playerActivePath;
            playerPathAffectY = originalData.playerPathAffectY;

            lastPlayerTargetNode = originalData.lastPlayerTargetNode;
            lastPlayerPrevNode = originalData.playerPrevNode;
            lastPlayerActivePath = originalData.playerActivePath;

            playerUpLock = originalData.playerUpLock;
            playerDownLock = originalData.playerDownLock;
            playerLeftlock = originalData.playerLeftlock;
            playerRightLock = originalData.playerRightLock;
            playerRunLock = originalData.playerRunLock;
            playerFreeAimLock = originalData.playerFreeAimLock;
            playerIgnoreGravity = originalData.playerIgnoreGravity;

            playerLockDirection = originalData.playerLockDirection;
            playerSpriteDirection = originalData.playerSpriteDirection;
            playerLockScale = originalData.playerLockScale;
            playerSpriteScale = originalData.playerSpriteScale;
            playerLockSorting = originalData.playerLockSorting;
            playerSortingOrder = originalData.playerSortingOrder;
            playerSortingLayer = originalData.playerSortingLayer;

            inventoryData = originalData.inventoryData;

            isHeadTurning = originalData.isHeadTurning;
            headTargetX = originalData.headTargetX;
            headTargetY = originalData.headTargetY;
            headTargetZ = originalData.headTargetZ;

            gameCamera = originalData.gameCamera;
            lastNavCamera = originalData.lastNavCamera;
            lastNavCamera2 = originalData.lastNavCamera2;
            mainCameraLocX = originalData.mainCameraLocX;
            mainCameraLocY = originalData.mainCameraLocY;
            mainCameraLocZ = originalData.mainCameraLocZ;

            mainCameraRotX = originalData.mainCameraRotX;
            mainCameraRotY = originalData.mainCameraRotY;
            mainCameraRotZ = originalData.mainCameraRotZ;

            isSplitScreen = originalData.isSplitScreen;
            isTopLeftSplit = originalData.isTopLeftSplit;
            splitIsVertical = originalData.splitIsVertical;
            splitCameraID = originalData.splitCameraID;
            splitAmountMain = originalData.splitAmountMain;
            splitAmountOther = originalData.splitAmountOther;
        }
Example #8
0
        /**
         * <summary>Updates it's own variables from a PlayerData class.</summary>
         * <param name = "playerData">The PlayerData class to load from</param>
         */
        public void LoadPlayerData(PlayerData playerData)
        {
            Teleport (new Vector3 (playerData.playerLocX, playerData.playerLocY, playerData.playerLocZ));
            SetRotation (playerData.playerRotY);
            SetMoveDirectionAsForward ();

            walkSpeedScale = playerData.playerWalkSpeed;
            runSpeedScale = playerData.playerRunSpeed;

            // Animation clips
            if (animationEngine == AnimationEngine.Sprites2DToolkit || animationEngine == AnimationEngine.SpritesUnity)
            {
                idleAnimSprite = playerData.playerIdleAnim;
                walkAnimSprite = playerData.playerWalkAnim;
                talkAnimSprite = playerData.playerTalkAnim;
                runAnimSprite = playerData.playerRunAnim;
            }
            else if (animationEngine == AnimationEngine.Legacy)
            {
                idleAnim = AssetLoader.RetrieveAsset <AnimationClip> (idleAnim, playerData.playerIdleAnim);
                walkAnim = AssetLoader.RetrieveAsset <AnimationClip> (walkAnim, playerData.playerWalkAnim);
                talkAnim = AssetLoader.RetrieveAsset <AnimationClip> (talkAnim, playerData.playerTalkAnim);
                runAnim = AssetLoader.RetrieveAsset <AnimationClip> (runAnim, playerData.playerRunAnim);
            }
            else if (animationEngine == AnimationEngine.Mecanim)
            {
                moveSpeedParameter = playerData.playerWalkAnim;
                talkParameter = playerData.playerTalkAnim;
                turnParameter = playerData.playerRunAnim;
            }

            // Sound
            walkSound = AssetLoader.RetrieveAsset (walkSound, playerData.playerWalkSound);
            runSound = AssetLoader.RetrieveAsset (runSound, playerData.playerRunSound);

            // Portrait graphic
            portraitIcon.texture = AssetLoader.RetrieveAsset (portraitIcon.texture, playerData.playerPortraitGraphic);
            speechLabel = playerData.playerSpeechLabel;

            // Rendering
            lockDirection = playerData.playerLockDirection;
            lockScale = playerData.playerLockScale;
            if (spriteChild && spriteChild.GetComponent <FollowSortingMap>())
            {
                spriteChild.GetComponent <FollowSortingMap>().lockSorting = playerData.playerLockSorting;
            }
            else if (GetComponent <FollowSortingMap>())
            {
                GetComponent <FollowSortingMap>().lockSorting = playerData.playerLockSorting;
            }
            else
            {
                ReleaseSorting ();
            }

            if (playerData.playerLockDirection)
            {
                spriteDirection = playerData.playerSpriteDirection;
            }
            if (playerData.playerLockScale)
            {
                spriteScale = playerData.playerSpriteScale;
            }
            if (playerData.playerLockSorting)
            {
                if (spriteChild && spriteChild.GetComponent <Renderer>())
                {
                    spriteChild.GetComponent <Renderer>().sortingOrder = playerData.playerSortingOrder;
                    spriteChild.GetComponent <Renderer>().sortingLayerName = playerData.playerSortingLayer;
                }
                else if (GetComponent <Renderer>())
                {
                    GetComponent <Renderer>().sortingOrder = playerData.playerSortingOrder;
                    GetComponent <Renderer>().sortingLayerName = playerData.playerSortingLayer;
                }
            }

            // Active path
            Halt ();
            ForceIdle ();

            if (playerData.playerPathData != null && playerData.playerPathData != "" && GetComponent <Paths>())
            {
                Paths savedPath = GetComponent <Paths>();
                savedPath = Serializer.RestorePathData (savedPath, playerData.playerPathData);
                SetPath (savedPath, playerData.playerTargetNode, playerData.playerPrevNode, playerData.playerPathAffectY);
                isRunning = playerData.playerIsRunning;
                lockedPath = false;
            }
            else if (playerData.playerActivePath != 0)
            {
                Paths savedPath = Serializer.returnComponent <Paths> (playerData.playerActivePath);
                if (savedPath)
                {
                    lockedPath = playerData.playerLockedPath;

                    if (lockedPath)
                    {
                        SetLockedPath (savedPath);
                    }
                    else
                    {
                        SetPath (savedPath, playerData.playerTargetNode, playerData.playerPrevNode);
                    }
                }
            }

            // Previous path
            if (playerData.lastPlayerActivePath != 0)
            {
                Paths savedPath = Serializer.returnComponent <Paths> (playerData.lastPlayerActivePath);
                if (savedPath)
                {
                    SetLastPath (savedPath, playerData.lastPlayerTargetNode, playerData.lastPlayerPrevNode);
                }
            }

            // Head target
            lockHotspotHeadTurning = playerData.playerLockHotspotHeadTurning;
            if (playerData.isHeadTurning)
            {
                SetHeadTurnTarget (new Vector3 (playerData.headTargetX, playerData.headTargetY, playerData.headTargetZ), true);
            }
            else
            {
                ClearHeadTurnTarget (true);
            }

            ignoreGravity = playerData.playerIgnoreGravity;
        }
Example #9
0
 /**
  * <summary>Updates its own variables from a PlayerData class.</summary>
  * <param name = "playerData">The PlayerData class to load from</param>
  */
 public void LoadPlayerData(PlayerData playerData)
 {
     SetUpLock (playerData.playerUpLock);
     isDownLocked = playerData.playerDownLock;
     isLeftLocked = playerData.playerLeftlock;
     isRightLocked = playerData.playerRightLock;
     runLock = (PlayerMoveLock) playerData.playerRunLock;
     SetFreeAimLock (playerData.playerFreeAimLock);
 }
Example #10
0
        /**
         * <summary>Updates a PlayerData class with its own variables that need saving.</summary>
         * <param name = "playerData">The original PlayerData class</param>
         * <returns>The updated PlayerData class</returns>
         */
        public PlayerData SavePlayerData(PlayerData playerData)
        {
            playerData.playerUpLock = isUpLocked;
            playerData.playerDownLock = isDownLocked;
            playerData.playerLeftlock = isLeftLocked;
            playerData.playerRightLock = isRightLocked;
            playerData.playerRunLock = (int) runLock;
            playerData.playerFreeAimLock = IsFreeAimingLocked ();

            return playerData;
        }
Example #11
0
        private PlayerData SavePlayerData(Player player)
        {
            PlayerData playerData = new PlayerData ();

            playerData.currentScene = UnityVersionHandler.GetCurrentSceneNumber ();
            playerData.currentSceneName = UnityVersionHandler.GetCurrentSceneName ();

            playerData.previousScene = KickStarter.sceneChanger.previousSceneInfo.number;
            playerData.previousSceneName = KickStarter.sceneChanger.previousSceneInfo.name;

            playerData = KickStarter.playerInput.SavePlayerData (playerData);

            KickStarter.runtimeInventory.RemoveRecipes ();
            playerData.inventoryData = CreateInventoryData (KickStarter.runtimeInventory.localItems);

            // Camera
            MainCamera mainCamera = KickStarter.mainCamera;
            if (mainCamera.attachedCamera)
            {
                playerData.gameCamera = Serializer.GetConstantID (mainCamera.attachedCamera.gameObject);
            }
            if (mainCamera.lastNavCamera)
            {
                playerData.lastNavCamera = Serializer.GetConstantID (mainCamera.lastNavCamera.gameObject);
            }
            if (mainCamera.lastNavCamera2)
            {
                playerData.lastNavCamera2 = Serializer.GetConstantID (mainCamera.lastNavCamera2.gameObject);
            }

            mainCamera.StopShaking ();
            playerData.mainCameraLocX = mainCamera.transform.position.x;
            playerData.mainCameraLocY = mainCamera.transform.position.y;
            playerData.mainCameraLocZ = mainCamera.transform.position.z;

            playerData.mainCameraRotX = mainCamera.transform.eulerAngles.x;
            playerData.mainCameraRotY = mainCamera.transform.eulerAngles.y;
            playerData.mainCameraRotZ = mainCamera.transform.eulerAngles.z;

            playerData.isSplitScreen = mainCamera.isSplitScreen;
            if (mainCamera.isSplitScreen)
            {
                playerData.isTopLeftSplit = mainCamera.isTopLeftSplit;
                playerData.splitAmountMain = mainCamera.splitAmountMain;
                playerData.splitAmountOther = mainCamera.splitAmountOther;

                if (mainCamera.splitOrientation == MenuOrientation.Vertical)
                {
                    playerData.splitIsVertical = true;
                }
                else
                {
                    playerData.splitIsVertical = false;
                }
                if (mainCamera.splitCamera && mainCamera.splitCamera.GetComponent <ConstantID>())
                {
                    playerData.splitCameraID = mainCamera.splitCamera.GetComponent <ConstantID>().constantID;
                }
                else
                {
                    playerData.splitCameraID = 0;
                }
            }

            if (player == null)
            {
                playerData.playerPortraitGraphic = "";
                playerData.playerID = KickStarter.settingsManager.GetEmptyPlayerID ();
                return playerData;
            }

            playerData = player.SavePlayerData (playerData);

            return playerData;
        }
Example #12
0
        private void ReturnPlayerData(PlayerData playerData, Player player)
        {
            if (player == null)
            {
                return;
            }

            player.LoadPlayerData (playerData);
        }
Example #13
0
        private void ReturnMainData()
        {
            if (KickStarter.playerInput && KickStarter.runtimeInventory && KickStarter.settingsManager && KickStarter.stateHandler)
            {
                PlayerData playerData = new PlayerData ();

                if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
                {
                    if (saveData.playerData.Count > 0)
                    {
                        playerData = saveData.playerData[0];
                    }
                }
                else
                {
                    foreach (PlayerData _data in saveData.playerData)
                    {
                        if (_data.playerID == saveData.mainData.currentPlayerID)
                        {
                            playerData = _data;
                        }
                    }
                }

                if (activeSelectiveLoad.loadPlayer)
                {
                    ReturnPlayerData (playerData, KickStarter.player);
                }
                if (activeSelectiveLoad.loadSceneObjects)
                {
                    ReturnCameraData (playerData);
                }

                KickStarter.stateHandler.LoadMainData (saveData.mainData);
                KickStarter.settingsManager.movementMethod = (MovementMethod) saveData.mainData.movementMethod;

                if (activeSelectiveLoad.loadScene)
                {
                    KickStarter.sceneChanger.previousSceneInfo = new SceneInfo (playerData.previousSceneName, playerData.previousScene);
                }

                if (activeSelectiveLoad.loadPlayer)
                {
                    KickStarter.playerInput.LoadPlayerData (playerData);
                }

                // Inventory
                KickStarter.runtimeInventory.RemoveRecipes ();
                if (activeSelectiveLoad.loadInventory)
                {
                    KickStarter.runtimeInventory.localItems = AssignInventory (KickStarter.runtimeInventory, playerData.inventoryData);
                    if (saveData.mainData.selectedInventoryID > -1)
                    {
                        if (saveData.mainData.isGivingItem)
                        {
                            KickStarter.runtimeInventory.SelectItemByID (saveData.mainData.selectedInventoryID, SelectItemMode.Give);
                        }
                        else
                        {
                            KickStarter.runtimeInventory.SelectItemByID (saveData.mainData.selectedInventoryID, SelectItemMode.Use);
                        }
                    }
                    else
                    {
                        KickStarter.runtimeInventory.SetNull ();
                    }
                    KickStarter.runtimeInventory.RemoveRecipes ();
                }

                KickStarter.playerInput.LoadMainData (saveData.mainData);

                // Variables
                if (activeSelectiveLoad.loadVariables)
                {
                    SaveSystem.AssignVariables (saveData.mainData.runtimeVariablesData);
                    KickStarter.runtimeVariables.AssignCustomTokensFromString (saveData.mainData.customTokenData);
                }

                // Menus
                KickStarter.playerMenus.LoadMainData (saveData.mainData);

                KickStarter.mainCamera.HideScene ();
                KickStarter.playerMenus.HideSaveMenus ();
                KickStarter.sceneSettings.UnpauseGame (KickStarter.playerInput.timeScale);//
                KickStarter.stateHandler.gameState = GameState.Cutscene;
                KickStarter.mainCamera.FadeIn (0.5f);

                Invoke ("ReturnToGameplay", gameplayInvokeTime);
            }
            else
            {
                if (KickStarter.playerInput == null)
                {
                    ACDebug.LogWarning ("Load failed - no PlayerInput found.");
                }
                if (KickStarter.runtimeInventory == null)
                {
                    ACDebug.LogWarning ("Load failed - no RuntimeInventory found.");
                }
                if (KickStarter.sceneChanger == null)
                {
                    ACDebug.LogWarning ("Load failed - no SceneChanger found.");
                }
                if (KickStarter.settingsManager == null)
                {
                    ACDebug.LogWarning ("Load failed - no Settings Manager found.");
                }
            }
        }
Example #14
0
		public override float Run ()
		{
			if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
			{
				PlayerPrefab newPlayerPrefab = KickStarter.settingsManager.GetPlayerPrefab (playerID);

				if (newPlayerPrefab != null)
				{
					if (KickStarter.player != null && KickStarter.player.ID == playerID)
					{
						Log ("Cannot switch player - already controlling the desired prefab.");
						return 0f;
					}
					
					if (newPlayerPrefab.playerOb != null)
					{
						KickStarter.saveSystem.SaveCurrentPlayerData ();
						
						Vector3 oldPlayerPosition = Vector3.zero;
						Quaternion oldPlayerRotation = new Quaternion ();
						Vector3 oldPlayerScale = Vector3.one;

						PlayerData oldPlayerData = new PlayerData ();
						NPCData oldNPCData = new NPCData ();
						bool recordedOldPlayerData = false;
						bool recordedOldNPCData = false;

						if (KickStarter.player != null)
						{
							oldPlayerPosition = KickStarter.player.transform.position;
							oldPlayerRotation = KickStarter.player.TransformRotation;
							oldPlayerScale = KickStarter.player.transform.localScale;

							oldPlayerData = KickStarter.player.SavePlayerData (oldPlayerData);
							recordedOldPlayerData = true;
						}

						if (newPlayerPosition != NewPlayerPosition.ReplaceCurrentPlayer)
						{
							if (oldPlayer == OldPlayer.ReplaceWithAssociatedNPC &&
								(runtimeOldPlayerNPC == null || !runtimeOldPlayerNPC.gameObject.activeInHierarchy) &&
								KickStarter.player.associatedNPCPrefab != null)
							{
								GameObject newObject = (GameObject) Instantiate (KickStarter.player.associatedNPCPrefab.gameObject);
								newObject.name = KickStarter.player.associatedNPCPrefab.gameObject.name;
								runtimeOldPlayerNPC = newObject.GetComponent <NPC>();
							}

							if ((oldPlayer == OldPlayer.ReplaceWithNPC || oldPlayer == OldPlayer.ReplaceWithAssociatedNPC) &&
								runtimeOldPlayerNPC != null && runtimeOldPlayerNPC.gameObject.activeInHierarchy)
							{
								runtimeOldPlayerNPC.Teleport (oldPlayerPosition);
								runtimeOldPlayerNPC.SetRotation (oldPlayerRotation);
								runtimeOldPlayerNPC.transform.localScale = oldPlayerScale;

								if (recordedOldPlayerData)
								{
									ApplyRenderData (runtimeOldPlayerNPC, oldPlayerData);
								}

								// Force the rotation / sprite child to update
								runtimeOldPlayerNPC._Update ();
							}
						}

						if (runtimeNewPlayerNPC == null || newPlayerPosition == NewPlayerPosition.ReplaceAssociatedNPC)
						{
							// Try to find from associated NPC prefab

							if (newPlayerPrefab.playerOb.associatedNPCPrefab != null)
							{
								ConstantID prefabID = newPlayerPrefab.playerOb.associatedNPCPrefab.GetComponent <ConstantID>();
								if (prefabID != null && prefabID.constantID != 0)
								{
									newPlayerNPC_ID = prefabID.constantID;
									runtimeNewPlayerNPC = AssignFile <NPC> (prefabID.constantID, null);
								}
							}
						}

						Quaternion newRotation = Quaternion.identity;
						if (newPlayerPosition == NewPlayerPosition.ReplaceCurrentPlayer)
						{
							newRotation = oldPlayerRotation;
						}
						else if (newPlayerPosition == NewPlayerPosition.ReplaceNPC && runtimeNewPlayerNPC != null)
						{
							newRotation = runtimeNewPlayerNPC.TransformRotation;
						}
						else if (newPlayerPosition == NewPlayerPosition.AppearAtMarker && runtimeNewPlayerMarker != null)
						{
							newRotation = runtimeNewPlayerMarker.transform.rotation;
						}

						if (runtimeNewPlayerNPC != null)
						{
							oldNPCData = runtimeNewPlayerNPC.SaveData (oldNPCData);
						}

						bool replacesOldPlayer = newPlayerPosition == NewPlayerPosition.ReplaceCurrentPlayer &&
												 (!restorePreviousData || !KickStarter.saveSystem.DoesPlayerDataExist (playerID, true));
						KickStarter.ResetPlayer (newPlayerPrefab.playerOb, playerID, true, newRotation, keepInventory, false, replacesOldPlayer, alwaysSnapCamera);
						Player newPlayer = KickStarter.player;
						PlayerMenus.ResetInventoryBoxes ();

						if (replacesOldPlayer && recordedOldPlayerData)
						{
							ApplyRenderData (newPlayer, oldPlayerData);
						}

						if (restorePreviousData && KickStarter.saveSystem.DoesPlayerDataExist (playerID, true))
						{
							int sceneToLoad = KickStarter.saveSystem.GetPlayerScene (playerID);
							if (sceneToLoad >= 0 && sceneToLoad != UnityVersionHandler.GetCurrentSceneNumber ())
							{
								KickStarter.saveSystem.loadingGame = LoadingGame.JustSwitchingPlayer;
								KickStarter.sceneChanger.ChangeScene (new SceneInfo (string.Empty, sceneToLoad), true, false);
							}
							else
							{
								// Same scene
								if (runtimeNewPlayerNPC != null)
								{
									newPlayer.RepositionToTransform (runtimeNewPlayerNPC.transform);
									runtimeNewPlayerNPC.HideFromView (newPlayer);
								}	
							}
						}
						else
						{
							// No data to restore

							if (newPlayerPosition == NewPlayerPosition.ReplaceCurrentPlayer)
							{
								newPlayer.Teleport (oldPlayerPosition);
								newPlayer.SetRotation (oldPlayerRotation);
								newPlayer.transform.localScale = oldPlayerScale;
							}
							else if (newPlayerPosition == NewPlayerPosition.ReplaceNPC || newPlayerPosition == NewPlayerPosition.ReplaceAssociatedNPC)
							{
								if (runtimeNewPlayerNPC != null)
								{
									newPlayer.RepositionToTransform (runtimeNewPlayerNPC.transform);
									runtimeNewPlayerNPC.HideFromView (newPlayer);

									if (recordedOldNPCData)
									{
										ApplyRenderData (newPlayer, oldNPCData);
									}
								}
							}
							else if (newPlayerPosition == NewPlayerPosition.AppearAtMarker)
							{
								if (runtimeNewPlayerMarker)
								{
									newPlayer.RepositionToTransform (runtimeNewPlayerMarker.transform);
								}
							}
							else if (newPlayerPosition == NewPlayerPosition.AppearInOtherScene)
							{
								if (chooseNewSceneBy == ChooseSceneBy.Name && newPlayerSceneName == UnityVersionHandler.GetCurrentSceneName () ||
									(chooseNewSceneBy == ChooseSceneBy.Number && newPlayerScene == UnityVersionHandler.GetCurrentSceneNumber ()))
								{
									// Already in correct scene
									if (runtimeNewPlayerNPC && runtimeNewPlayerNPC.gameObject.activeInHierarchy)
									{
										newPlayer.RepositionToTransform (runtimeNewPlayerNPC.transform);
										runtimeNewPlayerNPC.HideFromView (newPlayer);
									}
								}
								else
								{
									KickStarter.sceneChanger.ChangeScene (new SceneInfo (chooseNewSceneBy, newPlayerSceneName, newPlayerScene), true, false, true);
								}
							}
						}
						
						if (KickStarter.mainCamera.attachedCamera && alwaysSnapCamera)
						{
							KickStarter.mainCamera.attachedCamera.MoveCameraInstant ();
						}
						
						AssetLoader.UnloadAssets ();
					}
					else
					{
						LogWarning ("Cannot switch player - no player prefabs is defined.");
					}
				}
			}
			
			return 0f;
		}
 public override void LoadPlayerData(PlayerData playerData, Player player)
 {
     player.moveSpeedParameter = playerData.playerWalkAnim;
     player.talkParameter      = playerData.playerTalkAnim;
     player.turnParameter      = playerData.playerRunAnim;
 }