public override void OnEnter() { AnimateCameraActionSettings animateCameraActionSettings = PlatformUtils.FindAspectRatioSettings(OverrideSettings); if (animateCameraActionSettings != null) { applySettings(animateCameraActionSettings); } dispatcher = Service.Get <EventDispatcher>(); dispatcher.DispatchEvent(new CinematographyEvents.ChangeCameraContextEvent(Director.CameraContext.Cinematic, Curve.curve, Duration)); Transform target = null; Transform position = null; if (!string.IsNullOrEmpty(Target)) { GameObject gameObject = GameObject.Find(Target); if (gameObject != null) { target = gameObject.transform; } else { Disney.LaunchPadFramework.Log.LogError(this, "SetCameraPositionAndTargetAction: Unable to find Camera Target called " + Target); } } if (!string.IsNullOrEmpty(Position)) { GameObject gameObject = GameObject.Find(Position); if (gameObject != null) { position = gameObject.transform; } else { Disney.LaunchPadFramework.Log.LogError(this, "SetCameraPositionAndTargetAction: Unable to find Camera Anchor called " + Position); } } int posAnimTrigger = 0; if (!string.IsNullOrEmpty(PositionAnimTrigger)) { posAnimTrigger = Animator.StringToHash(PositionAnimTrigger); } int targetAnimTrigger = 0; if (!string.IsNullOrEmpty(TargetAnimTrigger)) { targetAnimTrigger = Animator.StringToHash(TargetAnimTrigger); } if (WaitForCompletion) { dispatcher.AddListener <ScriptedCameraEvents.CameraCompleted>(onCameraCompleted); } dispatcher.DispatchEvent(new ScriptedCameraEvents.SetCameraEvent(position, target, posAnimTrigger, targetAnimTrigger, TargetOffset, Curve.curve, Duration, WaitForCompletion)); if (!WaitForCompletion) { Finish(); } }
private void applySettings(AnimateCameraActionSettings settings) { Position = settings.Position; Target = settings.Target; TargetAnimTrigger = settings.TargetAnimTrigger; TargetOffset = settings.TargetOffset; Duration = settings.Duration; Curve = settings.Curve; }