Beispiel #1
0
    static public void Stop()
    {
        if (null != activeDialogue)
        {
            // if animation tracks are specified, let that take care of exit animations
            if (!activeDialogue.exitAnimationSequence.ContainsTracks() && !activeDialogue.exitActions.ContainsAnmationTracks())
            {
                TriggerEndAnimations();
            }

            activeDialogue.exitAnimationSequence.Execute();
            activeDialogue.exitActions.Execute();

            Interaction activeInteraction = GetActiveInteraction();
            if (null != activeInteraction)
            {
                activeInteraction.ClearCharacterRotationLocks();
                activeInteraction.SwitchCharactersBackToPreviousTeam();
                activeInteraction.ClearCharacterInfo();
            }

            Dialogue.DialogueData.DialoguePointCamera exitCamera = activeDialogue.GetExitCamera();
            if (null != exitCamera)
            {
                Interaction.SetUpNewCamera(exitCamera, null, activeDialogue.dialoguePoints);
            }
            else if (!activeDialogue.exitActions.ContainsCameraAction() && null != Camera.main)
            {
                CameraBase cameraComponent = Camera.main.gameObject.GetComponent <CameraBase>();
                if (null != cameraComponent)
                {
                    CameraLerp defaultDialogueLerp = GlobalDialogueData.Instance.defaultDialogueLerp;
                    cameraComponent.EnterFixedOffsetGameCamera(defaultDialogueLerp);
                }
            }

            if (!activeDialogue.isDuringGameplay && activeDialogue.removeDialogueHUDOnExit)
            {
                UIStack.Instance.BackStack();
            }
            activeDialogue = null;

            if (null != onInteractionEnd)
            {
                onInteractionEnd();
            }
            EventManager.instance.Raise(new DialogueEvent(DialogueEvent.EventType.stop));
        }
    }
Beispiel #2
0
    // turn on the type of camera we need for this conversation step
    static public void SetUpNewCamera(Dialogue.DialogueData.DialoguePointCamera conversation, CharacterModel inputCaller, List <Dialogue.DialogueData.DialoguePoint> dialoguePoints)
    {
        if (null == conversation.camera)
        {
            return;
        }

        CameraLerp cameraLerp = (null != conversation.cameraLerpOverride) ? conversation.cameraLerpOverride : GlobalDialogueData.Instance.defaultDialogueLerp;

        System.Type cameraType = conversation.camera.GetType();
        if (typeof(GameCameraParams) == cameraType)
        {
            if (null != Camera.main)
            {
                CameraBase cameraComponent = Camera.main.GetComponent <CameraBase>();

                GameCameraParams gameCameraParams = (GameCameraParams)conversation.camera;
                switch (conversation.targets)
                {
                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.localPlayer:
                    if (gameCameraParams.gameCamera)
                    {
                        cameraComponent.EnterFixedOffsetGameCamera(cameraLerp);
                    }
                    else
                    {
                        PlayerController controller = PlayerManager.LocalPlayerController();
                        if (null != controller)
                        {
                            List <GameObject> target = new List <GameObject>();
                            target.Add(controller.gameObject);
                            cameraComponent.EnterInteractionCamera(ref target, ref gameCameraParams, cameraLerp);
                        }
                    }
                    break;

                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.all:
                    List <GameObject> targets = new List <GameObject>();
                    Interaction.GetAllInteractionParticipants(ref targets, dialoguePoints);
                    if (targets.Count > 0)
                    {
                        cameraComponent.EnterInteractionCamera(ref targets, ref gameCameraParams, cameraLerp);
                    }
                    break;

                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.caller:
                    GameObject caller = GlobalUtils.FindCharacter(inputCaller);
                    if (null != caller)
                    {
                        if (inputCaller.isPlayer && gameCameraParams.gameCamera)
                        {
                            cameraComponent.EnterFixedOffsetGameCamera(cameraLerp);
                        }
                        else
                        {
                            List <GameObject> target = new List <GameObject>();
                            target.Add(caller);
                            cameraComponent.EnterInteractionCamera(ref target, ref gameCameraParams, cameraLerp);
                        }
                    }
                    break;

                default: break;
                }
            }
        }
        else if (typeof(CinematicCameraParams) == cameraType)
        {
            if (null != conversation.cinematic)
            {
                if (conversation.IsCinematicAPrefabRequiringInstantiation())
                {
                    GameObject cinematicObject = (GameObject)GameObject.Instantiate(conversation.cinematic);
                    if (null != cinematicObject && cinematicObject.activeInHierarchy)
                    {
                        Cinematic.Play(cinematicObject.GetComponent <Cinematic>(), PlayerManager.LocalPlayerGameObject());
                    }
                }
                else
                {
                    Cinematic.Play(conversation.cinematic.GetComponent <Cinematic>(), PlayerManager.LocalPlayerGameObject());
                }
            }
        }
    }