private void applySettings(ChangeCameraActionSettings settings) { ControllerName = settings.ControllerName; TargetName = settings.TargetName; StoreOriginalCameraPosition = settings.StoreOriginalCameraPosition; CameraPosition = settings.CameraPosition; PreserveCameraPriority = settings.PreserveCameraPriority; WaitForCameraToComplete = settings.WaitForCameraToComplete; ResetOnExit = settings.ResetOnExit; }
public override void OnEnter() { ChangeCameraActionSettings changeCameraActionSettings = PlatformUtils.FindAspectRatioSettings(OverrideSettings); if (changeCameraActionSettings != null) { applySettings(changeCameraActionSettings); } dispatcher = Service.Get <EventDispatcher>(); controllerGameObject = GameObject.Find(ControllerName); if ((bool)controllerGameObject) { controller = controllerGameObject.GetComponent <CameraController>(); } else { Disney.LaunchPadFramework.Log.LogError(this, "Unable to find Camera Setup called " + ControllerName); } if (controller == null) { Disney.LaunchPadFramework.Log.LogError(this, "Provided GameObject " + ControllerName + " does not contain a controller, but one is required."); Finish(); } else if (!WaitForCameraToComplete && ResetOnExit) { Finish(); } else { CinematographyEvents.CameraLogicChangeEvent evt = default(CinematographyEvents.CameraLogicChangeEvent); originalCameraPriority = controller.Priority; if (!PreserveCameraPriority) { controller.Priority = defaultAdventureCameraPriority; } controller.IsScripted = true; evt.Controller = controller; evt.DisablePostEffects = true; evt.ForceCutTransition = ForceCutTransition; dispatcher.DispatchEvent(evt); } if (StoreOriginalCameraPosition != null && StoreOriginalCameraPosition.Value != Vector3.zero) { StoreOriginalCameraPosition.Value = controllerGameObject.transform.position; } if (CameraPosition != null && CameraPosition.Value != Vector3.zero) { controllerGameObject.transform.position = CameraPosition.Value; } if (!string.IsNullOrEmpty(TargetName)) { GameObject gameObject = GameObject.Find(TargetName); if (gameObject != null) { Service.Get <EventDispatcher>().DispatchEvent(new CinematographyEvents.ChangeCameraTarget(gameObject.transform)); } } if (!WaitForCameraToComplete) { Finish(); } }