Esempio n. 1
0
        protected void Update()
        {
                        #if UNITY_EDITOR
            ACScreen.UpdateCache();
                        #endif

            if (!CanRun())
            {
                return;
            }

            if (KickStarter.settingsManager.IsInLoadingScene() || KickStarter.sceneChanger.IsLoading())
            {
                if (!menuIsOff)
                {
                    KickStarter.playerMenus.UpdateLoadingMenus();
                }
                return;
            }

            if (!inputIsOff)
            {
                if (gameState == GameState.DialogOptions)
                {
                    KickStarter.playerInput.DetectConversationInputs();
                }
                KickStarter.playerInput.UpdateInput();

                KickStarter.playerInput.UpdateDirectInput(IsInGameplay());

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

            KickStarter.dialog._Update();

            KickStarter.playerInteraction.UpdateInteractionLabel();

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

                bool canHideHotspots     = KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && KickStarter.settingsManager.hideUnhandledHotspots;
                bool canDrawHotspotIcons = (KickStarter.settingsManager.hotspotIconDisplay != HotspotIconDisplay.Never);
                bool canUpdateProximity  = (KickStarter.settingsManager.hotspotDetection == HotspotDetection.PlayerVicinity && KickStarter.settingsManager.placeDistantHotspotsOnSeparateLayer && KickStarter.player);

                foreach (Hotspot hotspot in hotspots)
                {
                    bool showing = (canHideHotspots) ? hotspot.UpdateUnhandledVisibility() : true;
                    if (showing)
                    {
                        if (canDrawHotspotIcons)
                        {
                            if (KickStarter.settingsManager.hotspotIconDisplay != HotspotIconDisplay.Never)
                            {
                                hotspot.UpdateIcon();
                                if (KickStarter.settingsManager.hotspotDrawing == ScreenWorld.WorldSpace)
                                {
                                    hotspot.DrawHotspotIcon(true);
                                }
                            }
                        }

                        if (canUpdateProximity)
                        {
                            hotspot.UpdateProximity(KickStarter.player.hotspotDetector);
                        }
                    }
                }
            }

            if (!menuIsOff)
            {
                KickStarter.playerMenus.CheckForInput();

                if (KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen && KickStarter.playerInput.GetMouseState() != MouseState.Normal)
                {
                    KickStarter.playerMenus.UpdateAllMenus();
                }
            }

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

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

                if (KickStarter.settingsManager.hotspotDetection == HotspotDetection.MouseOver && KickStarter.settingsManager.scaleHighlightWithMouseProximity)
                {
                    bool isInGameplay = IsInGameplay();
                    foreach (Hotspot hotspot in hotspots)
                    {
                        hotspot.SetProximity(isInGameplay);
                    }
                }
            }

            if (!triggerIsOff)
            {
                foreach (AC_Trigger trigger in triggers)
                {
                    trigger._Update();
                }
            }

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

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

            if (!movementIsOff)
            {
                if (IsInGameplay() && KickStarter.settingsManager && KickStarter.settingsManager.movementMethod != MovementMethod.None)
                {
                    KickStarter.playerMovement.UpdatePlayerMovement();
                }
            }

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

            foreach (LimitVisibility limitVisibility in limitVisibilitys)
            {
                limitVisibility._Update();
            }

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

            foreach (AC.Char character in characters)
            {
                if (character && (!playerIsOff || !(character.IsPlayer)))
                {
                    character._Update();
                }
            }

            if (!cameraIsOff)
            {
                foreach (_Camera _camera in cameras)
                {
                    _camera._Update();
                }
            }
        }
