示例#1
0
    public void AdvanceDialogue()
    {
        ++_currentInteraction;

        Dialogue.DialogueData.DialoguePoint dialoguePoint = GetCurrentDialoguePoint();
        if (null != dialoguePoint)
        {
            Dialogue.DialogueData.DialoguePointCamera dialoguePointCamera = new Dialogue.DialogueData.DialoguePointCamera();

            dialoguePointCamera.camera             = dialoguePoint.camera;
            dialoguePointCamera.cameraLerpOverride = dialoguePoint.cameraLerpOverride;
            dialoguePointCamera.cinematic          = dialoguePoint.cinematic;
            dialoguePointCamera.targets            = dialoguePoint.targets;

            Interaction.SetUpNewCamera(dialoguePointCamera, dialoguePoint.caller, _dialoguePoints);

            dialoguePoint.animationSequence.Execute();
            dialoguePoint.actions.Execute();
            SetDefaultFacing(dialoguePoint);
        }
        if (null != _onDialogueAdvance)
        {
            _onDialogueAdvance(dialoguePoint);
        }
        if (null == dialoguePoint)
        {
            Dialogue.Stop();
        }
        _lastAdvanceTime = Time.time;
    }
示例#2
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));
        }
    }
示例#3
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());
                }
            }
        }
    }