Beispiel #1
0
        private void Update()
        {
            if (KickStarter.settingsManager != null && KickStarter.settingsManager.IsInLoadingScene())
            {
                return;
            }

            if (gameState != GameState.Paused)
            {
                lastNonPausedState = gameState;
            }

            KickStarter.dialog._Update();

            if (!inputIsOff)
            {
                KickStarter.playerInput.UpdateInput();

                if (gameState == GameState.Normal)
                {
                    KickStarter.playerInput.UpdateDirectInput();
                }

                if (gameState != GameState.Paused)
                {
                    KickStarter.playerQTE.UpdateQTE();
                    //KickStarter.dialog.UpdateSkipDialogue ();
                }
            }

            if (!cursorIsOff)
            {
                KickStarter.playerCursor.UpdateCursor();
            }

            if (!menuIsOff)
            {
                KickStarter.playerMenus.UpdateAllMenus();
            }

            if (!interactionIsOff)
            {
                KickStarter.playerInteraction.UpdateInteraction();

                foreach (Highlight highlight in highlights)
                {
                    highlight._Update();
                }

                if (KickStarter.settingsManager.hotspotDetection == HotspotDetection.MouseOver && KickStarter.settingsManager.scaleHighlightWithMouseProximity)
                {
                    if (gameState == GameState.Normal)
                    {
                        foreach (Hotspot hotspot in hotspots)
                        {
                            hotspot.SetProximity(true);
                        }
                    }
                    else
                    {
                        foreach (Hotspot hotspot in hotspots)
                        {
                            hotspot.SetProximity(false);
                        }
                    }
                }
            }

            KickStarter.actionListManager.UpdateActionListManager();

            if (!movementIsOff)
            {
                foreach (DragBase dragBase in dragBases)
                {
                    dragBase.UpdateMovement();
                }

                if (gameState == GameState.Normal && KickStarter.settingsManager && KickStarter.settingsManager.movementMethod != MovementMethod.None)
                {
                    KickStarter.playerMovement.UpdatePlayerMovement();
                }

                KickStarter.playerMovement.UpdateFPCamera();
            }

            if (!interactionIsOff)
            {
                KickStarter.playerInteraction.UpdateInventory();
            }

            if (!cameraIsOff)
            {
                foreach (GameCamera2D gameCamera2D in gameCamera2Ds)
                {
                    gameCamera2D._Update();
                }
            }

            foreach (Sound sound in sounds)
            {
                sound._Update();
            }

            if (HasGameStateChanged())
            {
                if (KickStarter.settingsManager.movementMethod == MovementMethod.UltimateFPS)
                {
                    UltimateFPSIntegration._Update(gameState);
                }
                else if (KickStarter.settingsManager.movementMethod == MovementMethod.FirstPerson)
                {
                    if (gameState == GameState.DialogOptions || gameState == GameState.Normal)
                    {
                        KickStarter.mainCamera.SetFirstPerson();
                    }
                }

                if (gameState != GameState.Paused)
                {
                    AudioListener.pause = false;
                }
            }

            previousUpdateState = gameState;
        }
Beispiel #2
0
        public void SetGameCamera(_Camera newCamera)
        {
            if (newCamera == null)
            {
                return;
            }

            if (attachedCamera != null && attachedCamera is GameCamera25D)
            {
                if (newCamera is GameCamera25D)
                {
                }
                else
                {
                    RemoveBackground();
                }
            }

            if (_camera == null && GetComponent <Camera>())
            {
                _camera = GetComponent <Camera>();
            }
            _camera.ResetProjectionMatrix();
            attachedCamera = newCamera;
            attachedCamera.SetCameraComponent();

            if (attachedCamera && attachedCamera._camera)
            {
                _camera.farClipPlane  = attachedCamera._camera.farClipPlane;
                _camera.nearClipPlane = attachedCamera._camera.nearClipPlane;
                _camera.orthographic  = attachedCamera._camera.orthographic;
            }

            // Set LookAt
            if (attachedCamera is GameCamera)
            {
                GameCamera gameCam = (GameCamera)attachedCamera;
                cursorAffectsRotation = gameCam.followCursor;
                lookAtAmount          = gameCam.cursorInfluence;
            }
            else if (attachedCamera is GameCameraAnimated)
            {
                GameCameraAnimated gameCam = (GameCameraAnimated)attachedCamera;
                if (gameCam.animatedCameraType == AnimatedCameraType.SyncWithTargetMovement)
                {
                    cursorAffectsRotation = gameCam.followCursor;
                    lookAtAmount          = gameCam.cursorInfluence;
                }
                else
                {
                    cursorAffectsRotation = false;
                }
            }
            else
            {
                cursorAffectsRotation = false;
            }

            // Set background
            if (attachedCamera is GameCamera25D)
            {
                GameCamera25D cam25D = (GameCamera25D)attachedCamera;
                cam25D.SetActiveBackground();
            }

            // TransparencySortMode
            if (attachedCamera is GameCamera2D)
            {
                _camera.transparencySortMode = TransparencySortMode.Orthographic;
            }
            else if (attachedCamera)
            {
                if (attachedCamera._camera.orthographic)
                {
                    _camera.transparencySortMode = TransparencySortMode.Orthographic;
                }
                else
                {
                    _camera.transparencySortMode = TransparencySortMode.Perspective;
                }
            }

            // UFPS
            if (KickStarter.settingsManager.movementMethod == MovementMethod.UltimateFPS)
            {
                UltimateFPSIntegration._Update(KickStarter.stateHandler.gameState);
            }
        }