コード例 #1
0
        /// <summary>
        /// Function used to set our animation parameters
        /// </summary>
        /// <param name="transition">Type of interpolation function to utilize</param>
        /// <param name="startPosition"> Our start position</param>
        /// <param name="endPosition">Our end position</param>
        /// <param name="durationInSeconds">How many seconds the animation should take</param>
        public void Animate(TypeOfTransition transition, Vector3 startPosition, Vector3 endPosition, double durationInSeconds)
        {
            currentTransition = transition;

            switch (kindOfAnimation)
            {
            case VariableToAnimate.floatValue:
                singleValueTweener = new Tweener(startPosition.X, endPosition.X, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                singleValueTweener.PositionChanged += delegate(float newPosition) { returnValue = new Vector3(newPosition, 0, 0); };
                break;

            case VariableToAnimate.Vector2Value:
                vectorTwoTweener = new Vector2Tweener(new Vector2(startPosition.X, startPosition.Y), new Vector2(endPosition.X, endPosition.Y), TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                vectorTwoTweener.PositionChanged += delegate(Vector2 newPosition) { returnValue = new Vector3(newPosition.X, newPosition.Y, 0); };
                break;

            case VariableToAnimate.Vector3Value:
                vector3Tweener = new Vector3Tweener(startPosition, endPosition, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                vector3Tweener.PositionChanged += delegate(Vector3 newPosition) { returnValue = newPosition; };
                break;

            default:
                vector3Tweener = new Vector3Tweener(startPosition, endPosition, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                vector3Tweener.PositionChanged += delegate(Vector3 newPosition) { returnValue = newPosition; };
                break;
            }
        }
コード例 #2
0
 public static float DefaultTransitionTimeFor(TypeOfTransition transitionType)
 {
     if (transitionType != TypeOfTransition.Cut)
     {
         return(2f);
     }
     return(0f);
 }
コード例 #3
0
        public static float DefaultTransitionTimeFor(TypeOfTransition transitionType)
        {
            switch (transitionType)
            {
            case TypeOfTransition.Cut:
                return(0.0f);

            default:
                return(2.0f);
            }
        }
コード例 #4
0
 public void InitializeTransition(Camera sourceCamera, Camera destinationCamera, List <Camera> additionalSourceCameras, List <Camera> additionalDestinationCameras, TypeOfTransition transitionType)
 {
     if (sourceCamera == null || destinationCamera == null)
     {
         Debug.LogError(string.Format("Cannot create a transition with sourceCamera({0}) and destinationCamera({1}), one of them is null", sourceCamera, destinationCamera));
     }
     this.renderMaterial = new Material(Resources.Load(string.Format("Transitions/WellFired{0}", transitionType.ToString()), typeof(Material)) as Material);
     if (this.renderMaterial == null)
     {
         Debug.LogError(string.Format("Couldn't load render material for {0}", transitionType));
     }
     this.sourceCamera                 = sourceCamera;
     this.destinationCamera            = destinationCamera;
     this.additionalSourceCameras      = additionalSourceCameras;
     this.additionalDestinationCameras = additionalDestinationCameras;
     this.prevIntroCameraState         = this.sourceCamera.enabled;
     this.prevOutroCameraState         = this.destinationCamera.enabled;
 }
コード例 #5
0
        /// <summary>
        /// Function used to set our animation parameters
        /// </summary>
        /// <param name="transition">Type of interpolation function to utilize</param>
        /// <param name="startPosition"> Our start position</param>
        /// <param name="endPosition">Our end position</param>
        /// <param name="durationInSeconds">How many seconds the animation should take</param>
        public void Animate(TypeOfTransition transition, Vector3 startPosition, Vector3 endPosition, double durationInSeconds)
        {
            currentTransition = transition;

            switch (kindOfAnimation)
            {
                case VariableToAnimate.floatValue:
                    singleValueTweener = new Tweener(startPosition.X, endPosition.X, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                    singleValueTweener.PositionChanged += delegate(float newPosition) { returnValue = new Vector3(newPosition, 0, 0); };
                    break;
                case VariableToAnimate.Vector2Value:
                    vectorTwoTweener = new Vector2Tweener(new Vector2(startPosition.X, startPosition.Y), new Vector2(endPosition.X, endPosition.Y), TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                    vectorTwoTweener.PositionChanged += delegate(Vector2 newPosition) { returnValue = new Vector3(newPosition.X, newPosition.Y, 0); };
                    break;

                case VariableToAnimate.Vector3Value:
                    vector3Tweener = new Vector3Tweener(startPosition, endPosition, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                    vector3Tweener.PositionChanged += delegate(Vector3 newPosition) { returnValue = newPosition;};
                    break;

                default:
                    vector3Tweener = new Vector3Tweener(startPosition, endPosition, TimeSpan.FromSeconds(durationInSeconds), GetTweeningFunction());
                    vector3Tweener.PositionChanged += delegate(Vector3 newPosition) { returnValue = newPosition;};
                    break;
            }
        }