Esempio n. 2
0
        protected void Update()
        {
                        #if UNITY_EDITOR
            ACScreen.UpdateCache();
                        #endif

            if (isACDisabled || !hasGameEngine)
            {
                return;
            }

            if (KickStarter.settingsManager.IsInLoadingScene() || KickStarter.sceneChanger.IsLoading())
            {
                if (!menuIsOff)
                {
                    KickStarter.playerMenus.UpdateLoadingMenus();
                }
                return;
            }

            if (gameState != GameState.Paused)
            {
                lastNonPausedState = gameState;
            }
            if (!inputIsOff)
            {
                if (gameState == GameState.DialogOptions)
                {
                    KickStarter.playerInput.DetectConversationInputs();
                }
                KickStarter.playerInput.UpdateInput();

                if (IsInGameplay())
                {
                    KickStarter.playerInput.UpdateDirectInput();
                }

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

            KickStarter.dialog._Update();

            KickStarter.playerInteraction.UpdateInteractionLabel();

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

                bool canHideHotspots     = KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && KickStarter.settingsManager.hideUnhandledHotspots;
                bool canDrawHotspotIcons = (KickStarter.settingsManager.hotspotIconDisplay != HotspotIconDisplay.Never);
                bool canUpdateProximity  = (KickStarter.settingsManager.hotspotDetection == HotspotDetection.PlayerVicinity && KickStarter.settingsManager.placeDistantHotspotsOnSeparateLayer && KickStarter.player != null);

                for (_i = 0; _i < hotspots.Count; _i++)
                {
                    bool showing = (canHideHotspots) ? hotspots[_i].UpdateUnhandledVisibility() : true;
                    if (showing)
                    {
                        if (canDrawHotspotIcons)
                        {
                            if (KickStarter.settingsManager.hotspotIconDisplay != HotspotIconDisplay.Never)
                            {
                                hotspots[_i].UpdateIcon();
                                if (KickStarter.settingsManager.hotspotDrawing == ScreenWorld.WorldSpace)
                                {
                                    hotspots[_i].DrawHotspotIcon(true);
                                }
                            }
                        }

                        if (canUpdateProximity)
                        {
                            hotspots[_i].UpdateProximity(KickStarter.player.hotspotDetector);
                        }
                    }
                }
            }

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

            if (!menuIsOff)
            {
                if (KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen && KickStarter.playerInput.GetMouseState() != MouseState.Normal)
                {
                    KickStarter.playerMenus.UpdateAllMenus();
                }
            }

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

                for (_i = 0; _i < highlights.Count; _i++)
                {
                    highlights[_i]._Update();
                }

                if (KickStarter.settingsManager.hotspotDetection == HotspotDetection.MouseOver && KickStarter.settingsManager.scaleHighlightWithMouseProximity)
                {
                    bool setProximity = IsInGameplay();
                    for (_i = 0; _i < hotspots.Count; _i++)
                    {
                        hotspots[_i].SetProximity(setProximity);
                    }
                }
            }

            if (!triggerIsOff)
            {
                for (_i = 0; _i < triggers.Count; _i++)
                {
                    triggers[_i]._Update();
                }
            }

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

            KickStarter.actionListManager.UpdateActionListManager();

            for (_i = 0; _i < dragBases.Count; _i++)
            {
                dragBases[_i].UpdateMovement();
            }

            if (!movementIsOff)
            {
                if (IsInGameplay() && KickStarter.settingsManager && KickStarter.settingsManager.movementMethod != MovementMethod.None)
                {
                    KickStarter.playerMovement.UpdatePlayerMovement();
                }

                KickStarter.playerMovement.UpdateFPCamera();
            }

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

            for (_i = 0; _i < limitVisibilitys.Count; _i++)
            {
                limitVisibilitys[_i]._Update();
            }

            for (_i = 0; _i < sounds.Count; _i++)
            {
                sounds[_i]._Update();
            }

            for (_i = 0; _i < characters.Count; _i++)
            {
                if (characters[_i] != null && (!playerIsOff || !(characters[_i].IsPlayer)))
                {
                    characters[_i]._Update();
                }
            }

            if (!cameraIsOff)
            {
                for (_i = 0; _i < cameras.Count; _i++)
                {
                    cameras[_i]._Update();
                }
            }

            if (HasGameStateChanged())
            {
                KickStarter.eventManager.Call_OnChangeGameState(previousUpdateState);

                if (KickStarter.settingsManager.movementMethod == MovementMethod.FirstPerson)
                {
                    if (IsInGameplay() || (gameState == GameState.DialogOptions && KickStarter.settingsManager.useFPCamDuringConversations))
                    {
                        KickStarter.mainCamera.SetFirstPerson();
                    }
                }

                if (Time.time > 0f && gameState != GameState.Paused)
                {
                    AudioListener.pause = false;
                }

                if (gameState == GameState.Cutscene && previousUpdateState != GameState.Cutscene)
                {
                    KickStarter.playerMenus.MakeUINonInteractive();
                }
                else if (gameState != GameState.Cutscene && previousUpdateState == GameState.Cutscene)
                {
                    KickStarter.playerMenus.MakeUIInteractive();
                }
            }

            previousUpdateState = gameState;
        }