Example #1
0
        protected override SplineMovement CreateCameraMovement()
        {
            if (!BoundsProvider.Bounds.Any())
            {
                throw new Exception("No bound objects available!");
            }

            var parentObject = BoundsProvider.Bounds.First();

            var moveModule = new SplineMovement();

            moveModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(FocusType);
            moveModule.EvaluateSpline        = SplineTypes.GetEvaluationFunction(SplineType);

            if (TargetObject == null)
            {
                TargetObject = new GameObject("Camera movement Target");
            }
            TargetObject.transform.parent        = parentObject.transform;
            TargetObject.transform.localPosition = TargetOffset;
            moveModule.TargetTransform           = TargetObject.transform;

            var startTime = Time.time - DelayOverage;
            var timeCurve = CurveFactory.GetCurve(TimeCurve);

            moveModule.RealtimeToLocalTime = (realTime) => (realTime - startTime) / Duration;
            moveModule.ModulateLocalTime   = (timeProportion) => timeCurve.Evaluate(timeProportion);


            //moveModule.OnMovementCompleted += ()=>Object.Destroy( targetObject );

            return(moveModule);
        }
Example #2
0
        public SplineMovement GenerateTranslationMovement(float startTime)
        {
            var cameraMovement = new SplineMovement();

            cameraMovement.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(SplineComputeFocusFunctionTypes.Linear);
            cameraMovement.EvaluateSpline        = SplineTypes.GetEvaluationFunction(SplineEvaluationFunctionTypes.Bezier);

            TargetObject.transform.position = Position;
            TargetObject.transform.parent   = null;
            cameraMovement.TargetTransform  = TargetObject.transform;

            var timeCurve = CurveFactory.GetCurve("EaseBoth");

            cameraMovement.RealtimeToLocalTime = (realTime) => (realTime - startTime) / Duration;
            cameraMovement.ModulateLocalTime   = (timeProportion) => timeCurve.Evaluate(timeProportion);

            return(cameraMovement);
        }
Example #3
0
        public SplineMovement GenerateLookMovement(float startTime)
        {
            var lookModule = new SplineMovement();

            //lookModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(FocusType);
            lookModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(SplineComputeFocusFunctionTypes.Linear);
            lookModule.EvaluateSpline        = SplineTypes.GetEvaluationFunction(SplineEvaluationFunctionTypes.Bezier);

            FacingObject.transform.parent        = SplineCameraControlLord.CameraParent.transform;
            FacingObject.transform.localPosition = Facing;
            lookModule.TargetTransform           = FacingObject.transform;

            var timeCurve = CurveFactory.GetCurve("EaseBoth");

            lookModule.RealtimeToLocalTime = (realTime) => (realTime - startTime) / Duration;
            lookModule.ModulateLocalTime   = (timeProportion) => timeCurve.Evaluate(timeProportion);

            return(lookModule);
        }
Example #4
0
        protected override SplineMovement CreateLookMovement()
        {
            var lookModule = new SplineMovement();

            lookModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(FocusType);
            lookModule.EvaluateSpline        = SplineTypes.GetEvaluationFunction(SplineType);

            TargetObject.transform.parent        = SplineCameraControlLord.CameraParent.transform;
            TargetObject.transform.localPosition = TargetFacing;
            lookModule.TargetTransform           = TargetObject.transform;

            var startTime = Time.time - DelayOverage;
            var timeCurve = CurveFactory.GetCurve(TimeCurve);

            lookModule.RealtimeToLocalTime = (realTime) => (realTime - startTime) / Duration;
            lookModule.ModulateLocalTime   = (timeProportion) => timeCurve.Evaluate(timeProportion);

            //moveModule.OnMovementCompleted += ()=>Object.Destroy( targetObject );

            return(lookModule);
        }
Example #5
0
        protected override void ConductOtherFunctionality()
        {
            var lookModule = new SplineMovement();

            //lookModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(FocusType);
            lookModule.ComputeImaginaryFocus = SplineFocusTypes.GetFocusFunction(SplineComputeFocusFunctionTypes.Linear);
            lookModule.EvaluateSpline        = SplineTypes.GetEvaluationFunction(SplineType);

            FacingObject.transform.parent        = SplineCameraControlLord.CameraParent.transform;
            FacingObject.transform.localPosition = TargetFacing;
            lookModule.TargetTransform           = FacingObject.transform;

            var startTime = Time.time - DelayOverage;
            //var timeCurve = CurveFactory.GetCurve(TimeCurve);
            var timeCurve = CurveFactory.GetCurve("EaseBoth");

            lookModule.RealtimeToLocalTime = (realTime) => (realTime - startTime) / Duration;
            lookModule.ModulateLocalTime   = (timeProportion) => timeCurve.Evaluate(timeProportion);

            //moveModule.OnMovementCompleted += ()=>Object.Destroy( FacingObject );

            SplineCameraControlLord.EnqueueLookMovement(lookModule);
        }