// turn on/off the visuals for speech/thought bubbles private void ToggleBubbleType(Dialogue.DialogueData.DialoguePoint conversation) { bool areThoughtBubbleSpritesRequired = false; switch (conversation.bubbleType) { case Dialogue.DialogueData.DialoguePoint.ConversationBubble.speech: break; // thought bubble sprites will default to off case Dialogue.DialogueData.DialoguePoint.ConversationBubble.thought: areThoughtBubbleSpritesRequired = true; break; default: EB.Debug.LogError("DialogueHUDLogic.SetUpNewConversationStep() : Unsupported conversation bubble type"); break; } if (null != thoughtBubbleContainer) { NGUITools.SetActive(thoughtBubbleContainer, areThoughtBubbleSpritesRequired); // turn on thought bubble sprites if required } if (null != speechTail) { NGUITools.SetActive(speechTail, !areThoughtBubbleSpritesRequired); // if the thought bubble sprites are required, the speech tail will not be required (and vice-versa) } }
// set the facing of the player and the current talker private void SetDefaultFacing(Dialogue.DialogueData.DialoguePoint dialoguePoint) { if (null == dialoguePoint || // we can't do anything without a dialogue point dialoguePoint.actions.ContainsFacingActions() || // if this step has facing actions, then don't do anything here IsDuringGameplay()) // if this is a speech bubble conversation during gameplay, we're not gonna set facing { return; } GameObject caller = GlobalUtils.FindCharacter(dialoguePoint.caller); if (null == caller) // if we can't find the character to use { return; } GameObject player = PlayerManager.LocalPlayerGameObject(); if (null == player) // if we have no player we don't know who to look at { return; } if (caller != player) { FacingAction.OrientFacing(caller, player); } }
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; }
// after the dialogue starts cameras, get the transform private void GetLatestCameraTransform(Dialogue.DialogueData.DialoguePoint conversation, ref Vector3 outPosition, ref Quaternion outRotation) { if (Cinematic.IsCinematicActive()) { Cinematic.GetCurrentCinematicTransform(ref outPosition, ref outRotation); } else { _cameraComponent.GetNewestGameCameraBehaviorTransform(ref outPosition, ref outRotation); } }
public void AdvanceChatBubbles(Dialogue.DialogueData.DialoguePoint conversation) { if (null != conversation) { GameObject caller = GlobalUtils.FindCharacter(conversation.caller); if (null != caller) { ShowChatBubble showChat = caller.GetComponent <ShowChatBubble>(); if (null != showChat) { showChat.Show(StringUtils.ReplaceTokens(conversation.call)); } } } }
private void Advance(Dialogue.DialogueData.DialoguePoint conversation) { _currentPoint = conversation; if (null != conversation) { if (AreAllComponentsCached()) { if (_cameraComponent.IsCameraTransitioning()) // the camera will be transitioning if a new camera was added (apart from cuts) (or it was already transitioning) { _waitingForCameraTransition = true; ActivateBubbleContainer(false); } else { SetUpNewConversation(conversation); } } } }
private void SetUpNewConversation(Dialogue.DialogueData.DialoguePoint conversation) { FusionAudio.PostEvent(FusionAudio.eEvent.DLG_common); ActivateBubbleContainer(true); SetCharacterName(conversation.caller); _uiLabelDialogueBody.text = StringUtils.ReplaceTokens(conversation.call); NGUITools.SetActive(_uiLabelDialogueBody.gameObject, true); // force a refresh (ensures text is rendered) ToggleBubbleType(conversation); Vector3 outPosition = new Vector3(); Quaternion outRotation = new Quaternion(); GetLatestCameraTransform(conversation, ref outPosition, ref outRotation); PositionBubbleHorizontally(conversation.caller, outPosition, outRotation); PositionBubbleTailHorizontally(conversation.caller, outPosition, outRotation); _doRefreshPanel = true; }