Cinema Director Cut Scenes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Cinema Director Cut Scenes

Post by bohnstudios »

Hi Tony, I'm setting up my cut scenes to play at the beginning of scenes that are loaded using your ARPG/DS level loading sequencer command. I need to hide my ARPG GUI health bar, map, and skill icons, cross-hair when I play a Cinema Director cut-scene....sort of like how (or maybe exactly how) Dialogue System hides some of these components on conversations.

I've tried a lot of different non DS related ways to go about this. At first, I tried to disable the ARPG attack trigger, player controller, etc with the 'disable component' command for Cinema Director. Due to the spawning nature of my set-up, I ran into problems getting cinema director to enable/disable components at the beginning of the scene...I could get it roughly work by just putting the Player directly into the scene...but it didn't seem work when I compiled outside Unity Editor & changing scenes. Could moving them off-screen somehow (but not disabling them) be the safest way to make sure the saved/bridged data persists?

I also tried culling with my cut scene camera(s) and culling via layers...I could have missed something there. I know I haven't tried everything, but if you have any thoughts of what would be the best way way to about this, I have a feeling you would be the person that would know. I've been stuck on this longer than I'd like to admit.

Everything else is shaping up VERY nicely. Just even your small nudge in the right direction with the animation triggering with my salsa/fuse characters has enabled me to get results so good that it's somewhat unsettling lol. Working out this small hurdle with my cinema director cut scenes is pretty much the icing on the cake for what I hope will be an excellent showcase for Dialogue System's capabilities and work with so many other great assets at the same time.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cinema Director Cut Scenes

Post by Tony Li »

Hi,

Try saving the code below as ControlARPG.cs. Then add it to your scene (e.g., on a new, empty GameObject) and tick Disable On Start. Finally, when your Cinema Director cutscene is done, use Cinema Director to call ControlARPG's EnableARPG method.

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

namespace PixelCrushers.DialogueSystem.ARPG {
	
	public class ControlARPG : MonoBehaviour {

		public bool disableOnStart = false;

		public IEnumerator Start() {
			yield return null;
			if (disableOnStart) DisableARPG();
		}

		public void DisableARPG() {
			Debug.Log ("Disabling ARPG");
			var player = GameObject.FindGameObjectWithTag("Player");
			if (player == null) {
				Debug.Log ("Can't find player", this);
			} else {
				var pauseARPGCamera = player.GetComponent<PauseARPGCameraOnConversation>();
				if (pauseARPGCamera != null) pauseARPGCamera.OnConversationStart(player.transform);
				var setComponentsEnabled = player.GetComponent<SetComponentEnabledOnDialogueEvent>();
				if (setComponentsEnabled != null) setComponentsEnabled.OnConversationStart(player.transform);
				Tools.SetComponentEnabled(player.GetComponent<HealthBarC>(), Toggle.False);
				Tools.SetComponentEnabled(player.GetComponent<AttackTriggerC>(), Toggle.False);
			}
			var minimap = FindObjectOfType<MinimapOnOffC>();
			if (minimap == null) {
				Debug.Log ("Can't find minimap", this);
			} else {
				minimap.minimapCam.SetActive(false);
			}
		}

		public void EnableARPG() {
			Debug.Log ("Enabling ARPG");
			var player = GameObject.FindGameObjectWithTag("Player");
			if (player != null) {
				var pauseARPGCamera = player.GetComponent<PauseARPGCameraOnConversation>();
				if (pauseARPGCamera != null) pauseARPGCamera.OnConversationEnd(player.transform);
				var setComponentsEnabled = player.GetComponent<SetComponentEnabledOnDialogueEvent>();
				if (setComponentsEnabled != null) setComponentsEnabled.OnConversationEnd(player.transform);
				Tools.SetComponentEnabled(player.GetComponent<HealthBarC>(), Toggle.True);
				Tools.SetComponentEnabled(player.GetComponent<AttackTriggerC>(), Toggle.True);
			}
			var minimap = FindObjectOfType<MinimapOnOffC>();
			if (minimap != null) minimap.minimapCam.SetActive(false);
		}

	}
	
}
The DisableARPG method tells the player to take the same disabling actions that it does when starting a conversation, and it also hides the health bar, attack trigger GUI, and minimap. EnableARPG re-enables them.

If I missed a HUD element, let me know and I can update the script.
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Re: Cinema Director Cut Scenes

Post by bohnstudios »

I implemented and tested it. Works in editor and on build. All the HUD is hidden during cut scene and pulls right back up calling the EnableRPG method with Cinema Director. THANK YOU SO MUCH TONY!!! That's pretty sweet that you can send a message to call a method with Cinema Director on actor tracks...just learned that while putting this into action :)
Post Reply