diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f588942 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +_DOTween.Assembly/_ReSharper* +_DOTween.Assembly/bin_pro +_DOTween.Assembly/DOTweenPro* +_DOTween.Assembly/DOTween*/obj +_DOTween.Assembly/*.suo +_DOTween.Assembly/*.user +*.Unity*/_ReSharper* +*.Unity*/Library +*.Unity*/obj +*.Unity*/Temp +*.Unity*/*.csproj +*.Unity*/*.sln +*.Unity*/*.user +*.Unity*/*.suo +*.Unity*/*.userprefs +*.Unity*/Assets/Demigiant/DOTweenPro* \ No newline at end of file diff --git a/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.cs b/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.cs new file mode 100644 index 0000000..498ea65 --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.cs @@ -0,0 +1,45 @@ +using DG.Tweening; +using UnityEngine; + +public class CompatibilityTest : MonoBehaviour +{ + public Transform cubeCont; + public Transform[] cubes; + public GUITexture logo; + + Tween twSuccess; + bool success; + Color logoCol; + + void Start() + { + DOTween.Init(true); + Color c = logoCol = logo.color; + c.a = 0; + logo.color = c; + + // Create sequence + Sequence seq = DOTween.Sequence() + .SetLoops(-1, LoopType.Restart) + .OnStepComplete(Success); + seq.Append(cubeCont.DORotate(new Vector3(0, 720, 360), 2.25f).SetRelative().SetEase(Ease.Linear)); + foreach (Transform trans in cubes) { + Transform t = trans; + seq.Insert(0, t.DOScale(Vector3.one * 0.5f, 1f)); + seq.Insert(0, t.DOLocalMove(t.position * 8, 1f).SetEase(Ease.InQuint)); + seq.Insert(1, t.DOScale(Vector3.one * 0.5f, 1f)); + seq.Insert(1, t.DOLocalMove(t.position, 1f).SetEase(Ease.OutQuint)); + } + + // Create success tween + twSuccess = DOTween.To(()=> logo.color, x => logo.color = x, logoCol, 1.25f).Pause(); + } + + void Success() + { + if (success) return; + + success = true; + twSuccess.Play(); + } +} \ No newline at end of file diff --git a/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.unity b/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.unity new file mode 100644 index 0000000..60ff286 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/CompatibilityTest.unity differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML new file mode 100644 index 0000000..b562aa2 --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML @@ -0,0 +1,1906 @@ + + + + DOTween + + + + + Update type + + + + Updates every frame during Update calls + + + Updates every frame during LateUpdate calls + + + Updates using FixedUpdate calls + + + + Path mode (used to determine correct LookAt orientation) + + + + Ignores the path mode (and thus LookAt behaviour) + + + Regular 3D path + + + 2D top-down path + + + 2D side-scroller path + + + + Used internally + + + + + This class serves only as a utility class to store tween settings to apply on multiple tweens. + It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + + + + A variable you can eventually Clear and reuse when needed, + to avoid instantiating TweenParams objects + + + Creates a new TweenParams object, which you can use to store tween settings + to pass to multiple tweens via myTween.SetAs(myTweenParms) + + + Clears and resets this TweenParams instance using default values, + so it can be reused without instantiating another one + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function. + If applied to Sequences eases the whole sequence animation + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (default: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween reaches a new waypoint + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + + Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + Contains all instance-based methods + + + + + Used to allow method chaining with DOTween.Init + + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Controls other tweens as a group + + + + + Indicates either a Tweener or a Sequence + + + + Called the first time the tween is set in a playing state, after any eventual delay + + + TimeScale for the tween + + + If TRUE the tween wil go backwards + + + Id (usable for filtering with DOTween static methods). Can be an int, a string, an object, or anything else + + + Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shorcuts + + + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Called each time the tween updates + + + Called the moment the tween completes one loop cycle + + + Called the moment the tween reaches completion (loops included) + + + Called the moment the tween is killed + + + Called when a path tween's current waypoint changes + + + Gets and sets the time position (loops included, delays excluded) of the tween + + + + Rotation mode used with DORotate methods + + + + + Fastest way that never rotates beyond 360° + + + + + Fastest way that rotates beyond 360° + + + + + Adds the given rotation to the transform using world axis and an advanced precision mode + (like when using transform.Rotate(Space.World)). + In this mode the end value is is always considered relative + + + + + Adds the given rotation to the transform's local axis + (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + In this mode the end value is is always considered relative + + + + + This plugin generates some GC allocations at startup + + + + + Don't assign this! It's assigned automatically when creating 0 duration tweens + + + + + Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + + + + + Types of log behaviours + + + + Log only warnings and errors + + + Log warnings, errors and additional infos + + + Log only errors + + + + Methods that extend Tween objects and allow to set their parameters + + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot to use with Back ease (default is 1.70158) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual amplitude to use with Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + If applied to Sequences eases the whole sequence animation + + + Allows the tween to be recycled after being killed. + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (defalt: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onPlay callback for the tween. + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween's current waypoint changes + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + Has no effect if the tween has already started. + NOTE: the tween's target will not be changed + Tween from which to copy the parameters + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + Has no effect if the tween has already started. + TweenParams from which to copy the parameters + + + Adds the given tween to the end of the Sequence. + Has no effect if the Sequence has already started + The tween to append + + + Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The tween to prepend + + + Inserts the given tween at the same time position of the last tween added to the Sequence. + Has no effect if the Sequence has already started + + + Inserts the given tween at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the tween will be placed + The tween to insert + + + Adds the given interval to the end of the Sequence. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given callback to the end of the Sequence. + Has no effect if the Sequence has already started + The callback to append + + + Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The callback to prepend + + + Inserts the given callback at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the callback will be placed + The callback to insert + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + If TRUE the FROM value will be calculated as relative to the current one + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + Sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + Options for float tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Quaternion tweens + If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + + + Options for Color tweens + If TRUE only the alpha value of the color will be tweened + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL to use default ones + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Path tweens (created via the DOPath shortcut) + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Options for Path tweens (created via the DOPath shortcut) + If TRUE the path will be automatically closed + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target to the path, with the given lookAhead. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + + Methods that extend Tween objects and allow to control or get data from them + + + + Completes the tween + + + Flips the direction of this tween (backwards if it was going forward or viceversa) + + + Forces the tween to initialize its settings immediately + + + Send the tween to the given position in time + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Kills the tween + If TRUE completes the tween before killing it + + + Pauses the tween + + + Plays the tween + + + Sets the tween in a backwards direction and plays it + + + Sets the tween in a forward direction and plays it + + + Restarts the tween from the beginning + If TRUE includes the eventual tween delay, otherwise skips it + + + Rewinds the tween + If TRUE includes the eventual tween delay, otherwise skips it + + + Plays the tween if it was paused, pauses it if it was playing + + + Send a path tween to the given waypoint. + Has no effect if this is not a path tween. + BEWARE, this is a special utility method: + the lookAt direction might be wrong after calling this and might need to be set manually + (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + Waypoint index to reach + (if higher than the max waypoint index the tween will simply go to the last one) + If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + + + + Creates a yield instruction that waits until the tween is killed or complete. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForCompletion(); + + + + + Creates a yield instruction that waits until the tween is killed or rewinded. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForRewind(); + + + + + Creates a yield instruction that waits until the tween is killed. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForKill(); + + + + + Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForElapsedLoops(2); + + Elapsed loops to wait for + + + + Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForPosition(2.5f); + + Position (loops included, delays excluded) to wait for + + + + Creates a yield instruction that waits until the tween is killed or started + (meaning when the tween is set in a playing state the first time, after any eventual delay). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForStart(); + + + + Returns the total number of loops completed by this tween + + + Returns the eventual delay set for this tween + + + Returns the duration of this tween (delays excluded). + NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + If TRUE returns the full duration loops included, + otherwise the duration of a single loop cycle + + + Returns the elapsed time for this tween (delays exluded) + If TRUE returns the elapsed time since startup loops included, + otherwise the elapsed time within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + If TRUE returns the elapsed percentage since startup loops included, + otherwise the elapsed percentage within the current loop cycle + + + Returns FALSE if this tween has been killed. + BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + + + Returns TRUE if this tween was reversed and is set to go backwards + + + Returns TRUE if the tween is complete + (silently fails and returns FALSE if the tween has been killed) + + + Returns TRUE if this tween is playing + + + + Returns the length of a path (returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized). + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + + + + Used for tween callbacks + + + + + Used for tween callbacks + + + + + Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + Types of autoPlay behaviours + + + + No tween is automatically played + + + Only Sequences are automatically played + + + Only Tweeners are automatically played + + + All tweens are automatically played + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances + + + + Tweens an AudioSource's volume to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an AudioSource's pitch to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Camera's backgroundColor to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's color to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's intensity to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's shadowStrength to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a LineRenderer's color to the given value. + Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + Note that this method requires to also insert the start colors for the tween, + since LineRenderers have no way to get them. + The start value to tween from + The end value to reachThe duration of the tween + + + Tweens a Material's color to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named color property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named float property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Rigidbody's position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's X position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Y position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Z position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's rotation to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Rigidbody's rotation so that it will look towards the given position. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Tweens a TrailRenderer's startWidth/endWidth to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end startWidth to reachThe end endWidth to reach + The duration of the tween + + + Tweens a TrailRenderer's time to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's rotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localRotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's X localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Y localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Z localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's rotation so that it will look towards the given position. + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Punches a Transform's localPosition towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + The direction and strength of the punch (added to the Transform's current position) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the punch direction and the opposite direction, + while 0 oscillates only between the punch and the start position + If TRUE the tween will smoothly snap all values to integers + + + Punches a Transform's localScale towards the given size and then back to the starting one + as if it was connected to the starting scale via an elastic. + The punch strength (added to the Transform's current scale) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + 1 creates a full oscillation between the punch scale and the opposite scale, + while 0 oscillates only between the punch scale and the start scale + + + Punches a Transform's localRotation towards the given size and then back to the starting one + as if it was connected to the starting rotation via an elastic. + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoints to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoint to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + Type of path to use with DOPath tweens + + + + Linear, composed of straight segments between each waypoint + + + Curved path (which uses Catmull-Rom curves) + + + + Main DOTween class. Contains static methods to create and control tweens in a generic way + + + + DOTween's version + + + If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + Default: TRUE + + + If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + Beware, this will slightly slow down your tweens while inside Unity Editor. + Default: FALSE + + + Global DOTween timeScale. + Default: 1 + + + Default updateType for new tweens. + Default: UpdateType.Normal + + + Sets whether Unity's timeScale should be taken into account by default or not. + Default: false + + + Default autoPlay behaviour for new tweens. + Default: AutoPlay.All + + + Default autoKillOnComplete behaviour for new tweens. + Default: TRUE + + + Default loopType applied to all new tweens. + Default: LoopType.Restart + + + If TRUE all newly created tweens are set as recyclable, otherwise not. + Default: FALSE + + + Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + Default: Ease.InOutQuad + + + Default overshoot/amplitude used for eases + Default: 1.70158f + + + Default period used for eases + Default: 0 + + + + Must be called once, before the first ever DOTween call/reference, + otherwise it will be called automatically and will use default options. + Calling it a second time won't have any effect. + You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + + If TRUE all new tweens will be set for recycling, meaning that when killed, + instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + even if they were killed (since they might have been respawned and are now being used for other tweens). + If you want to automatically set your tween references to NULL when a tween is killed + you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + You can change this setting at any time by changing the static property, + or you can set the recycling behaviour for each tween separately, using: + SetRecyclable(bool recyclable) + Default: FALSE + If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + You can change this setting at any time by changing the static property. + Default: FALSE + Type of logging to use. + You can change this setting at any time by changing the static property. + Default: ErrorsOnly + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + + If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + (so that next time you use it it will need to be re-initialized) + + + + Clears all cached tween pools. + + + + + Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + and returns the total number of invalid tweens found and removed. + Automatically called when loading a new scene if is TRUE. + BEWARE: this is a slightly expensive operation so use it with care + + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using a custom plugin + The plugin to use. Each custom plugin implements a static Get() method + you'll need to call to assign the correct plugin in the correct way, like this: + CustomPlugin.Get() + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens only one axis of a Vector3 to the given value using default plugins. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + The axis to tween + + + Tweens only the alpha of a Color to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a virtual property from the given start to the given end value + and implements a setter that allows to use that value with an external method or a lambda + Example: + To(MyMethod, 0, 12, 0.5f); + Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + The action to perform with the tweened value + The value to start from + The end value to reach + The duration of the virtual tween + + + + Punches a Vector3 towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The direction and strength of the punch + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the direction and the opposite decaying direction, + while 0 oscillates only between the starting position and the decaying direction + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE only shakes on the X Y axis (looks better with things like cameras). + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + + + Tweens a property or field to the given values using default plugins. + Ease is applied between each segment and not as a whole. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end values to reach for each segment. This array must have the same length as durations + The duration of each segment. This array must have the same length as endValues + + + + Returns a new to be used for tween groups + + + + Completes all tweens and returns the number of actual tweens completed + (meaning tweens that don't have infinite loops and were not already complete) + + + Completes all tweens with the given ID or target and returns the number of actual tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + Flips all tweens (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + + + Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + and returns the actual tweens involved + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens with the given ID or target and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Pauses all tweens and returns the number of actual tweens paused + + + Pauses all tweens with the given ID or target and returns the number of actual tweens paused + (meaning the tweens that were actually playing and have been paused) + + + Plays all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing or complete) + + + Plays all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays backwards all tweens and returns the number of actual tweens played + (meaning tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays forward all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing forward or complete) + + + Restarts all tweens, then returns the number of actual tweens restarted + + + Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + + + Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + (meaning tweens that were not already rewinded) + + + Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + (meaning the tweens that were not already rewinded) + + + Toggles the play state of all tweens and returns the number of actual tweens toggled + (meaning tweens that could be played or paused, depending on the toggle state) + + + Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + (meaning the tweens that could be played or paused, depending on the toggle state) + + + + Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). + You can also use this to know if a shortcut tween is active for a given target. + Example: + transform.DOMoveX(45, 1); // transform is automatically added as the tween target + DOTween.IsTweening(transform); // Returns true + + + + + Returns the total number of active and playing tweens. + A tween is considered as playing even if its delay is actually playing + + + + + Returns a list of all active tweens in a playing state. + Returns NULL if there are no active playing tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens in a paused state. + Returns NULL if there are no active paused tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens with the given id. + Returns NULL if there are no active tweens with the given id. + Beware: each time you call this method a new list is generated + + + + + Returns a list of all active tweens with the given target. + Returns NULL if there are no active tweens with the given target. + Beware: each time you call this method a new list is generated + + + + DOTween's log behaviour. + Default: LogBehaviour.ErrorsOnly + + + + Path plugin works exclusively with Transforms + + + + + Types of loop + + + + Each loop cycle restarts from the beginning + + + The tween moves forward and backwards at alternate cycles + + + Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + In case of String tweens works only if the tween is set as relative + + + + Animates a single value + + + + Changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Creates virtual tweens that can be used to change other elements via their OnUpdate calls + + + + + Tweens a virtual float. + You can add regular settings to the generated tween, + but do not use SetUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type float, called at each update + + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Fires the given callback after the given time. + Callback delay + Callback to fire when the delay has expired + If TRUE (default) ignores Unity's timeScale + + + + Used to interpret AnimationCurves as eases. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Struct that stores two colors (used for LineRenderer tweens) + + + + + What axis to constrain in case of Vector tweens + + + + + Path control point + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a Vector3 with z = 0 + + + + + Returns the 2D angle between two vectors + + + + + Gets the point on the path at the given percentage (0 to 1) + + The percentage (0 to 1) at which to get the point + If TRUE constant speed is taken into account, otherwise not + + + + Public only so custom shortcuts can access some of these methods + + + + diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll new file mode 100644 index 0000000..842485e Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb new file mode 100644 index 0000000..7966c10 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll new file mode 100644 index 0000000..1c4d441 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb new file mode 100644 index 0000000..0c3b9cd Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml new file mode 100644 index 0000000..faa6a44 --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml @@ -0,0 +1,47 @@ + + + + DOTween43 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween43 methods, require Unity 4.3 or later. + + + + Tweens a SpriteRenderer's color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's alpha color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Rigidbody2D's position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's X position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's Y position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's rotation to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll new file mode 100644 index 0000000..ca86829 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb new file mode 100644 index 0000000..44d0a29 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.xml b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.xml new file mode 100644 index 0000000..d630ed1 --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.xml @@ -0,0 +1,120 @@ + + + + DOTween46 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween46 methods, require Unity 4.6 or later. + + + + Tweens a CanvasGroup's alpha color to the given value. + Also stores the canvasGroup as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's fillAmount to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an LayoutElement's flexibleWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's minWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's preferredWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Outline's effectColor to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectColor alpha to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectDistance to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a RectTransform's anchoredPosition to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's anchoredPosition3D to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's sizeDelta to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Slider's value to the given value. + Also stores the Slider as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Text's color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's alpha color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's text to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end string to tween toThe duration of the tween + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL (default) to use default ones + + + diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML new file mode 100644 index 0000000..09c788c --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML @@ -0,0 +1,60 @@ + + + + DOTweenEditor + + + + + Not used as menu item anymore, but as a utiity function + + + + + Setups DOTween + + If TRUE, no warning window appears in case there is no need for setup + + + + Checks that the given editor texture use the correct import settings, + and applies them if they're incorrect. + + + + + Returns TRUE if addons setup is required. + + + + + Returns TRUE if the file/directory at the given path exists. + + Path, relative to Unity's project folder + + + + + Converts the given project-relative path to a full path, + with backward (\) slashes). + + + + + Converts the given full path to a path usable with AssetDatabase methods + (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + + + + + Connects to a asset. + If the asset already exists at the given path, loads it and returns it. + Otherwise, either returns NULL or automatically creates it before loading and returning it + (depending on the given parameters). + + Asset type + File path (relative to Unity's project folder) + If TRUE and the requested asset doesn't exist, forces its creation + + + diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll new file mode 100644 index 0000000..a19c6e8 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb new file mode 100644 index 0000000..eac2d43 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png new file mode 100644 index 0000000..d06fc7c Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png new file mode 100644 index 0000000..e29d02f Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png new file mode 100644 index 0000000..e48db5e Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg new file mode 100644 index 0000000..4d710d7 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/readme.txt b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/readme.txt new file mode 100644 index 0000000..3439db1 --- /dev/null +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/readme.txt @@ -0,0 +1,18 @@ +DOTween and DOTween Pro are copyright (c) 2014 Daniele Giardini - Demigiant + +// GET STARTED ////////////////////////////////////////////// + +- After importing a new DOTween update, select DOTween's Utility Panel from the Tools menu (if it doesn't open automatically) and press the "Setup DOTween..." button to set up additional features based on your Unity version. +- In your code, add "using DG.Tweening" to each class where you want to use DOTween. +- You're ready to tween. Check out the links below for full documentation and license info. + + +// LINKS /////////////////////////////////////////////////////// + +DOTween website (documentation, examples, etc): http://dotween.demigiant.com +DOTween license: http://dotween.demigiant.com/license.php +DOTween repository (Google Code): https://code.google.com/p/dotween/ + +// NOTES ////////////////////////////////////////////////////// + +- DOTween's Utility Panel can be found under "Tools > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences \ No newline at end of file diff --git a/UnityCompatibilityTests.Unity35/Assets/dotween_logo.png b/UnityCompatibilityTests.Unity35/Assets/dotween_logo.png new file mode 100644 index 0000000..1b5f710 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/dotween_logo.png differ diff --git a/UnityCompatibilityTests.Unity35/Assets/test MAT.mat b/UnityCompatibilityTests.Unity35/Assets/test MAT.mat new file mode 100644 index 0000000..eaa0e4d Binary files /dev/null and b/UnityCompatibilityTests.Unity35/Assets/test MAT.mat differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/AudioManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..1f7efb3 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/AudioManager.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/DynamicsManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..27f0cdc Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/DynamicsManager.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/EditorBuildSettings.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..727b1f3 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/EditorBuildSettings.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/EditorSettings.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..ba0e8de Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/EditorSettings.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/InputManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..c330ada Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/InputManager.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/NavMeshLayers.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/NavMeshLayers.asset new file mode 100644 index 0000000..abc1099 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/NavMeshLayers.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/NetworkManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..9e81f42 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/NetworkManager.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/ProjectSettings.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..15f0df5 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/ProjectSettings.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/QualitySettings.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..9f50044 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/QualitySettings.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/TagManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..f43d657 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/TagManager.asset differ diff --git a/UnityCompatibilityTests.Unity35/ProjectSettings/TimeManager.asset b/UnityCompatibilityTests.Unity35/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..7ac6f97 Binary files /dev/null and b/UnityCompatibilityTests.Unity35/ProjectSettings/TimeManager.asset differ diff --git a/UnityTests.Unity4/Assets/Demigiant.meta b/UnityTests.Unity4/Assets/Demigiant.meta new file mode 100644 index 0000000..8a58321 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cb9375ae14b7c6d4da5d6f1482cb5d29 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween.meta new file mode 100644 index 0000000..8bcf43b --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ad88d42122718d342a246e7d8d8c9983 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML new file mode 100644 index 0000000..b562aa2 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML @@ -0,0 +1,1906 @@ + + + + DOTween + + + + + Update type + + + + Updates every frame during Update calls + + + Updates every frame during LateUpdate calls + + + Updates using FixedUpdate calls + + + + Path mode (used to determine correct LookAt orientation) + + + + Ignores the path mode (and thus LookAt behaviour) + + + Regular 3D path + + + 2D top-down path + + + 2D side-scroller path + + + + Used internally + + + + + This class serves only as a utility class to store tween settings to apply on multiple tweens. + It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + + + + A variable you can eventually Clear and reuse when needed, + to avoid instantiating TweenParams objects + + + Creates a new TweenParams object, which you can use to store tween settings + to pass to multiple tweens via myTween.SetAs(myTweenParms) + + + Clears and resets this TweenParams instance using default values, + so it can be reused without instantiating another one + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function. + If applied to Sequences eases the whole sequence animation + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (default: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween reaches a new waypoint + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + + Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + Contains all instance-based methods + + + + + Used to allow method chaining with DOTween.Init + + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Controls other tweens as a group + + + + + Indicates either a Tweener or a Sequence + + + + Called the first time the tween is set in a playing state, after any eventual delay + + + TimeScale for the tween + + + If TRUE the tween wil go backwards + + + Id (usable for filtering with DOTween static methods). Can be an int, a string, an object, or anything else + + + Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shorcuts + + + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Called each time the tween updates + + + Called the moment the tween completes one loop cycle + + + Called the moment the tween reaches completion (loops included) + + + Called the moment the tween is killed + + + Called when a path tween's current waypoint changes + + + Gets and sets the time position (loops included, delays excluded) of the tween + + + + Rotation mode used with DORotate methods + + + + + Fastest way that never rotates beyond 360° + + + + + Fastest way that rotates beyond 360° + + + + + Adds the given rotation to the transform using world axis and an advanced precision mode + (like when using transform.Rotate(Space.World)). + In this mode the end value is is always considered relative + + + + + Adds the given rotation to the transform's local axis + (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + In this mode the end value is is always considered relative + + + + + This plugin generates some GC allocations at startup + + + + + Don't assign this! It's assigned automatically when creating 0 duration tweens + + + + + Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + + + + + Types of log behaviours + + + + Log only warnings and errors + + + Log warnings, errors and additional infos + + + Log only errors + + + + Methods that extend Tween objects and allow to set their parameters + + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot to use with Back ease (default is 1.70158) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual amplitude to use with Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + If applied to Sequences eases the whole sequence animation + + + Allows the tween to be recycled after being killed. + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (defalt: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onPlay callback for the tween. + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween's current waypoint changes + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + Has no effect if the tween has already started. + NOTE: the tween's target will not be changed + Tween from which to copy the parameters + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + Has no effect if the tween has already started. + TweenParams from which to copy the parameters + + + Adds the given tween to the end of the Sequence. + Has no effect if the Sequence has already started + The tween to append + + + Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The tween to prepend + + + Inserts the given tween at the same time position of the last tween added to the Sequence. + Has no effect if the Sequence has already started + + + Inserts the given tween at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the tween will be placed + The tween to insert + + + Adds the given interval to the end of the Sequence. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given callback to the end of the Sequence. + Has no effect if the Sequence has already started + The callback to append + + + Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The callback to prepend + + + Inserts the given callback at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the callback will be placed + The callback to insert + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + If TRUE the FROM value will be calculated as relative to the current one + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + Sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + Options for float tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Quaternion tweens + If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + + + Options for Color tweens + If TRUE only the alpha value of the color will be tweened + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL to use default ones + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Path tweens (created via the DOPath shortcut) + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Options for Path tweens (created via the DOPath shortcut) + If TRUE the path will be automatically closed + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target to the path, with the given lookAhead. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + + Methods that extend Tween objects and allow to control or get data from them + + + + Completes the tween + + + Flips the direction of this tween (backwards if it was going forward or viceversa) + + + Forces the tween to initialize its settings immediately + + + Send the tween to the given position in time + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Kills the tween + If TRUE completes the tween before killing it + + + Pauses the tween + + + Plays the tween + + + Sets the tween in a backwards direction and plays it + + + Sets the tween in a forward direction and plays it + + + Restarts the tween from the beginning + If TRUE includes the eventual tween delay, otherwise skips it + + + Rewinds the tween + If TRUE includes the eventual tween delay, otherwise skips it + + + Plays the tween if it was paused, pauses it if it was playing + + + Send a path tween to the given waypoint. + Has no effect if this is not a path tween. + BEWARE, this is a special utility method: + the lookAt direction might be wrong after calling this and might need to be set manually + (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + Waypoint index to reach + (if higher than the max waypoint index the tween will simply go to the last one) + If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + + + + Creates a yield instruction that waits until the tween is killed or complete. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForCompletion(); + + + + + Creates a yield instruction that waits until the tween is killed or rewinded. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForRewind(); + + + + + Creates a yield instruction that waits until the tween is killed. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForKill(); + + + + + Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForElapsedLoops(2); + + Elapsed loops to wait for + + + + Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForPosition(2.5f); + + Position (loops included, delays excluded) to wait for + + + + Creates a yield instruction that waits until the tween is killed or started + (meaning when the tween is set in a playing state the first time, after any eventual delay). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForStart(); + + + + Returns the total number of loops completed by this tween + + + Returns the eventual delay set for this tween + + + Returns the duration of this tween (delays excluded). + NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + If TRUE returns the full duration loops included, + otherwise the duration of a single loop cycle + + + Returns the elapsed time for this tween (delays exluded) + If TRUE returns the elapsed time since startup loops included, + otherwise the elapsed time within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + If TRUE returns the elapsed percentage since startup loops included, + otherwise the elapsed percentage within the current loop cycle + + + Returns FALSE if this tween has been killed. + BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + + + Returns TRUE if this tween was reversed and is set to go backwards + + + Returns TRUE if the tween is complete + (silently fails and returns FALSE if the tween has been killed) + + + Returns TRUE if this tween is playing + + + + Returns the length of a path (returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized). + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + + + + Used for tween callbacks + + + + + Used for tween callbacks + + + + + Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + Types of autoPlay behaviours + + + + No tween is automatically played + + + Only Sequences are automatically played + + + Only Tweeners are automatically played + + + All tweens are automatically played + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances + + + + Tweens an AudioSource's volume to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an AudioSource's pitch to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Camera's backgroundColor to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's color to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's intensity to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's shadowStrength to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a LineRenderer's color to the given value. + Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + Note that this method requires to also insert the start colors for the tween, + since LineRenderers have no way to get them. + The start value to tween from + The end value to reachThe duration of the tween + + + Tweens a Material's color to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named color property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named float property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Rigidbody's position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's X position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Y position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Z position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's rotation to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Rigidbody's rotation so that it will look towards the given position. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Tweens a TrailRenderer's startWidth/endWidth to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end startWidth to reachThe end endWidth to reach + The duration of the tween + + + Tweens a TrailRenderer's time to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's rotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localRotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's X localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Y localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Z localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's rotation so that it will look towards the given position. + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Punches a Transform's localPosition towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + The direction and strength of the punch (added to the Transform's current position) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the punch direction and the opposite direction, + while 0 oscillates only between the punch and the start position + If TRUE the tween will smoothly snap all values to integers + + + Punches a Transform's localScale towards the given size and then back to the starting one + as if it was connected to the starting scale via an elastic. + The punch strength (added to the Transform's current scale) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + 1 creates a full oscillation between the punch scale and the opposite scale, + while 0 oscillates only between the punch scale and the start scale + + + Punches a Transform's localRotation towards the given size and then back to the starting one + as if it was connected to the starting rotation via an elastic. + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoints to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoint to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + Type of path to use with DOPath tweens + + + + Linear, composed of straight segments between each waypoint + + + Curved path (which uses Catmull-Rom curves) + + + + Main DOTween class. Contains static methods to create and control tweens in a generic way + + + + DOTween's version + + + If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + Default: TRUE + + + If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + Beware, this will slightly slow down your tweens while inside Unity Editor. + Default: FALSE + + + Global DOTween timeScale. + Default: 1 + + + Default updateType for new tweens. + Default: UpdateType.Normal + + + Sets whether Unity's timeScale should be taken into account by default or not. + Default: false + + + Default autoPlay behaviour for new tweens. + Default: AutoPlay.All + + + Default autoKillOnComplete behaviour for new tweens. + Default: TRUE + + + Default loopType applied to all new tweens. + Default: LoopType.Restart + + + If TRUE all newly created tweens are set as recyclable, otherwise not. + Default: FALSE + + + Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + Default: Ease.InOutQuad + + + Default overshoot/amplitude used for eases + Default: 1.70158f + + + Default period used for eases + Default: 0 + + + + Must be called once, before the first ever DOTween call/reference, + otherwise it will be called automatically and will use default options. + Calling it a second time won't have any effect. + You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + + If TRUE all new tweens will be set for recycling, meaning that when killed, + instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + even if they were killed (since they might have been respawned and are now being used for other tweens). + If you want to automatically set your tween references to NULL when a tween is killed + you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + You can change this setting at any time by changing the static property, + or you can set the recycling behaviour for each tween separately, using: + SetRecyclable(bool recyclable) + Default: FALSE + If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + You can change this setting at any time by changing the static property. + Default: FALSE + Type of logging to use. + You can change this setting at any time by changing the static property. + Default: ErrorsOnly + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + + If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + (so that next time you use it it will need to be re-initialized) + + + + Clears all cached tween pools. + + + + + Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + and returns the total number of invalid tweens found and removed. + Automatically called when loading a new scene if is TRUE. + BEWARE: this is a slightly expensive operation so use it with care + + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using a custom plugin + The plugin to use. Each custom plugin implements a static Get() method + you'll need to call to assign the correct plugin in the correct way, like this: + CustomPlugin.Get() + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens only one axis of a Vector3 to the given value using default plugins. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + The axis to tween + + + Tweens only the alpha of a Color to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a virtual property from the given start to the given end value + and implements a setter that allows to use that value with an external method or a lambda + Example: + To(MyMethod, 0, 12, 0.5f); + Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + The action to perform with the tweened value + The value to start from + The end value to reach + The duration of the virtual tween + + + + Punches a Vector3 towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The direction and strength of the punch + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the direction and the opposite decaying direction, + while 0 oscillates only between the starting position and the decaying direction + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE only shakes on the X Y axis (looks better with things like cameras). + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + + + Tweens a property or field to the given values using default plugins. + Ease is applied between each segment and not as a whole. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end values to reach for each segment. This array must have the same length as durations + The duration of each segment. This array must have the same length as endValues + + + + Returns a new to be used for tween groups + + + + Completes all tweens and returns the number of actual tweens completed + (meaning tweens that don't have infinite loops and were not already complete) + + + Completes all tweens with the given ID or target and returns the number of actual tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + Flips all tweens (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + + + Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + and returns the actual tweens involved + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens with the given ID or target and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Pauses all tweens and returns the number of actual tweens paused + + + Pauses all tweens with the given ID or target and returns the number of actual tweens paused + (meaning the tweens that were actually playing and have been paused) + + + Plays all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing or complete) + + + Plays all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays backwards all tweens and returns the number of actual tweens played + (meaning tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays forward all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing forward or complete) + + + Restarts all tweens, then returns the number of actual tweens restarted + + + Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + + + Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + (meaning tweens that were not already rewinded) + + + Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + (meaning the tweens that were not already rewinded) + + + Toggles the play state of all tweens and returns the number of actual tweens toggled + (meaning tweens that could be played or paused, depending on the toggle state) + + + Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + (meaning the tweens that could be played or paused, depending on the toggle state) + + + + Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). + You can also use this to know if a shortcut tween is active for a given target. + Example: + transform.DOMoveX(45, 1); // transform is automatically added as the tween target + DOTween.IsTweening(transform); // Returns true + + + + + Returns the total number of active and playing tweens. + A tween is considered as playing even if its delay is actually playing + + + + + Returns a list of all active tweens in a playing state. + Returns NULL if there are no active playing tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens in a paused state. + Returns NULL if there are no active paused tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens with the given id. + Returns NULL if there are no active tweens with the given id. + Beware: each time you call this method a new list is generated + + + + + Returns a list of all active tweens with the given target. + Returns NULL if there are no active tweens with the given target. + Beware: each time you call this method a new list is generated + + + + DOTween's log behaviour. + Default: LogBehaviour.ErrorsOnly + + + + Path plugin works exclusively with Transforms + + + + + Types of loop + + + + Each loop cycle restarts from the beginning + + + The tween moves forward and backwards at alternate cycles + + + Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + In case of String tweens works only if the tween is set as relative + + + + Animates a single value + + + + Changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Creates virtual tweens that can be used to change other elements via their OnUpdate calls + + + + + Tweens a virtual float. + You can add regular settings to the generated tween, + but do not use SetUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type float, called at each update + + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Fires the given callback after the given time. + Callback delay + Callback to fire when the delay has expired + If TRUE (default) ignores Unity's timeScale + + + + Used to interpret AnimationCurves as eases. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Struct that stores two colors (used for LineRenderer tweens) + + + + + What axis to constrain in case of Vector tweens + + + + + Path control point + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a Vector3 with z = 0 + + + + + Returns the 2D angle between two vectors + + + + + Gets the point on the path at the given percentage (0 to 1) + + The percentage (0 to 1) at which to get the point + If TRUE constant speed is taken into account, otherwise not + + + + Public only so custom shortcuts can access some of these methods + + + + diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML.meta new file mode 100644 index 0000000..4b6638a --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 32d3af87ee00b2540b93b3d175025be1 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll new file mode 100644 index 0000000..842485e Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb new file mode 100644 index 0000000..7966c10 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta new file mode 100644 index 0000000..51f33fb --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 75fba9607a513b64984db6d29f41986c +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.meta new file mode 100644 index 0000000..c5d101b --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6cc6d4d0f1606b041be016a1b3105a6e +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll new file mode 100644 index 0000000..1c4d441 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb new file mode 100644 index 0000000..0c3b9cd Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta new file mode 100644 index 0000000..74052c0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 589b8271dd960624a8620bca5ed778db +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.meta new file mode 100644 index 0000000..4147042 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cc98104edfc2736418636b4b8c0e3b0b +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml new file mode 100644 index 0000000..faa6a44 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml @@ -0,0 +1,47 @@ + + + + DOTween43 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween43 methods, require Unity 4.3 or later. + + + + Tweens a SpriteRenderer's color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's alpha color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Rigidbody2D's position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's X position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's Y position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's rotation to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml.meta new file mode 100644 index 0000000..21f2061 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6e08c600d5d981242b5d3c1d825106d6 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll new file mode 100644 index 0000000..ca86829 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb new file mode 100644 index 0000000..44d0a29 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta new file mode 100644 index 0000000..bcd85aa --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 773153d471589be45acb355405a2bcf5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.meta new file mode 100644 index 0000000..e33f4ff --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: da65c15675bf19f4c953026614098b09 +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml new file mode 100644 index 0000000..d630ed1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml @@ -0,0 +1,120 @@ + + + + DOTween46 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween46 methods, require Unity 4.6 or later. + + + + Tweens a CanvasGroup's alpha color to the given value. + Also stores the canvasGroup as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's fillAmount to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an LayoutElement's flexibleWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's minWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's preferredWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Outline's effectColor to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectColor alpha to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectDistance to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a RectTransform's anchoredPosition to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's anchoredPosition3D to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's sizeDelta to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Slider's value to the given value. + Also stores the Slider as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Text's color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's alpha color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's text to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end string to tween toThe duration of the tween + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL (default) to use default ones + + + diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml.meta new file mode 100644 index 0000000..e858ba5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d27835d6231b6aa48841c3f8b2214fa8 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor.meta new file mode 100644 index 0000000..1059025 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3500705e15d89ff43a4ee7740f47688f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML new file mode 100644 index 0000000..09c788c --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML @@ -0,0 +1,60 @@ + + + + DOTweenEditor + + + + + Not used as menu item anymore, but as a utiity function + + + + + Setups DOTween + + If TRUE, no warning window appears in case there is no need for setup + + + + Checks that the given editor texture use the correct import settings, + and applies them if they're incorrect. + + + + + Returns TRUE if addons setup is required. + + + + + Returns TRUE if the file/directory at the given path exists. + + Path, relative to Unity's project folder + + + + + Converts the given project-relative path to a full path, + with backward (\) slashes). + + + + + Converts the given full path to a path usable with AssetDatabase methods + (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + + + + + Connects to a asset. + If the asset already exists at the given path, loads it and returns it. + Otherwise, either returns NULL or automatically creates it before loading and returning it + (depending on the given parameters). + + Asset type + File path (relative to Unity's project folder) + If TRUE and the requested asset doesn't exist, forces its creation + + + diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta new file mode 100644 index 0000000..1481eb6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b1520efae3508be4a84aa316d04fc675 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll new file mode 100644 index 0000000..a19c6e8 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb new file mode 100644 index 0000000..eac2d43 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta new file mode 100644 index 0000000..43400aa --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f485bbcdc045cfb46ad37827b2f24d67 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta new file mode 100644 index 0000000..c076613 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 15321a018ba7b9f49a6442a41ee5dc70 +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta new file mode 100644 index 0000000..ea36eae --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a09669494da114f4fb79d0b583615396 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs.meta new file mode 100644 index 0000000..47e1b49 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b7c3cf2b694a2ab4d8e1b5a45b028052 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png new file mode 100644 index 0000000..d06fc7c Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta new file mode 100644 index 0000000..d0fd73a --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: b51ee612bc8b58e45b114f4f88219aa4 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 128 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png new file mode 100644 index 0000000..e29d02f Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta new file mode 100644 index 0000000..76dc75c --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: cbbac93ae244da644b3399f418baca2c +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 256 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png new file mode 100644 index 0000000..e48db5e Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta new file mode 100644 index 0000000..1dd185d --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 47b1c758170446e478d8369151ad68c0 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg new file mode 100644 index 0000000..4d710d7 Binary files /dev/null and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta new file mode 100644 index 0000000..9a96b8c --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: c75c360efddf317489499b0b8acad6be +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt b/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt new file mode 100644 index 0000000..3439db1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt @@ -0,0 +1,18 @@ +DOTween and DOTween Pro are copyright (c) 2014 Daniele Giardini - Demigiant + +// GET STARTED ////////////////////////////////////////////// + +- After importing a new DOTween update, select DOTween's Utility Panel from the Tools menu (if it doesn't open automatically) and press the "Setup DOTween..." button to set up additional features based on your Unity version. +- In your code, add "using DG.Tweening" to each class where you want to use DOTween. +- You're ready to tween. Check out the links below for full documentation and license info. + + +// LINKS /////////////////////////////////////////////////////// + +DOTween website (documentation, examples, etc): http://dotween.demigiant.com +DOTween license: http://dotween.demigiant.com/license.php +DOTween repository (Google Code): https://code.google.com/p/dotween/ + +// NOTES ////////////////////////////////////////////////////// + +- DOTween's Utility Panel can be found under "Tools > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt.meta b/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt.meta new file mode 100644 index 0000000..1c3d85b --- /dev/null +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/readme.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d528b87e51999eb4bb9bb1050815c97d +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice.meta b/UnityTests.Unity4/Assets/Dice.meta new file mode 100644 index 0000000..a7449c1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9208a251d3a0ed245a2207b7959b44b0 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt b/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt new file mode 100644 index 0000000..57a3f64 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt @@ -0,0 +1,48 @@ +INSTALLATION FROM UNITY ASSET STORE + +After you download and import this package from the Unity Asset Store, this product, containing the fully scripted and functional dice, will be automaticly installed. + +INSTALLATION AFTER DOWNLOAD FROM WWW.WYRMTALE.COM WEBSITE + +After you have downloaded the component archive file (Dices-Light.rar) you will find a Dices-Light.unitypackage when you extract the files from the archive. + +To install this package : + +- create an empty Unity Project. +- select [Menu] Assets->Import Package +- select the extracted Dices-Light.unitypackage and import all assets. + +After importing is complete, you will be ready to go. + +---------------- + +!!IMPORTANT!! - Set you project gravity to [-60] for the best rolling physics simulation behaviour +[Menu] Edit->Project Settings->Physics + + +USAGE + +Under [Project] Dice->Resources->Prefabs , you will find the full scripted and textured dice prefabs that you +can use in your project. The prefabs already have collider and rigid body components. + +If you would want to change physics behaviour you could alter the physics material that all dice use. This physics material can be found at [Project] Dice->Materials->general = 'dice-material' + +Each prefab has a Class Die (subclassed) script that contains a 'value' attribute that displays the 'side-up' value at all times. + +Under [Project] Dice->Plugins, you find a Dice.cs script file that holds some static 'helper' methods that you can use to roll dice and calculate or display the values. + +Under [Project] Dice->Scenes->Demo you will find the demo scene that makes use of the static helper functions. + +All c# code in this project has 'inline' code documentation. + +---------------- + +If you have any questions regarding this product send us an email at +support@wyrmtale.com + + + +Thanks for you interest in our components + + The WyrmTale Team. + diff --git a/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt.meta b/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt.meta new file mode 100644 index 0000000..d879931 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/-Read-Me-.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3c108f41fea98c449ae540d327852ac2 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Materials.meta b/UnityTests.Unity4/Assets/Dice/Materials.meta new file mode 100644 index 0000000..c7ddd70 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2c042466e7fa4ef43a6ae76ff8e1692f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Materials/d6.meta b/UnityTests.Unity4/Assets/Dice/Materials/d6.meta new file mode 100644 index 0000000..ccb15ea --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Materials/d6.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ea1263503347eb34ea2604b95084ea6f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat b/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat new file mode 100644 index 0000000..0242bec Binary files /dev/null and b/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat differ diff --git a/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat.meta b/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat.meta new file mode 100644 index 0000000..b5fefe1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Materials/d6/d6-white-dots.mat.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 90eb9b65faccf864a8ec41e32802c85c +labels: +- d6 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs.meta b/UnityTests.Unity4/Assets/Dice/Prefabs.meta new file mode 100644 index 0000000..07ed7c0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Prefabs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7b6b8bf2adac7f148a19f09b7dba5a76 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab b/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab new file mode 100644 index 0000000..e9bd728 Binary files /dev/null and b/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab differ diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab.meta b/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab.meta new file mode 100644 index 0000000..b42b669 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Prefabs/Dice.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c79f2f6981de7cd469e2dce06afe35c7 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX.meta b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX.meta new file mode 100644 index 0000000..992a655 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 37ba839696bf2ba41a1585af770bb7f1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx new file mode 100644 index 0000000..296c215 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx @@ -0,0 +1,3155 @@ +; FBX 6.1.0 project file +; Created by Blender FBX Exporter +; for support mail: ideasman42@gmail.com +; ---------------------------------------------------- + +FBXHeaderExtension: { + FBXHeaderVersion: 1003 + FBXVersion: 6100 + CreationTimeStamp: { + Version: 1000 + Year: 2010 + Month: 12 + Day: 31 + Hour: 12 + Minute: 43 + Second: 09 + Millisecond: 0 + } + Creator: "FBX SDK/FBX Plugins build 20070228" + OtherFlags: { + FlagPLE: 0 + } +} +CreationTime: "2010-12-31 12:43:09:000" +Creator: "Blender version 2.55 (sub 0)" + +; Object definitions +;------------------------------------------------------------------ + +Definitions: { + Version: 100 + Count: 22 + ObjectType: "Model" { + Count: 13 + } + ObjectType: "Geometry" { + Count: 4 + } + ObjectType: "Material" { + Count: 4 + } + ObjectType: "Texture" { + Count: 2 + } + ObjectType: "Video" { + Count: 2 + } + ObjectType: "Pose" { + Count: 1 + } + ObjectType: "GlobalSettings" { + Count: 1 + } +} + +; Object properties +;------------------------------------------------------------------ + +Objects: { + Model: "Model::Camera Switcher", "CameraSwitcher" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Camera Index", "Integer", "A+",100 + } + MultiLayer: 0 + MultiTake: 1 + Hidden: "True" + Shading: W + Culling: "CullingOff" + Version: 101 + Name: "Model::Camera Switcher" + CameraId: 0 + CameraName: 100 + CameraIndexName: + } + Model: "Model::blend_root", "Null" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + TypeFlags: "Null" + } + Model: "Model::d10Low", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 0.000750,0.011625,1.612802,-1.620013,-0.528873,0.149860,0.017342,-1.699249,0.149860,1.578616,0.528534,-0.137692,0.000118,1.669586,-0.137692,1.594383,-0.484776,0.138533,0.972043,1.360849,0.143062 + ,-0.975570,1.339298,0.143041,-1.618205,0.530150,-0.146483,1.024217,-1.365776,-0.152291,-0.983349,-1.376488,-0.152284,0.009668,0.015116,-1.610717 + PolygonVertexIndex: 0,7,8,-2,0,6,4,-8,0,5,3,-7,0,2,9,-6,0,1,10,-3,1,8,11,-11,2,10,11,-10,5,9,11,-4,6,3,11,-5,7,4,11,-9 + Edges: 0,2,0,1,8,11,9,11,10,11,7,8,5,9,3,11,1,10,3,5,2,9,1,8,4,7 + ,2,10,3,6,4,6,4,11,0,6,0,7,0,5 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.006591998040676,0.012024292722344,0.999877929687500,-0.892696917057037,-0.287820070981979,0.346720784902573 + ,0.012939848005772,-0.937406539916992,0.347972035408020,0.890438556671143,0.305246144533157,-0.337473690509796 + ,0.000610370188951,0.941648602485657,-0.336588650941849,0.901242077350616,-0.263649404048920,0.343791007995605 + ,0.547013759613037,0.764488637447357,0.341044336557388,-0.542649626731873,0.766838610172272,0.342692345380783 + ,-0.887875020503998,0.304971456527710,-0.344431906938553,0.572923958301544,-0.743064641952515,-0.345835745334625 + ,-0.545854032039642,-0.761192679405212,-0.350108325481415,0.008911404758692,0.013702810741961,-0.999847412109375 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.262641,0.384300,0.381728,0.624013,0.264874,0.681146,0.142234,0.628914,0.448802,0.553664,0.324241,0.302287,0.446706,0.248573 + ,0.570490,0.302401,0.852791,0.933422,0.733158,0.681154,0.854822,0.630760,0.977318,0.684656,0.505522,0.955324,0.381581,0.707416 + ,0.505500,0.651899,0.626649,0.709335,0.147976,0.966032,0.020675,0.717623,0.145525,0.661723,0.270423,0.714939,0.142212,0.246712 + ,0.267820,0.303016,0.141835,0.554794,0.016284,0.303097,0.605807,0.671740,0.481671,0.616130,0.606368,0.366102,0.731284,0.616439 + ,0.678718,0.979700,0.551989,0.928908,0.679227,0.677116,0.799452,0.927098,0.782111,0.246292,0.902442,0.301806,0.776366,0.545822 + ,0.660708,0.296323,0.315838,0.982302,0.194916,0.929357,0.317625,0.684493,0.439577,0.934429 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + Materials: 0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + } + Model: "Model::d10", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: -0.139987,0.055448,1.516454,-1.028753,1.260882,0.186687,-1.605425,0.523939,-0.083602,-1.613689,-0.433901,0.192402,0.000125,0.158906,1.514090,0.879220,1.383134,0.186860,0.000662,1.655530,-0.073787 + ,-0.883211,1.363086,0.187380,0.141427,0.058792,1.514007,1.586040,-0.389634,0.182364,1.566364,0.524210,-0.073032,1.022350,1.279983,0.187098,0.087939,-0.106873,1.517277,0.105045,-1.663498,0.191895 + ,1.014767,-1.355213,-0.089797,1.537226,-0.560305,0.181925,-0.085039,-0.108415,1.519401,-1.558262,-0.600657,0.191948,-0.977596,-1.368303,-0.086092,-0.070857,-1.664173,0.191693,-1.608615,-0.524767,0.085698 + ,-1.611870,0.435809,-0.188874,-0.130207,-0.031510,-1.517143,-1.034822,-1.296821,-0.194265,0.017676,-1.688349,0.084462,-0.891239,-1.399198,-0.194063,0.011008,-0.132948,-1.517346,0.932732,-1.389304,-0.194210 + ,1.583630,-0.482929,0.072372,1.071010,-1.281975,-0.194972,0.150500,-0.030835,-1.514207,1.573212,0.433700,-0.181782,0.963819,1.349612,0.079383,1.517057,0.601532,-0.181793,0.095683,0.134517,-1.511520 + ,0.088844,1.634364,-0.181477,-0.970709,1.330503,0.075953,-0.087551,1.632649,-0.181729,-0.078141,0.133456,-1.514246,-1.553747,0.601164,-0.188940 + PolygonVertexIndex: 0,1,2,-4,6,7,4,-6,10,11,8,-10,14,15,12,-14,18,19,16,-18,22,23,20,-22,26,27,24,-26,30,31,28,-30,34,35,32,-34,38,39,36,-38,0,4,7,-2,39,2,1,-37,16,0,3,-18 + ,2,21,20,-4,11,5,4,-9,5,32,35,-7,36,7,6,-38,15,9,8,-13,9,28,31,-11,32,11,10,-34,19,13,12,-17,27,14,13,-25,14,29,28,-16,23,18,17,-21,18,25,24,-20,38,22,21,-40 + ,22,26,25,-24,26,30,29,-28,30,34,33,-32,34,38,37,-36,8,0,16,-13,3,20,-18,13,19,-25,10,31,-34,6,35,-38,9,15,-29,5,11,-33,1,7,-37,2,39,-22 + ,14,27,-30,18,23,-26,30,22,38,-35,0,8,-5,22,30,-27 + Edges: 0,3,0,1,1,2,2,3,4,7,4,5,5,6,6,7,8,11,8,9,9,10,10,11,12,15 + ,12,13,13,14,14,15,16,19,12,16,16,17,17,18,18,19,20,23,17,20,20,21,21,22,22,23 + ,24,27,19,24,24,25,23,25,25,26,26,27,28,31,15,28,28,29,27,29,29,30,30,31,32,35 + ,11,32,32,33,31,33,33,34,34,35,36,39,7,36,36,37,35,37,37,38,34,38,21,39,38,39 + ,0,16,0,4,4,8,8,12,3,20,3,17,13,19,13,24,10,31,10,33,6,35,6,37,9,15 + ,9,28,5,11,5,32,1,7,1,36,2,39,2,21,14,27,14,29,18,23,18,25,22,38,22,26 + ,26,30,30,34,0,8,22,30 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: -0.365153968334198,0.133335366845131,0.921323299407959,-0.659230351448059,0.598681628704071,0.454908907413483 + ,-0.935300767421722,0.325785100460052,0.138096258044243,-0.884914696216583,-0.073519088327885,0.459852904081345 + ,-0.000152592547238,0.495834231376648,0.868373692035675,0.342570275068283,0.825220465660095,0.449018836021423 + ,-0.008270516060293,0.990508735179901,0.136997595429420,-0.346568197011948,0.822504341602325,0.450910985469818 + ,0.377544492483139,0.134006768465042,0.916226685047150,0.890896320343018,-0.056550797075033,0.450605779886246 + ,0.939451277256012,0.315195173025131,0.134311959147453,0.671742916107178,0.589587092399597,0.448438972234726 + ,0.298806726932526,-0.377971738576889,0.876247465610504,0.211645856499672,-0.860713541507721,0.462935268878937 + ,0.606097579002380,-0.783165991306305,0.138676106929779,0.779412209987640,-0.429395437240601,0.456160157918930 + ,-0.278450876474380,-0.387279897928238,0.878872036933899,-0.758659601211548,-0.464674830436707,0.456587433815002 + ,-0.576433598995209,-0.807458698749542,0.125309005379677,-0.195410013198853,-0.866939306259155,0.458479553461075 + ,-0.940916180610657,-0.311166733503342,-0.133579522371292,-0.884426414966583,0.086428418755531,-0.458571135997772 + ,-0.362010568380356,-0.111117891967297,-0.925504326820374,-0.663991212844849,-0.586748838424683,-0.463484615087509 + ,0.005554368719459,-0.991546392440796,-0.129520550370216,-0.340647608041763,-0.818720042705536,-0.462202817201614 + ,0.008453627116978,-0.475692003965378,-0.879543423652649,0.361430704593658,-0.811761856079102,-0.458662688732147 + ,0.953398227691650,-0.274056226015091,-0.125949889421463,0.694173991680145,-0.558549761772156,-0.453993350267410 + ,0.381725519895554,-0.101565599441528,-0.918637633323669,0.890255451202393,0.094332709908485,-0.445539712905884 + ,0.579332888126373,0.804193258285522,-0.132602930068970,0.763390004634857,0.466628015041351,-0.446577340364456 + ,0.291451752185822,0.405316323041916,-0.866451025009155,0.197546318173409,0.872615754604340,-0.446638375520706 + ,-0.570848703384399,0.811914443969727,-0.121890924870968,-0.202764973044395,0.873165071010590,-0.443220317363739 + ,-0.277779459953308,0.406445503234863,-0.870387911796570,-0.752647459506989,0.480330824851990,-0.450300604104996 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.262707,0.403336,0.371514,0.621403,0.264246,0.674226,0.152454,0.626308,0.445956,0.253666,0.561235,0.303243,0.448132,0.542238 + ,0.333120,0.305228,0.854365,0.637833,0.968535,0.687023,0.852300,0.921426,0.742619,0.686589,0.503829,0.661024,0.614770,0.713421 + ,0.504993,0.937504,0.393169,0.709841,0.144818,0.669044,0.259327,0.717165,0.146912,0.951778,0.026844,0.721275,0.141403,0.543550 + ,0.024694,0.306354,0.142129,0.252792,0.257831,0.305285,0.605870,0.377811,0.721621,0.612775,0.605581,0.665122,0.491101,0.613114 + ,0.679370,0.691697,0.791509,0.924353,0.678445,0.974989,0.560151,0.927009,0.776926,0.534245,0.668777,0.299264,0.781551,0.251624 + ,0.893636,0.303167,0.317959,0.697639,0.430480,0.931115,0.316478,0.976017,0.201723,0.926726,0.607536,0.077748,0.557520,0.151522 + ,0.539438,0.122458,0.589167,0.108173,0.572502,0.228693,0.539808,0.165431,0.557520,0.151522,0.553892,0.243330,0.521425,0.152261 + ,0.489364,0.188749,0.508459,0.218833,0.539438,0.122458,0.539808,0.165431,0.526106,0.082959,0.507177,0.067111,0.521425,0.152261 + ,0.716530,0.180028,0.570423,0.077731,0.589167,0.108173,0.697870,0.210046,0.570423,0.077731,0.678502,0.066496,0.660029,0.081346 + ,0.588858,0.064053,0.553892,0.243330,0.607536,0.077748,0.588858,0.064053,0.535628,0.227928,0.622763,0.186363,0.679732,0.179500 + ,0.697870,0.210046,0.604402,0.216260,0.679732,0.179500,0.650657,0.242424,0.669098,0.226991,0.698149,0.166299,0.678502,0.066496 + ,0.716530,0.180028,0.698149,0.166299,0.696462,0.082172,0.527004,0.188344,0.585828,0.186074,0.604402,0.216260,0.508459,0.218833 + ,0.650373,0.143809,0.604425,0.172324,0.585828,0.186074,0.631491,0.159481,0.604425,0.172324,0.631802,0.227263,0.650657,0.242424 + ,0.622763,0.186363,0.488196,0.082971,0.508112,0.174808,0.489364,0.188749,0.507177,0.067111,0.508112,0.174808,0.612752,0.143763 + ,0.631491,0.159481,0.527004,0.188344,0.554152,0.196591,0.507120,0.115384,0.526106,0.082959,0.572502,0.228693,0.507120,0.115384 + ,0.631568,0.111583,0.612752,0.143763,0.488196,0.082971,0.631568,0.111583,0.650795,0.194944,0.631802,0.227263,0.650373,0.143809 + ,0.650795,0.194944,0.677592,0.113467,0.696462,0.082172,0.669098,0.226991,0.677592,0.113467,0.554152,0.196591,0.535628,0.227928 + ,0.660029,0.081346,0.697870,0.210046,0.539438,0.122458,0.508459,0.218833,0.604402,0.216260,0.521425,0.152261,0.507177,0.067111 + ,0.489364,0.188749,0.585828,0.186074,0.527004,0.188344,0.631491,0.159481,0.698149,0.166299,0.669098,0.226991,0.696462,0.082172 + ,0.588858,0.064053,0.660029,0.081346,0.535628,0.227928,0.679732,0.179500,0.622763,0.186363,0.650657,0.242424,0.570423,0.077731 + ,0.716530,0.180028,0.678502,0.066496,0.557520,0.151522,0.607536,0.077748,0.553892,0.243330,0.539808,0.165431,0.572502,0.228693 + ,0.526106,0.082959,0.604425,0.172324,0.650373,0.143809,0.631802,0.227263,0.508112,0.174808,0.488196,0.082971,0.612752,0.143763 + ,0.650795,0.194944,0.507120,0.115384,0.554152,0.196591,0.677592,0.113467,0.539438,0.122458,0.697870,0.210046,0.589167,0.108173 + ,0.507120,0.115384,0.650795,0.194944,0.631568,0.111583 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163 + } + LayerElementTexture: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + Materials: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + Layer: 1 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 1 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 1 + } + } + } + Model: "Model::d6Low", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000,1.000000,0.999999,-1.000001,1.000000,-1.000000,-1.000000,1.000000 + ,-1.000000,1.000000,1.000000 + PolygonVertexIndex: 0,1,2,-4,4,7,6,-6,0,4,5,-2,1,5,6,-3,2,6,7,-4,4,0,3,-8 + Edges: 1,2,0,1,0,3,2,3,4,5,5,6,6,7,4,7,1,5,0,4,2,6,3,7 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,-0.577349185943604 + ,-0.577349185943604,-0.577349185943604,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604 + ,0.577349185943604,0.577349185943604,0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604 + ,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,0.577349185943604 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.318633,0.349476,0.318645,0.647602,0.020520,0.647614,0.020507,0.349489,0.648345,0.315093,0.353934,0.315093,0.353934,0.020682 + ,0.648345,0.020682,0.350206,0.350181,0.649819,0.350206,0.649794,0.649819,0.350181,0.649794,0.691822,0.025304,0.974615,0.025237 + ,0.974682,0.308029,0.691889,0.308097,0.679717,0.645987,0.679717,0.350198,0.975506,0.350198,0.975506,0.645987,0.311233,0.021648 + ,0.311233,0.310780,0.022101,0.310780,0.022101,0.021648 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + Materials: 0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + } + Model: "Model::d6", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 0.929588,0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929588,-0.929587,-1.000000,-0.929587,0.929588,-1.000000,-0.929588,-0.929587,1.000000,0.929587,-0.929588,1.000000,0.929588,0.929587,1.000000 + ,-0.929587,0.929588,1.000000,0.999999,-0.929588,0.929588,1.000000,-0.929588,-0.929588,1.000000,0.929587,-0.929588,1.000000,0.929587,0.929588,-0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929588 + ,0.929588,-1.000000,-0.929588,0.929587,-1.000001,0.929588,-1.000000,0.929588,0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929587,-0.929588,-1.000000,-0.929587,0.929588,-0.929587,1.000000,-0.929588 + ,-0.929587,1.000000,0.929588,0.929588,0.999999,0.929588,0.929588,1.000000,-0.929588,0.964434,0.929587,-0.985566,0.985566,0.929587,-0.964434,0.985566,-0.929588,-0.964434,0.964434,-0.929588,-0.985566 + ,-0.929588,-0.985566,-0.964434,-0.929588,-0.964434,-0.985566,0.929588,-0.964434,-0.985566,0.929588,-0.985566,-0.964434,0.929588,0.985566,-0.964434,0.929588,0.964434,-0.985566,-0.929587,0.964434,-0.985566 + ,-0.929587,0.985567,-0.964434,-0.985566,0.929588,-0.964434,-0.964433,0.929588,-0.985566,-0.964434,-0.929587,-0.985566,-0.985566,-0.929587,-0.964434,-0.929587,0.985566,0.964434,-0.929587,0.964434,0.985566 + ,0.929588,0.964433,0.985566,0.929588,0.985566,0.964434,-0.964434,0.929588,0.985566,-0.985566,0.929588,0.964434,-0.985567,-0.929587,0.964434,-0.964434,-0.929587,0.985566,0.964433,-0.929588,0.985566 + ,0.985566,-0.929588,0.964434,0.985567,0.929587,0.964434,0.964434,0.929587,0.985566,-0.929588,-0.964433,0.985566,-0.929588,-0.985566,0.964434,0.929587,-0.985567,0.964434,0.929587,-0.964434,0.985566 + ,0.964434,0.985566,0.929588,0.985567,0.964433,0.929588,0.985566,0.964434,-0.929588,0.964434,0.985566,-0.929588,0.985566,-0.964434,0.929588,0.964433,-0.985567,0.929588,0.964434,-0.985566,-0.929588 + ,0.985566,-0.964434,-0.929588,-0.964434,-0.985566,0.929588,-0.985567,-0.964433,0.929588,-0.985566,-0.964434,-0.929588,-0.964434,-0.985566,-0.929588,-0.985566,0.964434,0.929588,-0.964434,0.985566,0.929588 + ,-0.964433,0.985567,-0.929588,-0.985566,0.964434,-0.929588,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,-0.966667,-0.966667,0.966667,-0.966667,-0.966667 + ,0.966667,-0.966667,-0.966667,-0.966667,-0.966666,-0.966667,-0.966667,-0.966666,-0.966667,-0.966667,-0.966666,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667 + ,0.966667,0.966666,0.966667,0.966667,0.966666,0.966667,0.966667,0.966666,0.966667,0.966666,-0.966667,0.966667,0.966666,-0.966667,0.966667,0.966666,-0.966667,0.966667,-0.966667,-0.966666,0.966667 + ,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667 + PolygonVertexIndex: 0,1,2,-4,6,7,4,-6,10,11,8,-10,14,15,12,-14,18,19,16,-18,22,23,20,-22,26,27,24,-26,30,31,28,-30,34,35,32,-34,38,39,36,-38,42,43,40,-42,46,47,44,-46,50,51,48,-50 + ,54,55,52,-54,58,59,56,-58,62,63,60,-62,66,67,64,-66,70,71,68,-70,73,74,-73,76,77,-76,79,80,-79,82,83,-82,85,86,-85,88,89,-88,91,92,-91,94,95,-94 + ,0,24,27,-2,29,2,1,-31,33,0,3,-35,37,3,2,-39,55,5,4,-53,5,48,51,-7,47,4,7,-45,41,7,6,-43,63,9,8,-61,9,26,25,-11,49,8,11,-51,57,11,10,-59,67,13,12,-65 + ,13,28,31,-15,53,12,15,-55,61,15,14,-63,71,17,16,-69,17,36,39,-19,45,16,19,-47,65,19,18,-67,69,21,20,-71,21,40,43,-23,35,20,23,-33,59,23,22,-57,74,25,24,-73,26,76,75,-28 + ,28,79,78,-30,77,31,30,-76,32,73,72,-34,83,35,34,-82,36,82,81,-38,80,39,38,-79,40,94,93,-42,86,43,42,-85,95,45,44,-94,46,91,90,-48,89,49,48,-88,50,85,84,-52,92,53,52,-91 + ,54,88,87,-56,56,86,85,-58,73,59,58,-75,88,61,60,-90,62,77,76,-64,91,65,64,-93,66,80,79,-68,94,69,68,-96,70,83,82,-72,0,33,72,-25,27,75,30,-2,29,78,38,-3,3,37,81,-35 + ,6,51,84,-43,41,93,44,-8,47,90,52,-5,5,55,87,-49,25,74,58,-11,11,57,85,-51,49,89,60,-9,9,63,76,-27,31,77,62,-15,15,61,88,-55,53,92,64,-13,13,67,79,-29,39,80,66,-19 + ,19,65,91,-47,45,95,68,-17,17,71,82,-37,43,86,56,-23,23,59,73,-33,35,83,70,-21,21,69,94,-41 + Edges: 0,3,0,1,1,2,2,3,4,7,4,5,5,6,6,7,8,11,8,9,9,10,10,11,12,15 + ,12,13,13,14,14,15,16,19,16,17,17,18,18,19,20,23,20,21,21,22,22,23,24,27,24,25 + ,25,26,26,27,28,31,28,29,29,30,30,31,32,35,32,33,33,34,34,35,36,39,36,37,37,38 + ,38,39,40,43,40,41,41,42,42,43,44,47,44,45,45,46,46,47,48,51,48,49,49,50,50,51 + ,52,55,52,53,53,54,54,55,56,59,56,57,57,58,58,59,60,63,60,61,61,62,62,63,64,67 + ,64,65,65,66,66,67,68,71,68,69,69,70,70,71,72,74,33,72,72,73,59,73,58,74,73,74 + ,75,77,30,75,75,76,63,76,62,77,76,77,78,80,38,78,78,79,67,79,66,80,79,80,81,83 + ,37,81,81,82,71,82,70,83,82,83,84,86,51,84,84,85,57,85,56,86,85,86,87,89,55,87 + ,87,88,61,88,60,89,88,89,90,92,52,90,90,91,65,91,64,92,91,92,93,95,44,93,93,94 + ,69,94,68,95,94,95,0,33,0,24,24,72,1,27,1,30,27,75,2,29,2,38,29,78,3,37 + ,3,34,34,81,6,51,6,42,42,84,7,41,7,44,41,93,4,47,4,52,47,90,5,55,5,48 + ,48,87,10,25,10,58,25,74,11,57,11,50,50,85,8,49,8,60,49,89,9,63,9,26,26,76 + ,14,31,14,62,31,77,15,61,15,54,54,88,12,53,12,64,53,92,13,67,13,28,28,79,18,39 + ,18,66,39,80,19,65,19,46,46,91,16,45,16,68,45,95,17,71,17,36,36,82,22,43,22,56 + ,43,86,23,59,23,32,32,73,20,35,20,70,35,83,21,69,21,40,40,94 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945,-0.959929168224335 + ,-0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945,-0.959929168224335 + ,-0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945,-0.198126167058945,0.959929168224335 + ,0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945,0.198126167058945,0.959929168224335 + ,0.959929168224335,-0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945,-0.198126167058945 + ,0.959929168224335,0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945,0.198126167058945 + ,-0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945 + ,0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945 + ,-0.959929168224335,0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945 + ,-0.959929168224335,-0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945 + ,-0.198126167058945,0.959929168224335,-0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945 + ,0.198126167058945,0.959929168224335,0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945 + ,0.553819417953491,0.176305428147316,-0.813745558261871,0.813745558261871,0.176305428147316,-0.553819417953491 + ,0.813745558261871,-0.176305428147316,-0.553819417953491,0.553819417953491,-0.176305428147316,-0.813745558261871 + ,-0.176305428147316,-0.813745558261871,-0.553819417953491,-0.176305428147316,-0.553819417953491,-0.813745558261871 + ,0.176305428147316,-0.553819417953491,-0.813745558261871,0.176305428147316,-0.813745558261871,-0.553819417953491 + ,0.176305428147316,0.813745558261871,-0.553819417953491,0.176305428147316,0.553819417953491,-0.813745558261871 + ,-0.176305428147316,0.553819417953491,-0.813745558261871,-0.176305428147316,0.813745558261871,-0.553819417953491 + ,-0.813745558261871,0.176305428147316,-0.553819417953491,-0.553819417953491,0.176305428147316,-0.813745558261871 + ,-0.553819417953491,-0.176305428147316,-0.813745558261871,-0.813745558261871,-0.176305428147316,-0.553819417953491 + ,-0.176305428147316,0.813745558261871,0.553819417953491,-0.176305428147316,0.553819417953491,0.813745558261871 + ,0.176305428147316,0.553819417953491,0.813745558261871,0.176305428147316,0.813745558261871,0.553819417953491 + ,-0.553819417953491,0.176305428147316,0.813745558261871,-0.813745558261871,0.176305428147316,0.553819417953491 + ,-0.813745558261871,-0.176305428147316,0.553819417953491,-0.553819417953491,-0.176305428147316,0.813745558261871 + ,0.553819417953491,-0.176305428147316,0.813745558261871,0.813745558261871,-0.176305428147316,0.553819417953491 + ,0.813745558261871,0.176305428147316,0.553819417953491,0.553819417953491,0.176305428147316,0.813745558261871 + ,-0.176305428147316,-0.553819417953491,0.813745558261871,-0.176305428147316,-0.813745558261871,0.553819417953491 + ,0.176305428147316,-0.813745558261871,0.553819417953491,0.176305428147316,-0.553819417953491,0.813745558261871 + ,0.553819417953491,0.813745558261871,0.176305428147316,0.813745558261871,0.553819417953491,0.176305428147316 + ,0.813745558261871,0.553819417953491,-0.176305428147316,0.553819417953491,0.813745558261871,-0.176305428147316 + ,0.813745558261871,-0.553819417953491,0.176305428147316,0.553819417953491,-0.813745558261871,0.176305428147316 + ,0.553819417953491,-0.813745558261871,-0.176305428147316,0.813745558261871,-0.553819417953491,-0.176305428147316 + ,-0.553819417953491,-0.813745558261871,0.176305428147316,-0.813745558261871,-0.553819417953491,0.176305428147316 + ,-0.813745558261871,-0.553819417953491,-0.176305428147316,-0.553819417953491,-0.813745558261871,-0.176305428147316 + ,-0.813745558261871,0.553819417953491,0.176305428147316,-0.553819417953491,0.813745558261871,0.176305428147316 + ,-0.553819417953491,0.813745558261871,-0.176305428147316,-0.813745558261871,0.553819417953491,-0.176305428147316 + ,0.465620905160904,0.465620905160904,-0.752555906772614,0.465620905160904,0.752555906772614,-0.465620905160904 + ,0.752555906772614,0.465620905160904,-0.465620905160904,0.465620905160904,-0.465620905160904,-0.752555906772614 + ,0.752555906772614,-0.465620905160904,-0.465620905160904,0.465620905160904,-0.752555906772614,-0.465620905160904 + ,-0.465620905160904,-0.465620905160904,-0.752555906772614,-0.465620905160904,-0.752555906772614,-0.465620905160904 + ,-0.752555906772614,-0.465620905160904,-0.465620905160904,-0.465620905160904,0.465620905160904,-0.752555906772614 + ,-0.752555906772614,0.465620905160904,-0.465620905160904,-0.465620905160904,0.752555906772614,-0.465620905160904 + ,0.465620905160904,0.465620905160904,0.752555906772614,0.752555906772614,0.465620905160904,0.465620905160904 + ,0.465620905160904,0.752555906772614,0.465620905160904,0.465620905160904,-0.465620905160904,0.752525389194489 + ,0.465620905160904,-0.752555906772614,0.465620905160904,0.752555906772614,-0.465620905160904,0.465620905160904 + ,-0.465620905160904,-0.465620905160904,0.752555906772614,-0.752555906772614,-0.465620905160904,0.465620905160904 + ,-0.465620905160904,-0.752555906772614,0.465620905160904,-0.465620905160904,0.465620905160904,0.752555906772614 + ,-0.465620905160904,0.752555906772614,0.465620905160904,-0.752555906772614,0.465620905160904,0.465620905160904 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.302069,0.365621,0.302486,0.629558,0.035546,0.628254,0.035242,0.364379,0.623184,0.291488,0.376116,0.290753,0.375857,0.045830 + ,0.623630,0.044722,0.636631,0.630823,0.369248,0.630838,0.369233,0.363455,0.636615,0.363440,0.959514,0.300275,0.698728,0.300319 + ,0.698684,0.039533,0.959470,0.039489,0.696899,0.625532,0.696899,0.371559,0.950872,0.371559,0.950872,0.625532,0.294762,0.041516 + ,0.294749,0.294584,0.041682,0.294571,0.041694,0.041503,0.331041,0.352661,0.327779,0.348447,0.358379,0.335238,0.362415,0.337772 + ,0.320346,0.348893,0.317659,0.352921,0.288883,0.339337,0.293134,0.336095,0.331820,0.298787,0.331861,0.294558,0.362144,0.324607 + ,0.357916,0.327742,0.839007,0.345103,0.838329,0.336772,0.893656,0.338675,0.895801,0.347395,0.745939,0.024641,0.747798,0.033866 + ,0.664159,0.033331,0.665679,0.023117,0.668072,0.352472,0.682305,0.354552,0.680430,0.466356,0.667609,0.468959,0.692394,0.274055 + ,0.678490,0.273697,0.676116,0.167078,0.690060,0.166884,0.846902,0.024799,0.846181,0.030235,0.803332,0.029610,0.802321,0.024711 + ,0.650561,0.061948,0.661507,0.061241,0.661507,0.145092,0.650561,0.145798,0.666632,0.516855,0.682005,0.521438,0.677122,0.642336 + ,0.662725,0.644590,0.334714,0.488480,0.324552,0.489136,0.324552,0.411295,0.334714,0.410639,0.335555,0.651102,0.317992,0.652140 + ,0.320933,0.522245,0.335469,0.522672,0.363423,0.331099,0.363367,0.331246,0.362533,0.330864,0.324441,0.353969,0.324292,0.353912 + ,0.324681,0.353071,0.287473,0.332792,0.287528,0.332641,0.288381,0.333016,0.325062,0.293625,0.325212,0.293679,0.324840,0.294528 + ,0.758584,0.025925,0.758300,0.026052,0.757668,0.024356,0.852937,0.028567,0.853016,0.028709,0.852143,0.029193,0.796611,0.028957 + ,0.796762,0.028889,0.797101,0.029788,0.653373,0.026160,0.653246,0.025876,0.654935,0.025245,0.354143,0.331604,0.358379,0.335238 + ,0.327779,0.348447,0.323993,0.344550,0.293134,0.336095,0.294515,0.335015,0.323993,0.344550,0.320346,0.348893,0.357916,0.327742 + ,0.354143,0.331604,0.330020,0.303168,0.331820,0.298787,0.895801,0.347395,0.899483,0.355901,0.839558,0.358758,0.839007,0.345103 + ,0.846181,0.030235,0.846255,0.035867,0.803940,0.035389,0.803332,0.029610,0.660920,0.166399,0.676116,0.167078,0.678490,0.273697 + ,0.663321,0.275234,0.682305,0.354552,0.697183,0.354238,0.695544,0.464809,0.680430,0.466356,0.665679,0.023117,0.666887,0.014894 + ,0.744830,0.013776,0.745939,0.024641,0.682005,0.521438,0.692499,0.521158,0.689569,0.644010,0.677122,0.642336,0.334182,0.358162 + ,0.331041,0.352661,0.362415,0.337772,0.367831,0.340739,0.690060,0.166884,0.703268,0.164732,0.702298,0.272268,0.692394,0.274055 + ,0.650561,0.145798,0.639614,0.146498,0.639614,0.062648,0.650561,0.061948,0.324552,0.489136,0.314390,0.489786,0.314390,0.411945 + ,0.324552,0.411295,0.283527,0.342728,0.288883,0.339337,0.317659,0.352921,0.314832,0.358538,0.802321,0.024711,0.800260,0.018543 + ,0.848354,0.018379,0.846902,0.024799,0.662725,0.644590,0.652232,0.643893,0.654185,0.520065,0.666632,0.516855,0.317992,0.652140 + ,0.304332,0.652184,0.306297,0.521312,0.320933,0.522245,0.892011,0.328123,0.893656,0.338675,0.838329,0.336772,0.835452,0.327882 + ,0.667609,0.468959,0.651462,0.474299,0.651462,0.348575,0.668072,0.352472,0.334714,0.410639,0.344876,0.409989,0.344876,0.487830 + ,0.334714,0.488480,0.335469,0.522672,0.353132,0.521164,0.351167,0.652035,0.335555,0.651102,0.663432,0.039286,0.664159,0.033331 + ,0.747798,0.033866,0.749508,0.038818,0.331861,0.294558,0.334614,0.288935,0.367481,0.321303,0.362144,0.324607,0.661507,0.061241 + ,0.672454,0.060541,0.672454,0.144391,0.661507,0.145092,0.363367,0.331246,0.362415,0.337772,0.358379,0.335238,0.362533,0.330864 + ,0.331041,0.352661,0.324441,0.353969,0.324681,0.353071,0.327779,0.348447,0.288883,0.339337,0.287473,0.332792,0.288381,0.333016 + ,0.293134,0.336095,0.324292,0.353912,0.317659,0.352921,0.320346,0.348893,0.324681,0.353071,0.362144,0.324607,0.363423,0.331099 + ,0.362533,0.330864,0.357916,0.327742,0.325212,0.293679,0.331861,0.294558,0.331820,0.298787,0.324840,0.294528,0.320747,0.295220 + ,0.325062,0.293625,0.324840,0.294528,0.325268,0.297784,0.287528,0.332641,0.288398,0.325959,0.291931,0.330780,0.288381,0.333016 + ,0.664159,0.033331,0.653373,0.026160,0.654935,0.025245,0.665679,0.023117,0.758300,0.026052,0.747798,0.033866,0.745939,0.024641 + ,0.757668,0.024356,0.653246,0.025876,0.648592,0.018224,0.658145,0.015654,0.654935,0.025245,0.792808,0.034713,0.796611,0.028957 + ,0.797101,0.029788,0.798251,0.035509,0.853016,0.028709,0.857067,0.034277,0.851968,0.035249,0.852143,0.029193,0.765800,0.015106 + ,0.758584,0.025925,0.757668,0.024356,0.755542,0.013575,0.796762,0.028889,0.802321,0.024711,0.803332,0.029610,0.797101,0.029788 + ,0.846902,0.024799,0.852937,0.028567,0.852143,0.029193,0.846181,0.030235,0.759581,0.035180,0.758300,0.026052,0.758584,0.025925 + ,0.768429,0.029713,0.363423,0.331099,0.369895,0.328169,0.369799,0.333755,0.363367,0.331246,0.852937,0.028567,0.855293,0.021538 + ,0.859434,0.025570,0.853016,0.028709,0.321819,0.360320,0.324292,0.353912,0.324441,0.353969,0.327335,0.360411,0.796611,0.028957 + ,0.789700,0.026423,0.793813,0.022381,0.796762,0.028889,0.281019,0.330273,0.287528,0.332641,0.287473,0.332792,0.281027,0.335861 + ,0.653373,0.026160,0.652787,0.035964,0.643818,0.029270,0.653246,0.025876,0.327582,0.287197,0.325212,0.293679,0.325062,0.293625 + ,0.322000,0.287197,0.354143,0.331604,0.357916,0.327742,0.362533,0.330864,0.358379,0.335238,0.327779,0.348447,0.324681,0.353071 + ,0.320346,0.348893,0.323993,0.344550,0.293134,0.336095,0.288381,0.333016,0.291931,0.330780,0.294515,0.335015,0.330020,0.303168 + ,0.325268,0.297784,0.324840,0.294528,0.331820,0.298787,0.744830,0.013776,0.755542,0.013575,0.757668,0.024356,0.745939,0.024641 + ,0.665679,0.023117,0.654935,0.025245,0.658145,0.015654,0.666887,0.014894,0.798251,0.035509,0.797101,0.029788,0.803332,0.029610 + ,0.803940,0.035389,0.846255,0.035867,0.846181,0.030235,0.852143,0.029193,0.851968,0.035249,0.362415,0.337772,0.363367,0.331246 + ,0.369799,0.333755,0.367831,0.340739,0.777777,0.017973,0.768429,0.029713,0.758584,0.025925,0.765800,0.015106,0.857067,0.034277 + ,0.853016,0.028709,0.859434,0.025570,0.860343,0.030874,0.334182,0.358162,0.327335,0.360411,0.324441,0.353969,0.331041,0.352661 + ,0.317659,0.352921,0.324292,0.353912,0.321819,0.360320,0.314832,0.358538,0.848354,0.018379,0.855293,0.021538,0.852937,0.028567 + ,0.846902,0.024799,0.802321,0.024711,0.796762,0.028889,0.793813,0.022381,0.800260,0.018543,0.283527,0.342728,0.281027,0.335861 + ,0.287473,0.332792,0.288883,0.339337,0.288398,0.325959,0.287528,0.332641,0.281019,0.330273,0.282727,0.323211,0.786456,0.033223 + ,0.789700,0.026423,0.796611,0.028957,0.792808,0.034713,0.648592,0.018224,0.653246,0.025876,0.643818,0.029270,0.640512,0.022407 + ,0.318263,0.291177,0.322000,0.287197,0.325062,0.293625,0.320747,0.295220,0.747798,0.033866,0.758300,0.026052,0.759581,0.035180 + ,0.749508,0.038818,0.367481,0.321303,0.369895,0.328169,0.363423,0.331099,0.362144,0.324607,0.331861,0.294558,0.325212,0.293679 + ,0.327582,0.287197,0.334614,0.288935,0.663432,0.039286,0.652787,0.035964,0.653373,0.026160,0.664159,0.033331 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementUV: 2 { + Version: 101 + Name: "UVTex.002" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 2 { + Version: 101 + Name: "UVTex.002" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementUV: 3 { + Version: 101 + Name: "UVTex.003" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 3 { + Version: 101 + Name: "UVTex.003" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + Materials: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + Layer: 1 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 1 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 1 + } + } + Layer: 2 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 2 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 2 + } + } + Layer: 3 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 3 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 3 + } + } + } + Model: "Model::Producer Perspective", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,71.299999999999997,287.500000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",10.000000 + Property: "FarPlane", "double", "",4000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",0 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,71.300000,287.500000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Top", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,4000.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,4000.000000,0.000000 + Up: 0,0,-1 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Bottom", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,-4000.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,-4000.000000,0.000000 + Up: 0,0,-1 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Front", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,4000.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,0.000000,4000.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Back", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,-4000.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,0.000000,-4000.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Right", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",4000.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 4000.000000,0.000000,0.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Left", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",-4000.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: -4000.000000,0.000000,0.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Material: "Material::D6-red", "" { + Version: 102 + ShadingModel: "lambert" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",1.0000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "DiffuseFactor", "double", "",0.8000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",1.0000,1.0000,1.0000 + Property: "SpecularFactor", "double", "",0.2500 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.0,0.0 + Property: "Specular", "ColorRGB", "",1.0,1.0,1.0 + Property: "Shininess", "double", "",9.6 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::D6-red__d6-red-dots_png", "" { + Version: 102 + ShadingModel: "lambert" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",1.0000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "DiffuseFactor", "double", "",0.8000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",1.0000,1.0000,1.0000 + Property: "SpecularFactor", "double", "",0.2500 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.0,0.0 + Property: "Specular", "ColorRGB", "",1.0,1.0,1.0 + Property: "Shininess", "double", "",9.6 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::None__d10-red_png", "" { + Version: 102 + ShadingModel: "phong" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Phong" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",0.5000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "SpecularFactor", "double", "",0.2000 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8 + Property: "Specular", "ColorRGB", "",0.8,0.8,0.8 + Property: "Shininess", "double", "",20.0 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::unnamed", "" { + Version: 102 + ShadingModel: "phong" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Phong" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",0.5000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "SpecularFactor", "double", "",0.2000 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8 + Property: "Specular", "ColorRGB", "",0.8,0.8,0.8 + Property: "Shininess", "double", "",20.0 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Video: "Video::d10-red_png", "Clip" { + Type: "Clip" + Properties60: { + Property: "FrameRate", "double", "",0 + Property: "LastFrame", "int", "",0 + Property: "Width", "int", "",0 + Property: "Height", "int", "",0 + Property: "Path", "charptr", "", "d10-red.png" + Property: "StartFrame", "int", "",0 + Property: "StopFrame", "int", "",0 + Property: "PlaySpeed", "double", "",1 + Property: "Offset", "KTime", "",0 + Property: "InterlaceMode", "enum", "",0 + Property: "FreeRunning", "bool", "",0 + Property: "Loop", "bool", "",0 + Property: "AccessMode", "enum", "",0 + } + UseMipMap: 0 + Filename: "d10-red.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d10-red.png" + } + Video: "Video::d6-red-dots_png", "Clip" { + Type: "Clip" + Properties60: { + Property: "FrameRate", "double", "",0 + Property: "LastFrame", "int", "",0 + Property: "Width", "int", "",0 + Property: "Height", "int", "",0 + Property: "Path", "charptr", "", "d6-red-dots.png" + Property: "StartFrame", "int", "",0 + Property: "StopFrame", "int", "",0 + Property: "PlaySpeed", "double", "",1 + Property: "Offset", "KTime", "",0 + Property: "InterlaceMode", "enum", "",0 + Property: "FreeRunning", "bool", "",0 + Property: "Loop", "bool", "",0 + Property: "AccessMode", "enum", "",0 + } + UseMipMap: 0 + Filename: "d6-red-dots.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d6-red-dots.png" + } + Texture: "Texture::d10-red_png", "TextureVideoClip" { + Type: "TextureVideoClip" + Version: 202 + TextureName: "Texture::d10-red_png" + Properties60: { + Property: "Translation", "Vector", "A+",0,0,0 + Property: "Rotation", "Vector", "A+",0,0,0 + Property: "Scaling", "Vector", "A+",1,1,1 + Property: "Texture alpha", "Number", "A+",0 + Property: "TextureTypeUse", "enum", "",0 + Property: "CurrentTextureBlendMode", "enum", "",1 + Property: "UseMaterial", "bool", "",0 + Property: "UseMipMap", "bool", "",0 + Property: "CurrentMappingType", "enum", "",0 + Property: "UVSwap", "bool", "",0 + Property: "WrapModeU", "enum", "",0 + Property: "WrapModeV", "enum", "",0 + Property: "TextureRotationPivot", "Vector3D", "",0,0,0 + Property: "TextureScalingPivot", "Vector3D", "",0,0,0 + Property: "VideoProperty", "object", "" + } + Media: "Video::d10-red_png" + FileName: "d10-red.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d10-red.png" + ModelUVTranslation: 0,0 + ModelUVScaling: 1,1 + Texture_Alpha_Source: "None" + Cropping: 0,0,0,0 + } + Texture: "Texture::d6-red-dots_png", "TextureVideoClip" { + Type: "TextureVideoClip" + Version: 202 + TextureName: "Texture::d6-red-dots_png" + Properties60: { + Property: "Translation", "Vector", "A+",0,0,0 + Property: "Rotation", "Vector", "A+",0,0,0 + Property: "Scaling", "Vector", "A+",1,1,1 + Property: "Texture alpha", "Number", "A+",1 + Property: "TextureTypeUse", "enum", "",0 + Property: "CurrentTextureBlendMode", "enum", "",1 + Property: "UseMaterial", "bool", "",0 + Property: "UseMipMap", "bool", "",0 + Property: "CurrentMappingType", "enum", "",0 + Property: "UVSwap", "bool", "",0 + Property: "WrapModeU", "enum", "",0 + Property: "WrapModeV", "enum", "",0 + Property: "TextureRotationPivot", "Vector3D", "",0,0,0 + Property: "TextureScalingPivot", "Vector3D", "",0,0,0 + Property: "VideoProperty", "object", "" + } + Media: "Video::d6-red-dots_png" + FileName: "d6-red-dots.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d6-red-dots.png" + ModelUVTranslation: 0,0 + ModelUVScaling: 1,1 + Texture_Alpha_Source: "None" + Cropping: 0,0,0,0 + } + Pose: "Pose::BIND_POSES", "BindPose" { + Type: "BindPose" + Version: 100 + Properties60: { + } + NbPoseNodes: 5 + PoseNode: { + Node: "Model::blend_root" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d10Low" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d10" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d6Low" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d6" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + } + GlobalSettings: { + Version: 1000 + Properties60: { + Property: "UpAxis", "int", "",1 + Property: "UpAxisSign", "int", "",1 + Property: "FrontAxis", "int", "",2 + Property: "FrontAxisSign", "int", "",1 + Property: "CoordAxis", "int", "",0 + Property: "CoordAxisSign", "int", "",1 + Property: "UnitScaleFactor", "double", "",100 + } + } +} + +; Object relations +;------------------------------------------------------------------ + +Relations: { + Model: "Model::blend_root", "Null" { + } + Model: "Model::d10Low", "Mesh" { + } + Model: "Model::d10", "Mesh" { + } + Model: "Model::d6Low", "Mesh" { + } + Model: "Model::d6", "Mesh" { + } + Model: "Model::Producer Perspective", "Camera" { + } + Model: "Model::Producer Top", "Camera" { + } + Model: "Model::Producer Bottom", "Camera" { + } + Model: "Model::Producer Front", "Camera" { + } + Model: "Model::Producer Back", "Camera" { + } + Model: "Model::Producer Right", "Camera" { + } + Model: "Model::Producer Left", "Camera" { + } + Model: "Model::Camera Switcher", "CameraSwitcher" { + } + Material: "Material::D6-red", "" { + } + Material: "Material::D6-red__d6-red-dots_png", "" { + } + Material: "Material::None__d10-red_png", "" { + } + Material: "Material::unnamed", "" { + } + Texture: "Texture::d10-red_png", "TextureVideoClip" { + } + Texture: "Texture::d6-red-dots_png", "TextureVideoClip" { + } + Video: "Video::d10-red_png", "Clip" { + } + Video: "Video::d6-red-dots_png", "Clip" { + } +} + +; Object connections +;------------------------------------------------------------------ + +Connections: { + Connect: "OO", "Model::blend_root", "Model::Scene" + Connect: "OO", "Model::d10Low", "Model::blend_root" + Connect: "OO", "Model::d10", "Model::blend_root" + Connect: "OO", "Model::d6Low", "Model::blend_root" + Connect: "OO", "Model::d6", "Model::blend_root" + Connect: "OO", "Material::None__d10-red_png", "Model::d10Low" + Connect: "OO", "Material::None__d10-red_png", "Model::d10" + Connect: "OO", "Material::unnamed", "Model::d10" + Connect: "OO", "Material::D6-red__d6-red-dots_png", "Model::d6Low" + Connect: "OO", "Material::D6-red__d6-red-dots_png", "Model::d6" + Connect: "OO", "Material::D6-red", "Model::d6" + Connect: "OO", "Texture::d10-red_png", "Model::d10Low" + Connect: "OO", "Texture::d10-red_png", "Model::d10" + Connect: "OO", "Texture::d6-red-dots_png", "Model::d6Low" + Connect: "OO", "Texture::d6-red-dots_png", "Model::d6" + Connect: "OO", "Video::d10-red_png", "Texture::d10-red_png" + Connect: "OO", "Video::d6-red-dots_png", "Texture::d6-red-dots_png" +} +;Takes and animation section +;---------------------------------------------------- + +Takes: { + Current: "Default Take" + Take: "Default Take" { + FileName: "Default_Take.tak" + LocalTime: 0,479181389250 + ReferenceTime: 0,479181389250 + + ;Models animation + ;---------------------------------------------------- + Model: "Model::d10Low" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d10" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d6Low" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d6" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + } +} +;Version 5 settings +;------------------------------------------------------------------ + +Version5: { + AmbientRenderSettings: { + Version: 101 + AmbientLightColor: 0.0,0.0,0.0,0 + } + FogOptions: { + FlogEnable: 0 + FogMode: 0 + FogDensity: 0.000 + FogStart: 5.000 + FogEnd: 25.000 + FogColor: 0.1,0.1,0.1,1 + } + Settings: { + FrameRate: "24" + TimeFormat: 1 + SnapOnFrames: 0 + ReferenceTimeIndex: -1 + TimeLineStartTime: 0 + TimeLineStopTime: 479181389250 + } + RendererSetting: { + DefaultCamera: "Producer Perspective" + DefaultViewingMode: 0 + } +} diff --git a/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta new file mode 100644 index 0000000..cb1500f --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: e80dc46523d8f9f4cb6de5ffdb7b8639 +ModelImporter: + serializedVersion: 16 + fileIDToRecycleName: + 100000: //RootNode + 100002: d6 + 100006: d6Low + 100016: d10 + 100018: d10Low + 400000: //RootNode + 400002: d6 + 400006: d6Low + 400016: d10 + 400018: d10Low + 2300000: d6 + 2300004: d6Low + 2300014: d10 + 2300016: d10Low + 3300000: d6 + 3300004: d6Low + 3300014: d10 + 3300016: d10Low + 4300000: Cube + 4300002: d6 + 4300004: d6_beveled + 4300006: d4 + 4300008: d12 + 4300010: d8 + 4300012: d8Low + 4300014: d4Low + 4300016: d6Low + 4300018: d10Low + 4300020: d10 + 4300022: d12Low_001 + 4300024: d12Low + 4300026: d20Low + 4300028: d20 + 4300030: galery + 7400000: Default Take + 11100000: //RootNode + materials: + importMaterials: 0 + materialName: 3 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + optimizeGameObjects: 0 + motionNodeName: + animationCompression: 1 + animationRotationError: .5 + animationPositionError: .5 + animationScaleError: .5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + tangentSpace: + normalSmoothAngle: 99 + splitTangentsAcrossUV: 1 + normalImportMode: 0 + tangentImportMode: 0 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: .5 + foreArmTwist: .5 + upperLegTwist: .5 + legTwist: .5 + armStretch: .0500000007 + legStretch: .0500000007 + feetSpacing: 0 + rootMotionBoneName: + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + additionalBone: 0 + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Textures.meta b/UnityTests.Unity4/Assets/Dice/Textures.meta new file mode 100644 index 0000000..431d001 --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: edc7fb94cecaa6242ae70fea7401c11a +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Textures/d6.meta b/UnityTests.Unity4/Assets/Dice/Textures/d6.meta new file mode 100644 index 0000000..1a246bf --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Textures/d6.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a38ffb9a09e9db44182065c0bedd905b +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png b/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png new file mode 100644 index 0000000..468e20b Binary files /dev/null and b/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png differ diff --git a/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png.meta b/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png.meta new file mode 100644 index 0000000..55aae5b --- /dev/null +++ b/UnityTests.Unity4/Assets/Dice/Textures/d6/d6-white-dots.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 9e9c1db26c117a54b95cb11b5c5c4925 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Editor.meta b/UnityTests.Unity4/Assets/Editor.meta new file mode 100644 index 0000000..863b598 --- /dev/null +++ b/UnityTests.Unity4/Assets/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 805cdb447a0a94f85a92205ddec8d72e +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs b/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs new file mode 100644 index 0000000..31e51b8 --- /dev/null +++ b/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs @@ -0,0 +1,504 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; +using System.Linq; +using System.Collections.Generic; +using System.IO; + + + +[CustomEditor( typeof( GoDummyPath ) )] +public class GoDummyPathEditor : Editor +{ + private GoDummyPath _target; + private GUIStyle _labelStyle; + private GUIStyle _indexStyle; + + private int _insertIndex = 0; + private float _snapDistance = 5f; + private bool _showNodeDetails; + private bool _fileLoadSaveDetails; + private int _selectedNodeIndex = -1; + + + #region Monobehaviour and Editor + + void OnEnable() + { + // setup the font for the 'begin' 'end' text + _labelStyle = new GUIStyle(); + _labelStyle.fontStyle = FontStyle.Bold; + _labelStyle.normal.textColor = Color.white; + _labelStyle.fontSize = 16; + + _indexStyle = new GUIStyle(); + _indexStyle.fontStyle = FontStyle.Bold; + _indexStyle.normal.textColor = Color.white; + _indexStyle.fontSize = 12; + + _target = (GoDummyPath)target; + } + + + public override void OnInspectorGUI() + { + // what kind of handles shall we use? + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Use Standard Handles" ); + _target.useStandardHandles = EditorGUILayout.Toggle( _target.useStandardHandles ); + EditorGUILayout.EndHorizontal(); + + + // path name: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Route Name" ); + _target.pathName = EditorGUILayout.TextField( _target.pathName ); + EditorGUILayout.EndHorizontal(); + + if( _target.pathName == string.Empty ) + _target.pathName = "route" + Random.Range( 1, 100000 ); + + + // path color: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Route Color" ); + _target.pathColor = EditorGUILayout.ColorField( _target.pathColor ); + EditorGUILayout.EndHorizontal(); + + + // force straight lines: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Force Straight Line Path" ); + _target.forceStraightLinePath = EditorGUILayout.Toggle( _target.forceStraightLinePath ); + EditorGUILayout.EndHorizontal(); + + + // resolution + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Editor Drawing Resolution" ); + _target.pathResolution = EditorGUILayout.IntSlider( _target.pathResolution, 2, 100 ); + EditorGUILayout.EndHorizontal(); + + + EditorGUILayout.Separator(); + + + // insert node - we need 3 or more nodes for insert to make sense + if( _target.nodes.Count > 2 ) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Insert Node" ); + _insertIndex = EditorGUILayout.IntField( _insertIndex ); + if( GUILayout.Button( "Insert" ) ) + { + // validate the index + if( _insertIndex >= 0 && _insertIndex < _target.nodes.Count ) + { + // insert the node offsetting it a bit from the previous node + var copyNodeIndex = _insertIndex == 0 ? 0 : _insertIndex; + var copyNode = _target.nodes[copyNodeIndex]; + copyNode.x += 10; + copyNode.z += 10; + + insertNodeAtIndex( copyNode, _insertIndex ); + } + } + EditorGUILayout.EndHorizontal(); + } + + + // close route? + if( GUILayout.Button( "Close Path" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + closeRoute(); + GUI.changed = true; + } + + + // shift the start point to the origin + if( GUILayout.Button( "Shift Path to Start at Origin" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + + var offset = Vector3.zero; + + // see what kind of path we are. the simplest case is just a straight line + var path = new GoSpline( _target.nodes, _target.forceStraightLinePath ); + if( path.splineType == GoSplineType.StraightLine || _target.nodes.Count < 5 ) + offset = Vector3.zero - _target.nodes[0]; + else + offset = Vector3.zero - _target.nodes[1]; + + for( var i = 0; i < _target.nodes.Count; i++ ) + _target.nodes[i] += offset; + + GUI.changed = true; + } + + + // reverse + if( GUILayout.Button( "Reverse Path" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + _target.nodes.Reverse(); + GUI.changed = true; + } + + + // persist to disk + EditorGUILayout.Space(); + EditorGUILayout.LabelField( "Save to/Read from Disk" ); + + EditorGUILayout.Space(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Serialize and Save Path" ); + if( GUILayout.Button( "Save" ) ) + { + var path = EditorUtility.SaveFilePanel( "Save path", Application.dataPath + "/StreamingAssets", _target.pathName + ".asset", "asset" ); + if( path != string.Empty ) + { + persistRouteToDisk( path ); + + // fetch the filename and set it as the routeName + _target.pathName = Path.GetFileName( path ).Replace( ".asset", string.Empty ); + GUI.changed = true; + } + } + EditorGUILayout.EndHorizontal(); + + + // load from disk + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Load saved path" ); + if( GUILayout.Button( "Load" ) ) + { + var path = EditorUtility.OpenFilePanel( "Choose path to load", Path.Combine( Application.dataPath, "StreamingAssets" ), "asset" ); + if( path != string.Empty ) + { + if( !File.Exists( path ) ) + { + EditorUtility.DisplayDialog( "File does not exist", "Path couldn't find the file you specified", "Close" ); + } + else + { + _target.nodes = GoSpline.bytesToVector3List( File.ReadAllBytes( path ) ); + _target.pathName = Path.GetFileName( path ).Replace( ".asset", string.Empty ); + GUI.changed = true; + } + } + } + EditorGUILayout.EndHorizontal(); + + + // node display + EditorGUILayout.Space(); + _showNodeDetails = EditorGUILayout.Foldout( _showNodeDetails, "Show Node Values" ); + if( _showNodeDetails ) + { + EditorGUI.indentLevel++; + for( int i = 0; i < _target.nodes.Count; i++ ) + _target.nodes[i] = EditorGUILayout.Vector3Field( "Node " + ( i + 1 ), _target.nodes[i] ); + EditorGUI.indentLevel--; + } + + + // instructions + EditorGUILayout.Space(); + EditorGUILayout.HelpBox( "While dragging a node, hold down Ctrl and slowly move the cursor to snap to a nearby point\n\n" + + "Click the 'Close Path' button to add a new node that will close out the current path.\n\n" + + "Hold Command while dragging a node to snap in 5 point increments\n\n" + + "Double click to add a new node at the end of the path\n\n" + + "Hold down alt while adding a node to prepend the new node at the front of the route\n\n" + + "Press delete or backspace to delete the selected node\n\n" + + "NOTE: make sure you have the pan tool selected while editing paths", MessageType.None ); + + + // update and redraw: + if( GUI.changed ) + { + EditorUtility.SetDirty( _target ); + Repaint(); + } + } + + + void OnSceneGUI() + { + if( !_target.gameObject.activeSelf ) + return; + + // handle current selection and node addition via double click or ctrl click + if( Event.current.type == EventType.mouseDown ) + { + var nearestIndex = getNearestNodeForMousePosition( Event.current.mousePosition ); + _selectedNodeIndex = nearestIndex; + + // double click to add + if( Event.current.clickCount > 1 ) + { + var translatedPoint = HandleUtility.GUIPointToWorldRay( Event.current.mousePosition ) + .GetPoint( ( _target.transform.position - Camera.current.transform.position ).magnitude ); + + Undo.RecordObject( _target, "Path Node Added" ); + + // if alt is down then prepend the node to the beginning + if( Event.current.alt ) + insertNodeAtIndex( translatedPoint, 0 ); + else + appendNodeAtPoint( translatedPoint ); + } + } + + + if( _selectedNodeIndex >= 0 ) + { + // shall we delete the selected node? + if( Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Backspace ) + { + if (_target.nodes.Count > 2) { + Undo.RecordObject( _target, "Path Node Deleted" ); + Event.current.Use(); + removeNodeAtIndex( _selectedNodeIndex ); + _selectedNodeIndex = -1; + } + } + } + + + if( _target.nodes.Count > 1 ) + { + // allow path adjustment undo: + Undo.RecordObject( _target, "Path Vector Changed" ); + + // path begin and end labels or just one if the path is closed + if( Vector3.Distance( _target.nodes[0], _target.nodes[_target.nodes.Count - 1] ) == 0 ) + { + Handles.Label( _target.nodes[0], " Begin and End", _labelStyle ); + } + else + { + Handles.Label( _target.nodes[0], " Begin", _labelStyle ); + Handles.Label( _target.nodes[_target.nodes.Count - 1], " End", _labelStyle ); + } + + // draw the handles, arrows and lines + drawRoute(); + + for( var i = 0; i < _target.nodes.Count; i++ ) + { + Handles.color = _target.pathColor; + + // dont label the first and last nodes + if( i > 0 && i < _target.nodes.Count - 1 ) + Handles.Label( _target.nodes[i] + new Vector3( 3f, 0, 1.5f ), i.ToString(), _indexStyle ); + + Handles.color = Color.white; + if( _target.useStandardHandles ) + { + _target.nodes[i] = Handles.PositionHandle( _target.nodes[i], Quaternion.identity ); + } + else + { + // how big shall we draw the handles? + var distanceToTarget = Vector3.Distance( SceneView.lastActiveSceneView.camera.transform.position, _target.transform.position ); + distanceToTarget = Mathf.Abs( distanceToTarget ); + var handleSize = Mathf.Ceil( distanceToTarget / 75 ); + + _target.nodes[i] = Handles.FreeMoveHandle( _target.nodes[i], + Quaternion.identity, + handleSize, + new Vector3( 5, 0, 5 ), + Handles.SphereCap ); + } + + + // should we snap? we need at least 4 nodes because we dont snap to the previous and next nodes + if( Event.current.control && _target.nodes.Count > 3 ) + { + // dont even bother checking for snapping to the previous/next nodes + var index = getNearestNode( _target.nodes[i], i, i + 1, i - 1 ); + var nearest = _target.nodes[index]; + var distanceToNearestNode = Vector3.Distance( nearest, _target.nodes[i] ); + + // is it close enough to snap? + if( distanceToNearestNode <= _snapDistance ) + { + GUI.changed = true; + _target.nodes[i] = nearest; + } + else if( distanceToNearestNode <= _snapDistance * 2 ) + { + // show which nodes are getting close enough to snap to + var color = Color.red; + color.a = 0.3f; + Handles.color = color; + Handles.SphereCap( 0, _target.nodes[i], Quaternion.identity, _snapDistance * 2 ); + //Handles.DrawWireDisc( _target.nodes[i], Vector3.up, _snapDistance ); + Handles.color = Color.white; + } + } + } // end for + + + if( GUI.changed ) + { + Repaint(); + EditorUtility.SetDirty( _target ); + } + } // end if + } + + #endregion + + + #region Private methods + + private void appendNodeAtPoint( Vector3 node ) + { + _target.nodes.Add( node ); + + GUI.changed = true; + } + + + private void removeNodeAtIndex( int index ) + { + if( index >= _target.nodes.Count || index < 0 ) + return; + + _target.nodes.RemoveAt( index ); + + GUI.changed = true; + } + + + private void insertNodeAtIndex( Vector3 node, int index ) + { + // validate the index + if( index >= 0 && index < _target.nodes.Count ) + { + _target.nodes.Insert( index, node ); + + GUI.changed = true; + } + } + + + private void drawArrowBetweenPoints( Vector3 point1, Vector3 point2 ) + { + // no need to draw arrows for tiny segments + var distance = Vector3.Distance( point1, point2 ); + if( distance < 40 ) + return; + + // we dont want to be exactly in the middle so we offset the length of the arrow + var lerpModifier = ( distance * 0.5f - 25 ) / distance; + + Handles.color = _target.pathColor; + + // get the midpoint between the 2 points + var dir = Vector3.Lerp( point1, point2, lerpModifier ); + var quat = Quaternion.LookRotation( point2 - point1 ); + Handles.ArrowCap( 0, dir, quat, 25 ); + + Handles.color = Color.white; + } + + + private int getNearestNode( Vector3 pos, params int[] excludeNodes ) + { + var excludeNodesList = new System.Collections.Generic.List( excludeNodes ); + var bestDistance = float.MaxValue; + var index = -1; + + var distance = float.MaxValue; + for( var i = _target.nodes.Count - 1; i >= 0; i-- ) + { + if( excludeNodesList.Contains( i ) ) + continue; + + distance = Vector3.Distance( pos, _target.nodes[i] ); + if( distance < bestDistance ) + { + bestDistance = distance; + index = i; + } + } + return index; + } + + + private int getNearestNodeForMousePosition( Vector3 mousePos ) + { + var bestDistance = float.MaxValue; + var index = -1; + + var distance = float.MaxValue; + for( var i = _target.nodes.Count - 1; i >= 0; i-- ) + { + var nodeToGui = HandleUtility.WorldToGUIPoint( _target.nodes[i] ); + distance = Vector2.Distance( nodeToGui, mousePos ); + + if( distance < bestDistance ) + { + bestDistance = distance; + index = i; + } + } + + // make sure we are close enough to a node + if( bestDistance < 10 ) + return index; + return -1; + } + + + private void closeRoute() + { + // we will use the GoSpline class to handle the dirtywork of closing the path + var path = new GoSpline( _target.nodes, _target.forceStraightLinePath ); + path.closePath(); + + _target.nodes = path.nodes; + + GUI.changed = true; + } + + + private void persistRouteToDisk( string path ) + { + var bytes = new List(); + + foreach( var vec in _target.nodes ) + { + bytes.AddRange( System.BitConverter.GetBytes( vec.x ) ); + bytes.AddRange( System.BitConverter.GetBytes( vec.y ) ); + bytes.AddRange( System.BitConverter.GetBytes( vec.z ) ); + } + + File.WriteAllBytes( path, bytes.ToArray() ); + } + + + private void drawRoute() + { + // if we are forcing straight lines just use this setup + if( _target.forceStraightLinePath ) + { + // draw just the route here and optional arrows + for( var i = 0; i < _target.nodes.Count; i++ ) + { + Handles.color = _target.pathColor; + if( i < _target.nodes.Count - 1 ) + { + Handles.DrawLine( _target.nodes[i], _target.nodes[i + 1] ); + drawArrowBetweenPoints( _target.nodes[i], _target.nodes[i + 1] ); + } + } + } + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs.meta b/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs.meta new file mode 100644 index 0000000..8e6d794 --- /dev/null +++ b/UnityTests.Unity4/Assets/Editor/GoDummyPathEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 14be03d8aa8eb4defb30eb2e964df151 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/EnginesComparison.cs b/UnityTests.Unity4/Assets/EnginesComparison.cs new file mode 100644 index 0000000..6a48a8b --- /dev/null +++ b/UnityTests.Unity4/Assets/EnginesComparison.cs @@ -0,0 +1,346 @@ +using DG.Tweening; +using Holoville.DebugFramework.Components; +using Holoville.HOTween; +using System; +using System.Collections; +using UnityEngine; + +public class EnginesComparison : MonoBehaviour +{ + public GameObject prefab; + + enum State { + Menu, + Starting, + Executing + } + enum TestType { + Transforms, + GenericFloats + } + enum EngineType { + DOTween, HOTween, LeanTween, GoKit, iTween + } + string[] tweensList = new[] { + "1", "10", "100", "500", "1,000", "2,000", "4,000", "8,000", "16,000", "32,000", "64,000", "128,000" + }; + + TestType testType; + EngineType engineType; + public static int totTweens; + bool disableRenderers; + + State state = State.Menu; + HOFpsGadget fpsGadget; + float startupTime; + Transform container; + Action concludeTest; + public static Transform[] ts; + public static GameObject[] gos; + [System.NonSerialized] public float floatVal; // Used by iTween to at least do something during its update + + string testTitle; + string[] testTypeList, engineTypeList; + int tweensListId = 4; + + + void Start() + { + GameObject fpsGadgetGo = new GameObject("FPS"); + DontDestroyOnLoad(fpsGadgetGo); + fpsGadget = fpsGadgetGo.AddComponent(); + fpsGadget.showMemory = true; + + testTypeList = Enum.GetNames(typeof(TestType)); + engineTypeList = Enum.GetNames(typeof(EngineType)); + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + switch (state) { + case State.Menu: + testType = (TestType)GUILayout.Toolbar((int)testType, testTypeList); + engineType = (EngineType)GUILayout.Toolbar((int)engineType, engineTypeList); + tweensListId = GUILayout.Toolbar(tweensListId, tweensList); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("START")) StartCoroutine(StartTest()); + if (testType == TestType.Transforms) { + if (GUILayout.Button("START (renderers disabled)")) { + disableRenderers = true; + StartCoroutine(StartTest()); + } + } + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); + break; + case State.Starting: + GUILayout.Label("Starting the test..."); + GUILayout.FlexibleSpace(); + break; + case State.Executing: + GUILayout.Label(testTitle); + if (GUILayout.Button("STOP")) StopTest(); + break; + } + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + IEnumerator StartTest() + { + state = State.Starting; + totTweens = int.Parse(tweensList[tweensListId], System.Globalization.NumberStyles.AllowThousands); + testTitle = engineType.ToString(); + SampleClass[] cs = null; + Vector3[] toPositions = null; + float[] toFloats = null; + // Prepare test + switch (testType) { + case TestType.Transforms: + ts = new Transform[totTweens]; + gos = new GameObject[totTweens]; + toPositions = new Vector3[totTweens]; + container = new GameObject("Container").transform; + for (int i = 0; i < totTweens; ++i) { + GameObject go = (GameObject)Instantiate(prefab); + if (disableRenderers) go.renderer.enabled = false; + Transform t = go.transform; + t.parent = container; + t.position = new Vector3(UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f)); + gos[i] = go; + ts[i] = t; + toPositions[i] = new Vector3(UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f)); + } + break; + case TestType.GenericFloats: + cs = new SampleClass[totTweens]; + toFloats = new float[totTweens]; + for (int i = 0; i < totTweens; ++i) { + SampleClass c = new SampleClass(UnityEngine.Random.Range(-100f, 100f)); + cs[i] = c; + toFloats[i] = UnityEngine.Random.Range(-100f, 100f); + } + break; + } + yield return null; + + // Prepare and start engine + float time; + switch (engineType) { + case EngineType.DOTween: + testTitle += " v" + DOTween.Version; + concludeTest = DOTweenTester.Conclude; + DOTween.Init(true, false); + DOTween.SetTweensCapacity(totTweens, 0); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) DOTweenTester.Start(ts, toPositions); + else DOTweenTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.HOTween: + testTitle += " v" + HOTween.VERSION; + concludeTest = HOTweenTester.Conclude; + HOTween.Init(true, false, false); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) HOTweenTester.Start(ts, toPositions); + else HOTweenTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.LeanTween: + concludeTest = LeanTweenTester.Conclude; + LeanTween.init(totTweens + 1); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) LeanTweenTester.Start(gos, toPositions); + else LeanTweenTester.Start(this.gameObject, cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.GoKit: + concludeTest = GoKitTester.Conclude; + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) GoKitTester.Start(ts, toPositions); + else GoKitTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.iTween: + concludeTest = iTweenTester.Conclude; + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) iTweenTester.Start(gos, toPositions); + else iTweenTester.Start(this.gameObject, cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + } + testTitle += " (startup time: " + startupTime + ")"; + yield return null; + + state = State.Executing; + fpsGadget.ResetFps(); + } + + void StopTest() + { + state = State.Menu; + this.StopAllCoroutines(); + concludeTest(); + if (container != null) { + Destroy(container.gameObject); + container = null; + } + ts = null; + gos = null; + disableRenderers = false; + GC.Collect(); + fpsGadget.ResetFps(); + } + + public void UpdateiTweenFloat(float newVal) + { + // Practically does nothing: iTween can't logically tween many floats + // Still a valid test though, and even grants iTween some slack since it will do a LOT less than other engines + floatVal = newVal; + } +} + +public static class DOTweenTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + for (int i = 0; i < ts.Length; ++i) { + ts[i].DOMove(to[i], 1).SetEase(Ease.InOutQuad).SetLoops(-1, DG.Tweening.LoopType.Yoyo); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + DOTween.To(()=> c.floatVal, x=> c.floatVal = x, to[i], 1).SetEase(Ease.InOutQuad).SetLoops(-1, DG.Tweening.LoopType.Yoyo); + } + } + public static void Conclude() + { + DOTween.Clear(true); + } +} + +public static class HOTweenTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo); + for (int i = 0; i < ts.Length; ++i) { + HOTween.To(ts[i], 1, tp.NewProp("position", to[i])); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo); + for (int i = 0; i < cs.Length; ++i) { + HOTween.To(cs[i], 1, tp.NewProp("floatVal", to[i])); + } + } + public static void Conclude() + { + HOTween.Kill(); + UnityEngine.Object.Destroy(GameObject.Find("HOTween")); + } +} + +public static class LeanTweenTester +{ + public static void Start(GameObject[] gos, Vector3[] to) + { + for (int i = 0; i < gos.Length; ++i) { + LeanTween.move(gos[i], to[i], 1).setEase(LeanTweenType.easeInOutQuad).setRepeat(-1).setLoopType(LeanTweenType.pingPong); + } + } + public static void Start(GameObject target, SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + LeanTween.value(target, x=> c.floatVal = x, c.floatVal, to[i], 1).setEase(LeanTweenType.easeInOutQuad).setRepeat(-1).setLoopType(LeanTweenType.pingPong); + } + } + public static void Conclude() + { + LeanTween.reset(); + UnityEngine.Object.Destroy(GameObject.Find("~LeanTween")); + } +} + +public static class GoKitTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); + for (int i = 0; i < ts.Length; ++i) { + goConfig.clearProperties(); + goConfig.addTweenProperty(new PositionTweenProperty(to[i])); + Go.to(ts[i], 1, goConfig); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); + for (int i = 0; i < cs.Length; ++i) { + goConfig.clearProperties(); + goConfig.floatProp("floatVal", to[i]); + Go.to(cs[i], 1, goConfig); + } + } + public static void Conclude() + { + if(EnginesComparison.ts != null) for(int i = 0; i < EnginesComparison.ts.Length; ++i) Go.killAllTweensWithTarget(EnginesComparison.ts[i]); + UnityEngine.Object.Destroy(GameObject.Find("GoKit (" + EnginesComparison.totTweens + " tweens)")); + } +} + +public static class iTweenTester +{ + public static void Start(GameObject[] gos, Vector3[] to) + { + for (int i = 0; i < gos.Length; ++i) { + Hashtable hs = new Hashtable(); + hs.Add("position", to[i]); + hs.Add("time", 1); + hs.Add("looptype", iTween.LoopType.pingPong); + hs.Add("easetype", iTween.EaseType.easeInOutQuad); + iTween.MoveTo(gos[i], hs); + } + } + public static void Start(GameObject target, SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + Hashtable hs = new Hashtable(); + hs.Add("from", c.floatVal); + hs.Add("to", to[i]); + hs.Add("time", 1); + hs.Add("onupdate", "UpdateiTweenFloat"); + hs.Add("looptype", iTween.LoopType.pingPong); + hs.Add("easetype", iTween.EaseType.easeInOutQuad); + iTween.ValueTo(target, hs); + } + } + public static void Conclude() + { + iTween.Stop(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/EnginesComparison.cs.meta b/UnityTests.Unity4/Assets/EnginesComparison.cs.meta new file mode 100644 index 0000000..c8747f3 --- /dev/null +++ b/UnityTests.Unity4/Assets/EnginesComparison.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c24d57978826984a85ca1454246503a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/EnginesComparison.unity b/UnityTests.Unity4/Assets/EnginesComparison.unity new file mode 100644 index 0000000..d4f74e1 Binary files /dev/null and b/UnityTests.Unity4/Assets/EnginesComparison.unity differ diff --git a/UnityTests.Unity4/Assets/EnginesComparison.unity.meta b/UnityTests.Unity4/Assets/EnginesComparison.unity.meta new file mode 100644 index 0000000..6dce113 --- /dev/null +++ b/UnityTests.Unity4/Assets/EnginesComparison.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 411badc256d3c2c4ea41a29a75696d47 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville.meta b/UnityTests.Unity4/Assets/Holoville.meta new file mode 100644 index 0000000..736152d --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 48295f5b83676ed48b64d5dfbf9c9e8a +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework.meta b/UnityTests.Unity4/Assets/Holoville/HODebugFramework.meta new file mode 100644 index 0000000..3c96d6c --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HODebugFramework.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 62ab9f3b6ce5e114a872c9da4424e294 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll new file mode 100644 index 0000000..f08b3a8 Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll differ diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb new file mode 100644 index 0000000..96049cf Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta new file mode 100644 index 0000000..bfa95d5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 222eef240842c49489f37f9f3f8426d5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta new file mode 100644 index 0000000..7563eb3 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0e219f6858bc6be4899178b7a17cefcc +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml new file mode 100644 index 0000000..476ae76 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml @@ -0,0 +1,97 @@ + + + + HODebugFramework + + + + + Shows framerate and eventual memory info during runtime. + Can also force a specific framerate. + + + + + If TRUE also shows memory info. + + + + + Delay between each update of the fps calculation. + + + + + Alignment of the info gadget. + + + + + If different than 0 forces the given framerate. + Set it to 0 if you don't want HOFpsGadget to do anything with Application.targetFrameRate. + + + + + Static methods to draw gizmos automatically every frame. + + + + + if is set to TRUE, + this is just a reference size used to create points of random sizes + (useful to avoid overlapping points being hidden). + + + + + If TRUE, points will have a random radius. + + + + + If TRUE and no color is passed to methods, uses a random color. + + + + + Default color. + + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a target to be constantly evidenced. + + + Adds a target to be constantly evidenced. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + + Clears all gizmos managed by . + + + + diff --git a/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta new file mode 100644 index 0000000..eca140e --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 99c0393477c34c34d88070193f029429 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween.meta b/UnityTests.Unity4/Assets/Holoville/HOTween.meta new file mode 100644 index 0000000..438d26f --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ac42016c2e6cec747a60d52ef7ec66a1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/Editor.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor.meta new file mode 100644 index 0000000..988ec32 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 908988ff5c69010448c95aeec9824ee7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll new file mode 100644 index 0000000..d86831a Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll differ diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb new file mode 100644 index 0000000..22e55bd Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta new file mode 100644 index 0000000..3a8659f --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5f25b9ebc7cf994e84b23d5cc679c11 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta new file mode 100644 index 0000000..e485605 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 93bb3a583aeaea948a20ab316d0b585a +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML new file mode 100644 index 0000000..4716c85 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML @@ -0,0 +1,8450 @@ + + + + HOTween + + + + + Plugin for the tweening of the color of your choice. + Used for changing material colors different from the default one (like _SpecColor or _Emission). + Target for this tween must be of type . + + + + + ABSTRACT base class for all classes. + + + + + Untyped start value. + + + + + Untyped end value. + + + + + Stored so it can be set indipendently in case of speed-based tweens. + + + + + Name of the property being tweened. Stored during Init, used by overwrite manager and log messages. + + + + + Stored to be used during recreation of plugin for partial tweens. + + + + + Ease type. + + + + + Indicates that the end value is relative instead than absolute. + Default: false. + + + + + Some plugins (like PlugSetColor) may set this to false when instantiated, + to prevent the creation of a useless valAccessor. + + + + + Reference to the Tweener controlling this plugin. + + + + + Creates a new instance of this plugin with the given options. + Used because easeType can't be null, and otherwise there's no way + to understand if the ease was voluntarily set by the user or not. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin with the given options. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin with the given options. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Initializes the plugin after its instantiation. + Called by Tweener after a property and plugin have been validated, and the plugin has to be set and added. + Virtual because some classes (like PlugVector3Path) override it to avoid isRelative being TRUE. + + + The to refer to. + + + The name of the property to control. + + + The to use. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + + + Starts up the plugin, getting the actual start and change values. + Called by Tweener right before starting the effective animations. + + + + + Starts up the plugin, getting the actual start and change values. + Called by Tweener right before starting the effective animations. + + + Set to true by , + to calculate only the speed based duration and then reset any startup changes + (so Startup can be called from scratch when truly starting up). + + + + + If speed based duration was not already set (meaning Startup has not yet been called), + calculates the duration and then resets the plugin so that Startup will restart from scratch. + Used by . + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup (loops excluded). + + + + + Updates the plugin. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Reverses the ease of this plugin. + + + + + Sets the ease type (called during Init, but can also be called by Tweener to change easeType while playing). + + + + + Returns the speed-based duration based on the given speed. + + + + + Returns a clone of the basic plugin + (as it was at construction, without anything that was set during Init). + + + + + Sets the typed changeVal based on the current startVal and endVal. + Can only be called once, otherwise some typedEndVal (like HOTPluginColor) will be set incorrectly. + + + + + Used by Tweeners to force SetIncremental + (SetIncremental can't be made internal since + it needs to be overridden outside of HOTweem for custom plugin). + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor or PlugQuaterion) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Used by TweenParms to understand if this plugin was initialized with + another Tweener, and thus clone it. + + + + + Used by to get the property name. + + + + + Some plugins might override this to specify a different ID (like PlugVector3X). + Used by to check if two plugins are the same (for overwrite purposes). + Plugins with -1 ids always overwrite and are overwritten. + Plugins with different ids are always overwritten by plugins with -1 ids, + but overwrite only identical ids. + + + The plugin identifier. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Selects the color property to change. + + + The propertyName/colorName to change (see Unity's if you don't know how it works), + set via the enum. + + + + + Selects the color property to change. + + + The propertyName/colorName to change (see Unity's if you don't know how it works). + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enumeration of color properties names. + + + + + Main color of a material. + + + + + Specular color of a material (used in specular/glossy/vertexlit shaders). + + + + + Emissive color of a material (used in vertexlit shaders). + + + + + Reflection color of a material (used in reflective shaders). + + + + + Default plugin for the tweening of Vector4 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Plugin for uint values + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Default plugin for the tweening of Vector3 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Public interface shared by and . + + + + + Kills this Tweener/Sequence. + + + + + Resumes this Tweener/Sequence (tween delay included). + + + + + Resumes this Tweener/Sequence (tween delay included) and plays it forward. + + + + + Resumes this Tweener/Sequence and plays it backwards. + + + + + Pauses this Tweener/Sequence. + + + + + Rewinds this Tweener/Sequence (loops and tween delay included), and pauses it. + + + + + Restarts this Tweener/Sequence from the beginning (loops and tween delay included). + + + + + Reverses this Tweener/Sequence, + animating it backwards from its current position. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + + + Completes this Tweener/Sequence. + Where a loop was involved and not infinite, the Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + A coroutine that waits until the Tweener/Sequence is complete (delays and loops included). + You can use it inside a coroutin as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForCompletion() ); + + + + + A coroutine that waits until the Tweener/Sequence is rewinded (loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForRewind() ); + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + + Returns true if the given target is currently involved in this Tweener/Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside this Tweener/Sequence, than if the relative Tweener/Sequence is paused. + To simply check if the target is attached to this Tweener/Sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + A value of true if the given target is currently involved in a running tween or sequence. + + + + + Returns true if the given target is linked to this Tweener/Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to this Tweener/Sequence (running or not, taking into account also nested tweens). + + + + + Eventual ID of this tween + (more than one tween can share the same ID, thus allowing for grouped operations). + You can also use intId instead of id for faster operations. + + + + + Default is -1. + Eventual int ID of this tween + (more than one tween can share the same intId, thus allowing for grouped operations). + The main difference from id is that while id is more legible, intId allows for faster operations. + + + + + Default is true. + If false doesn't remove this Tweener/Sequence from HOTween's list when it is completed + (useful if you want to be able to control it independently with GoTo, instead than letting it run), + and you will need to call an HOTween.Kill to remove this Tweener/Sequence. + + + + + Default is true. + If set to false, this Tweener/Sequence will not be updated, + and any use of animation methods (Play/Pause/Rewind/etc) will be ignored + (both if called directly via this instance, than if using HOTween.Play/Pause/Rewind/etc.). + + + + + Time scale that will be used by this Tweener/Sequence. + + + + + Number of times the Tweener/Sequence will run (-1 means the tween has infinite loops, 1 means the tween will run only once). + + + + + Type of loop for this Tweener/Sequence, in case is greater than 1 (or infinite). + + + + + Gets and sets the time position of the Tweener/Sequence (loops are included when not infinite, delay is not). + + + + + Duration of this Tweener/Sequence, loops and tween delay excluded. + + + + + Full duration of this Tweener/Sequence, loops included (when not infinite) but tween delay excluded. + + + + + Elapsed time within the current loop (tween delay excluded). + Note that elapsed will be equal to duration only when all the loops are completed, + otherwise each time a loop is completed, completedLoops is augmented by 1 and elapsed is reset to 0. + + + + + Full elapsed time including loops (but without considering tween delay). + + + + + The update type for this Tweener/Sequence. + + + + + Number of loops that have been executed. + + + + + Returns a value of true if this Tweener/Sequence contains no tweens + (if this is a Tweener, it means that no valid property to tween was set; + if this is a Sequence, it means no valid was added). + + + + + Returns a value of true if this Tweener/Sequence is set to go backwards (because of a call to Reverse. + + + + + Returns a value of true when this Tweener/Sequence is in the "going backwards" part of a Yoyo loop. + + + + + Returns a value of true if this Tweener/Sequence is paused. + + + + + Returns a value of true after this Tweener/Sequence was started the first time, + or if a call to GoTo or GoToAndPlay was executed. + + + + + Returns a value of true when this Tweener/Sequence is complete. + + + + + Returns a value of true if this Tweener/Sequence was added to a Sequence. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Base class for all HOTween members + ( and ). + + + + + Always set to TRUE by Update(), if isStartupIteration is true, + and reset to FALSE in the last line of Update(). + Can also be set to TRUE by Sequence.TweenStartupIteration, + and then immediately reset to FALSE. + + + + + Used by main Sequences to set an ignoreCallbacks value to all its items/subitems, + which the items/subitmes themselves won't be able to reset. + Necessary during TweenStartupIteration. + + + + + Completed loops. + + + + + Duration. + + + + + Memorized when a partial tween is applied. + + + + + Memorized when applying speedBased duration. + + + + + Full duration. + + + + + Elapsed. + + + + + Full elapsed. + + + + + Destroyed. + + + + + Is empty. + + + + + Running backwards. + + + + + Yoyo looping back. + + + + + Has started. + + + + + Is complete. + + + + + Used to determine if OnUpdate callbacks should be called. + Refreshed at the end of each update. + + + + + Previously completed loops. + Refrehsed at the end of each update. + + + + + True if there are behaviours to manage + + + + + True if there are gameObject to manage + + + + + Behaviours to activate + + + + + Behaviours to deactivate + + + + + GameObjects to activate + + + + + GameObejcts to deactivate + + + + + True = enabled, False = disabled + + + + + True = active, False = inactive + + + + + Kills this Tweener/Sequence, removes it from HOTween, and cleans it. + + + + + Kills this Tweener/Sequence and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Resumes this Tweener/Sequence (tween delay included). + + + + + Resumes this Tweener/Sequence (tween delay included) and plays it forward. + + + + + Resumes this Tweener/Sequence and plays it backwards. + + + + + Pauses this Tweener/Sequence. + + + + + Rewinds this Tweener/Sequence (loops and tween delay included), and pauses it. + + + + + Restarts this Tweener/Sequence from the beginning (loops and tween delay included). + + + + + Reverses this Tweener/Sequence, + animating it backwards from its curren position. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + + + Completes this Tweener/Sequence. + Where a loop was involved, the Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + By default, if a Tweener/Sequence is already at the exact given time, it will not be refreshed. + Setting this to true will force it to refresh + (useful only if you want to be sure that any changes you made to the tweened property, + outside of HOTween, are reset). + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + By default, if a Tweener/Sequence is already at the exact given time, it will not be refreshed. + Setting this to true will force it to refresh + (useful only if you want to be sure that any changes you made to the tweened property, + outside of HOTween, are reset). + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + A coroutine that waits until the Tweener/Sequence is complete (delays and loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForCompletion() ); + + + + + A coroutine that waits until the Tweener/Sequence is rewinded (loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForRewind() ); + + + + + Completely resets this tween, except its target (in case of Tweeners). + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + This overload will use sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + The type of callback to apply + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + + + + Returns true if the given target is currently involved in a running tween or sequence. + Returns false both if the given target is not inside a tween, than if the relative tween is paused. + To simply check if the target is attached to a tween or sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + A value of true if the given target is currently involved in a running tween or sequence. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the given target is linked to a tween or sequence (running or not). + + + The target to check. + + + A value of true if the given target is linked to a tween or sequence (running or not). + + + + + Returns a list of all the targets of this tween, or NULL if there are none. + + A list of all the targets of this tween, or NULL if there are none. + + + + Returns a list of the eventual existing tweens with the given Id within this ABSTweenComponent, + nested tweens included (or an empty list if no tweens were found). + + + + + Returns a list of the eventual existing tweens with the given intId within this ABSTweenComponent, + nested tweens included (or an empty list if no tweens were found). + + + + + Used internally by HOTween, to avoid having the tween calling a kill while HOTween will already be killing it. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + A value of true if the tween is not reversed and is complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Applies the correct Incremental Sequence loop value. + Called by Sequences when they need to change the increment value of nested Sequences/Tweeners. + + + The difference from the previous main Sequence loop increment. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Manages on first start behaviour. + + + + + Manages on update behaviour. + + + + + Manages on plugin results behaviour. + + + + + Manages on pause behaviour. + + + + + Manages on resume behaviour (also called when the tween starts). + + + + + Manages on rewinded behaviour. + + + + + Manages step on complete behaviour. + + + + + Manages on complete behaviour. + + + + + Called by HOTween if this tween was placed inside its onCompletes list during this.OnComplete(). + + + + + Sets the current fullDuration, based on the current duration and loops values. + Remember to call this method each time you change the duration or loops of a tween. + + + + + Sets the current elapsed time, based on the current fullElapsed and completedLoops values. + Remember to call this method each time you set fullElapsed (after changing the eventual loops count where needed). + + + + + Sets completedLoops and isLoopingBack, based on the current fullElapsed value. + + + + + Manages the components/gameObjects that should be activated/deactivated. + + + + + Fills the given list with all the plugins inside this sequence tween, + while also looking for them recursively through inner sequences. + Used by HOTween.GetPlugins. + + + + + Eventual string ID of this Tweener/Sequence + (more than one Tweener/Sequence can share the same ID, thus allowing for grouped operations). + You can also use intId instead of id for faster operations. + + + + + Eventual int ID of this Tweener/Sequence + (more than one Tweener/Sequence can share the same intId, thus allowing for grouped operations). + The main difference from id is that while id is more legible, intId allows for faster operations. + + + + + Default is true, which means this Tweener/Sequence will be killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Tweener/Sequence from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Tweener/Sequence. + + + + + Default is true. + If set to false, this Tweener/Sequence will not be updated, + and any use of animation methods (Play/Pause/Rewind/etc) will be ignored + (both if called directly via this instance, than if using HOTween.Play/Pause/Rewind/etc.). + + + + + Time scale that will be used by this Tweener/Sequence. + + + + + Number of times the Tweener/Sequence will run (-1 means the tween has infinite loops). + + + + + Type of loop for this Tweener/Sequence, in case is greater than 1 (or infinite). + + + + + Gets and sets the time position of the Tweener/Sequence (loops are included when not infinite, delay is not). + + + + + Duration of this Tweener/Sequence, loops and tween delay excluded. + + + + + Full duration of this Tweener/Sequence, loops included (when not infinite) but tween delay excluded. + + + + + Elapsed time within the current loop (tween delay excluded). + + + + + Full elapsed time including loops (but without considering tween delay). + + + + + The update type for this Tweener/Sequence. + + + + + Number of loops that have been executed. + + + + + Returns a value of true if this Tweener/Sequence was destroyed + (either because it was manually destroyed, because it was completed, or because its target was destroyed). + + + + + Returns a value of true if this Tweener/Sequence contains no tweens + (if this is a tween, it means that no valid property to tween was set; + if this is a sequence, it means no valid was yet added). + + + + + Returns a value of true if this Tweener/Sequence is set to go backwards (because of a call to Reverse. + + + + + Returns a value of true when this Tweener/Sequence is in the "going backwards" part of a Yoyo loop. + + + + + Returns a value of true if this Tweener/Sequence is paused. + + + + + Returns a value of true after this Tweener/Sequence was started the first time, + or if a call to GoTo or GoToAndPlay was executed. + + + + + Returns a value of true when this Tweener/Sequence is complete. + + + + + Returns a value of true if this Tweener/Sequence was added to a Sequence. + + + + + Default plugin for the tweening of Vector2 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Tween type + + + + + Tween to value + + + + + Tween from value + + + + + Sequence component. Manager for sequence of Tweeners or other nested Sequences. + Author: Daniele Giardini (http://www.holoville.com) + + + + + Creates a new Sequence without any parameter. + + + + + Creates a new Sequence. + + + A representing the Sequence parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new SequenceParms().Id("sequence1").Loops(2).OnComplete(myFunction) + + + + Appends the given callback to this Sequence. + The function to call, who must return void and accept no parameters + + + Appends the given callback to this Sequence. + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + Appends the given SendMessage callback to this Sequence. + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + Inserts the given callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + The function to call, who must return void and accept no parameters + + + Inserts the given callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + Inserts the given SendMessage callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Appends an interval to the right of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The duration of the interval. + + + The new Sequence total time length (loops excluded). + + + + + Adds the given to the right of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The to append. + + + The new Sequence total time length (loops excluded). + + + + + Prepends an interval to the left of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The duration of the interval. + + + The new Sequence total time length (loops excluded). + + + + + Adds the given to the left of the sequence, + moving all the existing sequence elements to the right, + and returns the new Sequence total time length (loops excluded). + + + The to prepend. + + + The new Sequence total time length (loops excluded). + + + + + Inserts the given at the given time, + and returns the new Sequence total time length (loops excluded). + + + The time at which the element must be placed. + + + The to insert. + + + The new Sequence total time length (loops excluded). + + + + + Clears this sequence and resets its parameters, so it can be re-used. + You can check if a Sequence is clean by querying its isEmpty property. + + + New parameters for the Sequence + (if NULL, note that the dafult ones will be used, and not the previous ones) + + + + + Kills this Sequence and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Rewinds this Sequence (loops included), and pauses it. + + + + + Restarts this Sequence from the beginning (loops included). + + + + + Returns true if the given target is currently involved in a running tween of this Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside any of this Sequence tweens, than if the relative tween is paused. + To simply check if the target is attached to a tween of this Sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the given target is linked to a tween of this Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to a tween of this Sequence (running or not, taking into account also nested tweens). + + + + + Returns a list of all the targets of this Sequence, or NULL if there are none. + + A list of all the targets of this Sequence, or NULL if there are none. + + + + Returns a list of the eventual nested objects whose target is the given one, + or an empty list if none was found. + + + + + Returns a list of the eventual existing tweens with the given Id within this Sequence, + nested tweens included (or an empty list if no tweens were found). + + + + + Returns a list of the eventual existing tweens with the given Id within this Sequence, + nested tweens included (or an empty list if no tweens were found). + + + + + Removes the given tween from this Sequence, + and eventually kills the Sequence if all items have been removed. + Used by to remove overwritten tweens. + + + + + Completes this Sequence. + Where a loop was involved, the Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Updates the Sequence by the given elapsed time, + and returns a value of true if the Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + A value of true if the Sequence is not reversed and is complete (or all the Sequence tween targets don't exist anymore), otherwise false. + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + Sends the sequence to the given time (taking also loops into account) and eventually plays it. + If the time is bigger than the total sequence duration, it goes to the end. + + + Returns true if the sequence reached its end and was completed. + + + + + Iterates through all the elements in order, to startup the plugins correctly. + Called at OnStart and during Append/Insert/Prepend for speedBased tweens (to calculate correct duration). + + + + + If the given is a speedBased , + forces it to calculate the correct duration. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Fills the given list with all the plugins inside this sequence tween, + while also looking for them recursively through inner sequences. + Used by HOTween.GetPlugins. + + + + + Single sequencer item. + Tween value can be null (in case this is simply used as a spacer). + + + + + Default plugin for the tweening of number values. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enumeration of ease types. + + + + + Linear. + + + + + Ease in sine. + + + + + Ease out sine. + + + + + Ease in out sine. + + + + + Ease in quad. + + + + + Ease out quad. + + + + + Ease in out quad. + + + + + Ease in cubic. + + + + + Ease out cubic. + + + + + Ease in out cubic. + + + + + Ease in quart. + + + + + Ease out quart. + + + + + Ease in out quart. + + + + + Ease in quint. + + + + + Ease out quint. + + + + + Ease in out quint. + + + + + Ease in expo. + + + + + Ease out expo. + + + + + Ease in out expo. + + + + + Ease in circ. + + + + + Ease out circ. + + + + + Ease in out circ. + + + + + Ease in elastic. + + + + + Ease out elastic. + + + + + Ease in out elastic. + + + + + Ease in back. + + + + + Ease out back. + + + + + Ease in out back. + + + + + Ease in bounce. + + + + + Ease out bounce. + + + + + Ease in out bounce. + + + + + Don't assign this! It's assigned internally when setting the ease to an AnimationCurve + + + + + Ease in strong. + OBSOLETE: use EaseInQuint instead. + + + + + OBSOLETE: use EaseOutQuint instead. + Ease out strong. + + + + + OBSOLETE: use EaseInOutQuint instead. + Ease in out strong. + + + + + Enumeration of ease types. + + + + + Ease function. + + + + + Inverse ease function. + + + + + Creates a new instance. + + + The ease function. + + + Inverse ease function. + + + + + Returns an instance based on the given . + + + An . + + + + + Plugin for the tweening of only the Z value of Vector3 objects. + + + + + Plugin for the tweening of only the X value of Vector3 objects. + + + + + Start val. + + + + + End val. + + + + + Change val. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Various utils used by HOTween. + + + + + Converts the given Matrix4x4 to a Quaternion and returns it. + + + The matrix to convert. + + + The resulting . + + + + + Returns a string representing the given Type without the packages + (like Single instead than System.Single). + + + + + Returns the 2D angle between two vectors + + + + + Used by and HOTweenInspector, + to store info about tweens that can be displayed. + + + + + Tween. + + + + + Is sequence. + + + + + Targets. + + + + + Creates a new TweenInfo object. + + + + + Is paused. + + + + + Is complete. + + + + + Is enabled. + + + + + PropertyAccessorException class. + + + + + The IMemberAccessor interface defines a member + accessor. + + + + + Gets the value stored in the member for + the specified target. + + Object to retrieve + the member from. + Member value. + + + + Sets the value for the member of + the specified target. + + Object to set the + member on. + Member value. + + + + Creates a new member accessor. + + Member + + + + Added by Daniele Giardini for HOTween, + because if a Make is called we already know that a PropertyInfo or FieldInfo exist, + and we can directly pass them as parameters. + + + + + Thanks to Ben Ratzlaff for this snippet of code + http://www.codeproject.com/cs/miscctrl/CustomPropGrid.asp + + "Initialize a private hashtable with type-opCode pairs + so i dont have to write a long if/else statement when outputting msil" + + + + + Gets the member value from the specified target. + + Target object. + Member value. + + + + Sets the member for the specified target. + + Target object. + Value to set. + + + + This method generates creates a new assembly containing + the Type that will provide dynamic access. + + + + + Create an assembly that will provide the get and set methods. + + + + + Whether or not the Member supports read access. + + + + + Whether or not the Member supports write access. + + + + + The Type of object this member accessor was + created for. + + + + + The Type of the Member being accessed. + + + + + Used to interpret AnimationCurves as eases. + + + + + Plugin for the tweening of only the Y value of Vector3 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Default plugin for the tweening of Color objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Enumeration of the levels of warning that should be used to output messages in case of auto-resolved errors. + + + + + No messages will be logged. + + + + + Only important messages will be logged + (this will exclude warnings when a tween is overwritten). + + + + + All messages will be logged. + + + + + Enumeration of types of update that can be applied to a tween. + + + + + Normal update. + + + + + Late update. + + + + + Fixed update (useful for rigidBodies). + + + + + Timescale independent update. + Contrary to the other types, this one is not subject to changes in Time.timeScale, + thus it's the best way for tweens that happen inside GUI methods + (so that even if the game is paused, the GUI will still have animated tweens). + + + + + This object is passed as the only parameter of all HOTween's callbacks. + + + + + A reference to the IHOTweenComponent that invoked the callback method. + + + + + An array of eventual parameters that were passed to the callback. + + + + + The plugin (if any) that triggered the callback. + + + + + Plugin for the tweening of strings. + + + + + Creates a new instance of this plugin using the main ease type, + substituting any existing string with the given one over time. + + + The value to tween to. + + + + + Creates a new instance of this plugin, + substituting any existing string with the given one over time. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given value will be added to any existing string, + if false the existing string will be completely overwritten. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given value will be added to any existing string, + if false the existing string will be completely overwritten. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + HOTweenException class. + A new HOTweenException is thrown each time HOTween encounters an error. + + + + + Creates a new HOTweenException with the given message. + + + The exception message. + + + + + The PropertyAccessor class provides fast dynamic access + to a property of a specified target class. + + + + + Creates a new property accessor. + + + + + The Type of the Property being accessed. + + + + + Whether or not the Property supports read access. + + + + + Whether or not the Property supports write access. + + + + + Tween component, created by HOTween for each separate tween. + Author: Daniele Giardini (http://www.holoville.com) + + + + + Called by HOTween each time a new tween is generated via To or similar methods. + + + + + Kills this Tweener and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Resumes this Tweener. + + + If true skips any initial delay. + + + + + Resumes this Tweener and plays it forward. + + + If true skips any initial delay. + + + + + Rewinds this Tweener (loops and tween delay included), and pauses it. + + + + + Rewinds this Tweener (loops included), and pauses it. + + + If true skips any initial delay. + + + + + Restarts this Tweener from the beginning (loops and tween delay included). + + + + + Restarts this Tweener from the beginning (loops and tween delay included). + + + If true skips any initial delay. + + + + + Restarts the tween from position 0, but takes the current target value as start value, + and diffs to find the change value (as if it was a relative tween). + + + + + Completes this Tweener. + Where a loop was involved, the Tweener completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Completely resets the Tweener except its target, + and applies a new , duration, and . + + New tween type (to/from) + New duration + New parameters + + + + Completely resets this Tweener, except its target + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + + + + Returns true if the given target and this Tweener target are the same, and the Tweener is running. + Returns false both if the given target is not the same as this Tweener's, than if this Tweener is paused. + This method is here to uniform with . + + + The target to check. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + This method is here to uniform with . + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + This method is here to uniform with . + + + The id to check for. + + + + + Returns true if the given target and this Tweener target are the same. + This method is here to uniform with . + + + The target to check. + + + A value of true if the given target and this Tweener target are the same. + + + + + Returns a list containing the target of this tween. + + A list containing the target of this tween. + + + + Returns a list containing this tween if the id is the same as the given one + (or and empty list if no tweens were found). + + + + + Returns a list containing this tween if the id is the same as the given one + (or and empty list if no tweens were found). + + + + + If this Tweener contains a tween, + returns a point on the path at the given percentage (0 to 1). + Returns a zero Vector if there's no path tween associated with this tween. + Note that, if the tween wasn't started, the OnStart callback will be called + the first time you call this method, because the tween needs to be initialized. + + The percentage (0 to 1) at which to get the point + + + + If this Tweener contains a tween returns the length of the path, + otherwise returns -1 + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + also re-adapting the duration to the correct partial, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + + Tween duration of the partial path (if -1 auto-calculates the correct partial based on the original duration) + + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + New EaseType to apply + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + + Id of the new ending waypoint on the current path + (-1 in case you want to target the ending waypoint of a closed path) + + + Tween duration of the partial path (if -1 auto-calculates the correct partial based on the original duration) + + New EaseType to apply + + + + If this Tweener contains a tween + that had been partialized, returns it to its original size, easing, and duration, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + + + If this Tweener contains a , returns it. + Otherwise returns null. + + + + + + Updates the Tweener by the given elapsed time, + and returns a value of true if the Tweener is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup or HOTween.From), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + If true uses p_shortElapsed fully ignoring the delay + (useful when setting the initial FROM state). + + + A value of true if the Tweener is not reversed and is complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + If speed based duration was not already set (meaning OnStart has not yet been called), + calculates the duration and then resets the tween so that OnStart can be called from scratch. + Used by Sequences when Appending/Prepending/Inserting speed based tweens. + + + + + Sends the tween to the given time (taking also loops into account) and eventually plays it. + If the time is bigger than the total tween duration, it goes to the end. + + + Returns true if the tween reached its end and was completed. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + If TRUE forces startup even if it had already been executed + + + + Manages on first start behaviour. + + + + + Manages on play behaviour + + + + + Fills the given list with all the plugins inside this tween. + Used by HOTween.GetPlugins. + + + + + Returns the correct id of the given waypoint, converted to path id. + + Vector3 path plugin to use + Waypoint to convert + If TRUE indicates that the given waypoint is the starting one, + otherwise it's the ending one + + + + + Indicates whether this is a FROM or a TO tween. + + + + + Ease type of this tweener + (consider that the plugins you have set might have different ease types). + Setting it will change the ease of all the plugins used by this tweener. + + + + + Ease type of this tweener + (consider that the plugins you have set might have different ease types). + Setting it will change the ease of all the plugins used by this tweener. + + + + + Eventual overshoot to use with Back easeTypes. + + + + + Eventual period to use with Elastic easeTypes. + + + + + Target of this tween. + + + + + true if this tween is animated via integers values only. + + + + + true if this tween is animated by speed instead than by duration. + + + + + The delay that was set for this tween. + + + + + The currently elapsed delay time. + + + + + Default plugin for the tweening of Rect objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Type of path (used with ) + + + + + Straight path + + + + + Curved (Catmull-Rom) path + + + + + Main tween manager. + Controls all tween types ( and ), + and is used to directly create Tweeners (to create Sequences, directly create a new instead). + Author: Daniele Giardini (http://www.holoville.com) + + + + + HOTween author - me! :P + + + + + HOTween version. + + + + + Default that will be used by any new Tweener/Sequence that doesn't implement a specific ease + (default = EaseType.easeOutQuad) + + + + + Default time scale that will be used by any new Tweener/Sequence that doesn't implement a specific timeScale + (default = 1). + + + + + Default that will be used by any new Tweener/Sequence that doesn't implement a specific ease + (default = EaseType.easeOutQuad). + + + + + Default overshoot to use with Back easeTypes. + + + + + Default period to use with Elastic easeTypes. + + + + + Default that will be used by any Tweener/Sequence that doesn't implement a specific loopType + (default = LoopType.Restart). + + + + + If true, shows the eventual paths in use by + while playing inside Unity's Editor (and if the Editor's Gizmos button is on). + + + + + Level of message output in case an error is encountered. + Warnings are logged when HOTween encounters an error, and automatically resolves it without throwing any exception + (like if you try to tween an unexisting property, in which case the tween simply won't be generated, + and an eventual warning will appear in the output window). + + + + + true if the current player is iOS (iPhone). + Used so simple Reflection instead than unsupported MemberAccessorCacher will be applyed + (iOS doesn't support Reflection.Emit). + + + + + true if the current player is running in the Editor. + + + + + Filled by tweens that are completed, so that their onCompleteDispatch method can be called AFTER HOTween has eventually removed them + (otherwise a Kill + To on the same target won't work). + This field is emptied as soon as all onCompletes are called. + + + + + Reference to overwrite manager (if in use). + + + + + Initializes and sets it as non-permanent + (meaning HOTween instance will be destroyed when all tweens are killed, + and re-created when needed). + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + + + Initializes . + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + If set to true, doesn't destroy HOTween manager when no tween is present, + otherwise the manager is destroyed when all tweens have been killed, + and re-created when needed. + + + + + Initializes . + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + If set to true, doesn't destroy HOTween manager when no tween is present, + otherwise the manager is destroyed when all tweens have been killed, + and re-created when needed. + + + If true, renames HOTween's instance to show + the current number of running tweens (only while in the Editor). + + + If true, allows HOTween's instance to enable or disable + the OverwriteManager to improve performance if it is never needed. + + + + + Called internally each time a new is created. + Adds the given Sequence to the tween list. + + + The to add. + + + + + Creates a new absolute tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The ease to use. + + + The eventual delay to apply. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The ease to use. + + + The eventual delay to apply. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute PUNCH tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The end value the property should reach with the tween. + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new PUNCH tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The end value the property should reach with the tween. + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new PUNCH tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + Any ease type passed won't be considered, since punch uses its own one. + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute SHAKE tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The amount of shaking to apply. + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new SHAKE tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The amount of shaking to apply. + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new SHAKE tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + Any ease type passed won't be considered, since shake uses its own one. + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Updates normal tweens. + + + + + Updates lateUpdate tweens. + + + + + Updates fixedUpdate tweens. + + + + + Updates timeScaleIndependent tweens. + + + + + Enables the overwrite manager (disabled by default). + + If TRUE, the overwriteManager will log a warning each time a tween is overwritten + + + + Disables the overwrite manager (disabled by default). + + + + + Pauses all the tweens for the given target, and returns the total number of paused Tweeners. + + + The target whose tweens to pause. + + + The total number of paused Tweeners. + + + + + Pauses all the Tweeners/Sequences with the given ID, and returns the total number of paused Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to pause. + + + The total number of paused Tweeners/Sequences. + + + + + Pauses all the Tweeners/Sequences with the given intId, and returns the total number of paused Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to pause. + + + The total number of paused Tweeners/Sequences. + + + + + Pauses the given Tweener, and returns the total number of paused ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to pause. + + + The total number of paused Tweener (1 if the Tweener existed, otherwise 0). + + + + + Pauses the given Sequence, and returns the total number of paused ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to pause. + + + The total number of paused Sequence (1 if the sequence existed, otherwise 0). + + + + + Pauses all Tweeners/Sequences, and returns the total number of paused Tweeners/Sequences. + + + The total number of paused Tweeners/Sequences. + + + + + Resumes all the tweens (delays included) for the given target, and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the tweens for the given target, and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given ID, and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener (delays included), and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Tweener, and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners (delays included) and Sequences, and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all Tweeners/Sequences, and returns the total number of resumed Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the tweens (delays included) for the given target, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the tweens for the given target, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given ID, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given ID, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given intId, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener (delays included), + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Tweener, + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners (delays included) and Sequences, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all Tweeners/Sequences, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the tweens for the given target, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners/Sequences with the given ID, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener, + sets it so that it moves backwards instead than forward, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, + sets it so that it moves backwards instead than forward, + and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners/Sequences, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Rewinds all the tweens (delays included) for the given target, and returns the total number of rewinded Tweeners. + + + The target whose tweens to rewind. + + + The total number of rewinded Tweeners. + + + + + Rewinds all the tweens for the given target, and returns the total number of rewinded Tweeners. + + + The target whose tweens to rewind. + + + If true skips any initial delay. + + + The total number of rewinded Tweeners. + + + + + Rewinds all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of rewinded Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to rewind. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners/Sequences with the given ID, and returns the total number of rewinded Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to rewind. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of rewinded Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to rewind. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners/Sequences with the given intId, and returns the total number of rewinded Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to rewind. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds the given Tweener (delays included), and returns the total number of rewinded ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to rewind. + + + The total number of rewinded Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Rewinds the given Tweener, and returns the total number of rewinded ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to rewind. + + + If true skips any initial delay. + + + The total number of rewinded Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Rewinds the given Sequence, and returns the total number of rewinded ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to rewind. + + + The total number of rewinded Sequences (1 if the Sequence existed, otherwise 0). + + + + + Rewinds all Tweeners (delay included) and Sequences, and returns the total number of rewinded Tweeners/Sequences. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all Tweeners/Sequences, and returns the total number of rewinded Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Restarts all the tweens (delays included) for the given target, and returns the total number of restarted Tweeners. + + + The target whose tweens to restart. + + + The total number of restarted Tweeners. + + + + + Restarts all the tweens for the given target, and returns the total number of restarted Tweeners. + + + The target whose tweens to restart. + + + If true skips any initial delay. + + + The total number of restarted Tweeners. + + + + + Restarts all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of restarted Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners/Sequences with the given ID, and returns the total number of restarted Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to restart. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of restarted Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners/Sequences with the given intId, and returns the total number of restarted Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to restart. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts the given Tweener (delays included), and returns the total number of restarted ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to restart. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts the given Tweener, and returns the total number of restarted ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to restart. + + + If true skips any initial delay. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts the given Sequence, and returns the total number of restarted ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to restart. + + + The total number of restarted Sequences (1 if the Sequence existed, otherwise 0). + + + + + Restarts all Tweeners/Sequences (delay included) and Sequences, and returns the total number of restarted Tweeners/Sequences. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all Tweeners/Sequences and returns the total number of restarted Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all tweens from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The target whose tweens to restart. + + + The total number of restarted Tweeners. + + + + + Restarts all the Tweeners from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The ID of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The intId of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts the given Tweener from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The Tweener to restart. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts all Tweeners/Sequences from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The total number of restarted Tweeners/Sequences. + + + + + Reverses all the tweens for the given target, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners. + + + The target whose tweens to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners. + + + + + Reverses all the Tweeners/Sequences with the given ID, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Reverses all the Tweeners/Sequences with the given intId, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Reverses the given Tweener, + animating it from its current value back to the starting one, + and returns the total number of reversed Tweeners (1 if the Tweener existed, otherwise 0). + + + The Tweener to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Reverses the given Sequence, and returns the total number of reversed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Reverses all Tweeners/Sequences, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Completes all the tweens for the given target, and returns the total number of completed Tweeners. + Where a loop was involved and not infinite, the relative tween completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The target whose tweens to complete. + + + The total number of completed Tweeners. + + + + + Completes all the Tweeners/Sequences with the given ID, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The ID of the Tweeners/Sequences to complete. + + + The total number of completed Tweeners/Sequences. + + + + + Completes all the Tweeners/Sequences with the given intId, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The intId of the Tweeners/Sequences to complete. + + + The total number of completed Tweeners/Sequences. + + + + + Completes the given Tweener, and returns the total number of completed ones (1 if the Tweener existed, otherwise 0). + Where a loop was involved and not infinite, the relative Tweener completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The Tweener to complete. + + + The total number of completed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Completes the given Sequence, and returns the total number of completed ones (1 if the Sequence existed, otherwise 0). + Where a loop was involved and not infinite, the relative Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The Sequence to complete. + + + The total number of completed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Completes all Tweeners/Sequences, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The total number of completed Tweeners/Sequences. + + + + + Kills all the tweens for the given target (unless they're were created inside a ), + and returns the total number of killed Tweeners. + + + The target whose Tweeners to kill. + + + The total number of killed Tweeners. + + + + + Kills all the Tweeners/Sequences with the given ID, and returns the total number of killed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to kill. + + + The total number of killed Tweeners/Sequences. + + + + + Kills all the Tweeners/Sequences with the given intId, and returns the total number of killed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to kill. + + + The total number of killed Tweeners/Sequences. + + + + + Kills the given Tweener, and returns the total number of killed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to kill. + + + The total number of killed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Kills the given Sequence, and returns the total number of killed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to kill. + + + The total number of killed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Kills all Tweeners/Sequences, and returns the total number of killed Tweeners/Sequences. + + + The total number of killed Tweeners/Sequences. + + + + + Used by Sequences to remove added tweens from main tweens list. + + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences, paused or not. + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences that are currently playing. + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences that are currently paused. + + + + + Returns a list of the eventual existing tweens with the given Id, + (empty if no Tweener/Sequence was found). + + Id to look for + If TRUE also searches inside nested tweens + + + + + Returns a list of the eventual existing tweens with the given intId, + (empty if no Tweener/Sequence was found). + + IntId to look for + If TRUE also searches inside nested tweens + + + + + Returns a list with all the existing objects whose target is the given one, + or an empty list if none was found. + + Target to look for + If TRUE also searches inside nested Tweeners + + + + + Returns true if the given target is currently involved in any running Tweener or Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside a Tweener, than if the relative Tweener is paused. + To simply check if the target is attached to a Tweener or Sequence use instead. + + + The target to check. + + + A value of true if the given target is currently involved in any running Tweener or Sequence (taking into account also nested tweens). + + + + + Returns true if the given id is involved in any running Tweener or Sequence (taking into account also nested tweens). + + + The target to check. + + + + + Returns true if the given id is involved in any running Tweener or Sequence (taking into account also nested tweens). + + + The target to check. + + + + + Returns true if the given target is linked to any Tweener or Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to any Tweener or Sequence (running or not, taking into account also nested tweens). + + + + + Returns a list of the current tweens (paused and delayed included), + or null if there are no tweens. + + + + + + Used by callbacks that are wired to sendMessage. + + + + + Filter filters for: + - ID if + - Tweener if + - Sequence if + - Tweener target if (doesn't look inside sequence tweens) + - Everything if null + + + + + Returns all the currently existing plugins involved in any tween, even if nested or paused, + or null if there are none. + + + + + TRUE while inside the update loop + + + + + Total number of tweeners/sequences (paused and delayed ones are included). + Tweeners and sequences contained into other sequences don't count: + for example, if there's only one sequence that contains 2 tweeners, totTweens will be 1. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a simple linear tweening, with no easing. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Base class for all HOTParms. + + + + + ID. + + + + + Int ID. + + + + + Auto kill on complete. + + + + + Update type. + + + + + Time scale. + + + + + Loops + + + + + Loop type. + + + + + Paused. + + + + + On start. + + + + + On start with parms. + + + + + On start parameters. + + + + + On update. + + + + + On update with parms. + + + + + On update parameters. + + + + + On plugin results. + + + + + On plugin results with parms. + + + + + On plugin results parameters. + + + + + On pause. + + + + + On pause with parms. + + + + + On pause parameters. + + + + + On play. + + + + + On play with parms. + + + + + On play parameters. + + + + + On rewinded. + + + + + On rewinded with parms. + + + + + On rewinded parameters. + + + + + On step complete. + + + + + On step complete with parms. + + + + + On step complete parameters. + + + + + On complete. + + + + + On complete with parms. + + + + + On complete parameters. + + + + + True if there are behaviours to manage + + + + + True if there are gameObject to manage + + + + + Behaviours to activate + + + + + Behaviours to deactivate + + + + + GameObjects to activate + + + + + GameObejcts to deactivate + + + + + Initializes the given owner with the stored parameters. + + + The to initialize. + + + + + Only used with ApplyCallback method. + + + + + Called when the tween is starting + + + + + Called each time the tween is updated + + + + + Called each time a single loop is completed + + + + + Called when the whole tween (loops included) is complete + + + + + Called when the tween is paused + + + + + Called when the tween is played + + + + + Called when the tween is rewinded + + + + + Works only with Tweeners, and not with Sequences. + Called when a plugin of the Tweens is overwritten by the OverwriteManager. + + + + + Cache manager for James Nies' MemberAccessor classes + + + + + Returns the cached memberAccessor if it alread exists, + or calls MemberAccessor.Make and caches and returns the newly created MemberAccessor. + + + + + Clears the cache. + + + + + The PropertyAccessor class provides fast dynamic access + to a property of a specified target class. + + + + + Creates a new property accessor. + + + + + The Type of the Property being accessed. + + + + + Whether or not the Property supports read access. + + + + + Whether or not the Property supports write access. + + + + + Enumeration of axis. + + + + + No axis. + + + + + X axis. + + + + + Y axis. + + + + + Z axis. + + + + + W axis. + + + + + Plugin for the tweening of Vector3 objects along a Vector3 path. + + + + + Creates a new instance of this plugin using the main ease type and an absolute path. + + + The path to tween through. + + Type of path + + + + Creates a new instance of this plugin using an absolute path. + + + The path to tween through. + + + The to use. + + Type of path + + + + Creates a new instance of this plugin using the main ease type. + + + The path to tween through. + + + If true, the path is considered relative to the starting value of the property, instead than absolute. + Not compatible with HOTween.From. + + Type of path + + + + Creates a new instance of this plugin. + + + The path to tween through. + + + The to use. + + + If true, the path is considered relative to the starting value of the property, instead than absolute. + Not compatible with HOTween.From. + + Type of path + + + + Creates a new instance of this plugin. + + + The path to tween through. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + Type of path + + + + Init override. + Used to check that isRelative is FALSE, + and otherwise use the given parameters to send a decent warning message. + + + + + Parameter > Smoothly closes the path, so that it can be used for cycling loops. + + + A + + + + + Parameter > Choose whether to smoothly close the path, so that it can be used for cycling loops. + + + Set to true to close the path. + + + + + Parameter > If the tween target is a , orients the tween target to the path. + + + A + + + + + Parameter > Choose whether to orient the tween target to the path (only if it's a ). + + + Set to true to orient the tween target to the path. + + + + + Parameter > If the tween target is a , orients the tween target to the path, + using the given lookAhead percentage. + + + The look ahead percentage (0 to 1). + + + + + Parameter > If the tween target is a , orients the tween target to the path, + locking its rotation on the given axis. + + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > If the tween target is a , orients the tween target to the path, + using the given lookAhead percentage and locking its rotation on the given axis. + + The look ahead percentage (0 to 1) + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > Choose whether to orient the tween target to the path (only if it's a ), + and which lookAhead percentage ad lockRotation to use. + + + Set to true to orient the tween target to the path. + + + The look ahead percentage (0 to 1). + + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > If the tween target is a , sets the tween so that the target will always look at the given transform. + + + The to look at. + + + + + Parameter > If the tween target is a , sets the tween so that the target will always look at the given position. + + + The to look at. + + + + + Parameter > locks the given position axis. + + Sets one or more axis to lock. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y) + + + + + Indicates that the path works must be calculated in 2D + + If TRUE the target will be considered as moving from a side-scrolling perspective, + if FALSE (default) the target will be considered as moving from a top-down perspective + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Adds the correct starting and ending point so the path can be reached from the property's actual position. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the point at the given percentage (0 to 1), + considering the path at constant speed. + Used by DoUpdate and by Tweener.GetPointOnPath. + + + The percentage (0 to 1) at which to get the point. + + + + + Returns the point at the given percentage (0 to 1), + considering the path at constant speed. + Used by DoUpdate and by Tweener.GetPointOnPath. + + + The percentage (0 to 1) at which to get the point. + + + IF true updates also value + (necessary if this method is called for an update). + + + IF not NULL uses the given path instead than the default one. + + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Returns the percentage of the path length occupied by the given path waypoints interval. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Manager used for automatic control of eventual overwriting of tweens. + It is disabled by default, you need to call to enable it. + + + + + List of currently running Tweeners + (meaning all Tweeners whose OnStart has been called, paused or not). + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Default plugin for the tweening of Color32 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Used internally to generate warnings that are managed without throwing exceptions. + + + + + Used to manage movement on a Cardinal spline (of Catmull-Rom type). + Contains code from Andeeee's CRSpline (http://forum.unity3d.com/threads/32954-Waypoints-and-constant-variable-speed-problems). + + + + + Creates a new based on the given array of points. + + Type of path + + The array used to create the path. + + + + + Gets the point on the path at the given percentage (0 to 1). + + + The percentage (0 to 1) at which to get the point. + + + + + Gets the point on the path at the given percentage (0 to 1). + + + The percentage (0 to 1) at which to get the point. + + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Gets the velocity at the given time position. + OBSOLETE since path now uses constant velocity. + + + + + Draws the full path. + + + + + Draws the full path, and if t is not -1 also draws the velocity at t. + + + The point where to calculate velocity and eventual additional trigonometry. + + + If true also draws the normal, tangent, and binormal of t. + + + + + Returns the point at the given time percentage (0 to 1), + considering the path at constant speed. + + The time percentage (0 to 1) at which to get the point + + + + Returns the point at the given time percentage (0 to 1), + considering the path at constant speed. + + The time percentage (0 to 1) at which to get the point + Outputs the calculated path percentage value + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Gets the constant path percentage for the given time percentage + that can be used with GetConstPoint. + + The time percentage (0 to 1) to use + + + + + Method chaining parameters for a . + + + + + Initializes the given with the stored parameters. + + + The to initialize. + + + The target. + + + + + Sets this tween so that it works with pixel perfect values. + Only works with , , , + , , + plugins. + + + + + + Sets this tween to work by speed instead than time. + When a tween is based on speed instead than time, + duration is considered as the amount that the property will change every second, + and ease is automatically set to Linear. + In case of Vectors, the amount represents the vector length x second; + in case of Quaternions, the amount represents the full rotation (360°) speed x second; + in case of strings, the amount represents the amount of changed letters x second. + + + + + Sets whether to tween by speed or not. + When a tween is based on speed instead than time, + duration is considered as the amount that the property will change every second, + and ease is automatically set to Linear. + In case of Vectors, the amount represents the vector length x second; + in case of strings, the amount represents the amount of changed letters x second. + + + If true this tween will work by speed instead than by time. + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + Eventual overshoot to use with Back easeType (default is 1.70158). + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + Eventual amplitude to use with Elastic easeType (default is 0). + + + Eventual period to use with Elastic easeType (default is 0). + + + + + Sets the ease to use the given AnimationCurve. + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + + + Sets the seconds of delay before the tween should start (default = 0). + + + The seconds of delay. + + + + + Sets the Tweener in a paused state. + + + + + Choose whether to set the Tweener in a paused state. + + + + + Sets a property or field to tween, + directly assigning the given TweenPlugin to it. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The to use. + + + + + Sets a property or field to tween. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The absolute end value the object should reach with the tween. + + + + + Sets a property or field to tween. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The end value the object should reach with the tween. + + + If true treats the end value as relative, otherwise as absolute. + + + + + Sets a property or field to tween, + directly assigning the given TweenPlugin to it. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The to use. + + + + + Sets a property or field to tween. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The absolute end value the object should reach with the tween. + + + + + Sets a property or field to tween. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The end value the object should reach with the tween. + + + If true treats the end value as relative, otherwise as absolute. + + + + + Sets the ID of this Tweener (default = ""). + The same ID can be applied to multiple Tweeners, thus allowing for group operations. + You can also use IntId instead of Id for faster operations. + + + The ID for this Tweener. + + + + + Sets the int ID of this Tweener (default = 0). + The same intId can be applied to multiple Tweeners, thus allowing for group operations. + The main difference from Id is that while Id is more legible, IntId allows for faster operations. + + + The int ID for this Tweener. + + + + + Sets auto-kill behaviour for when the Tweener reaches its end (default = false). + + + If true the Tweener is killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Tweener from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Tweener. + + + + + Sets the type of update to use for this Tweener (default = .Update). + + + The type of update to use. + + + + + Sets the time scale that will be used by this Tweener. + + + The time scale to use. + + + + + Sets the number of times the Tweener will run (default = 1, meaning only one go and no other loops). + + + Number of loops (set it to -1 or to apply infinite loops). + + + + + Sets the number of times the Tweener will run, + and the type of loop behaviour to apply + (default = 1, LoopType.Restart). + + + Number of loops (set it to -1 or to apply infinite loops). + + + The behaviour to use. + + + + + Function to call when the Tweener is started for the very first time. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener is started for the very first time. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Tweener is updated. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Tweener is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a plugin is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Tweener switches from a playing state to a paused state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener switches from a playing state to a paused state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Tweener switches from a paused state to a playing state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener switches from a paused state to a playing state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Tweener is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Tweener is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a single loop of the Tweener is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time a single loop of the Tweener is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when the full Tweener, loops included, is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the full Tweener, loops included, is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when one of the plugins used in the tween gets overwritten + (available only if OverwriteManager is active). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when one of the plugins used in the tween gets overwritten + (available only if OverwriteManager is active). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Keeps the given component enabled while the tween is playing + + + + + Keeps the given gameObject activated while the tween is playing + + + + + Keeps the given components enabled while the tween is playing + + + + + Keeps the given GameObject activated while the tween is playing + + + + + Keeps the given component disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Keeps the given components disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Used by HOTween.From to set isFrom property. + + + A + + + + + Returns true if at least one property tween was added to these parameters, + either via Prop() or NewProp(). + + + + + Enumeration of types of loops to apply. + + + + + When a tween completes, rewinds the animation and restarts (X to Y, repeat). + + + + + Tweens to the end values then back to the original ones and so on (X to Y, Y to X, repeat). + + + + + Like , but also inverts the easing (meaning if it was easeInSomething, it will become easeOutSomething, and viceversa). + + + + + Continuously increments the tween (X to Y, Y to Y+(Y-X), and so on), + thus always moving "onward". + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Plugin for the tweening of the float of your choice. + Used for changing material floats. + Target for this tween must be of type . + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Selects the color property to change. + + + The propertyName/floatName to change (see Unity's if you don't know how it works). + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Default plugin for the tweening of Quaternion objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin using the main ease type. + + + The euler angles to tween to. + + + + + Creates a new instance of this plugin. + + + The euler angles to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The euler angles to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The euler angles to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Parameter > Sets rotations to be calculated fully, + and the end value will be reached using the full degrees of the given rotation, even if beyond 360 degrees. + + + + + Parameter > Choose whether you want to calculate angles bigger than 360 degrees or not. + In the first case, the end value will be reached using the full degrees of the given rotation. + In the second case, the end value will be reached from the shortest direction. + If the endValue is set as relative, this option will have no effect, and full beyond 360 rotations will always be used. + + + Set to true to use angles bigger than 360 degrees. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enum of delegates used by HOTween. + + + + + Delegate used to store OnEvent (OnStart, OnComplete, etc) functions that will accept a parameter. + + + + + Delegate used to store OnEvent (OnStart, OnComplete, etc) functions without parameters. + + + + + Delegate used internally for ease functions. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + A special class used to setup a "virtual" tween, + which will not actually be tweened nor updated, + but will just set and return a value when you call Update. + + + + + Virtual duration + (you could also set it to 1 or 100 to treat it as a percentage). + + + + + Creates a new TweenVar instance using Linear ease. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + + + Creates a new TweenVar instance. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + Ease type. + + + + + Creates a new TweenVar instance. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + AnimationCurve used for ease. + + + + + Sets and returns the value at which this + would be after the given absolute time. + + + The elapsed time to calculate. + + + + + Sets and returns the value at which this + would be after the given time. + + + The elapsed time to calculate. + + + If true consideres p_elapsed as relative, + meaning it will be added to the previous elapsed time, + otherwise it is considered absolute. + + + + + Start value (FROM). + + + + + End value (TO). + + + + + Ease type. + + + + + Ease type as AnimationCurve. + + + + + The current value of this + + + + + The current elapsed time. + + + + + Method chaining parameters for a . + + + + + Initializes the given with the stored parameters. + + + The to initialize. + + + + + Sets the ID of this Sequence (default = ""). + The same ID can be applied to multiple Sequences, thus allowing for group operations. + You can also use IntId instead of Id for faster operations. + + + The ID for this Sequence. + + + + + Sets the int ID of this Tweener (default = 0). + The same intId can be applied to multiple Tweeners, thus allowing for group operations. + The main difference from Id is that while Id is more legible, IntId allows for faster operations. + + + The int ID for this Tweener. + + + + + Sets auto-kill behaviour for when the Sequence reaches its end (default = false). + + + If true the Sequence is killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Sequence from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Sequence. + + + + + Sets the type of update to use for this Sequence (default = .Update). + + + The type of update to use. + + + + + Sets the time scale that will be used by this Sequence. + + + The time scale to use. + + + + + Sets the number of times the Sequence will run (default = 1, meaning only one go and no other loops). + + + Number of loops (set it to -1 or to apply infinite loops). + + + + + Sets the number of times the Sequence will run, + and the type of loop behaviour to apply + (default = 1, LoopType.Restart). + + + Number of loops (set it to -1 or to apply infinite loops). + + + The behaviour to use. + Note the is available, but as an experimental feature. + It works with simple Sequences, but you should check that your animation + works as intended with more complex Sequences. + + + + + Function to call when the Sequence is started for the very first time. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence is started for the very first time. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Sequence is updated. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Sequence is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Sequence switches from a playing state to a paused state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence switches from a playing state to a paused state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Sequence switches from a paused state to a playing state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence switches from a paused state to a playing state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the sequence is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the sequence is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a single loop of the Sequence is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time a single loop of the Sequence is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when the full Sequence, loops included, is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the full Sequence, loops included, is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Keeps the given component enabled while the tween is playing + + + + + Keeps the given gameObject activated while the tween is playing + + + + + Keeps the given components enabled while the tween is playing + + + + + Keeps the given GameObject activated while the tween is playing + + + + + Keeps the given component disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Keeps the given components disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Plugin for the tweening of number values only through integers. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML.meta new file mode 100644 index 0000000..1f987b1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4112ba0757d9aa94f9f4ff3a1f079fbc +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll new file mode 100644 index 0000000..448df80 Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll differ diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb new file mode 100644 index 0000000..f47cbe6 Binary files /dev/null and b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb.meta new file mode 100644 index 0000000..ce141ba --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e11b7548cea2849468e735d5cf8684ec +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.meta new file mode 100644 index 0000000..120e495 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 219563a788c6c504f8aedb4eae97878e +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt new file mode 100644 index 0000000..42e55f7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt @@ -0,0 +1,7 @@ +Copyright (c) 2012 Daniele Giardini + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt.meta b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt.meta new file mode 100644 index 0000000..562c282 --- /dev/null +++ b/UnityTests.Unity4/Assets/Holoville/HOTween/HOTween_License.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: bb5422ae1d7e10944baa3e4201d73647 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/LeanTween.meta b/UnityTests.Unity4/Assets/LeanTween.meta new file mode 100644 index 0000000..3bfcb5d --- /dev/null +++ b/UnityTests.Unity4/Assets/LeanTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9e5ab3de744409e40807ac0f286b66e8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/LeanTween/Plugins.meta b/UnityTests.Unity4/Assets/LeanTween/Plugins.meta new file mode 100644 index 0000000..f3cbad4 --- /dev/null +++ b/UnityTests.Unity4/Assets/LeanTween/Plugins.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1839327a1a81c4d979f53b07027ab4b9 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs b/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs new file mode 100644 index 0000000..b286cf0 --- /dev/null +++ b/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs @@ -0,0 +1,4031 @@ +// Copyright (c) 2013 Russell Savage - Dented Pixel +// +// LeanTween version 2.14 - http://dentedpixel.com/developer-diary/ +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* +TERMS OF USE - EASING EQUATIONS# +Open source under the BSD License. +Copyright (c)2001 Robert Penner +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** +* Pass this to the "ease" parameter in the optional hashtable, to get a different easing behavior

+* Example:
LeanTween.rotateX(gameObject, 270.0f, 1.5f).setEase(LeanTweenType.easeInBack); +* +* @class LeanTweenType +*/ + +/** +* @property {integer} linear +*/ +/** +* @property {integer} easeOutQuad +*/ +/** +* @property {integer} easeInQuad +*/ +/** +* @property {integer} easeInOutQuad +*/ +/** +* @property {integer} easeInCubic +*/ +/** +* @property {integer} easeOutCubic +*/ +/** +* @property {integer} easeInOutCubic +*/ +/** +* @property {integer} easeInQuart +*/ +/** +* @property {integer} easeOutQuart +*/ +/** +* @property {integer} easeInOutQuart +*/ +/** +* @property {integer} easeInQuint +*/ +/** +* @property {integer} easeOutQuint +*/ +/** +* @property {integer} easeInOutQuint +*/ +/** +* @property {integer} easeInSine +*/ +/** +* @property {integer} easeOutSine +*/ +/** +* @property {integer} easeInOutSine +*/ +/** +* @property {integer} easeInExpo +*/ +/** +* @property {integer} easeOutExpo +*/ +/** +* @property {integer} easeInOutExpo +*/ +/** +* @property {integer} easeInCirc +*/ +/** +* @property {integer} easeOutCirc +*/ +/** +* @property {integer} easeInOutCirc +*/ +/** +* @property {integer} easeInBounce +*/ +/** +* @property {integer} easeOutBounce +*/ +/** +* @property {integer} easeInOutBounce +*/ +/** +* @property {integer} easeInBack +*/ +/** +* @property {integer} easeOutBack +*/ +/** +* @property {integer} easeInOutBack +*/ +/** +* @property {integer} easeInElastic +*/ +/** +* @property {integer} easeOutElastic +*/ +/** +* @property {integer} easeInOutElastic +*/ +/** +* @property {integer} punch +*/ +using UnityEngine; +using System.Collections; +using System; +public enum LeanTweenType{ + notUsed, linear, easeOutQuad, easeInQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, + easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, + easeInBounce, easeOutBounce, easeInOutBounce, easeInBack, easeOutBack, easeInOutBack, easeInElastic, easeOutElastic, easeInOutElastic, easeSpring, easeShake, punch, once, clamp, pingPong, animationCurve +} + +/** +* Internal Representation of a Tween
+*
+* This class represents all of the optional parameters you can pass to a method (it also represents the internal representation of the tween).

+* Optional Parameters are passed at the end of every method:
+*
+*   Example:
+*   LeanTween.moveX( gameObject, 1f, 1f).setEase( LeanTweenType.easeInQuad ).setDelay(1f);
+*
+* You can pass the optional parameters in any order, and chain on as many as you wish.
+* You can also pass parameters at a later time by saving a reference to what is returned.
+*
+*   Example:
+*   LTDescr d = LeanTween.moveX(gameObject, 1f, 1f);
+*     ...later set some parameters
+*   d.setOnComplete( onCompleteFunc ).setEase( LeanTweenType.easeInOutBack );
+*
+* Retrieve a unique id for the tween by using the "id" property. You can pass this to LeanTween.pause, LeanTween.resume, LeanTween.cancel methods
+*
+*   Example:
+*   int id = LeanTween.moveX(gameObject, 1f, 3f).id;
+*   LeanTween.pause( id );
+* @class LTDescr +* @constructor +*/ +public class LTDescr{ + public bool toggle; + public bool useEstimatedTime; + public bool useFrames; + public bool hasInitiliazed; + public bool hasPhysics; + public float passed; + public float delay; + public float time; + public float lastVal; + private uint _id; + public int loopCount; + public uint counter; + public float direction; + public bool destroyOnComplete; + public Transform trans; + public LTRect ltRect; + public Vector3 from; + public Vector3 to; + public Vector3 diff; + public Vector3 point; + public Vector3 axis; + public Vector3 origRotation; + public LTBezierPath path; + public LTSpline spline; + public TweenAction type; + public LeanTweenType tweenType; + public AnimationCurve animationCurve; + public LeanTweenType loopType; + public Action onUpdateFloat; + public Action onUpdateFloatObject; + public Action onUpdateVector3; + public Action onUpdateVector3Object; + public Action onComplete; + public Action onCompleteObject; + public object onCompleteParam; + public object onUpdateParam; + #if !UNITY_METRO + public Hashtable optional; + #endif + + private static uint global_counter = 0; + + public override string ToString(){ + return (trans!=null ? "gameObject:"+trans.gameObject : "gameObject:null")+" toggle:"+toggle+" passed:"+passed+" time:"+time+" delay:"+delay+" from:"+from+" to:"+to+" type:"+type+" useEstimatedTime:"+useEstimatedTime+" id:"+id+" hasInitiliazed:"+hasInitiliazed; + } + + public LTDescr(){ + + } + + /** + * Cancel a tween + * + * @method cancel + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr cancel(){ + LeanTween.removeTween((int)this._id); + return this; + } + + public int uniqueId{ + get{ + uint toId = _id | counter << 16; + + /*uint backId = toId & 0xFFFF; + uint backCounter = toId >> 16; + if(_id!=backId || backCounter!=counter){ + Debug.LogError("BAD CONVERSION toId:"+_id); + }*/ + + return (int)toId; + } + } + + public int id{ + get{ + return uniqueId; + } + } + + public void reset(){ + this.toggle = true; + #if !UNITY_METRO + this.optional = null; + #endif + this.destroyOnComplete = false; + this.passed = this.delay = 0.0f; + this.useEstimatedTime = this.useFrames = this.hasInitiliazed = false; + this.animationCurve = null; + this.tweenType = LeanTweenType.linear; + this.loopType = LeanTweenType.once; + this.loopCount = 0; + this.direction = this.lastVal = 1.0f; + this.onUpdateFloat = null; + this.onUpdateVector3 = null; + this.onUpdateFloatObject = null; + this.onUpdateVector3Object = null; + this.onComplete = null; + this.onCompleteObject = null; + this.onCompleteParam = null; + this.point = Vector3.zero; + global_counter++; + } + + /** + * Pause a tween + * + * @method pause + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr pause(){ + if(this.direction != 0.0f){ // check if tween is already paused + this.lastVal = this.direction; + this.direction = 0.0f; + } + + return this; + } + + /** + * Resume a paused tween + * + * @method resume + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr resume(){ + this.direction = this.lastVal; + return this; + } + + public LTDescr setAxis( Vector3 axis ){ + this.axis = axis; + return this; + } + + /** + * Delay the start of a tween + * + * @method setDelay + * @param {float} float time The time to complete the tween in + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setDelay( 1.5f ); + */ + public LTDescr setDelay( float delay ){ + if(this.useEstimatedTime){ + this.delay = delay; + }else{ + this.delay = delay*Time.timeScale; + } + + return this; + } + + /** + * Set the type of easing used for the tween.
+ * + * + * @method setEase + * @param {LeanTweenType} easeType:LeanTweenType the easing type to use + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setEase( LeanTweenType.easeInBounce ); + */ + public LTDescr setEase( LeanTweenType easeType ){ + this.tweenType = easeType; + return this; + } + + /** + * Set the type of easing used for the tween with a custom curve.
+ * @method setEase (AnimationCurve) + * @param {AnimationCurve} easeDefinition:AnimationCurve an AnimationCure that describes the type of easing you want, this is great for when you want a unique type of movement + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setEase( LeanTweenType.easeInBounce ); + */ + public LTDescr setEase( AnimationCurve easeCurve ){ + this.animationCurve = easeCurve; + return this; + } + + public LTDescr setTo( Vector3 to ){ + this.to = to; + return this; + } + + public LTDescr setFrom( Vector3 from ){ + this.from = from; + this.hasInitiliazed = true; // this is set, so that the "from" value isn't overwritten later on when the tween starts + this.diff = this.to - this.from; + return this; + } + + public LTDescr setId( uint id ){ + this._id = id; + this.counter = global_counter; + return this; + } + + /** + * Set the tween to repeat a number of times. + * @method setRepeat + * @param {int} repeatNum:int the number of times to repeat the tween. -1 to repeat infinite times + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 10 ).setLoopPingPong(); + */ + public LTDescr setRepeat( int repeat ){ + this.loopCount = repeat; + if((repeat>1 && this.loopType == LeanTweenType.once) || (repeat < 0 && this.loopType == LeanTweenType.once)){ + this.loopType = LeanTweenType.clamp; + } + return this; + } + + public LTDescr setLoopType( LeanTweenType loopType ){ + this.loopType = loopType; + return this; + } + + /** + * Use estimated time when tweening an object. Great for pause screens, when you want all other action to be stopped (or slowed down) + * @method setUseEstimatedTime + * @param {bool} useEstimatedTime:bool whether to use estimated time or not + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 2 ).setUseEstimatedTime( true ); + */ + public LTDescr setUseEstimatedTime( bool useEstimatedTime ){ + this.useEstimatedTime = useEstimatedTime; + return this; + } + + /** + * Use frames when tweening an object, when you don't want the animation to be time-frame independent... + * @method setUseFrames + * @param {bool} useFrames:bool whether to use estimated time or not + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 2 ).setUseFrames( true ); + */ + public LTDescr setUseFrames( bool useFrames ){ + this.useFrames = useFrames; + return this; + } + + public LTDescr setLoopCount( int loopCount ){ + this.loopCount = loopCount; + return this; + } + + /** + * No looping involved, just run once (the default) + * @method setLoopOnce + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setLoopOnce(); + */ + public LTDescr setLoopOnce(){ this.loopType = LeanTweenType.once; return this; } + + /** + * When the animation gets to the end it starts back at where it began + * @method setLoopClamp + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat(2).setLoopClamp(); + */ + public LTDescr setLoopClamp(){ + this.loopType = LeanTweenType.clamp; + if(this.loopCount==0) + this.loopCount = -1; + return this; + } + + /** + * When the animation gets to the end it then tweens back to where it started (and on, and on) + * @method setLoopPingPong + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat(2).setLoopPingPong(); + */ + public LTDescr setLoopPingPong(){ + this.loopType = LeanTweenType.pingPong; + if(this.loopCount==0) + this.loopCount = -1; + return this; + } + + /** + * Have a method called when the tween finishes + * @method setOnComplete + * @param {Action} onComplete:Action the method that should be called when the tween is finished ex: tweenFinished(){ } + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnComplete( Action onComplete ){ + this.onComplete = onComplete; + return this; + } + + /** + * Have a method called when the tween finishes + * @method setOnComplete (object) + * @param {Action} onComplete:Action the method that should be called when the tween is finished ex: tweenFinished( object myObj ){ } + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnComplete( Action onComplete ){ + this.onCompleteObject = onComplete; + return this; + } + public LTDescr setOnComplete( Action onComplete, object onCompleteParam ){ + this.onCompleteObject = onComplete; + if(onCompleteParam!=null) + this.onCompleteParam = onCompleteParam; + return this; + } + + /** + * Pass an object to along with the onComplete Function + * @method setOnCompleteParam + * @param {object} onComplete:object an object that + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnCompleteParam( object onCompleteParam ){ + this.onCompleteParam = onCompleteParam; + return this; + } + + + /** + * Have a method called on each frame that the tween is being animated (passes a float value) + * @method setOnUpdate + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved );
+ *
+ * void tweenMoved( float val ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate ){ + this.onUpdateFloat = onUpdate; + return this; + } + + public LTDescr setOnUpdateObject( Action onUpdate ){ + this.onUpdateFloatObject = onUpdate; + return this; + } + public LTDescr setOnUpdateVector3( Action onUpdate ){ + this.onUpdateVector3 = onUpdate; + return this; + } + + #if !UNITY_FLASH + /** + * Have a method called on each frame that the tween is being animated (passes a float value and a object) + * @method setOnUpdate (object) + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object, and an object of the person's choosing + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved ).setOnUpdateParam( myObject );
+ *
+ * void tweenMoved( float val, object obj ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateFloatObject = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateVector3Object = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + + /** + * Have a method called on each frame that the tween is being animated (passes a float value) + * @method setOnUpdate (Vector3) + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved );
+ *
+ * void tweenMoved( Vector3 val ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateVector3 = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + #endif + + + /** + * Have an object passed along with the onUpdate method + * @method setOnUpdateParam + * @param {object} onUpdateParam:object an object that will be passed along with the onUpdate method + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved ).setOnUpdateParam( myObject );
+ *
+ * void tweenMoved( float val, object obj ){ }
+ */ + public LTDescr setOnUpdateParam( object onUpdateParam ){ + this.onUpdateParam = onUpdateParam; + return this; + } + + /** + * While tweening along a curve, set this property to true, to be perpendicalur to the path it is moving upon + * @method setOrientToPath + * @param {bool} doesOrient:bool whether the gameobject will orient to the path it is animating along + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.move( ltLogo, path, 1.0f ).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true).setAxis(Vector3.forward);
+ */ + public LTDescr setOrientToPath( bool doesOrient ){ + if(this.type==TweenAction.MOVE_CURVED || this.type==TweenAction.MOVE_CURVED_LOCAL){ + if(this.path==null) + this.path = new LTBezierPath(); + this.path.orientToPath = doesOrient; + }else{ + this.spline.orientToPath = doesOrient; + } + return this; + } + + public LTDescr setRect( LTRect rect ){ + this.ltRect = rect; + return this; + } + + public LTDescr setRect( Rect rect ){ + this.ltRect = new LTRect(rect); + return this; + } + + public LTDescr setPath( LTBezierPath path ){ + this.path = path; + return this; + } + + /** + * Set the point at which the GameObject will be rotated around + * @method setPoint + * @param {Vector3} point:Vector3 point at which you want the object to rotate around (local space) + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.rotateAround( cube, Vector3.up, 360.0f, 1.0f ) .setPoint( new Vector3(1f,0f,0f) ) .setEase( LeanTweenType.easeInOutBounce );
+ */ + public LTDescr setPoint( Vector3 point ){ + this.point = point; + return this; + } + + public LTDescr setDestroyOnComplete( bool doesDestroy ){ + this.destroyOnComplete = doesDestroy; + return this; + } + + public LTDescr setAudio( object audio ){ + this.onCompleteParam = audio; + return this; + } + +} + +/** +* Animate GUI Elements by creating this object and passing the *.rect variable to the GUI method

+* Example Javascript:
var bRect:LTRect = new LTRect( 0, 0, 100, 50 );
+* LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 );
+* function OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*
+* Example C#:
+* LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );
+* LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f );
+* void OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+* +* @class LTRect +* @constructor +* @param {float} x:float X location +* @param {float} y:float Y location +* @param {float} width:float Width +* @param {float} height:float Height +* @param {float} alpha:float (Optional) initial alpha amount (0-1) +* @param {float} rotation:float (Optional) initial rotation in degrees (0-360) +*/ + +[System.Serializable] +public class LTRect : System.Object{ + /** + * Pass this value to the GUI Methods + * + * @property rect + * @type {Rect} rect:Rect Rect object that controls the positioning and size + */ + public Rect _rect; + public float alpha = 1f; + public float rotation; + public Vector2 pivot; + public Vector2 margin; + public Rect relativeRect = new Rect(0f,0f,float.PositiveInfinity,float.PositiveInfinity); + + public bool rotateEnabled; + [HideInInspector] + public bool rotateFinished; + public bool alphaEnabled; + public string labelStr; + public LTGUI.Element_Type type; + public GUIStyle style; + public bool useColor = false; + public Color color = Color.white; + public bool fontScaleToFit; + public bool useSimpleScale; + public bool sizeByHeight; + + public Texture texture; + + private int _id = -1; + [HideInInspector] + public int counter; + + public static bool colorTouched; + + public LTRect(){ + reset(); + this.rotateEnabled = this.alphaEnabled = true; + _rect = new Rect(0f,0f,1f,1f); + } + + public LTRect(Rect rect){ + _rect = rect; + reset(); + } + + public LTRect(float x, float y, float width, float height){ + _rect = new Rect(x,y,width,height); + this.alpha = 1.0f; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + } + + public LTRect(float x, float y, float width, float height, float alpha){ + _rect = new Rect(x,y,width,height); + this.alpha = alpha; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + } + + public LTRect(float x, float y, float width, float height, float alpha, float rotation){ + _rect = new Rect(x,y,width,height); + this.alpha = alpha; + this.rotation = rotation; + this.rotateEnabled = this.alphaEnabled = false; + if(rotation!=0.0f){ + this.rotateEnabled = true; + resetForRotation(); + } + } + + public bool hasInitiliazed{ + get{ + return _id!=-1; + } + } + + public int id{ + get{ + int toId = _id | counter << 16; + + /*uint backId = toId & 0xFFFF; + uint backCounter = toId >> 16; + if(_id!=backId || backCounter!=counter){ + Debug.LogError("BAD CONVERSION toId:"+_id); + }*/ + + return toId; + } + } + + public void setId( int id, int counter){ + this._id = id; + this.counter = counter; + } + + public void reset(){ + this.alpha = 1.0f; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + this.margin = Vector2.zero; + this.sizeByHeight = false; + this.useColor = false; + } + + public void resetForRotation(){ + Vector3 scale = new Vector3(GUI.matrix[0,0], GUI.matrix[1,1], GUI.matrix[2,2]); + if(pivot==Vector2.zero){ + pivot = new Vector2((_rect.x+((_rect.width)*0.5f )) * scale.x + GUI.matrix[0,3], (_rect.y+((_rect.height)*0.5f )) * scale.y + GUI.matrix[1,3]); + } + } + + public float x{ + get{ return _rect.x; } + set{ _rect.x = value; } + } + + public float y{ + get{ return _rect.y; } + set{ _rect.y = value; } + } + + public float width{ + get{ return _rect.width; } + set{ _rect.width = value; } + } + + public float height{ + get{ return _rect.height; } + set{ _rect.height = value; } + } + + public Rect rect{ + + get{ + if(colorTouched){ + colorTouched = false; + GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,1.0f); + } + if(rotateEnabled){ + if(rotateFinished){ + rotateFinished = false; + rotateEnabled = false; + //this.rotation = 0.0f; + pivot = Vector2.zero; + }else{ + GUIUtility.RotateAroundPivot(rotation, pivot); + } + } + if(alphaEnabled){ + GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,alpha); + colorTouched = true; + } + if(fontScaleToFit){ + if(this.useSimpleScale){ + style.fontSize = (int)(_rect.height*this.relativeRect.height); + }else{ + style.fontSize = (int)_rect.height; + } + } + return _rect; + } + + set{ + _rect = value; + } + } + + public LTRect setStyle( GUIStyle style ){ + this.style = style; + return this; + } + + public LTRect setFontScaleToFit( bool fontScaleToFit ){ + this.fontScaleToFit = fontScaleToFit; + return this; + } + + public LTRect setColor( Color color ){ + this.color = color; + this.useColor = true; + return this; + } + + public LTRect setAlpha( float alpha ){ + this.alpha = alpha; + return this; + } + + public LTRect setLabel( String str ){ + this.labelStr = str; + return this; + } + + public LTRect setUseSimpleScale( bool useSimpleScale, Rect relativeRect){ + this.useSimpleScale = useSimpleScale; + this.relativeRect = relativeRect; + return this; + } + + public LTRect setUseSimpleScale( bool useSimpleScale){ + this.useSimpleScale = useSimpleScale; + this.relativeRect = new Rect(0f,0f,Screen.width,Screen.height); + return this; + } + + public LTRect setSizeByHeight( bool sizeByHeight){ + this.sizeByHeight = sizeByHeight; + return this; + } + + public override string ToString(){ + return "x:"+_rect.x+" y:"+_rect.y+" width:"+_rect.width+" height:"+_rect.height; + } +} + +public class LTBezier{ + public float length; + + private Vector3 a; + private Vector3 aa; + private Vector3 bb; + private Vector3 cc; + private float len; + private float[] arcLengths; + + public LTBezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float precision){ + this.a = a; + aa = (-a + 3*(b-c) + d); + bb = 3*(a+c) - 6*b; + cc = 3*(b-a); + + this.len = 1.0f / precision; + arcLengths = new float[(int)this.len + (int)1]; + arcLengths[0] = 0; + + Vector3 ov = a; + Vector3 v; + float clen = 0.0f; + for(int i = 1; i <= this.len; i++) { + v = bezierPoint(i * precision); + clen += (ov - v).magnitude; + this.arcLengths[i] = clen; + ov = v; + } + this.length = clen; + } + + private float map(float u) { + float targetLength = u * this.arcLengths[(int)this.len]; + int low = 0; + int high = (int)this.len; + int index = 0; + while (low < high) { + index = low + ((int)((high - low) / 2.0f) | 0); + if (this.arcLengths[index] < targetLength) { + low = index + 1; + } else { + high = index; + } + } + if(this.arcLengths[index] > targetLength) + index--; + if(index<0) + index = 0; + + return (index + (targetLength - arcLengths[index]) / (arcLengths[index + 1] - arcLengths[index])) / this.len; + } + + private Vector3 bezierPoint(float t){ + return ((aa* t + (bb))* t + cc)* t + a; + } + + public Vector3 point(float t){ + return bezierPoint( map(t) ); + } +} + +/** +* Manually animate along a bezier path with this class +* @class LTBezierPath +* @constructor +* @param {Vector3 Array} pts A set of points that define one or many bezier paths (the paths should be passed in multiples of 4, which correspond to each individual bezier curve) +* @example +* LTBezierPath ltPath = new LTBezierPath( new Vector3[] { new Vector3(0f,0f,0f),new Vector3(1f,0f,0f), new Vector3(1f,0f,0f), new Vector3(1f,1f,0f)} );

+* LeanTween.move(lt, ltPath.vec3, 4.0f).setOrientToPath(true).setDelay(1f).setEase(LeanTweenType.easeInOutQuad); // animate
+* Vector3 pt = ltPath.point( 0.6f ); // retrieve a point along the path +*/ +public class LTBezierPath{ + public Vector3[] pts; + public float length; + public bool orientToPath; + + private LTBezier[] beziers; + private float[] lengthRatio; + + public LTBezierPath(){ } + public LTBezierPath( Vector3[] pts_ ){ + setPoints( pts_ ); + } + + public void setPoints( Vector3[] pts_ ){ + if(pts_.Length<4) + LeanTween.logError( "LeanTween - When passing values for a vector path, you must pass four or more values!" ); + if(pts_.Length%4!=0) + LeanTween.logError( "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..." ); + + pts = pts_; + + int k = 0; + beziers = new LTBezier[ pts.Length / 4 ]; + lengthRatio = new float[ beziers.Length ]; + int i; + length = 0; + for(i = 0; i < pts.Length; i+=4){ + beziers[k] = new LTBezier(pts[i+0],pts[i+2],pts[i+1],pts[i+3],0.05f); + length += beziers[k].length; + k++; + } + // Debug.Log("beziers.Length:"+beziers.Length + " beziers:"+beziers); + for(i = 0; i < beziers.Length; i++){ + lengthRatio[i] = beziers[i].length / length; + } + } + + /** + * Retrieve a point along a path + * + * @method point + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @return {Vector3} Vector3 position of the point along the path + * @example + * transform.position = ltPath.point( 0.6f ); + */ + public Vector3 point( float ratio ){ + float added = 0.0f; + for(int i = 0; i < lengthRatio.Length; i++){ + added += lengthRatio[i]; + if(added >= ratio) + return beziers[i].point( (ratio-(added-lengthRatio[i])) / lengthRatio[i] ); + } + return beziers[lengthRatio.Length-1].point( 1.0f ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.place( transform, 0.6f ); + */ + public void place( Transform transform, float ratio ){ + place( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.place( transform, 0.6f, Vector3.left ); + */ + public void place( Transform transform, float ratio, Vector3 worldUp ){ + transform.position = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( point( ratio ), worldUp ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.placeLocal( transform, 0.6f ); + */ + public void placeLocal( Transform transform, float ratio ){ + placeLocal( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.placeLocal( transform, 0.6f, Vector3.left ); + */ + public void placeLocal( Transform transform, float ratio, Vector3 worldUp ){ + transform.localPosition = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( transform.parent.TransformPoint( point( ratio ) ), worldUp ); + } +} + +/** +* Animate along a set of points that need to be in the format: controlPoint, point1, point2.... pointLast, endControlPoint +* @class LTSpline +* @constructor +* @param {Vector3 Array} pts A set of points that define the points the path will pass through (starting with starting control point, and ending with a control point) +* @example +* LTSpline ltSpline = new LTSpline( new Vector3[] { new Vector3(0f,0f,0f),new Vector3(0f,0f,0f), new Vector3(0f,0.5f,0f), new Vector3(1f,1f,0f), new Vector3(1f,1f,0f)} );

+* LeanTween.moveSpline(lt, ltSpline.vec3, 4.0f).setOrientToPath(true).setDelay(1f).setEase(LeanTweenType.easeInOutQuad); // animate
+* Vector3 pt = ltSpline.point( 0.6f ); // retrieve a point along the path +*/ +[System.Serializable] +public class LTSpline { + public Vector3[] pts; + public bool orientToPath; + private float[] lengthRatio; + private float[] lengths; + private int numSections; + private int currPt; + private float totalLength; + + public LTSpline(params Vector3[] pts) { + this.pts = new Vector3[pts.Length]; + System.Array.Copy(pts, this.pts, pts.Length); + + numSections = pts.Length - 3; + int precision = 20; + lengthRatio = new float[precision]; + lengths = new float[precision]; + + Vector3 lastPoint = new Vector3(Mathf.Infinity,0,0); + + totalLength = 0f; + for(int i = 0; i < precision; i++){ + //Debug.Log("i:"+i); + float fract = (i*1f) / precision; + Vector3 point = interp( fract ); + + if(i>=1){ + lengths[ i ] = (point - lastPoint).magnitude; + // Debug.Log("fract:"+fract+" mag:"+lengths[ i ] + " i:"+i); + } + totalLength += lengths[ i ]; + + lastPoint = point; + } + + float ratioTotal = 0f; + for(int i = 0; i < lengths.Length; i++){ + float t = i *1f / (lengths.Length-1); + currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + + float ratioLength = lengths[i] / totalLength; + ratioTotal += ratioLength; + lengthRatio[i] = ratioTotal; + + //Debug.Log("lengthRatio["+i+"]:"+lengthRatio[i]+" lengths["+i+"]:"+lengths[i] + " t:"+t); + } + } + + public float map( float t ){ + //Debug.Log("map t:"+t); + for(int i = 0; i < lengthRatio.Length; i++){ + if(lengthRatio[i] >= t){ + // Debug.Log("map lengthRatio["+i+"]:"+lengthRatio[i]); + return lengthRatio[i]+(t-lengthRatio[i]); + } + } + return 1f; + } + + public Vector3 interp(float t) { + // The adjustments done to numSections, I am not sure why I needed to add them + /*int numSections = this.numSections+1; + if(numSections>=3) + numSections += 1;*/ + currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + // Debug.Log("currPt:"+currPt+" numSections:"+numSections+" pts.Length :"+pts.Length ); + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + /** + * Retrieve a point along a path + * + * @method point + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @return {Vector3} Vector3 position of the point along the path + * @example + * transform.position = ltSpline.point( 0.6f ); + */ + public Vector3 point( float ratio ){ + float t = map( ratio ); + //Debug.Log("t:"+t+" ratio:"+ratio); + //float t = ratio; + return interp( t ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.place( transform, 0.6f ); + */ + public void place( Transform transform, float ratio ){ + place(transform, ratio, Vector3.up); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.place( transform, 0.6f, Vector3.left ); + */ + public void place( Transform transform, float ratio, Vector3 worldUp ){ + transform.position = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( point( ratio ), worldUp ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.placeLocal( transform, 0.6f ); + */ + public void placeLocal( Transform transform, float ratio ){ + placeLocal( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.placeLocal( transform, 0.6f, Vector3.left ); + */ + public void placeLocal( Transform transform, float ratio, Vector3 worldUp ){ + transform.localPosition = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( transform.parent.TransformPoint( point( ratio ) ), worldUp ); + } + + public void gizmoDraw(float t = -1.0f) { + if(lengthRatio!=null && lengthRatio.Length>0){ + Vector3 prevPt = point(0); + + for (int i = 1; i <= 120; i++) { + float pm = (float) i / 120f; + Vector3 currPt = point(pm); + Gizmos.DrawLine(currPt, prevPt); + prevPt = currPt; + } + } + } + + public Vector3 Velocity(float t) { + t = map( t ); + + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return 1.5f * (-a + 3f * b - 3f * c + d) * (u * u) + + (2f * a -5f * b + 4f * c - d) * u + + .5f * c - .5f * a; + } +} + +public enum TweenAction{ + MOVE_X, + MOVE_Y, + MOVE_Z, + MOVE_LOCAL_X, + MOVE_LOCAL_Y, + MOVE_LOCAL_Z, + MOVE_CURVED, + MOVE_CURVED_LOCAL, + MOVE_SPLINE, + MOVE_SPLINE_LOCAL, + SCALE_X, + SCALE_Y, + SCALE_Z, + ROTATE_X, + ROTATE_Y, + ROTATE_Z, + ROTATE_AROUND, + ALPHA, + ALPHA_VERTEX, + CALLBACK, + MOVE, + MOVE_LOCAL, + ROTATE, + ROTATE_LOCAL, + SCALE, + VALUE3, + GUI_MOVE, + GUI_MOVE_MARGIN, + GUI_SCALE, + GUI_ALPHA, + GUI_ROTATE, + DELAYED_SOUND +} + +/** +* LeanTween is an efficient tweening engine for Unity3d

+* Index of All Methods | Optional Paramaters that can be passed

+* Optional Parameters are passed at the end of every method
+*
+* Example:
+* LeanTween.moveX( gameObject, 1f, 1f).setEase( LeanTweenType.easeInQuad ).setDelay(1f);
+*
+* You can pass the optional parameters in any order, and chain on as many as you wish.
+* You can also pass parameters at a later time by saving a reference to what is returned.
+*
+* Example:
+* LTDescr d = LeanTween.moveX(gameObject, 1f, 1f);
+*   ...later set some parameters
+* d.setOnComplete( onCompleteFunc ).setEase( LeanTweenType.easeInOutBack );
+* +* @class LeanTween +*/ + +public class LeanTween: MonoBehaviour { + +public static bool throwErrors = true; + +private static LTDescr[] tweens; +private static int tweenMaxSearch = 0; +private static int maxTweens = 400; +private static int frameRendered= -1; +private static GameObject _tweenEmpty; +private static float dtEstimated; +private static float previousRealTime; +private static float dt; +private static float dtActual; +private static LTDescr tween; +private static int i; +private static int j; +private static AnimationCurve punch = new AnimationCurve( new Keyframe(0.0f, 0.0f ), new Keyframe(0.112586f, 0.9976035f ), new Keyframe(0.3120486f, -0.1720615f ), new Keyframe(0.4316337f, 0.07030682f ), new Keyframe(0.5524869f, -0.03141804f ), new Keyframe(0.6549395f, 0.003909959f ), new Keyframe(0.770987f, -0.009817753f ), new Keyframe(0.8838775f, 0.001939224f ), new Keyframe(1.0f, 0.0f ) ); +private static AnimationCurve shake = new AnimationCurve( new Keyframe(0f, 0f), new Keyframe(0.25f, 1f), new Keyframe(0.75f, -1f), new Keyframe(1f, 0f) ) ; + +public static void init(){ + init(maxTweens); +} + +/** +* This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400). This must be called before any use of LeanTween is made for it to be effective. +* +* @method LeanTween.init +* @param {integer} maxSimultaneousTweens:int The maximum number of tweens you will use, make sure you don't go over this limit, otherwise the code will throw an error +* @example +* LeanTween.init( 800 ); +*/ +public static void init(int maxSimultaneousTweens){ + if(tweens==null){ + maxTweens = maxSimultaneousTweens; + tweens = new LTDescr[maxTweens]; + _tweenEmpty = new GameObject(); + _tweenEmpty.name = "~LeanTween"; + _tweenEmpty.AddComponent(typeof(LeanTween)); + _tweenEmpty.isStatic = true; + #if !UNITY_EDITOR + _tweenEmpty.hideFlags = HideFlags.HideAndDontSave; + #endif + DontDestroyOnLoad( _tweenEmpty ); + for(int i = 0; i < maxTweens; i++){ + tweens[i] = new LTDescr(); + } + } +} + +public static void reset(){ + tweens = null; +} + +public void Update(){ + LeanTween.update(); +} + +public void OnLevelWasLoaded( int lvl ){ + // Debug.Log("reseting gui"); + LTGUI.reset(); +} + +private static Transform trans; +private static float timeTotal; +private static TweenAction tweenAction; +private static float ratioPassed; +private static float from; +private static float to; +private static float val; +private static Vector3 newVect; +private static bool isTweenFinished; +private static GameObject target; +private static GameObject customTarget; + +public static void update() { + if(frameRendered != Time.frameCount){ // make sure update is only called once per frame + init(); + + dtEstimated = Time.realtimeSinceStartup - previousRealTime; + if(dtEstimated>0.2f) // a catch put in, when at the start sometimes this number can grow unrealistically large + dtEstimated = 0.2f; + previousRealTime = Time.realtimeSinceStartup; + dtActual = Time.deltaTime*Time.timeScale; + // if(tweenMaxSearch>1500) + // Debug.Log("tweenMaxSearch:"+tweenMaxSearch +" maxTweens:"+maxTweens); + for( int i = 0; i < tweenMaxSearch && i < maxTweens; i++){ + + //Debug.Log("tweens["+i+"].toggle:"+tweens[i].toggle); + if(tweens[i].toggle){ + tween = tweens[i]; + trans = tween.trans; + timeTotal = tween.time; + tweenAction = tween.type; + + dt = dtActual; + if( tween.useEstimatedTime ){ + dt = dtEstimated; + timeTotal = tween.time; + }else if( tween.useFrames ){ + dt = 1; + }else if(tween.direction==0f){ + dt = 0f; + } + + if(trans==null){ + removeTween(i); + continue; + } + //Debug.Log("i:"+i+" tween:"+tween+" dt:"+dt); + + // Check for tween finished + isTweenFinished = false; + if(tween.delay<=0){ + if((tween.passed + dt > timeTotal && tween.direction > 0.0f )){ + isTweenFinished = true; + tween.passed = tween.time; // Set to the exact end time so that it can finish tween exactly on the end value + }else if(tween.direction<0.0f && tween.passed - dt < 0.0f){ + isTweenFinished = true; + tween.passed = Mathf.Epsilon; + } + } + + if(!tween.hasInitiliazed && ((tween.passed==0.0 && tween.delay==0.0) || tween.passed>0.0) ){ + tween.hasInitiliazed = true; + + // Set time based on current timeScale + if( !tween.useEstimatedTime ){ + tween.time = tween.time*Time.timeScale; + } + + // Initialize From Values + switch(tweenAction){ + case TweenAction.MOVE: + tween.from = trans.position; break; + case TweenAction.MOVE_X: + tween.from.x = trans.position.x; break; + case TweenAction.MOVE_Y: + tween.from.x = trans.position.y; break; + case TweenAction.MOVE_Z: + tween.from.x = trans.position.z; break; + case TweenAction.MOVE_LOCAL_X: + tweens[i].from.x = trans.localPosition.x; break; + case TweenAction.MOVE_LOCAL_Y: + tweens[i].from.x = trans.localPosition.y; break; + case TweenAction.MOVE_LOCAL_Z: + tweens[i].from.x = trans.localPosition.z; break; + case TweenAction.SCALE_X: + tween.from.x = trans.localScale.x; break; + case TweenAction.SCALE_Y: + tween.from.x = trans.localScale.y; break; + case TweenAction.SCALE_Z: + tween.from.x = trans.localScale.z; break; + case TweenAction.ALPHA: + #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 + tween.from.x = trans.gameObject.renderer.material.color.a; + break; + #else + SpriteRenderer ren = trans.gameObject.GetComponent(); + tween.from.x = (ren!=null) ? ren.color.a : trans.gameObject.renderer.material.color.a; + break; + #endif + case TweenAction.MOVE_LOCAL: + tween.from = trans.localPosition; break; + case TweenAction.MOVE_CURVED: + case TweenAction.MOVE_CURVED_LOCAL: + case TweenAction.MOVE_SPLINE: + case TweenAction.MOVE_SPLINE_LOCAL: + tween.from.x = 0; break; + case TweenAction.ROTATE: + tween.from = trans.eulerAngles; + tween.to = new Vector3(LeanTween.closestRot( tween.from.x, tween.to.x), LeanTween.closestRot( tween.from.y, tween.to.y), LeanTween.closestRot( tween.from.z, tween.to.z)); + break; + case TweenAction.ROTATE_X: + tween.from.x = trans.eulerAngles.x; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_Y: + tween.from.x = trans.eulerAngles.y; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_Z: + tween.from.x = trans.eulerAngles.z; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_AROUND: + tween.lastVal = 0.0f; // optional["last"] + tween.origRotation = trans.eulerAngles; // optional["origRotation" + break; + case TweenAction.ROTATE_LOCAL: + tween.from = trans.localEulerAngles; + tween.to = new Vector3(LeanTween.closestRot( tween.from.x, tween.to.x), LeanTween.closestRot( tween.from.y, tween.to.y), LeanTween.closestRot( tween.from.z, tween.to.z)); + break; + case TweenAction.SCALE: + tween.from = trans.localScale; break; + case TweenAction.GUI_MOVE: + tween.from = new Vector3(tween.ltRect.rect.x, tween.ltRect.rect.y, 0); break; + case TweenAction.GUI_MOVE_MARGIN: + tween.from = new Vector2(tween.ltRect.margin.x, tween.ltRect.margin.y); break; + case TweenAction.GUI_SCALE: + tween.from = new Vector3(tween.ltRect.rect.width, tween.ltRect.rect.height, 0); break; + case TweenAction.GUI_ALPHA: + tween.from.x = tween.ltRect.alpha; break; + case TweenAction.GUI_ROTATE: + if(tween.ltRect.rotateEnabled==false){ + tween.ltRect.rotateEnabled = true; + tween.ltRect.resetForRotation(); + } + + tween.from.x = tween.ltRect.rotation; break; + case TweenAction.ALPHA_VERTEX: + tween.from.x = trans.GetComponent().mesh.colors32[0].a; + break; + } + tween.diff = tween.to - tween.from; + } + if(tween.delay<=0){ + // Move Values + if(timeTotal<=0f){ + //Debug.LogError("time total is zero Time.timeScale:"+Time.timeScale+" useEstimatedTime:"+tween.useEstimatedTime); + ratioPassed = 0f; + }else{ + ratioPassed = tween.passed / timeTotal; + } + + if(ratioPassed>1.0f){ + ratioPassed = 1.0f; + }else if(ratioPassed<0f){ + ratioPassed = 0f; + } + // Debug.Log("action:"+tweenAction+" ratioPassed:"+ratioPassed + " timeTotal:" + timeTotal + " tween.passed:"+ tween.passed +" dt:"+dt); + + if(tweenAction>=TweenAction.MOVE_X && tweenAction<=TweenAction.CALLBACK){ + if(tween.animationCurve!=null){ + val = tweenOnCurve(tween, ratioPassed); + }else { + switch( tween.tweenType ){ + case LeanTweenType.linear: + val = tween.from.x + tween.diff.x * ratioPassed; break; + case LeanTweenType.easeOutQuad: + val = easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInQuad: + val = easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInOutQuad: + val = easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInCubic: + val = easeInCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutCubic: + val = easeOutCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutCubic: + val = easeInOutCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInQuart: + val = easeInQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutQuart: + val = easeOutQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutQuart: + val = easeInOutQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInQuint: + val = easeInQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutQuint: + val = easeOutQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutQuint: + val = easeInOutQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInSine: + val = easeInSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutSine: + val = easeOutSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutSine: + val = easeInOutSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInExpo: + val = easeInExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutExpo: + val = easeOutExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutExpo: + val = easeInOutExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInCirc: + val = easeInCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutCirc: + val = easeOutCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutCirc: + val = easeInOutCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInBounce: + val = easeInBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutBounce: + val = easeOutBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutBounce: + val = easeInOutBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInBack: + val = easeInBack(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutBack: + val = easeOutBack(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutBack: + val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInElastic: + val = easeInElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutElastic: + val = easeOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutElastic: + val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.punch: + case LeanTweenType.easeShake: + if(tween.tweenType==LeanTweenType.punch){ + tween.animationCurve = LeanTween.punch; + }else if(tween.tweenType==LeanTweenType.easeShake){ + tween.animationCurve = LeanTween.shake; + } + tween.to.x = tween.from.x + tween.to.x; + tween.diff.x = tween.to.x - tween.from.x; + val = tweenOnCurve(tween, ratioPassed); break; + case LeanTweenType.easeSpring: + val = spring(tween.from.x, tween.to.x, ratioPassed); break; + default: + { + val = tween.from.x + tween.diff.x * ratioPassed; break; + } + } + + } + + //Debug.Log("from:"+from+" to:"+to+" val:"+val+" ratioPassed:"+ratioPassed); + if(tweenAction==TweenAction.MOVE_X){ + trans.position=new Vector3( val,trans.position.y,trans.position.z); + }else if(tweenAction==TweenAction.MOVE_Y){ + trans.position =new Vector3( trans.position.x,val,trans.position.z); + }else if(tweenAction==TweenAction.MOVE_Z){ + trans.position=new Vector3( trans.position.x,trans.position.y,val); + }if(tweenAction==TweenAction.MOVE_LOCAL_X){ + trans.localPosition=new Vector3( val,trans.localPosition.y,trans.localPosition.z); + }else if(tweenAction==TweenAction.MOVE_LOCAL_Y){ + trans.localPosition=new Vector3( trans.localPosition.x,val,trans.localPosition.z); + }else if(tweenAction==TweenAction.MOVE_LOCAL_Z){ + trans.localPosition=new Vector3( trans.localPosition.x,trans.localPosition.y,val); + }else if(tweenAction==TweenAction.MOVE_CURVED){ + if(tween.path.orientToPath){ + tween.path.place( trans, val ); + }else{ + trans.position = tween.path.point( val ); + } + // Debug.Log("val:"+val+" trans.position:"+trans.position + " 0:"+ tween.curves[0] +" 1:"+tween.curves[1] +" 2:"+tween.curves[2] +" 3:"+tween.curves[3]); + }else if((TweenAction)tweenAction==TweenAction.MOVE_CURVED_LOCAL){ + if(tween.path.orientToPath){ + tween.path.placeLocal( trans, val ); + }else{ + trans.localPosition = tween.path.point( val ); + } + // Debug.Log("val:"+val+" trans.position:"+trans.position); + }else if((TweenAction)tweenAction==TweenAction.MOVE_SPLINE){ + if(tween.spline.orientToPath){ + tween.spline.place( trans, val ); + }else{ + trans.position = tween.spline.point( val ); + } + }else if((TweenAction)tweenAction==TweenAction.MOVE_SPLINE_LOCAL){ + if(tween.spline.orientToPath){ + tween.spline.placeLocal( trans, val ); + }else{ + trans.localPosition = tween.spline.point( val ); + } + }else if(tweenAction==TweenAction.SCALE_X){ + trans.localScale=new Vector3(val, trans.localScale.y,trans.localScale.z); + }else if(tweenAction==TweenAction.SCALE_Y){ + trans.localScale=new Vector3( trans.localScale.x,val,trans.localScale.z); + }else if(tweenAction==TweenAction.SCALE_Z){ + trans.localScale=new Vector3(trans.localScale.x,trans.localScale.y,val); + }else if(tweenAction==TweenAction.ROTATE_X){ + trans.eulerAngles=new Vector3(val, trans.eulerAngles.y,trans.eulerAngles.z); + }else if(tweenAction==TweenAction.ROTATE_Y){ + trans.eulerAngles=new Vector3(trans.eulerAngles.x,val,trans.eulerAngles.z); + }else if(tweenAction==TweenAction.ROTATE_Z){ + trans.eulerAngles=new Vector3(trans.eulerAngles.x,trans.eulerAngles.y,val); + }else if(tweenAction==TweenAction.ROTATE_AROUND){ + + float move = val - tween.lastVal; + // Debug.Log("move:"+move+" val:"+val + " timeTotal:"+timeTotal + " from:"+tween.from+ " diff:"+tween.diff); + if(isTweenFinished){ + trans.eulerAngles = tween.origRotation; + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, tween.to.x); + }else{ + /*trans.rotation = tween.origRotation; + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, val); + tween.lastVal = val;*/ + + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, move); + tween.lastVal = val; + + //trans.rotation = * Quaternion.AngleAxis(val, tween.axis); + } + + }else if(tweenAction==TweenAction.ALPHA){ + #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 + + foreach(Material mat in trans.gameObject.renderer.materials){ + mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val); + } + + #else + + SpriteRenderer ren = trans.gameObject.GetComponent(); + if(ren!=null){ + ren.color = new Color( ren.color.r, ren.color.g, ren.color.b, val); + }else{ + foreach(Material mat in trans.gameObject.renderer.materials){ + mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val); + } + } + + #endif + }else if(tweenAction==TweenAction.ALPHA_VERTEX){ + Mesh mesh = trans.GetComponent().mesh; + Vector3[] vertices = mesh.vertices; + Color32[] colors = new Color32[vertices.Length]; + Color32 c = mesh.colors32[0]; + c = new Color( c.r, c.g, c.b, val); + for (int k= 0; k < vertices.Length; k++) { + colors[k] = c; + } + mesh.colors32 = colors; + } + + }else if(tweenAction>=TweenAction.MOVE){ + // + + if(tween.animationCurve!=null){ + newVect = tweenOnCurveVector(tween, ratioPassed); + }else{ + if(tween.tweenType == LeanTweenType.linear){ + newVect = new Vector3( tween.from.x + tween.diff.x * ratioPassed, tween.from.y + tween.diff.y * ratioPassed, tween.from.z + tween.diff.z * ratioPassed); + }else if(tween.tweenType >= LeanTweenType.linear){ + switch(tween.tweenType){ + case LeanTweenType.easeOutQuad: + newVect = new Vector3(easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInQuad: + newVect = new Vector3(easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuad: + newVect = new Vector3(easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInCubic: + newVect = new Vector3(easeInCubic(tween.from.x, tween.to.x, ratioPassed), easeInCubic(tween.from.y, tween.to.y, ratioPassed), easeInCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutCubic: + newVect = new Vector3(easeOutCubic(tween.from.x, tween.to.x, ratioPassed), easeOutCubic(tween.from.y, tween.to.y, ratioPassed), easeOutCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutCubic: + newVect = new Vector3(easeInOutCubic(tween.from.x, tween.to.x, ratioPassed), easeInOutCubic(tween.from.y, tween.to.y, ratioPassed), easeInOutCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInQuart: + newVect = new Vector3(easeInQuart(tween.from.x, tween.to.x, ratioPassed), easeInQuart(tween.from.y, tween.to.y, ratioPassed), easeInQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutQuart: + newVect = new Vector3(easeOutQuart(tween.from.x, tween.to.x, ratioPassed), easeOutQuart(tween.from.y, tween.to.y, ratioPassed), easeOutQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuart: + newVect = new Vector3(easeInOutQuart(tween.from.x, tween.to.x, ratioPassed), easeInOutQuart(tween.from.y, tween.to.y, ratioPassed), easeInOutQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInQuint: + newVect = new Vector3(easeInQuint(tween.from.x, tween.to.x, ratioPassed), easeInQuint(tween.from.y, tween.to.y, ratioPassed), easeInQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutQuint: + newVect = new Vector3(easeOutQuint(tween.from.x, tween.to.x, ratioPassed), easeOutQuint(tween.from.y, tween.to.y, ratioPassed), easeOutQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuint: + newVect = new Vector3(easeInOutQuint(tween.from.x, tween.to.x, ratioPassed), easeInOutQuint(tween.from.y, tween.to.y, ratioPassed), easeInOutQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInSine: + newVect = new Vector3(easeInSine(tween.from.x, tween.to.x, ratioPassed), easeInSine(tween.from.y, tween.to.y, ratioPassed), easeInSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutSine: + newVect = new Vector3(easeOutSine(tween.from.x, tween.to.x, ratioPassed), easeOutSine(tween.from.y, tween.to.y, ratioPassed), easeOutSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutSine: + newVect = new Vector3(easeInOutSine(tween.from.x, tween.to.x, ratioPassed), easeInOutSine(tween.from.y, tween.to.y, ratioPassed), easeInOutSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInExpo: + newVect = new Vector3(easeInExpo(tween.from.x, tween.to.x, ratioPassed), easeInExpo(tween.from.y, tween.to.y, ratioPassed), easeInExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutExpo: + newVect = new Vector3(easeOutExpo(tween.from.x, tween.to.x, ratioPassed), easeOutExpo(tween.from.y, tween.to.y, ratioPassed), easeOutExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutExpo: + newVect = new Vector3(easeInOutExpo(tween.from.x, tween.to.x, ratioPassed), easeInOutExpo(tween.from.y, tween.to.y, ratioPassed), easeInOutExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInCirc: + newVect = new Vector3(easeInCirc(tween.from.x, tween.to.x, ratioPassed), easeInCirc(tween.from.y, tween.to.y, ratioPassed), easeInCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutCirc: + newVect = new Vector3(easeOutCirc(tween.from.x, tween.to.x, ratioPassed), easeOutCirc(tween.from.y, tween.to.y, ratioPassed), easeOutCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutCirc: + newVect = new Vector3(easeInOutCirc(tween.from.x, tween.to.x, ratioPassed), easeInOutCirc(tween.from.y, tween.to.y, ratioPassed), easeInOutCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInBounce: + newVect = new Vector3(easeInBounce(tween.from.x, tween.to.x, ratioPassed), easeInBounce(tween.from.y, tween.to.y, ratioPassed), easeInBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutBounce: + newVect = new Vector3(easeOutBounce(tween.from.x, tween.to.x, ratioPassed), easeOutBounce(tween.from.y, tween.to.y, ratioPassed), easeOutBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutBounce: + newVect = new Vector3(easeInOutBounce(tween.from.x, tween.to.x, ratioPassed), easeInOutBounce(tween.from.y, tween.to.y, ratioPassed), easeInOutBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInBack: + newVect = new Vector3(easeInBack(tween.from.x, tween.to.x, ratioPassed), easeInBack(tween.from.y, tween.to.y, ratioPassed), easeInBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutBack: + newVect = new Vector3(easeOutBack(tween.from.x, tween.to.x, ratioPassed), easeOutBack(tween.from.y, tween.to.y, ratioPassed), easeOutBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutBack: + newVect = new Vector3(easeInOutBack(tween.from.x, tween.to.x, ratioPassed), easeInOutBack(tween.from.y, tween.to.y, ratioPassed), easeInOutBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInElastic: + newVect = new Vector3(easeInElastic(tween.from.x, tween.to.x, ratioPassed), easeInElastic(tween.from.y, tween.to.y, ratioPassed), easeInElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutElastic: + newVect = new Vector3(easeOutElastic(tween.from.x, tween.to.x, ratioPassed), easeOutElastic(tween.from.y, tween.to.y, ratioPassed), easeOutElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutElastic: + newVect = new Vector3(easeInOutElastic(tween.from.x, tween.to.x, ratioPassed), easeInOutElastic(tween.from.y, tween.to.y, ratioPassed), easeInOutElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.punch: + case LeanTweenType.easeShake: + if(tween.tweenType==LeanTweenType.punch){ + tween.animationCurve = LeanTween.punch; + }else if(tween.tweenType==LeanTweenType.easeShake){ + tween.animationCurve = LeanTween.shake; + } + tween.to = tween.from + tween.to; + tween.diff = tween.to - tween.from; + if(tweenAction==TweenAction.ROTATE || tweenAction==TweenAction.ROTATE_LOCAL){ + tween.to = new Vector3(closestRot(tween.from.x, tween.to.x), closestRot(tween.from.y, tween.to.y), closestRot(tween.from.z, tween.to.z)); + } + newVect = tweenOnCurveVector(tween, ratioPassed); break; + case LeanTweenType.easeSpring: + newVect = new Vector3(spring(tween.from.x, tween.to.x, ratioPassed), spring(tween.from.y, tween.to.y, ratioPassed), spring(tween.from.z, tween.to.z, ratioPassed)); break; + + } + }else{ + newVect = new Vector3( tween.from.x + tween.diff.x * ratioPassed, tween.from.y + tween.diff.y * ratioPassed, tween.from.z + tween.diff.z * ratioPassed); + } + } + + if(tweenAction==TweenAction.MOVE){ + trans.position = newVect; + }else if(tweenAction==TweenAction.MOVE_LOCAL){ + trans.localPosition = newVect; + }else if(tweenAction==TweenAction.ROTATE){ + /*if(tween.hasPhysics){ + trans.gameObject.rigidbody.MoveRotation(Quaternion.Euler( newVect )); + }else{*/ + trans.eulerAngles = newVect; + // } + }else if(tweenAction==TweenAction.ROTATE_LOCAL){ + trans.localEulerAngles = newVect; + }else if(tweenAction==TweenAction.SCALE){ + trans.localScale = newVect; + }else if(tweenAction==TweenAction.GUI_MOVE){ + tween.ltRect.rect = new Rect( newVect.x, newVect.y, tween.ltRect.rect.width, tween.ltRect.rect.height); + }else if(tweenAction==TweenAction.GUI_MOVE_MARGIN){ + tween.ltRect.margin = new Vector2(newVect.x, newVect.y); + }else if(tweenAction==TweenAction.GUI_SCALE){ + tween.ltRect.rect = new Rect( tween.ltRect.rect.x, tween.ltRect.rect.y, newVect.x, newVect.y); + }else if(tweenAction==TweenAction.GUI_ALPHA){ + tween.ltRect.alpha = newVect.x; + }else if(tweenAction==TweenAction.GUI_ROTATE){ + tween.ltRect.rotation = newVect.x; + } + } + //Debug.Log("tween.delay:"+tween.delay + " tween.passed:"+tween.passed + " tweenAction:"+tweenAction + " to:"+newVect+" axis:"+tween.axis); + + if(tween.onUpdateFloat!=null){ + tween.onUpdateFloat(val); + }else if(tween.onUpdateFloatObject!=null){ + tween.onUpdateFloatObject(val, tween.onUpdateParam); + }else if(tween.onUpdateVector3Object!=null){ + tween.onUpdateVector3Object(newVect, tween.onUpdateParam); + }else if(tween.onUpdateVector3!=null){ + tween.onUpdateVector3(newVect); + } + #if !UNITY_METRO + else if(tween.optional!=null){ // LeanTween 1.x legacy stuff + + var onUpdate = tween.optional["onUpdate"]; + if(onUpdate!=null){ + Hashtable updateParam = (Hashtable)tween.optional["onUpdateParam"]; + if((TweenAction)tweenAction==TweenAction.VALUE3){ + if(onUpdate.GetType() == typeof(string)){ + string onUpdateS = onUpdate as string; + customTarget = tween.optional["onUpdateTarget"]!=null ? tween.optional["onUpdateTarget"] as GameObject : trans.gameObject; + customTarget.BroadcastMessage( onUpdateS, newVect ); + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(newVect, updateParam); + }else{ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(newVect); + } + }else{ + if(onUpdate.GetType() == typeof(string)){ + string onUpdateS = onUpdate as string; + if (tween.optional["onUpdateTarget"]!=null){ + customTarget = tween.optional["onUpdateTarget"] as GameObject; + customTarget.BroadcastMessage( onUpdateS, val ); + }else{ + trans.gameObject.BroadcastMessage( onUpdateS, val ); + } + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(val, updateParam); + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA( newVect ); + }else{ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(val); + } + } + } + } + #endif + } + + if(isTweenFinished){ + // Debug.Log("finished tween:"+i+" tween:"+tween); + if(tweenAction==TweenAction.GUI_ROTATE) + tween.ltRect.rotateFinished = true; + + if(tween.loopType==LeanTweenType.once || tween.loopCount==1){ + if(tweenAction==TweenAction.DELAYED_SOUND){ + AudioSource.PlayClipAtPoint((AudioClip)tween.onCompleteParam, tween.to, tween.from.x); + } + if(tween.onComplete!=null){ + removeTween(i); + tween.onComplete(); + + }else if(tween.onCompleteObject!=null){ + removeTween(i); + tween.onCompleteObject(tween.onCompleteParam); + } + + #if !UNITY_METRO + else if(tween.optional!=null){ + System.Action callback=null; + System.Action callbackWithParam = null; + string callbackS=string.Empty; + object callbackParam=null; + if(tween.optional!=null && tween.trans){ + if(tween.optional["onComplete"]!=null){ + callbackParam = tween.optional["onCompleteParam"]; + if(tween.optional["onComplete"].GetType()==typeof(string)){ + callbackS = tween.optional["onComplete"] as string; + }else{ + if(callbackParam!=null){ + callbackWithParam = (System.Action)tween.optional["onComplete"]; + }else{ + callback = (System.Action)tween.optional["onComplete"]; + if(callback==null) + Debug.LogWarning("callback was not converted"); + } + } + } + } + removeTween(i); + if(callbackWithParam!=null){ + callbackWithParam( callbackParam ); + }else if(callback!=null){ + callback(); + }else if(callbackS!=string.Empty){ + if (tween.optional["onCompleteTarget"]!=null){ + customTarget = tween.optional["onCompleteTarget"] as GameObject; + if(callbackParam!=null) customTarget.BroadcastMessage ( callbackS, callbackParam ); + else customTarget.BroadcastMessage( callbackS ); + }else{ + if(callbackParam!=null) trans.gameObject.BroadcastMessage ( callbackS, callbackParam ); + else trans.gameObject.BroadcastMessage( callbackS ); + } + } + } + #endif + else{ + removeTween(i); + } + }else{ + if(tween.loopCount<0 && tween.type==TweenAction.CALLBACK){ + if(tween.onComplete!=null){ + tween.onComplete(); + }else if(tween.onCompleteObject!=null){ + tween.onCompleteObject(tween.onCompleteParam); + } + } + if(tween.loopCount>=1){ + tween.loopCount--; + } + if(tween.loopType==LeanTweenType.clamp){ + tween.passed = Mathf.Epsilon; + // tween.delay = 0.0; + }else if(tween.loopType==LeanTweenType.pingPong){ + tween.direction = 0.0f-(tween.direction); + } + } + }else if(tween.delay<=0){ + tween.passed += dt*tween.direction; + }else{ + tween.delay -= dt; + // Debug.Log("dt:"+dt+" tween:"+i+" tween:"+tween); + if(tween.delay<0){ + tween.passed = 0.0f;//-tween.delay + tween.delay = 0.0f; + } + } + } + } + + frameRendered = Time.frameCount; + } +} + +// This method is only used internally! Do not call this from your scripts. To cancel a tween use LeanTween.cancel +public static void removeTween( int i ){ + if(tweens[i].toggle){ + tweens[i].toggle = false; + if(tweens[i].destroyOnComplete){ + //Debug.Log("destroying tween.type:"+tween.type); + if(tweens[i].ltRect!=null){ + // Debug.Log("destroy i:"+i+" id:"+tweens[i].ltRect.id); + LTGUI.destroy( tweens[i].ltRect.id ); + }else{ // check if equal to tweenEmpty + + } + } + //tweens[i].optional = null; + startSearch = i; + //Debug.Log("start search reset:"+startSearch + " i:"+i+" tweenMaxSearch:"+tweenMaxSearch); + if(i+1>=tweenMaxSearch){ + //Debug.Log("reset to zero"); + startSearch = 0; + tweenMaxSearch--; + } + } +} + +public static Vector3[] add(Vector3[] a, Vector3 b){ + Vector3[] c = new Vector3[ a.Length ]; + for(i=0; i +* LeanTween.cancel( gameObject ); +*/ +public static void cancel( GameObject gameObject ){ + init(); + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans) + removeTween(i); + } +} + +/** +* Cancel a specific tween with the provided id +* +* @method LeanTween.cancel +* @param {GameObject} gameObject:GameObject gameObject whose tweens you want to cancel +* @param {float} id:float unique id that represents that tween +*/ +public static void cancel( GameObject gameObject, int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" counter:"+backCounter + " setCounter:"+ tweens[backId].counter + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].trans==null || (tweens[backId].trans.gameObject == gameObject && tweens[backId].counter==backCounter)) + removeTween((int)backId); + } +} + +/** +* Cancel a specific tween with the provided id +* +* @method LeanTween.cancel +* @param {LTRect} ltRect:LTRect LTRect object whose tweens you want to cancel +* @param {float} id:float unique id that represents that tween +*/ +public static void cancel( LTRect ltRect, int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].ltRect == ltRect && tweens[backId].counter==backCounter) + removeTween((int)backId); + } +} + +private static void cancel( int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].hasInitiliazed && tweens[backId].counter==backCounter) + removeTween((int)backId); + } +} + +// Deprecated +public static LTDescr description( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + + if(tweens[backId]!=null && tweens[backId].uniqueId == uniqueId && tweens[backId].counter==backCounter) + return tweens[backId]; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].uniqueId == uniqueId && tweens[i].counter==backCounter) + return tweens[i]; + } + return null; +} + +// Deprecated use pause( id ) +public static void pause( GameObject gameObject, int uniqueId ){ + pause( uniqueId ); +} + +public static void pause( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter){ + tweens[backId].pause(); + } +} + +/** +* Pause all tweens for a GameObject +* +* @method LeanTween.pause +* @param {GameObject} gameObject:GameObject GameObject whose tweens you want to pause +*/ +public static void pause( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans){ + tweens[i].pause(); + } + } +} + +// Deprecated +public static void resume( GameObject gameObject, int uniqueId ){ + resume( uniqueId ); +} + +/** +* Resume a specific tween +* +* @method LeanTween.resume +* @param {int} id:int Id of the tween you want to resume ex: int id = LeanTween.MoveX(gameObject, 5, 1.0).id; +*/ +public static void resume( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter){ + tweens[backId].resume(); + } +} + +/** +* Resume all the tweens on a GameObject +* +* @method LeanTween.resume +* @param {GameObject} gameObject:GameObject GameObject whose tweens you want to resume +*/ +public static void resume( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans) + tweens[i].resume(); + } +} + +/** +* Test whether or not a tween is active on a GameObject +* +* @method LeanTween.isTweening +* @param {GameObject} gameObject:GameObject GameObject that you want to test if it is tweening +*/ +public static bool isTweening( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].toggle && tweens[i].trans==trans) + return true; + } + return false; +} + +/** +* Test whether or not a tween is active or not +* +* @method LeanTween.isTweening +* @param {GameObject} id:int id of the tween that you want to test if it is tweening +*   Example:
+*   int id = LeanTween.moveX(gameObject, 1f, 3f).id;
+*   if(LeanTween.isTweening( id ))
+*      Debug.Log("I am tweening!");
+*/ +public static bool isTweening( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter && tweens[backId].toggle){ + return true; + } + return false; +} + +/** +* Test whether or not a tween is active on a LTRect +* +* @method LeanTween.isTweening +* @param {LTRect} ltRect:LTRect LTRect that you want to test if it is tweening +*/ +public static bool isTweening( LTRect ltRect ){ + for( int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].toggle && tweens[i].ltRect==ltRect) + return true; + } + return false; +} + +public static void drawBezierPath(Vector3 a, Vector3 b, Vector3 c, Vector3 d){ + Vector3 last = a; + Vector3 p; + Vector3 aa = (-a + 3*(b-c) + d); + Vector3 bb = 3*(a+c) - 6*b; + Vector3 cc = 3*(b-a); + float t; + for(float k = 1.0f; k <= 30.0f; k++){ + t = k / 30.0f; + p = ((aa* t + (bb))* t + cc)* t + a; + Gizmos.DrawLine(last, p); + last = p; + } +} + +public static object logError( string error ){ + if(throwErrors) Debug.LogError(error); else Debug.Log(error); + return null; +} + +// LeanTween 2.0 Methods + +public static LTDescr options(LTDescr seed){ Debug.LogError("error this function is no longer used"); return null; } +public static LTDescr options(){ + init(); + + for(j=0, i = startSearch; j < maxTweens; i++){ + if(i>=maxTweens-1) + i = 0; + if(tweens[i].toggle==false){ + if(i+1>tweenMaxSearch) + tweenMaxSearch = i+1; + startSearch = i + 1; + break; + } + + j++; + if(j>=maxTweens) + return logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );") as LTDescr; + } + tween = tweens[i]; + tween.reset(); + tween.setId( (uint)i ); + + return tween; +} + +public static GameObject tweenEmpty{ + get{ + init(maxTweens); + return _tweenEmpty; + } +} + +public static int startSearch = 0; +public static LTDescr descr; + +private static LTDescr pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, LTDescr tween ){ + init(maxTweens); + if(gameObject==null) + return null; + tween.trans = gameObject.transform; + tween.to = to; + tween.time = time; + tween.type = tweenAction; + //tween.hasPhysics = gameObject.rigidbody!=null; + + return tween; +} + +/** +* Fade a gameobject's material to a certain alpha value. The material's shader needs to support alpha. Owl labs has some excellent efficient shaders. +* +* @method LeanTween.alpha +* @param {GameObject} gameObject:GameObject Gameobject that you wish to fade +* @param {float} to:float the final alpha value (0-1) +* @param {float} time:float The time with which to fade the object +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* LeanTween.alpha(gameObject, 1f, 1f) .setDelay(1f); +*/ +public static LTDescr alpha(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ALPHA, options() ); +} + +/** +* Fade a GUI Object +* +* @method LeanTween.alpha +* @param {LTRect} ltRect:LTRect LTRect that you wish to fade +* @param {float} to:float the final alpha value (0-1) +* @param {float} time:float The time with which to fade the object +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* LeanTween.alpha(ltRect, 1f, 1f) .setEase(LeanTweenType.easeInCirc); +*/ +public static LTDescr alpha(LTRect ltRect, float to, float time){ + ltRect.alphaEnabled = true; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ALPHA, options().setRect( ltRect ) ); +} + +/** +* This works by tweening the vertex colors directly.
+
+Vertex-based coloring is useful because you avoid making a copy of your +object's material for each instance that needs a different color.
+
+A shader that supports vertex colors is required for it to work +(for example the shaders in Mobile/Particles/) +* +* @method LeanTween.alphaVertex +* @param {GameObject} gameObject:GameObject Gameobject that you wish to alpha +* @param {float} to:float The alpha value you wish to tween to +* @param {float} time:float The time with which to delay before calling the function +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr alphaVertex(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0f,0f), time, TweenAction.ALPHA_VERTEX, options() ); +} + +public static LTDescr delayedCall( float delayTime, Action callback){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( float delayTime, Action callback){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( GameObject gameObject, float delayTime, Action callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( GameObject gameObject, float delayTime, Action callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr destroyAfter( LTRect rect, float delayTime){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setRect( rect ).setDestroyOnComplete(true) ); +} + +/*public static LTDescr delayedCall(GameObject gameObject, float delayTime, string callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete( callback ) ); +}*/ + +/** +* Move a GameObject to a certain location +* +* @method LeanTween.move +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {Vector3} vec:Vector3 to The final positin with which to move to +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example LeanTween.move(gameObject, new Vector3(0f,-3f,5f), 2.0f) .setEase( LeanTween.easeOutQuad ); +*/ +public static LTDescr move(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE, options() ); +} +public static LTDescr move(GameObject gameObject, Vector2 to, float time){ + return pushNewTween( gameObject, new Vector3(to.x, to.y, gameObject.transform.position.z), time, TweenAction.MOVE, options() ); +} + + +/** +* Move a GameObject along a set of bezier curves +* +* @method LeanTween.move +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,... +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.move(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);;
+*/ +public static LTDescr move(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + if(descr.path==null) + descr.path = new LTBezierPath( to ); + else + descr.path.setPoints( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED, descr ); +} + +/** +* Move a GameObject through a set of points +* +* @method LeanTween.moveSpline +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.moveSpline(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveSpline(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + descr.spline = new LTSpline( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_SPLINE, descr ); +} + +/** +* Move a GameObject through a set of points, in local space +* +* @method LeanTween.moveSplineLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.moveSpline(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f). setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveSplineLocal(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + descr.spline = new LTSpline( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_SPLINE_LOCAL, descr ); +} + +/** +* Move a GUI Element to a certain location +* +* @method LeanTween.move (GUI) +* @param {LTRect} ltRect:LTRect ltRect LTRect object that you wish to move +* @param {Vector2} vec:Vector2 to The final position with which to move to (pixel coordinates) +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr move(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE, options().setRect( ltRect ) ); +} + +public static LTDescr moveMargin(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE_MARGIN, options().setRect( ltRect ) ); +} + +/** +* Move a GameObject along the x-axis +* +* @method LeanTween.moveX +* @param {GameObject} gameObject:GameObject gameObject Gameobject that you wish to move +* @param {float} to:float to The final position with which to move to +* @param {float} time:float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_X, options() ); +} + +/** +* Move a GameObject along the y-axis +* +* @method LeanTween.moveY +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {float} float to The final position with which to move to +* @param {float} float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Y, options() ); +} + +/** +* Move a GameObject along the z-axis +* +* @method LeanTween.moveZ +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {float} float to The final position with which to move to +* @param {float} float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Z, options() ); +} + +/** +* Move a GameObject to a certain location relative to the parent transform. +* +* @method LeanTween.moveLocal +* @param {GameObject} GameObject gameObject Gameobject that you wish to rotate +* @param {Vector3} Vector3 to The final positin with which to move to +* @param {float} float time The time to complete the tween in +* @param {Hashtable} Hashtable optional Hashtable where you can pass optional items. +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveLocal(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE_LOCAL, options() ); +} + +/** +* Move a GameObject along a set of bezier curves, in local space +* +* @method LeanTween.moveLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,... +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0).setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.move(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}).setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveLocal(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + if(descr.path==null) + descr.path = new LTBezierPath( to ); + else + descr.path.setPoints( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED_LOCAL, descr ); +} + +public static LTDescr moveLocalX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_X, options() ); +} + +public static LTDescr moveLocalY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Y, options() ); +} + +public static LTDescr moveLocalZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Z, options() ); +} + +/** +* Rotate a GameObject, to values are in passed in degrees +* +* @method LeanTween.rotate +* @param {GameObject} GameObject gameObject Gameobject that you wish to rotate +* @param {Vector3} Vector3 to The final rotation with which to rotate to +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example LeanTween.rotate(cube, new Vector3(180f,30f,0f), 1.5f); +*/ + +public static LTDescr rotate(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE, options() ); +} + +/** +* Rotate a GUI element (using an LTRect object), to a value that is in degrees +* +* @method LeanTween.rotate +* @param {LTRect} ltRect:LTRect LTRect that you wish to rotate +* @param {float} to:float The final rotation with which to rotate to +* @param {float} time:float The time to complete the tween in +* @param {Array} optional:Array Object Array where you can pass optional items. +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* if(GUI.Button(buttonRect.rect, "Rotate"))
+* LeanTween.rotate( buttonRect4, 150.0f, 1.0f).setEase(LeanTween.easeOutElastic);
+* GUI.matrix = Matrix4x4.identity;
+*/ +public static LTDescr rotate(LTRect ltRect, float to, float time){ + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ROTATE, options().setRect( ltRect ) ); +} + +/** +* Rotate a GameObject in the objects local space (on the transforms localEulerAngles object) +* +* @method LeanTween.rotateLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to rotate +* @param {Vector3} to:Vector3 The final rotation with which to rotate to +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateLocal(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE_LOCAL, options() ); +} + +/** +* Rotate a GameObject only on the X axis +* +* @method LeanTween.rotateX +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final x-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_X, options() ); +} + +/** +* Rotate a GameObject only on the Y axis +* +* @method LeanTween.rotateY +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final y-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Y, options() ); +} + +/** +* Rotate a GameObject only on the Z axis +* +* @method LeanTween.rotateZ +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final z-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Z, options() ); +} + +/** +* Rotate a GameObject around a certain Axis (the best method to use when you want to rotate beyond 180 degrees) +* +* @method LeanTween.rotateAround +* @param {GameObject} gameObject:GameObject Gameobject that you wish to rotate +* @param {Vector3} vec:Vector3 axis in which to rotate around ex: Vector3.up +* @param {float} degrees:float the degrees in which to rotate +* @param {float} time:float time The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example:
+* LeanTween.rotateAround ( gameObject, Vector3.left, 90f, 1f ); +*/ +public static LTDescr rotateAround(GameObject gameObject, Vector3 axis, float add, float time){ + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, options().setAxis(axis) ); +} + +/** +* Scale a GameObject to a certain size +* +* @method LeanTween.scale +* @param {GameObject} gameObject:GameObject gameObject Gameobject that you wish to scale +* @param {Vector3} vec:Vector3 to The size with which to tween to +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scale(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.SCALE, options() ); +} + +/** +* Scale a GUI Element to a certain width and height +* +* @method LeanTween.scale (GUI) +* @param {LTRect} LTRect ltRect LTRect object that you wish to move +* @param {Vector2} Vector2 to The final width and height to scale to (pixel based) +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example Javascript:
+* var bRect:LTRect = new LTRect( 0, 0, 100, 50 );
+* LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 ).setEase(LeanTweenType.easeOutBounce);
+* function OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*
+* Example C#:
+* LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );
+* LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f ).setEase(LeanTweenType.easeOutBounce);
+* void OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*/ +public static LTDescr scale(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_SCALE, options().setRect( ltRect ) ); +} + +/** +* Scale a GameObject to a certain size along the x-axis only +* +* @method LeanTween.scaleX +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_X, options() ); +} + +/** +* Scale a GameObject to a certain size along the y-axis only +* +* @method LeanTween.scaleY +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Y, options() ); +} + +/** +* Scale a GameObject to a certain size along the z-axis only +* +* @method LeanTween.scaleZ +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Z, options()); +} + +/** +* Tween any particular value, it does not need to be tied to any particular type or GameObject +* +* @method LeanTween.value (float) +* @param {GameObject} GameObject gameObject GameObject with which to tie the tweening with. This is only used when you need to cancel this tween, it does not actually perform any operations on this gameObject +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( float val ){ } +* @param {float} float from The original value to start the tween from +* @param {float} float to The value to end the tween on +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example Javascript:
+* LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
+* function updateValueExampleCallback( val:float ){
+*   Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
+* }
+*
+* Example C#:
+* LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
+* void updateValueExampleCallback( float val ){
+*   Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
+* }
+*/ + +public static LTDescr value(GameObject gameObject, Action callOnUpdate, float from, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, options().setTo( new Vector3(to,0,0) ).setFrom( new Vector3(from,0,0) ).setOnUpdate(callOnUpdate) ); +} + +/** +* Tween any particular value (Vector3), this could be used to tween an arbitrary value like a material color +* +* @method LeanTween.value (Vector3) +* @param {GameObject} gameObject:GameObject Gameobject that you wish to attach the tween to +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val ){ } +* @param {float} from:Vector3 The original value to start the tween from +* @param {Vector3} to:Vector3 The final Vector3 with which to tween to +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr value(GameObject gameObject, Action callOnUpdate, Vector3 from, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.VALUE3, options().setTo( to ).setFrom( from ).setOnUpdateVector3(callOnUpdate) ); +} + +/** +* Tween any particular value (float) +* +* @method LeanTween.value (float,object) +* @param {GameObject} gameObject:GameObject Gameobject that you wish to attach the tween to +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val, object obj ){ } +* @param {float} from:Vector3 The original value to start the tween from +* @param {Vector3} to:Vector3 The final Vector3 with which to tween to +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr value(GameObject gameObject, Action callOnUpdate, float from, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, options().setTo( new Vector3(to,0,0) ).setFrom( new Vector3(from,0,0) ).setOnUpdateObject(callOnUpdate) ); +} + +public static LTDescr delayedSound( AudioClip audio, Vector3 pos, float volume ){ + return pushNewTween( tweenEmpty, pos, 0f, TweenAction.DELAYED_SOUND, options().setTo( pos ).setFrom( new Vector3(volume,0,0) ).setAudio( audio ) ); +} + +#if !UNITY_METRO +// LeanTween 1.x Methods + +public static Hashtable h( object[] arr ){ + if(arr.Length%2==1){ + logError("LeanTween - You have attempted to create a Hashtable with an odd number of values."); + return null; + } + Hashtable hash = new Hashtable(); + for(i = 0; i < arr.Length; i += 2){ + hash.Add(arr[i] as string, arr[i+1]); + } + + return hash; +} + +private static int idFromUnique( int uniqueId ){ + return uniqueId & 0xFFFF; +} + +private static int pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, Hashtable optional ){ + init(maxTweens); + if(gameObject==null) + return -1; + + j = 0; + for(i = startSearch; j < maxTweens; i++){ + if(i>=maxTweens-1) + i = 0; + if(tweens[i].toggle==false){ + if(i+1>tweenMaxSearch) + tweenMaxSearch = i+1; + startSearch = i + 1; + break; + } + + j++; + if(j>=maxTweens){ + logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );"); + return -1; + } + } + tween = tweens[i]; + tween.toggle = true; + tween.reset(); + tween.trans = gameObject.transform; + tween.to = to; + tween.time = time; + tween.type = tweenAction; + tween.optional = optional; + tween.setId( (uint)i ); + //tween.hasPhysics = gameObject.rigidbody!=null; + + if(optional!=null){ + var ease = optional["ease"]; + //LeanTweenType ease; + var optionsNotUsed = 0; + if(ease!=null) { + tween.tweenType = LeanTweenType.linear; + if( ease.GetType() ==typeof( LeanTweenType) ){ + tween.tweenType = (LeanTweenType)ease;// Enum.Parse(typeof(LeanTweenType), optional["ease"].ToString()); + } else if(ease.GetType() == typeof(AnimationCurve)){ + tween.animationCurve = optional["ease"] as AnimationCurve; + } else{ + string func = optional["ease"].ToString(); + if(func.Equals("easeOutQuad")){ + tween.tweenType = LeanTweenType.easeOutQuad; + }else if(func.Equals("easeInQuad")){ + tween.tweenType = LeanTweenType.easeInQuad; + }else if(func.Equals("easeInOutQuad")){ + tween.tweenType = LeanTweenType.easeInOutQuad; + } + } + optionsNotUsed++; + } + if(optional["rect"]!=null){ + tween.ltRect = (LTRect)optional["rect"]; + optionsNotUsed++; + } + if(optional["path"]!=null){ + tween.path = (LTBezierPath)optional["path"]; + optionsNotUsed++; + } + if(optional["delay"]!=null){ + tween.delay = (float)optional["delay"]; + optionsNotUsed++; + } + if(optional["useEstimatedTime"]!=null){ + tween.useEstimatedTime =(bool) optional["useEstimatedTime"]; + optionsNotUsed++; + } + if(optional["useFrames"]!=null){ + tween.useFrames =(bool) optional["useFrames"]; + optionsNotUsed++; + } + if(optional["loopType"]!=null){ + tween.loopType = (LeanTweenType)optional["loopType"]; + optionsNotUsed++; + } + if(optional["repeat"]!=null){ + tween.loopCount = (int)optional["repeat"]; + if(tween.loopType==LeanTweenType.once) + tween.loopType = LeanTweenType.clamp; + optionsNotUsed++; + } + if(optional["point"]!=null){ + tween.point = (Vector3)optional["point"]; + optionsNotUsed++; + } + if(optional["axis"]!=null){ + tween.axis = (Vector3)optional["axis"]; + optionsNotUsed++; + } + if(optional.Count <= optionsNotUsed) + tween.optional = null; // nothing else is used with the extra piece, so set to null + }else{ + tween.optional = null; + } + //Debug.Log("pushing new tween["+i+"]:"+tweens[i]); + + return tweens[i].uniqueId; +} + +public static int value(string callOnUpdate, float from, float to, float time, Hashtable optional){ + return value( tweenEmpty, callOnUpdate, from, to, time, optional ); +} + +public static int value(GameObject gameObject, string callOnUpdate, float from, float to, float time){ + return value(gameObject, callOnUpdate, from, to, time, new Hashtable()); +} +public static int value(GameObject gameObject, string callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject, Action callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} +public static int value(GameObject gameObject, Action callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject,string callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject,Action callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject,Action callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject, String callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, String callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int rotate(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE, optional ); +} +public static int rotate(GameObject gameObject, Vector3 to, float time, object[] optional){ + return rotate( gameObject, to, time, h( optional ) ); +} + + +public static int rotate(LTRect ltRect, float to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ROTATE, optional ); +} + +public static int rotate(LTRect ltRect, float to, float time, object[] optional){ + return rotate( ltRect, to, time, h(optional) ); +} + +public static int rotateX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_X, optional ); +} + +public static int rotateX(GameObject gameObject, float to, float time, object[] optional){ + return rotateX( gameObject, to, time, h(optional) ); +} + +public static int rotateY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Y, optional ); +} +public static int rotateY(GameObject gameObject, float to, float time, object[] optional){ + return rotateY( gameObject, to, time, h(optional) ); +} + +public static int rotateZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Z, optional ); +} + +public static int rotateZ(GameObject gameObject, float to, float time, object[] optional){ + return rotateZ( gameObject, to, time, h(optional) ); +} + +public static int rotateLocal(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE_LOCAL, optional ); +} +public static int rotateLocal(GameObject gameObject, Vector3 to, float time, object[] optional){ + return rotateLocal( gameObject, to, time, h(optional) ); +} + +/*public static int rotateAround(GameObject gameObject, Vector3 point, Vector3 axis, float add, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["axis"] = axis; + if(optional["point"]!=null) + optional["point"] = Vector3.zero; + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, optional ); +}*/ + +public static int rotateAround(GameObject gameObject, Vector3 axis, float add, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["axis"] = axis; + if(optional["point"]==null) + optional["point"] = Vector3.zero; + + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, optional ); +} + +public static int rotateAround(GameObject gameObject, Vector3 axis, float add, float time, object[] optional){ + return rotateAround(gameObject, axis, add, time, h(optional)); +} + +public static int moveX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_X, optional ); +} +public static int moveX(GameObject gameObject, float to, float time, object[] optional){ + return moveX( gameObject, to, time, h(optional) ); +} + +public static int moveY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Y, optional ); +} +public static int moveY(GameObject gameObject, float to, float time, object[] optional){ + return moveY( gameObject, to, time, h(optional) ); +} + +public static int moveZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Z, optional ); +} +public static int moveZ(GameObject gameObject, float to, float time, object[] optional){ + return moveZ( gameObject, to, time, h(optional) ); +} + +public static int move(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE, optional ); +} + +public static int move(GameObject gameObject, Vector3 to, float time, object[] optional){ + return move( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int move(GameObject gameObject, Vector3[] to, float time, Hashtable optional){ + if(to.Length<4){ + string errorMsg = "LeanTween - When passing values for a vector path, you must pass four or more values!"; + if(throwErrors) Debug.LogError(errorMsg); else Debug.Log(errorMsg); + return -1; + } + if(to.Length%4!=0){ + string errorMsg2 = "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..."; + if(throwErrors) Debug.LogError(errorMsg2); else Debug.Log(errorMsg2); + return -1; + } + + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + LTBezierPath ltPath = new LTBezierPath( to ); + if(optional["orientToPath"]!=null) + ltPath.orientToPath = true; + optional["path"] = ltPath; + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED, optional ); +} +public static int move(GameObject gameObject, Vector3[] to, float time, object[] optional){ + return move( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int move(LTRect ltRect, Vector2 to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE, optional ); +} +public static int move(LTRect ltRect, Vector3 to, float time, object[] optional){ + return move( ltRect, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocal(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE_LOCAL, optional ); +} +public static int moveLocal(GameObject gameObject, Vector3 to, float time, object[] optional){ + return moveLocal( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocal(GameObject gameObject, Vector3[] to, float time, Hashtable optional){ + if(to.Length<4){ + string errorMsg = "LeanTween - When passing values for a vector path, you must pass four or more values!"; + if(throwErrors) Debug.LogError(errorMsg); else Debug.Log(errorMsg); + return -1; + } + if(to.Length%4!=0){ + string errorMsg2 = "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..."; + if(throwErrors) Debug.LogError(errorMsg2); else Debug.Log(errorMsg2); + return -1; + } + + init(); + if( optional == null ) + optional = new Hashtable(); + + LTBezierPath ltPath = new LTBezierPath( to ); + if(optional["orientToPath"]!=null) + ltPath.orientToPath = true; + optional["path"] = ltPath; + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED_LOCAL, optional ); +} +public static int moveLocal(GameObject gameObject, Vector3[] to, float time,object[] optional){ + return moveLocal( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocalX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_X, optional ); +} +public static int moveLocalX(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalX( gameObject, to, time, h(optional) ); +} + +public static int moveLocalY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Y, optional ); +} +public static int moveLocalY(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalY( gameObject, to, time, h(optional) ); +} + +public static int moveLocalZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Z, optional ); +} +public static int moveLocalZ(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalZ( gameObject, to, time, h(optional) ); +} + +public static int scale(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.SCALE, optional ); +} +public static int scale(GameObject gameObject, Vector3 to, float time, object[] optional){ + return scale( gameObject, to, time, h(optional) ); +} + +public static int scale(LTRect ltRect,Vector2 to, float time, Hashtable optional) +{ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_SCALE, optional ); +} +public static int scale(LTRect ltRect, Vector2 to, float time, object[] optional){ + return scale( ltRect, to, time, h(optional) ); +} + +public static int alpha(LTRect ltRect, float to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + ltRect.alphaEnabled = true; + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ALPHA, optional ); +} +public static int alpha(LTRect ltRect, float to, float time, object[] optional){ + return alpha( ltRect, to, time, h(optional) ); +} + +public static int scaleX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_X, optional ); +} +public static int scaleX(GameObject gameObject, float to, float time, object[] optional){ + return scaleX( gameObject, to, time, h(optional) ); +} + +public static int scaleY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Y, optional ); +} +public static int scaleY(GameObject gameObject, float to, float time, object[] optional){ + return scaleY( gameObject, to, time, h(optional) ); +} + +public static int scaleZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Z, optional ); +} +public static int scaleZ(GameObject gameObject, float to, float time, object[] optional){ + return scaleZ( gameObject, to, time, h(optional) ); +} + +public static int delayedCall( float delayTime, string callback, Hashtable optional ){ + init(); + return delayedCall( tweenEmpty, delayTime, callback, optional ); +} +public static int delayedCall( float delayTime, Action callback, object[] optional){ + init(); + return delayedCall( tweenEmpty, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, string callback, object[] optional){ + return delayedCall( gameObject, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, object[] optional){ + return delayedCall( gameObject, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, string callback, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, Hashtable optional){ + if(optional==null) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, Hashtable optional){ + if(optional==null) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int alpha(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ALPHA, optional ); +} +public static int alpha(GameObject gameObject, float to, float time, object[] optional){ + return alpha(gameObject, to, time, h(optional)); +} +#endif + +// Tweening Functions - Thanks to Robert Penner and GFX47 + +private static float tweenOnCurve( LTDescr tweenDescr, float ratioPassed ){ + // Debug.Log("single ratio:"+ratioPassed+" tweenDescr.animationCurve.Evaluate(ratioPassed):"+tweenDescr.animationCurve.Evaluate(ratioPassed)); + return tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed); +} + +private static Vector3 tweenOnCurveVector( LTDescr tweenDescr, float ratioPassed ){ + return new Vector3(tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed), + tweenDescr.from.y + (tweenDescr.diff.y) * tweenDescr.animationCurve.Evaluate(ratioPassed), + tweenDescr.from.z + (tweenDescr.diff.z) * tweenDescr.animationCurve.Evaluate(ratioPassed) ); +} + +private static float easeOutQuadOpt( float start, float diff, float ratioPassed ){ + return -diff * ratioPassed * (ratioPassed - 2) + start; +} + +private static float easeInQuadOpt( float start, float diff, float ratioPassed ){ + return diff * ratioPassed * ratioPassed + start; +} + +private static float easeInOutQuadOpt( float start, float diff, float ratioPassed ){ + ratioPassed /= .5f; + if (ratioPassed < 1) return diff / 2 * ratioPassed * ratioPassed + start; + ratioPassed--; + return -diff / 2 * (ratioPassed * (ratioPassed - 2) - 1) + start; +} + +private static float linear(float start, float end, float val){ + return Mathf.Lerp(start, end, val); +} + +private static float clerp(float start, float end, float val){ + float min = 0.0f; + float max = 360.0f; + float half = Mathf.Abs((max - min) / 2.0f); + float retval = 0.0f; + float diff = 0.0f; + if ((end - start) < -half){ + diff = ((max - start) + end) * val; + retval = start + diff; + }else if ((end - start) > half){ + diff = -((max - end) + start) * val; + retval = start + diff; + }else retval = start + (end - start) * val; + return retval; +} + +private static float spring(float start, float end, float val){ + val = Mathf.Clamp01(val); + val = (Mathf.Sin(val * Mathf.PI * (0.2f + 2.5f * val * val * val)) * Mathf.Pow(1f - val, 2.2f) + val) * (1f + (1.2f * (1f - val))); + return start + (end - start) * val; +} + +private static float easeInQuad(float start, float end, float val){ + end -= start; + return end * val * val + start; +} + +private static float easeOutQuad(float start, float end, float val){ + end -= start; + return -end * val * (val - 2) + start; +} + +private static float easeInOutQuad(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val + start; + val--; + return -end / 2 * (val * (val - 2) - 1) + start; +} + +private static float easeInCubic(float start, float end, float val){ + end -= start; + return end * val * val * val + start; +} + +private static float easeOutCubic(float start, float end, float val){ + val--; + end -= start; + return end * (val * val * val + 1) + start; +} + +private static float easeInOutCubic(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val + start; + val -= 2; + return end / 2 * (val * val * val + 2) + start; +} + +private static float easeInQuart(float start, float end, float val){ + end -= start; + return end * val * val * val * val + start; +} + +private static float easeOutQuart(float start, float end, float val){ + val--; + end -= start; + return -end * (val * val * val * val - 1) + start; +} + +private static float easeInOutQuart(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val * val + start; + val -= 2; + return -end / 2 * (val * val * val * val - 2) + start; +} + +private static float easeInQuint(float start, float end, float val){ + end -= start; + return end * val * val * val * val * val + start; +} + +private static float easeOutQuint(float start, float end, float val){ + val--; + end -= start; + return end * (val * val * val * val * val + 1) + start; +} + +private static float easeInOutQuint(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val * val * val + start; + val -= 2; + return end / 2 * (val * val * val * val * val + 2) + start; +} + +private static float easeInSine(float start, float end, float val){ + end -= start; + return -end * Mathf.Cos(val / 1 * (Mathf.PI / 2)) + end + start; +} + +private static float easeOutSine(float start, float end, float val){ + end -= start; + return end * Mathf.Sin(val / 1 * (Mathf.PI / 2)) + start; +} + +private static float easeInOutSine(float start, float end, float val){ + end -= start; + return -end / 2 * (Mathf.Cos(Mathf.PI * val / 1) - 1) + start; +} + +private static float easeInExpo(float start, float end, float val){ + end -= start; + return end * Mathf.Pow(2, 10 * (val / 1 - 1)) + start; +} + +private static float easeOutExpo(float start, float end, float val){ + end -= start; + return end * (-Mathf.Pow(2, -10 * val / 1) + 1) + start; +} + +private static float easeInOutExpo(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * Mathf.Pow(2, 10 * (val - 1)) + start; + val--; + return end / 2 * (-Mathf.Pow(2, -10 * val) + 2) + start; +} + +private static float easeInCirc(float start, float end, float val){ + end -= start; + return -end * (Mathf.Sqrt(1 - val * val) - 1) + start; +} + +private static float easeOutCirc(float start, float end, float val){ + val--; + end -= start; + return end * Mathf.Sqrt(1 - val * val) + start; +} + +private static float easeInOutCirc(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return -end / 2 * (Mathf.Sqrt(1 - val * val) - 1) + start; + val -= 2; + return end / 2 * (Mathf.Sqrt(1 - val * val) + 1) + start; +} + +/* GFX47 MOD START */ +private static float easeInBounce(float start, float end, float val){ + end -= start; + float d = 1f; + return end - easeOutBounce(0, end, d-val) + start; +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +//public static function bounce(float start, float end, float val){ +private static float easeOutBounce(float start, float end, float val){ + val /= 1f; + end -= start; + if (val < (1 / 2.75f)){ + return end * (7.5625f * val * val) + start; + }else if (val < (2 / 2.75f)){ + val -= (1.5f / 2.75f); + return end * (7.5625f * (val) * val + .75f) + start; + }else if (val < (2.5 / 2.75)){ + val -= (2.25f / 2.75f); + return end * (7.5625f * (val) * val + .9375f) + start; + }else{ + val -= (2.625f / 2.75f); + return end * (7.5625f * (val) * val + .984375f) + start; + } +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +private static float easeInOutBounce(float start, float end, float val){ + end -= start; + float d= 1f; + if (val < d/2) return easeInBounce(0, end, val*2) * 0.5f + start; + else return easeOutBounce(0, end, val*2-d) * 0.5f + end*0.5f + start; +} +/* GFX47 MOD END */ + +private static float easeInBack(float start, float end, float val){ + end -= start; + val /= 1; + float s= 1.70158f; + return end * (val) * val * ((s + 1) * val - s) + start; +} + +private static float easeOutBack(float start, float end, float val){ + float s= 1.70158f; + end -= start; + val = (val / 1) - 1; + return end * ((val) * val * ((s + 1) * val + s) + 1) + start; +} + +private static float easeInOutBack(float start, float end, float val){ + float s= 1.70158f; + end -= start; + val /= .5f; + if ((val) < 1){ + s *= (1.525f); + return end / 2 * (val * val * (((s) + 1) * val - s)) + start; + } + val -= 2; + s *= (1.525f); + return end / 2 * ((val) * val * (((s) + 1) * val + s) + 2) + start; +} + +/* GFX47 MOD START */ +private static float easeInElastic(float start, float end, float val){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s= 0; + float a = 0; + + if (val == 0) return start; + val = val/d; + if (val == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + val = val-1; + return -(a * Mathf.Pow(2, 10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p)) + start; +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +//public static function elastic(float start, float end, float val){ +private static float easeOutElastic(float start, float end, float val){ +/* GFX47 MOD END */ + //Thank you to rafael.marteleto for fixing this as a port over from Pedro's UnityTween + end -= start; + + float d = 1f; + float p= d * .3f; + float s= 0; + float a= 0; + + if (val == 0) return start; + + val = val / d; + if (val == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return (a * Mathf.Pow(2, -10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p) + end + start); +} + +/* GFX47 MOD START */ +private static float easeInOutElastic(float start, float end, float val) +{ + end -= start; + + float d = 1f; + float p= d * .3f; + float s= 0; + float a = 0; + + if (val == 0) return start; + + val = val / (d/2); + if (val == 2) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + if (val < 1){ + val = val-1; + return -0.5f * (a * Mathf.Pow(2, 10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p)) + start; + } + val = val-1; + return a * Mathf.Pow(2, -10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p) * 0.5f + end + start; +} + +// LeanTween Listening/Dispatch + +private static System.Action[] eventListeners; +private static GameObject[] goListeners; +private static int eventsMaxSearch = 0; +public static int EVENTS_MAX = 10; +public static int LISTENERS_MAX = 10; + +public static void addListener( int eventId, System.Action callback ){ + addListener(tweenEmpty, eventId, callback); +} + +/** +* Add a listener method to be called when the appropriate LeanTween.dispatchEvent is called +* @method LeanTween.addListener +* @param {GameObject} caller:GameObject the gameObject the listener is attached to +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {System.Action} callback:System.Action the method to call when the event has been dispatched +* @example +* LeanTween.addListener(gameObject, (int)MyEvents.JUMP, jumpUp);
+*
+* void jumpUp( LTEvent e ){ Debug.Log("jump!"); }
+*/ +public static void addListener( GameObject caller, int eventId, System.Action callback ){ + if(eventListeners==null){ + eventListeners = new System.Action[ EVENTS_MAX * LISTENERS_MAX ]; + goListeners = new GameObject[ EVENTS_MAX * LISTENERS_MAX ]; + } + // Debug.Log("searching for an empty space for:"+caller + " eventid:"+event); + for(i = 0; i < LISTENERS_MAX; i++){ + int point = eventId*LISTENERS_MAX + i; + if(goListeners[ point ]==null || eventListeners[ point ]==null){ + eventListeners[ point ] = callback; + goListeners[ point ] = caller; + if(i>=eventsMaxSearch) + eventsMaxSearch = i+1; + // Debug.Log("adding event for:"+caller.name); + + return; + } + if(goListeners[ point ] == caller && System.Object.ReferenceEquals( eventListeners[ point ], callback)){ + // Debug.Log("This event is already being listened for."); + return; + } + } + Debug.LogError("You ran out of areas to add listeners, consider increasing LISTENERS_MAX, ex: LeanTween.LISTENERS_MAX = "+(LISTENERS_MAX*2)); +} + +public static bool removeListener( int eventId, System.Action callback ){ + return removeListener( tweenEmpty, eventId, callback); +} + +/** +* Remove an event listener you have added +* @method LeanTween.removeListener +* @param {GameObject} caller:GameObject the gameObject the listener is attached to +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {System.Action} callback:System.Action the method that was specified to call when the event has been dispatched +* @example +* LeanTween.removeListener(gameObject, (int)MyEvents.JUMP, jumpUp);
+*
+* void jumpUp( LTEvent e ){ }
+*/ +public static bool removeListener( GameObject caller, int eventId, System.Action callback ){ + for(i = 0; i < eventsMaxSearch; i++){ + int point = eventId*LISTENERS_MAX + i; + if(goListeners[ point ] == caller && System.Object.ReferenceEquals( eventListeners[ point ], callback) ){ + eventListeners[ point ] = null; + goListeners[ point ] = null; + return true; + } + } + return false; +} + +/** +* Tell the added listeners that you are dispatching the event +* @method LeanTween.dispatchEvent +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @example +* LeanTween.dispatchEvent( (int)MyEvents.JUMP );
+*/ +public static void dispatchEvent( int eventId ){ + dispatchEvent( eventId, null); +} + +/** +* Tell the added listeners that you are dispatching the event +* @method LeanTween.dispatchEvent +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {object} data:object Pass data to the listener, access it from the listener with *.data on the LTEvent object +* @example +* LeanTween.dispatchEvent( (int)MyEvents.JUMP, transform );
+*
+* void jumpUp( LTEvent e ){
+*   Transform tran = (Transform)e.data;
+* }
+*/ +public static void dispatchEvent( int eventId, object data ){ + for(int k = 0; k < eventsMaxSearch; k++){ + int point = eventId*LISTENERS_MAX + k; + if(eventListeners[ point ]!=null){ + if(goListeners[point]){ + eventListeners[ point ]( new LTEvent(eventId, data) ); + }else{ + eventListeners[ point ] = null; + } + } + } +} + +} + +/** +* Object that describes the event to an event listener +* @class LTEvent +* @constructor +* @param {object} data:object Data that has been passed from the dispatchEvent method +*/ +public class LTEvent{ + public int id; + public object data; + + public LTEvent(int id, object data){ + this.id = id; + this.data = data; + } +} + +public class LTGUI{ + public static int RECT_LEVELS = 5; + public static int RECTS_PER_LEVEL = 10; + public static int BUTTONS_MAX = 24; + + private static LTRect[] levels; + private static int[] levelDepths; + private static Rect[] buttons; + private static int[] buttonLevels; + private static int[] buttonLastFrame; + private static LTRect r; + private static Color color = Color.white; + private static bool isGUIEnabled = false; + private static int global_counter = 0; + + public enum Element_Type{ + Texture, + Label + } + + public static void init(){ + if(levels==null){ + levels = new LTRect[RECT_LEVELS*RECTS_PER_LEVEL]; + levelDepths = new int[RECT_LEVELS]; + } + } + + public static void initRectCheck(){ + if(buttons==null){ + buttons = new Rect[BUTTONS_MAX]; + buttonLevels = new int[BUTTONS_MAX]; + buttonLastFrame = new int[BUTTONS_MAX]; + for(int i = 0; i < buttonLevels.Length; i++){ + buttonLevels[i] = -1; + } + } + } + + public static void reset(){ + if(isGUIEnabled){ + isGUIEnabled = false; + for(int i = 0; i < levels.Length; i++){ + levels[i] = null; + } + + for(int i = 0; i < levelDepths.Length; i++){ + levelDepths[i] = 0; + } + } + } + + public static void update( int updateLevel ){ + if(isGUIEnabled){ + init(); + if(levelDepths[updateLevel]>0){ + color = GUI.color; + int baseI = updateLevel*RECTS_PER_LEVEL; + int maxLoop = baseI + levelDepths[updateLevel];// RECTS_PER_LEVEL;//; + + for(int i = baseI; i < maxLoop; i++){ + r = levels[i]; + // Debug.Log("r:"+r+" i:"+i); + if(r!=null /*&& checkOnScreen(r.rect)*/){ + //Debug.Log("label:"+r.labelStr+" textColor:"+r.style.normal.textColor); + if(r.useColor) + GUI.color = r.color; + if(r.type == Element_Type.Label){ + if(r.style!=null) + GUI.skin.label = r.style; + if(r.useSimpleScale){ + GUI.Label( new Rect((r.rect.x + r.margin.x + r.relativeRect.x)*r.relativeRect.width, (r.rect.y + r.margin.y + r.relativeRect.y)*r.relativeRect.height, r.rect.width*r.relativeRect.width, r.rect.height*r.relativeRect.height), r.labelStr ); + }else{ + GUI.Label( new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, r.rect.width, r.rect.height), r.labelStr ); + } + }else if(r.type == Element_Type.Texture && r.texture!=null){ + Vector2 size = r.useSimpleScale ? new Vector2(0f, r.rect.height*r.relativeRect.height) : new Vector2(r.rect.width, r.rect.height); + if(r.sizeByHeight){ + size.x = (float)r.texture.width/(float)r.texture.height * size.y; + } + if(r.useSimpleScale){ + GUI.DrawTexture( new Rect((r.rect.x + r.margin.x + r.relativeRect.x)*r.relativeRect.width, (r.rect.y + r.margin.y + r.relativeRect.y)*r.relativeRect.height, size.x, size.y), r.texture ); + }else{ + GUI.DrawTexture( new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, size.x, size.y), r.texture ); + } + } + } + } + GUI.color = color; + } + } + } + + public static bool checkOnScreen(Rect rect){ + bool offLeft = rect.x + rect.width < 0f; + bool offRight = rect.x > Screen.width; + bool offBottom = rect.y > Screen.height; + bool offTop = rect.y + rect.height < 0f; + + return !(offLeft || offRight || offBottom || offTop); + } + + public static void destroy( int id ){ + int backId = id & 0xFFFF; + int backCounter = id >> 16; + if(id>=0 && levels[backId]!=null && levels[backId].hasInitiliazed && levels[backId].counter==backCounter) + levels[backId] = null; + } + + public static LTRect label( Rect rect, string label, int depth){ + return LTGUI.label(new LTRect(rect), label, depth); + } + + public static LTRect label( LTRect rect, string label, int depth){ + rect.type = Element_Type.Label; + rect.labelStr = label; + return element(rect, depth); + } + + public static LTRect texture( Rect rect, Texture texture, int depth){ + return LTGUI.texture( new LTRect(rect), texture, depth); + } + + public static LTRect texture( LTRect rect, Texture texture, int depth){ + rect.type = Element_Type.Texture; + rect.texture = texture; + return element(rect, depth); + } + + public static LTRect element( LTRect rect, int depth){ + isGUIEnabled = true; + init(); + int maxLoop = depth*RECTS_PER_LEVEL + RECTS_PER_LEVEL; + int k = 0; + if(rect!=null){ + destroy(rect.id); + } + if(rect.type==LTGUI.Element_Type.Label && rect.style!=null){ + if(rect.style.normal.textColor.a<=0f){ + Debug.LogWarning("Your GUI normal color has an alpha of zero, and will not be rendered."); + } + } + if(rect.relativeRect.width==float.PositiveInfinity){ + rect.relativeRect = new Rect(0f,0f,Screen.width,Screen.height); + } + for(int i = depth*RECTS_PER_LEVEL; i < maxLoop; i++){ + r = levels[i]; + if(r==null){ + r = rect; + r.rotateEnabled = true; + r.alphaEnabled = true; + r.setId( i, global_counter ); + levels[i] = r; + // Debug.Log("k:"+k+ " maxDepth:"+levelDepths[depth]); + if(k>=levelDepths[depth]){ + levelDepths[depth] = k + 1; + } + global_counter++; + return r; + } + k++; + } + + Debug.LogError("You ran out of GUI Element spaces"); + + return null; + } + + public static bool hasNoOverlap( Rect rect, int depth ){ + initRectCheck(); + bool hasNoOverlap = true; + bool wasAddedToList = false; + for(int i = 0; i < buttonLevels.Length; i++){ + // Debug.Log("buttonLastFrame["+i+"]:"+buttonLastFrame[i]); + //Debug.Log("buttonLevels["+i+"]:"+buttonLevels[i]); + if(buttonLevels[i]>=0){ + //Debug.Log("buttonLastFrame["+i+"]:"+buttonLastFrame[i]+" Time.frameCount:"+Time.frameCount); + if( buttonLastFrame[i] + 1 < Time.frameCount ){ // It has to have been visible within the current, or + buttonLevels[i] = -1; + // Debug.Log("resetting i:"+i); + }else{ + //if(buttonLevels[i]>=0) + // Debug.Log("buttonLevels["+i+"]:"+buttonLevels[i]); + if(buttonLevels[i]>depth){ + /*if(firstTouch().x > 0){ + Debug.Log("buttons["+i+"]:"+buttons[i] + " firstTouch:"); + Debug.Log(firstTouch()); + Debug.Log(buttonLevels[i]); + }*/ + if(pressedWithinRect( buttons[i] )){ + hasNoOverlap = false; // there is an overlapping button that is higher + } + } + } + } + + if(wasAddedToList==false && buttonLevels[i]<0){ + wasAddedToList = true; + buttonLevels[i] = depth; + buttons[i] = rect; + buttonLastFrame[i] = Time.frameCount; + } + } + + return hasNoOverlap; + } + + public static bool pressedWithinRect( Rect rect ){ + Vector2 vec2 = firstTouch(); + if(vec2.x<0f) + return false; + float vecY = Screen.height-vec2.y; + return (vec2.x > rect.x && vec2.x < rect.x + rect.width && vecY > rect.y && vecY < rect.y + rect.height); + } + + public static bool checkWithinRect(Vector2 vec2, Rect rect){ + vec2.y = Screen.height-vec2.y; + return (vec2.x > rect.x && vec2.x < rect.x + rect.width && vec2.y > rect.y && vec2.y < rect.y + rect.height); + } + + public static Vector2 firstTouch(){ + if(Input.touchCount>0){ + return Input.touches[0].position; + }else if(Input.GetMouseButton(0)){ + return Input.mousePosition; + } + + return new Vector2(Mathf.NegativeInfinity,Mathf.NegativeInfinity); + } + +} diff --git a/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs.meta b/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs.meta new file mode 100644 index 0000000..13d23f8 --- /dev/null +++ b/UnityTests.Unity4/Assets/LeanTween/Plugins/LeanTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c2f4b27196f84954b44753aaac214bb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins.meta b/UnityTests.Unity4/Assets/Plugins.meta new file mode 100644 index 0000000..2b41241 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c3dc57e0651866248b11147918501490 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit.meta b/UnityTests.Unity4/Assets/Plugins/GoKit.meta new file mode 100644 index 0000000..b67bec1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8c5cefa129e0c4945acf6eb49a983eae +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs new file mode 100644 index 0000000..b5bbf23 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs @@ -0,0 +1,406 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class Go : MonoBehaviour +{ + // defaults used for all tweens/properties that are not explicitly set + public static GoEaseType defaultEaseType = GoEaseType.Linear; + public static GoLoopType defaultLoopType = GoLoopType.RestartFromBeginning; + public static GoUpdateType defaultUpdateType = GoUpdateType.Update; + + // defines what we should do in the event that a TweenProperty is added and an already existing tween has the same + // property and target + public static GoDuplicatePropertyRuleType duplicatePropertyRule = GoDuplicatePropertyRuleType.None; + public static GoLogLevel logLevel = GoLogLevel.Warn; + + // validates that the target object still exists each tick of the tween. NOTE: it is recommended + // that you just properly remove your tweens before destroying any objects even though this might destroy them for you + public static bool validateTargetObjectsEachTick = true; + + // Used to stop instances being created while the application is quitting + private static bool _applicationIsQuitting = false; + + private static List _tweens = new List(); // contains Tweens, TweenChains and TweenFlows + private bool _timeScaleIndependentUpdateIsRunning; + + // only one Go can exist + static Go _instance = null; + public static Go instance + { + get + { + // Don't allow new instances to be created when the application is quitting to avoid the GOKit object never being destroyed. + // These dangling instances can't be found with FindObjectOfType and so you'd get multiple instances in a scene. + if( !_instance && !_applicationIsQuitting ) + { + // check if there is a GO instance already available in the scene graph + _instance = FindObjectOfType( typeof( Go ) ) as Go; + + // possible Unity bug with FindObjectOfType workaround + //_instance = FindObjectOfType( typeof( Go ) ) ?? GameObject.Find( "GoKit" ).GetComponent() as Go; + + // nope, create a new one + if( !_instance ) + { + var obj = new GameObject( "GoKit" ); + _instance = obj.AddComponent(); + DontDestroyOnLoad( obj ); + } + } + + return _instance; + } + } + + + /// + /// loops through all the Tweens and updates any that are of updateType. If any Tweens are complete + /// (the update call will return true) they are removed. + /// + private void handleUpdateOfType( GoUpdateType updateType, float deltaTime ) + { + // loop backwards so we can remove completed tweens + for( var i = _tweens.Count - 1; i >= 0; --i ) + { + var t = _tweens[i]; + + if( t.state == GoTweenState.Destroyed ) + { + // destroy method has been called + removeTween( t ); + } + else + { + // only process tweens with our update type that are running + if( t.updateType == updateType && t.state == GoTweenState.Running && t.update( deltaTime * t.timeScale ) ) + { + // tween is complete if we get here. if destroyed or set to auto remove kill it + if( t.state == GoTweenState.Destroyed || t.autoRemoveOnComplete ) + { + removeTween( t ); + t.destroy(); + } + } + } + } + } + + + #region Monobehaviour + + private void Update() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.Update, Time.deltaTime ); + } + + + private void LateUpdate() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.LateUpdate, Time.deltaTime ); + } + + + private void FixedUpdate() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.FixedUpdate, Time.deltaTime ); + } + + + private void OnApplicationQuit() + { + _instance = null; + Destroy( gameObject ); + _applicationIsQuitting = true; + } + + #endregion + + + /// + /// this only runs as needed and handles time scale independent Tweens + /// + private IEnumerator timeScaleIndependentUpdate() + { + _timeScaleIndependentUpdateIsRunning = true; + var time = Time.realtimeSinceStartup; + + while( _tweens.Count > 0 ) + { + var elapsed = Time.realtimeSinceStartup - time; + time = Time.realtimeSinceStartup; + + // update tweens + handleUpdateOfType( GoUpdateType.TimeScaleIndependentUpdate, elapsed ); + + yield return null; + } + + _timeScaleIndependentUpdateIsRunning = false; + } + + + /// + /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to + /// DontAddCurrentProperty it will return true indicating that the tween should not be added. + /// this only checks tweens that are not part of an AbstractTweenCollection + /// + private static bool handleDuplicatePropertiesInTween( GoTween tween ) + { + // first fetch all the current tweens with the same target object as this one + var allTweensWithTarget = tweensWithTarget( tween.target ); + + // store a list of all the properties in the tween + var allProperties = tween.allTweenProperties(); + + // TODO: perhaps only perform the check on running Tweens? + + // loop through all the tweens with the same target + foreach( var tweenWithTarget in allTweensWithTarget ) + { + // loop through all the properties in the tween and see if there are any dupes + foreach( var tweenProp in allProperties ) + { + warn( "found duplicate TweenProperty {0} in tween {1}", tweenProp, tween ); + + // check for a matched property + if( tweenWithTarget.containsTweenProperty( tweenProp ) ) + { + // handle the different duplicate property rules + if( duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty ) + { + return true; + } + else if( duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty ) + { + // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? + tweenWithTarget.removeTweenProperty( tweenProp ); + } + + return false; + } + } + } + + return false; + } + + + #region Logging + + /// + /// logging should only occur in the editor so we use a conditional + /// + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + private static void log( object format, params object[] paramList ) + { + if( format is string ) + Debug.Log( string.Format( format as string, paramList ) ); + else + Debug.Log( format ); + } + + + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + public static void warn( object format, params object[] paramList ) + { + if( logLevel == GoLogLevel.None || logLevel == GoLogLevel.Info ) + return; + + if( format is string ) + Debug.LogWarning( string.Format( format as string, paramList ) ); + else + Debug.LogWarning( format ); + } + + + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + public static void error( object format, params object[] paramList ) + { + if( logLevel == GoLogLevel.None || logLevel == GoLogLevel.Info || logLevel == GoLogLevel.Warn ) + return; + + if( format is string ) + Debug.LogError( string.Format( format as string, paramList ) ); + else + Debug.LogError( format ); + } + + #endregion + + + #region public API + + /// + /// helper function that creates a "to" Tween and adds it to the pool + /// + public static GoTween to( object target, float duration, GoTweenConfig config ) + { + config.setIsTo(); + var tween = new GoTween( target, duration, config ); + addTween( tween ); + + return tween; + } + + + /// + /// helper function that creates a "from" Tween and adds it to the pool + /// + public static GoTween from( object target, float duration, GoTweenConfig config ) + { + config.setIsFrom(); + var tween = new GoTween( target, duration, config ); + addTween( tween ); + + return tween; + } + + + /// + /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens + /// + public static void addTween( AbstractGoTween tween ) + { + // early out for invalid items + if( !tween.isValid() ) + return; + + // dont add the same tween twice + if( _tweens.Contains( tween ) ) + return; + + // check for dupes and handle them before adding the tween. we only need to check for Tweens + if( duplicatePropertyRule != GoDuplicatePropertyRuleType.None && tween is GoTween ) + { + // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween + if( handleDuplicatePropertiesInTween( tween as GoTween ) ) + return; + + // if we became invalid after handling dupes dont add the tween + if( !tween.isValid() ) + return; + } + + _tweens.Add( tween ); + + // enable ourself if we are not enabled + if( !instance.enabled ) // purposely using the static instace property just once for initialization + _instance.enabled = true; + + // if the Tween isn't paused and it is a "from" tween jump directly to the start position + if( tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused ) + tween.update( 0 ); + + // should we start up the time scale independent update? + if( !_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate ) + _instance.StartCoroutine( _instance.timeScaleIndependentUpdate() ); + +#if UNITY_EDITOR + _instance.gameObject.name = string.Format( "GoKit ({0} tweens)", _tweens.Count ); +#endif + } + + + /// + /// removes the Tween returning true if it was removed or false if it was not found + /// + public static bool removeTween( AbstractGoTween tween ) + { + if( _tweens.Contains( tween ) ) + { + _tweens.Remove( tween ); + +#if UNITY_EDITOR + if( _instance != null && _tweens != null ) + _instance.gameObject.name = string.Format( "GoKit ({0} tweens)", _tweens.Count ); +#endif + + if( _instance != null && _tweens.Count == 0 ) + { + // disable ourself if we have no more tweens + _instance.enabled = false; + } + + return true; + } + + return false; + } + + + /// + /// returns a list of all Tweens, TweenChains and TweenFlows with the given id + /// + public static List tweensWithId( int id ) + { + List list = null; + + foreach( var tween in _tweens ) + { + if( tween.id == id ) + { + if( list == null ) + list = new List(); + list.Add( tween ); + } + } + + return list; + } + + + /// + /// returns a list of all Tweens with the given target. TweenChains and TweenFlows can optionally + /// be traversed and matching Tweens returned as well. + /// + public static List tweensWithTarget( object target, bool traverseCollections = false ) + { + List list = new List(); + + foreach( var item in _tweens ) + { + // we always check Tweens so handle them first + var tween = item as GoTween; + if( tween != null && tween.target == target ) + list.Add( tween ); + + // optionally check TweenChains and TweenFlows. if tween is null we have a collection + if( traverseCollections && tween == null ) + { + var tweenCollection = item as AbstractGoTweenCollection; + if( tweenCollection != null ) + { + var tweensInCollection = tweenCollection.tweensWithTarget( target ); + if( tweensInCollection.Count > 0 ) + list.AddRange( tweensInCollection ); + } + } + } + + return list; + } + + + /// + /// kills all tweens with the given target by calling the destroy method on each one + /// + public static void killAllTweensWithTarget( object target ) + { + foreach( var tween in tweensWithTarget( target, true ) ) + tween.destroy(); + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs.meta new file mode 100644 index 0000000..16082f3 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/Go.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aabcf1780fb4540bbb12fde714c3f88a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs new file mode 100644 index 0000000..8302a6b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// place this script on any GameObject to enable route editing. note that it is not required at runtime! it is +/// only required to be in your scene while editing a path +/// +public class GoDummyPath : MonoBehaviour +{ + public string pathName = string.Empty; + public Color pathColor = Color.magenta; // color of the path if visible in the editor + public List nodes = new List() { Vector3.zero, Vector3.zero }; + public bool useStandardHandles = false; + public bool forceStraightLinePath = false; + public int pathResolution = 50; + + + public void OnDrawGizmos() + { + // the editor will draw paths when force straight line is on + if( !forceStraightLinePath ) + { + var spline = new GoSpline( nodes ); + Gizmos.color = pathColor; + spline.drawGizmos( pathResolution ); + } + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs.meta new file mode 100644 index 0000000..60af7e7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoDummyPath.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25af92ea012eb4667a9c36cc4a72a725 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs new file mode 100644 index 0000000..c456d14 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs @@ -0,0 +1,341 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTween : AbstractGoTween +{ + // Tween specific properties + public object target { get; private set; } // the target of the tweens + public float delay { get; private set; } // delay before starting the actual animations + private float _elapsedDelay; // total time delayed + private bool _delayComplete; // once we complete the delay this gets set so we can reverse and play properly for the future + public bool isFrom { get; private set; } // a value of true will make this a "from" tween + + private List _tweenPropertyList = new List(); + private string targetTypeString; + + /// + /// sets the ease type for all Tweens. this will overwrite the ease types for each Tween! + /// + private GoEaseType _easeType; + public GoEaseType easeType + { + get + { + return _easeType; + } + set + { + _easeType = value; + + // change ease type of all existing tweens. + foreach( var tween in _tweenPropertyList ) + tween.setEaseType( value ); + } + } + + + /// + /// initializes a new instance and sets up the details according to the config parameter + /// + public GoTween( object target, float duration, GoTweenConfig config, Action onComplete = null ) + { + // default to removing on complete + autoRemoveOnComplete = true; + + // allow events by default + allowEvents = true; + + // setup callback bools + _didInit = false; + _didBegin = false; + + // flag the onIterationStart event to fire. + // as long as goTo is not called on this tween, the onIterationStart event will fire + // as soon as the delay, if any, is completed. + _fireIterationStart = true; + + this.target = target; + this.targetTypeString = target.GetType().ToString(); + this.duration = duration; + + // copy the TweenConfig info over + id = config.id; + delay = config.delay; + loopType = config.loopType; + iterations = config.iterations; + _easeType = config.easeType; + updateType = config.propertyUpdateType; + isFrom = config.isFrom; + timeScale = config.timeScale; + + _onInit = config.onInitHandler; + _onBegin = config.onBeginHandler; + _onIterationStart = config.onIterationStartHandler; + _onUpdate = config.onUpdateHandler; + _onIterationEnd = config.onIterationEndHandler; + _onComplete = config.onCompleteHandler; + + if( config.isPaused ) + state = GoTweenState.Paused; + + // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be + // set and maintain clean code (Actions always try to be the last param of a method) + if( onComplete != null ) + _onComplete = onComplete; + + // add all our properties + for( var i = 0; i < config.tweenProperties.Count; ++i ) + { + var tweenProp = config.tweenProperties[i]; + + // if the tween property is initialized already it means it is being reused so we need to clone it + if( tweenProp.isInitialized ) + tweenProp = tweenProp.clone(); + + addTweenProperty( tweenProp ); + } + + // calculate total duration + if( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = iterations * duration; + } + + /// + /// tick method. if it returns true it indicates the tween is complete + /// + public override bool update( float deltaTime ) + { + // properties are prepared only once on the first update of the tween. + if ( !_didInit ) + onInit(); + + // should we validate the target? + if( Go.validateTargetObjectsEachTick ) + { + // This might seem to be overkill, but on the case of Transforms that + // have been destroyed, target == null will return false, whereas + // target.Equals(null) will return true. Otherwise we don't really + // get the benefits of the nanny. + if( target == null || target.Equals(null) ) + { + // if the target doesn't pass validation + Debug.LogWarning( "target validation failed. destroying the tween to avoid errors. Target type: " + this.targetTypeString ); + autoRemoveOnComplete = true; + return true; + } + } + + // we only fire the begin callback once per run. + if ( !_didBegin ) + onBegin(); + + // handle delay and return if we are still delaying + if( !_delayComplete && _elapsedDelay < delay ) + { + // if we have a timeScale set we need to remove its influence so that delays are always in seconds + if( timeScale != 0 ) + _elapsedDelay += deltaTime / timeScale; + + // are we done delaying? + if( _elapsedDelay >= delay ) + _delayComplete = true; + + return false; + } + + // loops only start once the delay has completed. + if ( _fireIterationStart ) + onIterationStart(); + + // base will calculate the proper elapsedTime, iterations, etc. + base.update( deltaTime ); + + // if we are looping back on a PingPong loop + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + //Debug.Log(string.Format("{0} : {1} -- {2}", _elapsedTime, convertedElapsedTime, _isLoopingBackOnPingPong ? "Y" : "N")); + + // update all properties + for( var i = 0; i < _tweenPropertyList.Count; ++i ) + _tweenPropertyList[i].tick( convertedElapsedTime ); + + onUpdate(); + + if ( _fireIterationEnd ) + onIterationEnd(); + + if( state == GoTweenState.Complete ) + { + onComplete(); + + return true; // true if complete + } + + return false; // false if not complete + } + + + /// + /// we are valid if we have a target and at least one TweenProperty + /// + public override bool isValid() + { + return target != null; + } + + + /// + /// adds the tween property if it passes validation and initializes the property + /// + public void addTweenProperty( AbstractTweenProperty tweenProp ) + { + // make sure the target is valid for this tween before adding + if( tweenProp.validateTarget( target ) ) + { + // ensure we dont add two tweens of the same property so they dont fight + if( _tweenPropertyList.Contains( tweenProp ) ) + { + Debug.Log( "not adding tween property because one already exists: " + tweenProp ); + return; + } + + _tweenPropertyList.Add( tweenProp ); + tweenProp.init( this ); + } + else + { + Debug.Log( "tween failed to validate target: " + tweenProp ); + } + } + + + public override bool removeTweenProperty( AbstractTweenProperty property ) + { + if( _tweenPropertyList.Contains( property ) ) + { + _tweenPropertyList.Remove( property ); + return true; + } + + return false; + } + + + public override bool containsTweenProperty( AbstractTweenProperty property ) + { + return _tweenPropertyList.Contains( property ); + } + + + public void clearTweenProperties() + { + _tweenPropertyList.Clear(); + } + + + public override List allTweenProperties() + { + return _tweenPropertyList; + } + + + #region AbstractTween overrides + + /// + /// called only once the first update of a tween. + /// + protected override void onInit() + { + base.onInit(); + + for ( var i = 0; i < _tweenPropertyList.Count; ++i ) + _tweenPropertyList[i].prepareForUse(); + } + + /// + /// removes the tween and cleans up its state + /// + public override void destroy() + { + base.destroy(); + + _tweenPropertyList.Clear(); + target = null; + } + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it will be force updated to the time specified. + /// + public override void goTo( float time , bool skipDelay = true ) + { + // handle delay, which is specific to Tweens + if( skipDelay ) + { + _elapsedDelay = delay; + } + else + { + _elapsedDelay = Mathf.Min( time, delay ); + time -= _elapsedDelay; + } + + _delayComplete = _elapsedDelay >= delay; + + time = Mathf.Clamp( time, 0f, totalDuration ); + + // provide an early out for calling goto on the same time multiple times. + if ( time == _totalElapsedTime ) + return; + + // if we are doing a goTo at the "start" of the timeline, based on the isReversed variable, + // allow the onBegin and onIterationStart callback to fire again. + // we only allow the onIterationStart event callback to fire at the start of the timeline, + // as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we + // go to the start. + if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + else + { + _didBegin = true; + _fireIterationStart = false; + } + + // since we're doing a goTo, we want to stop this tween from remembering that it iterated. + // this could cause issues if you caused the tween to complete an iteration and then goTo somewhere + // else while still paused. + _didIterateThisFrame = false; + + // force a time and completedIterations before we update + _totalElapsedTime = time; + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + update( 0 ); + } + + + /// + /// completes the tween. sets the object to it's final position as if the tween completed normally. + /// takes into effect if the tween was playing forward or reversed. + /// + public override void complete() + { + if( iterations < 0 ) + return; + + // set delayComplete so we get one last update in before we die (base will set the elapsed time for us) + _delayComplete = true; + + base.complete(); + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs.meta new file mode 100644 index 0000000..ace9b8c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5e29433d2fb8417c9b59ce3453f2ca3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs new file mode 100644 index 0000000..d9b9595 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs @@ -0,0 +1,147 @@ +using UnityEngine; +using System.Collections; + + +public class GoTweenChain : AbstractGoTweenCollection +{ + public GoTweenChain() : this(new GoTweenCollectionConfig()) {} + public GoTweenChain(GoTweenCollectionConfig config) : base(config) {} + + #region internal Chain management + + private void append( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenChain is not permitted" ); + return; + } + + if ( item.tween != null ) + { + if ( item.tween.isReversed != isReversed ) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween(item.tween); + + // ensure that the item is marked to play. + item.tween.play(); + } + + _tweenFlows.Add( item ); + + // update the duration and total duration + duration += item.duration; + + if( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + + private void prepend( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenChain is not permitted" ); + return; + } + + if ( item.tween != null ) + { + if ( item.tween.isReversed != isReversed ) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween( item.tween ); + + // ensure that the item is marked to play. + item.tween.play(); + } + + // fix all the start times on our previous chains + foreach( var flowItem in _tweenFlows ) + flowItem.startTime += item.duration; + + _tweenFlows.Insert( 0, item ); + + // update the duration and total duration + duration += item.duration; + + if ( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + #endregion + + + #region Chain management + + /// + /// appends a Tween at the end of the current flow + /// + public GoTweenChain append( AbstractGoTween tween ) + { + var item = new TweenFlowItem( duration, tween ); + append( item ); + + return this; + } + + + /// + /// appends a delay to the end of the current flow + /// + public GoTweenChain appendDelay( float delay ) + { + var item = new TweenFlowItem( duration, delay ); + append( item ); + + return this; + } + + + /// + /// adds a Tween to the front of the flow + /// + public GoTweenChain prepend( AbstractGoTween tween ) + { + var item = new TweenFlowItem( 0, tween ); + prepend( item ); + + return this; + } + + + /// + /// adds a delay to the front of the flow + /// + public GoTweenChain prependDelay( float delay ) + { + var item = new TweenFlowItem( 0, delay ); + prepend( item ); + + return this; + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs.meta new file mode 100644 index 0000000..d8cc75a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenChain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4985888b83c04c04b428c6b4d0e9e13 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs new file mode 100644 index 0000000..c3fbf93 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs @@ -0,0 +1,122 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTweenCollectionConfig +{ + public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id + public int iterations = 1; // number of times to iterate. -1 will loop indefinitely + public GoLoopType loopType = Go.defaultLoopType; + public GoUpdateType propertyUpdateType = Go.defaultUpdateType; + + public Action onInitHandler; + public Action onBeginHandler; + public Action onIterationStartHandler; + public Action onUpdateHandler; + public Action onIterationEndHandler; + public Action onCompleteHandler; + + + /// + /// sets the number of iterations. setting to -1 will loop infinitely + /// + public GoTweenCollectionConfig setIterations( int iterations ) + { + this.iterations = iterations; + return this; + } + + + /// + /// sets the number of iterations and the loop type. setting to -1 will loop infinitely + /// + public GoTweenCollectionConfig setIterations( int iterations, GoLoopType loopType ) + { + this.iterations = iterations; + this.loopType = loopType; + return this; + } + + + /// + /// sets the update type for the Tween + /// + public GoTweenCollectionConfig setUpdateType( GoUpdateType setUpdateType ) + { + this.propertyUpdateType = setUpdateType; + return this; + } + + + /// + /// sets the onInit handler for the Tween + /// + public GoTweenCollectionConfig onInit( Action onInit ) + { + onInitHandler = onInit; + return this; + } + + + /// + /// sets the onBegin handler for the Tween + /// + public GoTweenCollectionConfig onBegin( Action onBegin ) + { + onBeginHandler = onBegin; + return this; + } + + + /// + /// sets the onIterationStart handler for the Tween + /// + public GoTweenCollectionConfig onIterationStart( Action onIterationStart ) + { + onIterationStartHandler = onIterationStart; + return this; + } + + + /// + /// sets the onUpdate handler for the Tween + /// + public GoTweenCollectionConfig onUpdate( Action onUpdate ) + { + onUpdateHandler = onUpdate; + return this; + } + + + /// + /// sets the onIterationEnd handler for the Tween + /// + public GoTweenCollectionConfig onIterationEnd( Action onIterationEnd ) + { + onIterationEndHandler = onIterationEnd; + return this; + } + + + /// + /// sets the onComplete handler for the Tween + /// + public GoTweenCollectionConfig onComplete( Action onComplete ) + { + onCompleteHandler = onComplete; + return this; + } + + + /// + /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class + /// + public GoTweenCollectionConfig setId( int id ) + { + this.id = id; + return this; + } + +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta new file mode 100644 index 0000000..3e6701f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04126d38111de41799edaa161b80b0b4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs new file mode 100644 index 0000000..d0b87c5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs @@ -0,0 +1,533 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTweenConfig +{ + private List _tweenProperties = new List(); + public List tweenProperties { get { return _tweenProperties; } } + + public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id + public float delay; // how long should we delay before starting the Tween + public int iterations = 1; // number of times to iterate. -1 will loop indefinitely + public int timeScale = 1; + public GoLoopType loopType = Go.defaultLoopType; + public GoEaseType easeType = Go.defaultEaseType; + public bool isPaused; + public GoUpdateType propertyUpdateType = Go.defaultUpdateType; + public bool isFrom; + + public Action onInitHandler; + public Action onBeginHandler; + public Action onIterationStartHandler; + public Action onUpdateHandler; + public Action onIterationEndHandler; + public Action onCompleteHandler; + + + #region TweenProperty adders + + /// + /// position tween + /// + public GoTweenConfig position( Vector3 endValue, bool isRelative = false ) + { + var prop = new PositionTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// localPosition tween + /// + public GoTweenConfig localPosition( Vector3 endValue, bool isRelative = false ) + { + var prop = new PositionTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// position path tween + /// + public GoTweenConfig positionPath( GoSpline path, bool isRelative = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null ) + { + var prop = new PositionPathTweenProperty( path, isRelative, false, lookAtType, lookTarget ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// uniform scale tween (x, y and z scale to the same value) + /// + public GoTweenConfig scale( float endValue, bool isRelative = false ) + { + return this.scale( new Vector3( endValue, endValue, endValue ), isRelative ); + } + + + /// + /// scale tween + /// + public GoTweenConfig scale( Vector3 endValue, bool isRelative = false ) + { + var prop = new ScaleTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// scale through a series of Vector3s + /// + public GoTweenConfig scalePath( GoSpline path, bool isRelative = false ) + { + var prop = new ScalePathTweenProperty( path, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// eulerAngle tween + /// + public GoTweenConfig eulerAngles( Vector3 endValue, bool isRelative = false ) + { + var prop = new EulerAnglesTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// local eulerAngle tween + /// + public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false ) + { + var prop = new EulerAnglesTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// rotation tween + /// + public GoTweenConfig rotation( Vector3 endValue, bool isRelative = false ) + { + var prop = new RotationTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// localRotation tween + /// + public GoTweenConfig localRotation( Vector3 endValue, bool isRelative = false ) + { + var prop = new RotationTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// rotation tween as Quaternion + /// + public GoTweenConfig rotation( Quaternion endValue, bool isRelative = false ) + { + var prop = new RotationQuaternionTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + /// + /// localRotation tween as Quaternion + /// + public GoTweenConfig localRotation( Quaternion endValue, bool isRelative = false ) + { + var prop = new RotationQuaternionTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// material color tween + /// + public GoTweenConfig materialColor( Color endValue, string colorName = "_Color", bool isRelative = false ) + { + var prop = new MaterialColorTweenProperty( endValue, colorName, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// shake tween + /// + public GoTweenConfig shake( Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false ) + { + var prop = new ShakeTweenProperty( shakeMagnitude, shakeType, frameMod, useLocalProperties ); + _tweenProperties.Add( prop ); + + return this; + } + + + #region generic properties + + /// + /// generic vector2 tween + /// + public GoTweenConfig vector2Prop( string propertyName, Vector2 endValue, bool isRelative = false ) + { + var prop = new Vector2TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3 tween + /// + public GoTweenConfig vector3Prop( string propertyName, Vector3 endValue, bool isRelative = false ) + { + var prop = new Vector3TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector4 tween + /// + public GoTweenConfig vector4Prop( string propertyName, Vector4 endValue, bool isRelative = false ) + { + var prop = new Vector4TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3 path tween + /// + public GoTweenConfig vector3PathProp( string propertyName, GoSpline path, bool isRelative = false ) + { + var prop = new Vector3PathTweenProperty( propertyName, path, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.x tween + /// + public GoTweenConfig vector3XProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3XTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.y tween + /// + public GoTweenConfig vector3YProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3YTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.z tween + /// + public GoTweenConfig vector3ZProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3ZTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic color tween + /// + public GoTweenConfig colorProp( string propertyName, Color endValue, bool isRelative = false ) + { + var prop = new ColorTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic integer tween + /// + public GoTweenConfig intProp( string propertyName, int endValue, bool isRelative = false ) + { + var prop = new IntTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic float tween + /// + public GoTweenConfig floatProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new FloatTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + #endregion + + #endregion + + + /// + /// adds a TweenProperty to the list + /// + public GoTweenConfig addTweenProperty( AbstractTweenProperty tweenProp ) + { + _tweenProperties.Add( tweenProp ); + + return this; + } + + + /// + /// clears out all the TweenProperties + /// + public GoTweenConfig clearProperties() + { + _tweenProperties.Clear(); + + return this; + } + + /// + /// clears out all the TweenProperties + /// + public GoTweenConfig clearEvents() + { + onInitHandler = null; + onBeginHandler = null; + onIterationStartHandler = null; + onUpdateHandler = null; + onIterationEndHandler = null; + onCompleteHandler = null; + + return this; + } + + /// + /// sets the delay for the tween + /// + public GoTweenConfig setDelay( float seconds ) + { + delay = seconds; + + return this; + } + + + /// + /// sets the number of iterations. setting to -1 will loop infinitely + /// + public GoTweenConfig setIterations( int iterations ) + { + this.iterations = iterations; + + return this; + } + + + /// + /// sets the number of iterations and the loop type. setting to -1 will loop infinitely + /// + public GoTweenConfig setIterations( int iterations, GoLoopType loopType ) + { + this.iterations = iterations; + this.loopType = loopType; + + return this; + } + + + /// + /// sets the timeScale to be used by the Tween + /// + public GoTweenConfig setTimeScale( int timeScale ) + { + this.timeScale = timeScale; + + return this; + } + + + /// + /// sets the ease type for the Tween + /// + public GoTweenConfig setEaseType( GoEaseType easeType ) + { + this.easeType = easeType; + + return this; + } + + + /// + /// sets whether the Tween should start paused + /// + public GoTweenConfig startPaused() + { + isPaused = true; + + return this; + } + + + /// + /// sets the update type for the Tween + /// + public GoTweenConfig setUpdateType( GoUpdateType setUpdateType ) + { + propertyUpdateType = setUpdateType; + + return this; + } + + + /// + /// sets if this Tween should be a "from" Tween. From Tweens use the current property as the endValue and + /// the endValue as the start value + /// + public GoTweenConfig setIsFrom() + { + isFrom = true; + + return this; + } + + /// + /// sets if this Tween should be a "to" Tween. + /// + public GoTweenConfig setIsTo() + { + isFrom = false; + + return this; + } + + + /// + /// sets the onInit handler for the Tween + /// + public GoTweenConfig onInit( Action onInit ) + { + onInitHandler = onInit; + return this; + } + + + /// + /// sets the onBegin handler for the Tween + /// + public GoTweenConfig onBegin( Action onBegin ) + { + onBeginHandler = onBegin; + + return this; + } + + + /// + /// sets the onIterationStart handler for the Tween + /// + public GoTweenConfig onIterationStart( Action onIterationStart ) + { + onIterationStartHandler = onIterationStart; + + return this; + } + + + /// + /// sets the onUpdate handler for the Tween + /// + public GoTweenConfig onUpdate( Action onUpdate ) + { + onUpdateHandler = onUpdate; + + return this; + } + + + /// + /// sets the onIterationEnd handler for the Tween + /// + public GoTweenConfig onIterationEnd( Action onIterationEnd ) + { + onIterationEndHandler = onIterationEnd; + + return this; + } + + + /// + /// sets the onComplete handler for the Tween + /// + public GoTweenConfig onComplete( Action onComplete ) + { + onCompleteHandler = onComplete; + + return this; + } + + + /// + /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class + /// + public GoTweenConfig setId( int id ) + { + this.id = id; + + return this; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs.meta new file mode 100644 index 0000000..64d0104 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenConfig.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 110c83c73e3544e7785938ec38e5361e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs new file mode 100644 index 0000000..c6c946c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs @@ -0,0 +1,83 @@ +using UnityEngine; +using System.Collections; + + +/// +/// TweenFlows are used for creating a chain of Tweens via the append/prepend methods. You can also get timeline +/// like control by inserting Tweens and setting them to start at a specific time. Note that TweenFlows do not +/// honor the delays set within regular Tweens. Use the append/prependDelay method to add any required delays +/// +public class GoTweenFlow : AbstractGoTweenCollection +{ + public GoTweenFlow() : this( new GoTweenCollectionConfig() ) {} + + public GoTweenFlow( GoTweenCollectionConfig config ) : base( config ) {} + + + #region internal Flow management + + /// + /// the item being added already has a start time so no extra parameter is needed + /// + private void insert( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenFlow is not permitted" ); + return; + } + + if( item.tween != null ) + { + if (item.tween.isReversed != isReversed) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenFlow is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween(item.tween); + + // ensure that the item is marked to play. + item.tween.play(); + } + + // add the item then sort based on startTimes + _tweenFlows.Add( item ); + _tweenFlows.Sort( ( x, y ) => + { + return x.startTime.CompareTo( y.startTime ); + } ); + + duration = Mathf.Max( item.startTime + item.duration, duration ); + + if (iterations < 0) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + #endregion + + + #region Flow management + + /// + /// inserts a Tween and sets it to start at the given startTime + /// + public GoTweenFlow insert( float startTime, AbstractGoTween tween ) + { + var item = new TweenFlowItem( startTime, tween ); + insert( item ); + + return this; + } + + #endregion + + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs.meta new file mode 100644 index 0000000..78b498f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/GoTweenFlow.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc32096ae2bba43da839e42c553f294c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/base.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/base.meta new file mode 100644 index 0000000..ebbc1e1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/base.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0a0650221f37549c4988877fdaa5e4bb +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs new file mode 100644 index 0000000..2e03474 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs @@ -0,0 +1,445 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +/// +/// base class shared by the Tween and TweenChain classes to allow a seemless API when controlling +/// either of them +/// +public abstract class AbstractGoTween +{ + public int id = 0; // optional id used for identifying this tween + public GoTweenState state { get; protected set; } // current state of the tween + public float duration { get; protected set; } // duration for a single loop + public float totalDuration { get; protected set; } // duration for all loops of this tween + public float timeScale { get; set; } // time scale to be used by this tween + + public GoUpdateType updateType { get; protected set; } + public GoLoopType loopType { get; protected set; } + public int iterations { get; protected set; } // set to -1 for infinite + + public bool autoRemoveOnComplete { get; set; } // should we automatically remove ourself from the Go's list of tweens when done? + public bool isReversed { get; protected set; } // have we been reversed? this is different than a PingPong loop's backwards section + public bool allowEvents { get; set; } // allow the user to surpress events. + protected bool _didInit; // flag to ensure event only gets fired once + protected bool _didBegin; // flag to ensure event only gets fired once + protected bool _fireIterationStart; + protected bool _fireIterationEnd; + + // internal state for update logic + protected float _elapsedTime; // elapsed time for the current loop iteration + protected float _totalElapsedTime; // total elapsed time of the entire tween + public float totalElapsedTime { get { return _totalElapsedTime; } } + + protected bool _isLoopingBackOnPingPong; + public bool isLoopingBackOnPingPong { get { return _isLoopingBackOnPingPong; } } + + protected bool _didIterateLastFrame; + protected bool _didIterateThisFrame; + protected int _deltaIterations; // change in completed iterations this frame. + protected int _completedIterations; + public int completedIterations { get { return _completedIterations; } } + + // action event handlers + protected Action _onInit; // executes before initial setup. + protected Action _onBegin; // executes when a tween starts. + protected Action _onIterationStart; // executes whenever a tween starts an iteration. + protected Action _onUpdate; // execute whenever a tween updates. + protected Action _onIterationEnd; // executes whenever a tween ends an iteration. + protected Action _onComplete; // exectures whenever a tween completes + + public void setOnInitHandler( Action onInit ) + { + _onInit = onInit; + } + + public void setOnBeginHandler( Action onBegin ) + { + _onBegin = onBegin; + } + + public void setonIterationStartHandler( Action onIterationStart ) + { + _onIterationStart = onIterationStart; + } + + public void setOnUpdateHandler( Action onUpdate ) + { + _onUpdate = onUpdate; + } + + public void setonIterationEndHandler( Action onIterationEnd ) + { + _onIterationEnd = onIterationEnd; + } + + public void setOnCompleteHandler( Action onComplete ) + { + _onComplete = onComplete; + } + + /// + /// called once per tween when it is first updated + /// + protected virtual void onInit() + { + if( !allowEvents ) + return; + + if( _onInit != null ) + _onInit( this ); + + _didInit = true; + } + + /// + /// called whenever the tween is updated and the playhead is at the start (or end, depending on isReversed) of the tween. + /// + protected virtual void onBegin() + { + if( !allowEvents ) + return; + + if( isReversed && _totalElapsedTime != totalDuration ) + return; + else if( !isReversed && _totalElapsedTime != 0f ) + return; + + if( _onBegin != null ) + _onBegin( this ); + + _didBegin = true; + } + + + /// + /// called once per iteration at the start of the iteration. + /// + protected virtual void onIterationStart() + { + if( !allowEvents ) + return; + + if( _onIterationStart != null ) + _onIterationStart( this ); + } + + /// + /// called once per update, after the update has occured. + /// + protected virtual void onUpdate() + { + if( !allowEvents ) + return; + + if( _onUpdate != null ) + _onUpdate( this ); + } + + /// + /// called once per iteration at the end of the iteration. + /// + protected virtual void onIterationEnd() + { + if( !allowEvents ) + return; + + if( _onIterationEnd != null ) + _onIterationEnd( this ); + } + + + /// + /// called when the tween completes playing. + /// + protected virtual void onComplete() + { + if( !allowEvents ) + return; + + if( _onComplete != null ) + _onComplete( this ); + } + + + /// + /// tick method. if it returns true it indicates the tween is complete. + /// note: at it's base, AbstractGoTween does not fire events, it is up to the implementer to + /// do so. see GoTween and AbstractGoTweenCollection for examples. + /// + public virtual bool update( float deltaTime ) + { + // increment or decrement the total elapsed time then clamp from 0 to totalDuration + if( isReversed ) + _totalElapsedTime -= deltaTime; + else + _totalElapsedTime += deltaTime; + + _totalElapsedTime = Mathf.Clamp( _totalElapsedTime, 0, totalDuration ); + + _didIterateLastFrame = _didIterateThisFrame || ( !isReversed && _totalElapsedTime == 0 ) || ( isReversed && _totalElapsedTime == totalDuration ); + + // we flip between ceil and floor based on the direction, because we want the iteration change + // to happen when "duration" seconds has elapsed, not immediately, as was the case if you + // were doing a floor and were going in reverse. + if( isReversed ) + _deltaIterations = Mathf.CeilToInt( _totalElapsedTime / duration ) - _completedIterations; + else + _deltaIterations = Mathf.FloorToInt( _totalElapsedTime / duration ) - _completedIterations; + + // we iterated this frame if we have done a goTo() to an iteration point, or we've passed over + // an iteration threshold. + _didIterateThisFrame = !_didIterateLastFrame && ( _deltaIterations != 0f || _totalElapsedTime % duration == 0f ); + + _completedIterations += _deltaIterations; + + // set the elapsedTime, given what we know. + if( _didIterateLastFrame ) + { + _elapsedTime = isReversed ? duration : 0f; + } + else if( _didIterateThisFrame ) + { + // if we iterated this frame, we force the _elapsedTime to the end of the timeline. + _elapsedTime = isReversed ? 0f : duration; + } + else + { + _elapsedTime = _totalElapsedTime % duration; + + // if you do a goTo(x) where x is a multiple of duration, we assume that you want + // to be at the end of your duration, as this sets you up to have an automatic OnIterationStart fire + // the next updated frame. the only caveat is when you do a goTo(0) when playing forwards, + // or a goTo(totalDuration) when playing in reverse. we assume that at that point, you want to be + // at the start of your tween. + if( _elapsedTime == 0f && ( ( isReversed && _totalElapsedTime == totalDuration ) || ( !isReversed && _totalElapsedTime > 0f ) ) ) + { + _elapsedTime = duration; + } + } + + // we can only be looping back on a PingPong if our loopType is PingPong and we are on an odd numbered iteration + _isLoopingBackOnPingPong = false; + if( loopType == GoLoopType.PingPong ) + { + // due to the way that we count iterations, and force a tween to remain at the end + // of it's timeline for one frame after passing the duration threshold, + // we need to make sure that _isLoopingBackOnPingPong references the current + // iteration, and not the next one. + if( isReversed ) + { + _isLoopingBackOnPingPong = _completedIterations % 2 == 0; + + if( _elapsedTime == 0f ) + _isLoopingBackOnPingPong = !_isLoopingBackOnPingPong; + } + else + { + _isLoopingBackOnPingPong = _completedIterations % 2 != 0; + + if( _elapsedTime == duration ) + _isLoopingBackOnPingPong = !_isLoopingBackOnPingPong; + } + } + + // set a flag whether to fire the onIterationEnd event or not. + _fireIterationStart = _didIterateThisFrame || ( !isReversed && _elapsedTime == duration ) || ( isReversed && _elapsedTime == 0f ); + _fireIterationEnd = _didIterateThisFrame; + + // check for completion + if( ( !isReversed && iterations >= 0 && _completedIterations >= iterations ) || ( isReversed && _totalElapsedTime <= 0 ) ) + state = GoTweenState.Complete; + + if( state == GoTweenState.Complete ) + { + // these variables need to be reset here. if a tween were to complete, + // and then get played again: + // * The onIterationStart event would get fired + // * tweens would flip their elapsedTime between 0 and totalDuration + + _fireIterationStart = false; + _didIterateThisFrame = false; + + return true; // true if complete + } + + return false; // false if not complete + } + + + /// + /// subclasses should return true if they are a valid and ready to be added to the list of running tweens + /// or false if not ready. + /// technically, this should be marked as internal + /// + public abstract bool isValid(); + + + /// + /// attempts to remove the tween property returning true if successful + /// technically, this should be marked as internal + /// + public abstract bool removeTweenProperty( AbstractTweenProperty property ); + + + /// + /// returns true if the tween contains the same type (or propertyName) property in its property list + /// technically, this should be marked as internal + /// + public abstract bool containsTweenProperty( AbstractTweenProperty property ); + + + /// + /// returns a list of all the TweenProperties contained in the tween and all its children (if it is + /// a TweenChain or a TweenFlow) + /// technically, this should be marked as internal + /// + public abstract List allTweenProperties(); + + + /// + /// removes the Tween from action and cleans up its state + /// + public virtual void destroy() + { + state = GoTweenState.Destroyed; + } + + + /// + /// pauses playback + /// + public virtual void pause() + { + state = GoTweenState.Paused; + } + + + /// + /// resumes playback + /// + public virtual void play() + { + state = GoTweenState.Running; + } + + + /// + /// plays the tween forward. if it is already playing forward has no effect + /// + public void playForward() + { + if( isReversed ) + reverse(); + + play(); + } + + + /// + /// plays the tween backwards. if it is already playing backwards has no effect + /// + public void playBackwards() + { + if( !isReversed ) + reverse(); + + play(); + } + + + /// + /// resets the tween to the beginning, taking isReversed into account. + /// + protected virtual void reset( bool skipDelay = true ) + { + goTo( isReversed ? totalDuration : 0, skipDelay ); + + _fireIterationStart = true; + } + + + /// + /// rewinds the tween to the beginning (or end, depending on isReversed) and pauses playback. + /// + public virtual void rewind( bool skipDelay = true ) + { + reset( skipDelay ); + pause(); + } + + + /// + /// rewinds the tween to the beginning (or end, depending on isReversed) and starts playback, + /// optionally skipping delay (only relevant for Tweens). + /// + public void restart( bool skipDelay = true ) + { + reset( skipDelay ); + play(); + } + + + /// + /// reverses playback. if going forward it will be going backward after this and vice versa. + /// + public virtual void reverse() + { + isReversed = !isReversed; + + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + // if we are at the "start" of the timeline, based on isReversed, + // allow the onBegin/onIterationStart callbacks to fire again. + if( ( isReversed && _totalElapsedTime == totalDuration ) || ( !isReversed && _totalElapsedTime == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + } + + + /// + /// completes the tween. sets the playhead to it's final position as if the tween completed normally. + /// takes into account if the tween was playing forward or reversed. + /// + public virtual void complete() + { + if( iterations < 0 ) + return; + + // set full elapsed time and let the next iteration finish it off + goTo( isReversed ? 0 : totalDuration, true ); + } + + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it can optionally be force updated to the time specified. delays are not taken into effect. + /// (must be implemented by inherited classes.) + /// + public abstract void goTo( float time, bool skipDelay = true ); + + /// + /// goes to the time and starts playback skipping any delays + /// + public void goToAndPlay( float time, bool skipDelay = true ) + { + goTo( time, skipDelay ); + play(); + } + + + /// + /// waits for either completion or destruction. call in a Coroutine and yield on the return + /// + public IEnumerator waitForCompletion() + { + while( state != GoTweenState.Complete && state != GoTweenState.Destroyed ) + yield return null; + + yield break; + } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta new file mode 100644 index 0000000..e13d51e --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d8eb47665d5434148a4bd7391644861a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs new file mode 100644 index 0000000..39e93a0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs @@ -0,0 +1,500 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// base class for TweenChains and TweenFlows +/// +public class AbstractGoTweenCollection : AbstractGoTween +{ + protected List _tweenFlows = new List(); + + + /// + /// data class that wraps an AbstractTween and its start time for the timeline + /// + protected class TweenFlowItem + { + public float startTime; + public float endTime { get { return startTime + duration; } } + public float duration; + public AbstractGoTween tween; + + + public TweenFlowItem( float startTime, AbstractGoTween tween ) + { + this.tween = tween; + this.startTime = startTime; + this.duration = tween.totalDuration; + } + + + public TweenFlowItem( float startTime, float duration ) + { + this.duration = duration; + this.startTime = startTime; + } + } + + + public AbstractGoTweenCollection( GoTweenCollectionConfig config ) + { + // allow events by default + allowEvents = true; + + // setup callback bools + _didInit = false; + _didBegin = false; + + // flag the onIterationStart event to fire. + // as long as goTo is not called on this tween, the onIterationStart event will fire + _fireIterationStart = true; + + // copy the TweenConfig info over + id = config.id; + loopType = config.loopType; + iterations = config.iterations; + updateType = config.propertyUpdateType; + timeScale = 1; + state = GoTweenState.Paused; + + _onInit = config.onInitHandler; + _onBegin = config.onBeginHandler; + _onIterationStart = config.onIterationStartHandler; + _onUpdate = config.onUpdateHandler; + _onIterationEnd = config.onIterationEndHandler; + _onComplete = config.onCompleteHandler; + + Go.addTween( this ); + } + + + #region AbstractTween overrides + + /// + /// returns a list of all Tweens with the given target in the collection + /// technically, this should be marked as internal + /// + public List tweensWithTarget( object target ) + { + List list = new List(); + + foreach( var flowItem in _tweenFlows ) + { + // skip TweenFlowItems with no target + if( flowItem.tween == null ) + continue; + + // check Tweens first + var tween = flowItem.tween as GoTween; + if( tween != null && tween.target == target ) + list.Add( tween ); + + // check for TweenCollections + if( tween == null ) + { + var tweenCollection = flowItem.tween as AbstractGoTweenCollection; + if( tweenCollection != null ) + { + var tweensInCollection = tweenCollection.tweensWithTarget( target ); + if( tweensInCollection.Count > 0 ) + list.AddRange( tweensInCollection ); + } + } + } + + return list; + } + + + public override bool removeTweenProperty( AbstractTweenProperty property ) + { + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + if( flowItem.tween.removeTweenProperty( property ) ) + return true; + } + + return false; + } + + + public override bool containsTweenProperty( AbstractTweenProperty property ) + { + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + if( flowItem.tween.containsTweenProperty( property ) ) + return true; + } + + return false; + } + + + public override List allTweenProperties() + { + var propList = new List(); + + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + propList.AddRange( flowItem.tween.allTweenProperties() ); + } + + return propList; + } + + + /// + /// we are always considered valid because our constructor adds us to Go and we start paused + /// + public override bool isValid() + { + return true; + } + + /// + /// resumes playback + /// + public override void play() + { + base.play(); + + foreach( var flowItem in _tweenFlows ) + { + if( flowItem.tween != null ) + flowItem.tween.play(); + } + } + + /// + /// pauses playback + /// + public override void pause() + { + base.pause(); + + foreach( var flowItem in _tweenFlows ) + { + if( flowItem.tween != null ) + flowItem.tween.pause(); + } + } + + /// + /// tick method. if it returns true it indicates the tween is complete + /// + public override bool update( float deltaTime ) + { + if ( !_didInit ) + onInit(); + + if ( !_didBegin ) + onBegin(); + + if ( _fireIterationStart ) + onIterationStart(); + + // update the timeline and state. + base.update( deltaTime ); + + // get the proper elapsedTime if we're doing a PingPong + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + // used for iterating over flowItems below. + TweenFlowItem flowItem = null; + + // if we iterated last frame and this flow restarts from the beginning, we now need to reset all + // of the flowItem tweens to either the beginning or the end of their respective timelines + // we also want to do this in the _opposite_ way that we would normally iterate on them + // as the start value of a later flowItem may alter a property of an earlier flowItem. + if ( _didIterateLastFrame && loopType == GoLoopType.RestartFromBeginning ) + { + if ( isReversed || _isLoopingBackOnPingPong ) + { + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + var cacheAllow = flowItem.tween.allowEvents; + flowItem.tween.allowEvents = false; + flowItem.tween.restart(); + flowItem.tween.allowEvents = cacheAllow; + } + } + else + { + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + var cacheAllow = flowItem.tween.allowEvents; + flowItem.tween.allowEvents = false; + flowItem.tween.restart(); + flowItem.tween.allowEvents = cacheAllow; + } + } + } + else + { + if ( ( isReversed && !_isLoopingBackOnPingPong ) || ( !isReversed && _isLoopingBackOnPingPong ) ) + { + // if we are moving the tween in reverse, we should be iterating over the flowItems in reverse + // to help properties behave a bit better. + for ( var i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + // if there's been an iteration this frame and we're not done yet, we want to make sure + // this tween is set to play in the right direction, and isn't set to complete/paused. + if ( _didIterateLastFrame && state != GoTweenState.Complete ) + { + if ( !flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.play(); + } + + if ( flowItem.tween.state == GoTweenState.Running && flowItem.endTime >= convertedElapsedTime ) + { + var convertedDeltaTime = Mathf.Abs( convertedElapsedTime - flowItem.startTime - flowItem.tween.totalElapsedTime ); + flowItem.tween.update( convertedDeltaTime ); + } + } + } + else + { + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + // if there's been an iteration this frame and we're not done yet, we want to make sure + // this tween is set to play in the right direction, and isn't set to complete/paused. + if ( _didIterateLastFrame && state != GoTweenState.Complete ) + { + if ( flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.play(); + } + + if ( flowItem.tween.state == GoTweenState.Running && flowItem.startTime <= convertedElapsedTime ) + { + var convertedDeltaTime = convertedElapsedTime - flowItem.startTime - flowItem.tween.totalElapsedTime; + flowItem.tween.update( convertedDeltaTime ); + } + } + } + } + + onUpdate(); + + if ( _fireIterationEnd ) + onIterationEnd(); + + if ( state == GoTweenState.Complete ) + { + onComplete(); + + return true; // true if complete + } + + return false; // false if not complete + } + + /// + /// reverses playback. if going forward it will be going backward after this and vice versa. + /// + public override void reverse() + { + base.reverse(); + + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + foreach ( var flowItem in _tweenFlows ) + { + if ( flowItem.tween == null ) + continue; + + if ( isReversed != flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.pause(); + + // we selectively mark tweens for play if they will be played immediately or in the future. + // update() will filter out more tweens that should not be played yet. + if ( isReversed || _isLoopingBackOnPingPong ) + { + if ( flowItem.startTime <= convertedElapsedTime ) + flowItem.tween.play(); + } + else + { + if ( flowItem.endTime >= convertedElapsedTime ) + flowItem.tween.play(); + } + } + } + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it will be force updated to the time specified. + /// + public override void goTo( float time, bool skipDelay = true ) + { + time = Mathf.Clamp( time, 0f, totalDuration ); + + // provide an early out for calling goTo on the same time multiple times. + if ( time == _totalElapsedTime ) + return; + + // we don't simply call base.goTo because that would force an update within AbstractGoTweenCollection, + // which forces an update on all the tweenFlowItems without putting them in the right position. + // it's also possible that people will move around a tween via the goTo method, so we want to + // try to make that as efficient as possible. + + // if we are doing a goTo at the "start" of the timeline, based on the isReversed variable, + // allow the onBegin and onIterationStart callback to fire again. + // we only allow the onIterationStart event callback to fire at the start of the timeline, + // as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we + // go to the start. + if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + else + { + _didBegin = true; + _fireIterationStart = false; + } + + // since we're doing a goTo, we want to stop this tween from remembering that it iterated. + // this could cause issues if you caused the tween to complete an iteration and then goTo somewhere + // else while still paused. + _didIterateThisFrame = false; + + // force a time and completedIterations before we update + _totalElapsedTime = time; + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + // we don't want to use the Collection update function, because we don't have all of our + // child tweenFlowItems setup properly. this will properly setup our iterations, + // totalElapsedTime, and other useful information. + base.update( 0 ); + + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + // we always want to process items in the future of this tween from last to first. + // and items that have already occured from first to last. + TweenFlowItem flowItem = null; + if ( isReversed || _isLoopingBackOnPingPong ) + { + // flowItems in the future of the timeline + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.endTime >= convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + + // flowItems in the past & current part of the timeline + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.endTime < convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + } + else + { + // flowItems in the future of the timeline + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.startTime <= convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + + // flowItems in the past & current part of the timeline + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.startTime > convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + } + } + + private void changeTimeForFlowItem( TweenFlowItem flowItem, float time ) + { + if ( flowItem == null || flowItem.tween == null ) + return; + + if ( flowItem.tween.isReversed != ( isReversed || _isLoopingBackOnPingPong ) ) + flowItem.tween.reverse(); + + var convertedTime = Mathf.Clamp( time - flowItem.startTime, 0f, flowItem.endTime ); + + if ( flowItem.startTime <= time && flowItem.endTime >= time ) + { + flowItem.tween.goToAndPlay( convertedTime ); + } + else + { + flowItem.tween.goTo( convertedTime ); + flowItem.tween.pause(); + } + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta new file mode 100644 index 0000000..498d505 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c011ef2561dca4c2492fdbf1b78d96a8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing.meta new file mode 100644 index 0000000..7f25095 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 34b16834b4ced4d9a9b03c6d00303ad5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs new file mode 100644 index 0000000..1b32a97 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs @@ -0,0 +1,25 @@ +public static class GoEaseBack +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * ( ( 1.70158f + 1 ) * t - 1.70158f ) + b; + } + + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * ( ( 1.70158f + 1 ) * t + 1.70158f ) + 1 ) + b; + } + + + public static float EaseInOut( float t, float b, float c, float d ) + { + float s = 1.70158f; + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * ( t * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t - s ) ) + b; + } + return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t + s ) + 2 ) + b; + } +} + diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta new file mode 100644 index 0000000..dda0af8 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e44fd25dcb7704da0a39cfe042b81293 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs new file mode 100644 index 0000000..c74f515 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs @@ -0,0 +1,35 @@ +public static class GoEaseBounce +{ + public static float EaseOut( float t, float b, float c, float d ) + { + if( ( t /= d ) < ( 1 / 2.75 ) ) + { + return c * ( 7.5625f * t * t ) + b; + } + else if( t < ( 2 / 2.75 ) ) + { + return c * ( 7.5625f * ( t -= ( 1.5f / 2.75f ) ) * t + .75f ) + b; + } + else if( t < ( 2.5 / 2.75 ) ) + { + return c * ( 7.5625f * ( t -= ( 2.25f / 2.75f ) ) * t + .9375f ) + b; + } + else + { + return c * ( 7.5625f * ( t -= ( 2.625f / 2.75f ) ) * t + .984375f ) + b; + } + } + + public static float EaseIn( float t, float b, float c, float d ) + { + return c - EaseOut( d - t, 0, c, d ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t < d / 2 ) + return EaseIn( t * 2, 0, c, d ) * 0.5f + b; + else + return EaseOut( t * 2 - d, 0, c, d ) * .5f + c * 0.5f + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta new file mode 100644 index 0000000..330e0a0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95777a3e9f3304c5f87d79f0035e7cce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs new file mode 100644 index 0000000..9c05c92 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs @@ -0,0 +1,24 @@ +using System; + + +public static class GoEaseCircular +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return -c * ( (float)Math.Sqrt( 1 - ( t /= d ) * t ) - 1 ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * (float)Math.Sqrt( 1 - ( t = t / d - 1 ) * t ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return -c / 2 * ( (float)Math.Sqrt( 1 - t * t ) - 1 ) + b; + } + return c / 2 * ( (float)Math.Sqrt( 1 - ( t -= 2 ) * t ) + 1 ) + b; + } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta new file mode 100644 index 0000000..3d9ddf8 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b7f811e7d59a41bf99d08c646d1725b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs new file mode 100644 index 0000000..3c8df0a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs @@ -0,0 +1,21 @@ +public static class GoEaseCubic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * t + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t + b; + } + return c / 2 * ( ( t -= 2 ) * t * t + 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta new file mode 100644 index 0000000..d778eab --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7210f854113854752bdff44a9b562d42 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs new file mode 100644 index 0000000..a252b41 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs @@ -0,0 +1,68 @@ +using System; +using UnityEngine; + + +public class GoEaseElastic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d ) == 1 ) + { + return b + c; + } + float p = d * .3f; + float s = p / 4; + return -(float)( c * Math.Pow( 2, 10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d ) == 1 ) + { + return b + c; + } + float p = d * .3f; + float s = p / 4; + return (float)( c * Math.Pow( 2, -10 * t ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b ); + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d / 2 ) == 2 ) + { + return b + c; + } + float p = d * ( .3f * 1.5f ); + float a = c; + float s = p / 4; + if( t < 1 ) + { + return -.5f * (float)( a * Math.Pow( 2, 10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; + } + return (float)( a * Math.Pow( 2, -10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b ); + } + + public static float Punch( float t, float b, float c, float d ) + { + if( t == 0 ) + return 0; + + if( ( t /= d ) == 1 ) + return 0; + + const float p = 0.3f; + return ( c * Mathf.Pow( 2, -10 * t ) * Mathf.Sin( t * ( 2 * Mathf.PI ) / p ) ); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta new file mode 100644 index 0000000..cf0540c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c183f70ddaf54b6caa706e2d7a15837 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs new file mode 100644 index 0000000..eaeecd2 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs @@ -0,0 +1,32 @@ +using System; + + +public static class GoEaseExponential +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return ( t == 0 ) ? b : c * (float)Math.Pow( 2, 10 * ( t / d - 1 ) ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return ( t == d ) ? b + c : c * (float)( -Math.Pow( 2, -10 * t / d ) + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( t == d ) + { + return b + c; + } + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * (float)Math.Pow( 2, 10 * ( t - 1 ) ) + b; + } + return c / 2 * (float)( -Math.Pow( 2, -10 * --t ) + 2 ) + b; + } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta new file mode 100644 index 0000000..d62fa06 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9db2ed7f90d404641b604f6db1368fcc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs new file mode 100644 index 0000000..a61643d --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs @@ -0,0 +1,10 @@ +using UnityEngine; + + +public static class GoEaseLinear +{ + public static float EaseNone( float t, float b, float c, float d ) + { + return c * t / d + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta new file mode 100644 index 0000000..9d1c67c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2f840d866998449683cf9b8a34c0b8f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs new file mode 100644 index 0000000..f15e825 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuadratic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return -c * ( t /= d ) * ( t - 2 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t + b; + } + return -c / 2 * ( ( --t ) * ( t - 2 ) - 1 ) + b; + } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta new file mode 100644 index 0000000..816a532 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94e247c3236114f678e9ffffa07bfe09 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs new file mode 100644 index 0000000..a9631b6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuartic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return -c * ( ( t = t / d - 1 ) * t * t * t - 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t * t + b; + } + return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta new file mode 100644 index 0000000..293cc52 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 178a095287feb40b3b2fb42327529cf3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs new file mode 100644 index 0000000..8275a6c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuintic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t * t * t + b; + } + return c / 2 * ( ( t -= 2 ) * t * t * t * t + 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta new file mode 100644 index 0000000..dd6b826 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ec4a9f5d98bf04114b5a015db1308a60 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs new file mode 100644 index 0000000..0d93276 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs @@ -0,0 +1,21 @@ +using System; +using UnityEngine; + + +public static class GoEaseSinusoidal +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return -c * (float)Math.Cos( t / d * ( Math.PI / 2 ) ) + c + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * (float)Math.Sin( t / d * ( Math.PI / 2 ) ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + return -c / 2 * ( (float)Math.Cos( Math.PI * t / d ) - 1 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta new file mode 100644 index 0000000..65ae0e5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fa97311d39f04b93b833ca28fac10ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt new file mode 100644 index 0000000..4b171ff --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt @@ -0,0 +1,33 @@ +/* +Microsoft Public License (Ms-PL) + +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. + +1. Definitions + +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. + +A "contribution" is the original software, or any additions or changes to the software. + +A "contributor" is any person that distributes its contribution under this license. + +"Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights + +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations + +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. + +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. +*/ \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta new file mode 100644 index 0000000..cf14134 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 098d0b0599d2b4fcc8c8f24379e8bf90 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums.meta new file mode 100644 index 0000000..fcfe59c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3fdf9641baedb40338ca9a110aa99706 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs new file mode 100644 index 0000000..2a23635 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + + + +/// +/// defines what should be done in the event that a TweenProperty is being added to Go when an existing TweenProperty +/// of the same type with the same target object is already present +/// +public enum GoDuplicatePropertyRuleType +{ + None, // dont bother checking or doing anything + RemoveRunningProperty, // removes the property from the Tween that was already running + DontAddCurrentProperty // leaves the original property intact and doesnt add the current property +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta new file mode 100644 index 0000000..ad0ddca --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7107639cda4a541a79a05bd60caf35c8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs new file mode 100644 index 0000000..85ece37 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs @@ -0,0 +1,50 @@ +using UnityEngine; +using System.Collections; + + + +public enum GoEaseType +{ + Linear, + + SineIn, + SineOut, + SineInOut, + + QuadIn, + QuadOut, + QuadInOut, + + CubicIn, + CubicOut, + CubicInOut, + + QuartIn, + QuartOut, + QuartInOut, + + QuintIn, + QuintOut, + QuintInOut, + + ExpoIn, + ExpoOut, + ExpoInOut, + + CircIn, + CircOut, + CircInOut, + + ElasticIn, + ElasticOut, + ElasticInOut, + Punch, + + BackIn, + BackOut, + BackInOut, + + BounceIn, + BounceOut, + BounceInOut +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta new file mode 100644 index 0000000..7af1d29 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e53d7306407a34ceaa133d772fa1ec3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs new file mode 100644 index 0000000..f85f14f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoLogLevel +{ + None, + Info, + Warn, + Error +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta new file mode 100644 index 0000000..12dac08 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95f2b1a5decae452784d0c332801c1d1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs new file mode 100644 index 0000000..d6ac54a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using System.Collections; + + +/// +/// used by paths to identify what the object being tweened should look at +/// +public enum GoLookAtType +{ + None, + NextPathNode, + TargetTransform +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta new file mode 100644 index 0000000..8f47701 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08691283d482e4054b037fc5d4030e48 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs new file mode 100644 index 0000000..ceaddd9 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using System.Collections; + + + +public enum GoLoopType +{ + RestartFromBeginning, + PingPong +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta new file mode 100644 index 0000000..4919875 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8820e9c24b06041b8ab4157ec84b5f86 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs new file mode 100644 index 0000000..b9abc80 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +[System.Flags] +public enum GoShakeType +{ + Position = ( 1 << 0 ), + Scale = ( 1 << 1 ), + Eulers = ( 1 << 2 ) +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta new file mode 100644 index 0000000..ae54040 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83c69d81ac63f4b789dd05ab1f326517 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs new file mode 100644 index 0000000..89651d2 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoSplineType +{ + StraightLine, // 2 points + QuadraticBezier, // 3 points + CubicBezier, // 4 points + CatmullRom // 5+ points +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta new file mode 100644 index 0000000..ba9152f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3b24cf23dec3f4db7869ebfde6112be9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs new file mode 100644 index 0000000..3accbb7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoTweenState +{ + Running, + Paused, + Complete, + Destroyed +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta new file mode 100644 index 0000000..d863321 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de15fdc9763ed4873b7021c616d7952d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs new file mode 100644 index 0000000..ffb1100 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoUpdateType +{ + Update, + LateUpdate, + FixedUpdate, + TimeScaleIndependentUpdate +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta new file mode 100644 index 0000000..b0b6fc0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 634c22f604be24212ae1f75ddec523f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/extensions.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions.meta new file mode 100644 index 0000000..86f5f2c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cb14c988d1865428599a6a5bc46a79e5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs new file mode 100644 index 0000000..b384fd7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs @@ -0,0 +1,124 @@ +using UnityEngine; +using System.Collections; + + +public static class GoKitTweenExtensions +{ + #region Transform extensions + + // to tweens + public static GoTween rotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) ); + } + + + public static GoTween localRotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) ); + } + + + public static GoTween eulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) ); + } + + + public static GoTween localEulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) ); + } + + + public static GoTween positionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().position( endValue, isRelative ) ); + } + + + public static GoTween localPositionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) ); + } + + + public static GoTween scaleTo( this Transform self, float duration, float endValue, bool isRelative = false ) + { + return self.scaleTo( duration, new Vector3( endValue, endValue, endValue ), isRelative ); + } + + + public static GoTween scaleTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().scale( endValue, isRelative ) ); + } + + + public static GoTween shake( this Transform self, float duration, Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false ) + { + return Go.to( self, duration, new GoTweenConfig().shake( shakeMagnitude, shakeType, frameMod, useLocalProperties ) ); + } + + + // from tweens + public static GoTween rotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) ); + } + + + public static GoTween localRotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) ); + } + + + public static GoTween eulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) ); + } + + + public static GoTween localEulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) ); + } + + + public static GoTween positionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().position( endValue, isRelative ) ); + } + + + public static GoTween localPositionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) ); + } + + + public static GoTween scaleFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().scale( endValue, isRelative ) ); + } + + #endregion + + + #region Material extensions + + public static GoTween colorTo( this Material self, float duration, Color endValue, string colorName = "_Color" ) + { + return Go.to( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) ); + } + + + public static GoTween colorFrom( this Material self, float duration, Color endValue, string colorName = "_Color" ) + { + return Go.from( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) ); + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta new file mode 100644 index 0000000..047f239 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21ffa6d37448541bead4c009180436bd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties.meta new file mode 100644 index 0000000..9fcc64e --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4204282772fc1408da934f8775d6da4f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs new file mode 100644 index 0000000..47d6e98 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs @@ -0,0 +1,236 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Reflection; + + +public static class GoTweenUtils +{ + /// + /// fetches the actual function for the given ease type + /// + public static Func easeFunctionForType( GoEaseType easeType ) + { + switch( easeType ) + { + case GoEaseType.Linear: + return GoEaseLinear.EaseNone; + + case GoEaseType.BackIn: + return GoEaseBack.EaseIn; + case GoEaseType.BackOut: + return GoEaseBack.EaseOut; + case GoEaseType.BackInOut: + return GoEaseBack.EaseInOut; + + case GoEaseType.BounceIn: + return GoEaseBounce.EaseIn; + case GoEaseType.BounceOut: + return GoEaseBounce.EaseOut; + case GoEaseType.BounceInOut: + return GoEaseBounce.EaseInOut; + + case GoEaseType.CircIn: + return GoEaseCircular.EaseIn; + case GoEaseType.CircOut: + return GoEaseCircular.EaseOut; + case GoEaseType.CircInOut: + return GoEaseCircular.EaseInOut; + + case GoEaseType.CubicIn: + return GoEaseCubic.EaseIn; + case GoEaseType.CubicOut: + return GoEaseCubic.EaseOut; + case GoEaseType.CubicInOut: + return GoEaseCubic.EaseInOut; + + case GoEaseType.ElasticIn: + return GoEaseElastic.EaseIn; + case GoEaseType.ElasticOut: + return GoEaseElastic.EaseOut; + case GoEaseType.ElasticInOut: + return GoEaseElastic.EaseInOut; + case GoEaseType.Punch: + return GoEaseElastic.Punch; + + case GoEaseType.ExpoIn: + return GoEaseExponential.EaseIn; + case GoEaseType.ExpoOut: + return GoEaseExponential.EaseOut; + case GoEaseType.ExpoInOut: + return GoEaseExponential.EaseInOut; + + case GoEaseType.QuadIn: + return GoEaseQuadratic.EaseIn; + case GoEaseType.QuadOut: + return GoEaseQuadratic.EaseOut; + case GoEaseType.QuadInOut: + return GoEaseQuadratic.EaseInOut; + + case GoEaseType.QuartIn: + return GoEaseQuartic.EaseIn; + case GoEaseType.QuartOut: + return GoEaseQuartic.EaseOut; + case GoEaseType.QuartInOut: + return GoEaseQuartic.EaseInOut; + + case GoEaseType.QuintIn: + return GoEaseQuintic.EaseIn; + case GoEaseType.QuintOut: + return GoEaseQuintic.EaseOut; + case GoEaseType.QuintInOut: + return GoEaseQuintic.EaseInOut; + + case GoEaseType.SineIn: + return GoEaseSinusoidal.EaseIn; + case GoEaseType.SineOut: + return GoEaseSinusoidal.EaseOut; + case GoEaseType.SineInOut: + return GoEaseSinusoidal.EaseInOut; + } + + return GoEaseLinear.EaseNone; + } + + + /// + /// either returns a super fast Delegate to set the given property or null if it couldn't be found + /// via reflection + /// + public static T setterForProperty( System.Object targetObject, string propertyName ) + { + // first get the property +#if NETFX_CORE + var propInfo = targetObject.GetType().GetRuntimeProperty( propertyName ); +#else + var propInfo = targetObject.GetType().GetProperty( propertyName ); +#endif + + if( propInfo == null ) + { + Debug.Log( "could not find property with name: " + propertyName ); + return default( T ); + } + +#if NETFX_CORE + // Windows Phone/Store new API + return (T)(object)propInfo.SetMethod.CreateDelegate( typeof( T ), targetObject ); +#else + return (T)(object)Delegate.CreateDelegate( typeof( T ), targetObject, propInfo.GetSetMethod() ); +#endif + } + + + /// + /// either returns a super fast Delegate to get the given property or null if it couldn't be found + /// via reflection + /// + public static T getterForProperty( System.Object targetObject, string propertyName ) + { + // first get the property +#if NETFX_CORE + var propInfo = targetObject.GetType().GetRuntimeProperty( propertyName ); +#else + var propInfo = targetObject.GetType().GetProperty( propertyName ); +#endif + + if( propInfo == null ) + { + Debug.Log( "could not find property with name: " + propertyName ); + return default( T ); + } + +#if NETFX_CORE + // Windows Phone/Store new API + return (T)(object)propInfo.GetMethod.CreateDelegate( typeof( T ), targetObject ); +#else + return (T)(object)Delegate.CreateDelegate( typeof( T ), targetObject, propInfo.GetGetMethod() ); +#endif + } + + + #region math functions + + /// + /// note for all lerps: normally a lerp would be something like the following: + /// val1 + ( val2 - val1 ) * t + /// or in more familiar terms: + /// start + ( end - start ) * t + /// + /// when lerping relatively, the formula simplifies to: + /// start + end * t + /// + /// for all the unclamped lerps in this class the diff value is precalculated and cached. that means these arent like normal + /// lerps where you pass in the start and end values. the "diff" paramter in each method should be either the cached + /// ( end - start ) for non-relative tweens or just end for relative tweens (that are not "from" tweens) + /// + + + /// + /// unclamped lerp from c1 to c2. diff should be c2 - c1 (or just c2 for relative lerps) + /// + public static Color unclampedColorLerp( Color c1, Color diff, float value ) + { + return new Color + ( + c1.r + diff.r * value, + c1.g + diff.g * value, + c1.b + diff.b * value, + c1.a + diff.a * value + ); + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector2 unclampedVector2Lerp( Vector2 v1, Vector2 diff, float value ) + { + return new Vector2 + ( + v1.x + diff.x * value, + v1.y + diff.y * value + ); + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector3 unclampedVector3Lerp( Vector3 v1, Vector3 diff, float value ) + { + return new Vector3 + ( + v1.x + diff.x * value, + v1.y + diff.y * value, + v1.z + diff.z * value + ); + + /* + return new Vector3 + ( + v1.x + ( v2.x - v1.x ) * value, + v1.y + ( v2.y - v1.y ) * value, + v1.z + ( v2.z - v1.z ) * value + ); + */ + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector4 unclampedVector4Lerp( Vector4 v1, Vector4 diff, float value ) + { + return new Vector4 + ( + v1.x + diff.x * value, + v1.y + diff.y * value, + v1.z + diff.z * value, + v1.w + diff.w * value + ); + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta new file mode 100644 index 0000000..ed58ca4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a79611b258ffd496990f232247eefc3a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts.meta new file mode 100644 index 0000000..18ec7f9 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b015a50b4ac6b4515bd5116d6da7ff5d +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs new file mode 100644 index 0000000..73f5b14 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for any color tweens (MaterialColor and ColorTween) +/// +public abstract class AbstractColorTweenProperty : AbstractTweenProperty +{ + protected Material _target; + + protected Color _originalEndValue; + protected Color _startValue; + protected Color _endValue; + protected Color _diffValue; + + + public AbstractColorTweenProperty( Color endValue, bool isRelative ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return ( target is Material || target is GameObject || target is Transform || target is Renderer ); + } + + + public override void init( GoTween owner ) + { + // setup our target before initting + if( owner.target is Material ) + _target = (Material)owner.target; + else if( owner.target is GameObject ) + _target = ((GameObject)owner.target).renderer.material; + else if( owner.target is Transform ) + _target = ((Transform)owner.target).renderer.material; + else if( owner.target is Renderer ) + _target = ((Renderer)owner.target).material; + + base.init( owner ); + } + + + public override void prepareForUse() + { + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta new file mode 100644 index 0000000..be55103 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06d1e7d9b36ea4b9fb70c40298d959ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs new file mode 100644 index 0000000..0b5639a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for generic Quaternion props +/// +public abstract class AbstractQuaternionTweenProperty : AbstractTweenProperty +{ + protected Transform _target; + + protected Quaternion _originalEndValue; + protected Quaternion _startValue; + protected Quaternion _endValue; + + public AbstractQuaternionTweenProperty() + {} + + + public AbstractQuaternionTweenProperty( Quaternion endValue, bool isRelative = false ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + if (_isRelative && !_ownerTween.isFrom) + _endValue = _startValue * _endValue; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta new file mode 100644 index 0000000..970a921 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91d9cba1487704697be079449afdefbb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs new file mode 100644 index 0000000..ce1f3fe --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs @@ -0,0 +1,112 @@ +using UnityEngine; +using System; +using System.Collections; + + +public abstract class AbstractTweenProperty +{ + protected bool _isInitialized; + public bool isInitialized { get { return _isInitialized; } } + + protected bool _isRelative; + protected GoTween _ownerTween; + + protected Func _easeFunction; + + + + public AbstractTweenProperty( bool isRelative = false ) + { + _isRelative = isRelative; + } + + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + /// + /// checks to see if a TweenProperty matches another. checks propertyNames of IGenericPropertys first then + /// resorts to direct type checking + /// + public override bool Equals( object obj ) + { + // null check first + if( obj == null ) + return false; + + // handle IGenericProperty comparisons which just have the property name checked + if( this is IGenericProperty && obj is IGenericProperty ) + return ((IGenericProperty)this).propertyName == ((IGenericProperty)obj).propertyName; + + // check for the same types + if( obj.GetType() == this.GetType() ) + return true; + + return base.Equals( obj ); + } + + + /// + /// called by a Tween just after this property is validated and added to the Tweens property list + /// + public virtual void init( GoTween owner ) + { + _isInitialized = true; + _ownerTween = owner; + + // if we dont have an easeFunction use the owners type + if( _easeFunction == null ) + setEaseType( owner.easeType ); + } + + + /// + /// clones the instance + /// + public AbstractTweenProperty clone() + { + var clone = MemberwiseClone() as AbstractTweenProperty; + clone._ownerTween = null; + clone._isInitialized = false; + clone._easeFunction = null; + + return clone; + } + + + /// + /// sets the ease type for this tween property + /// technically, this should be an internal method + /// + public void setEaseType( GoEaseType easeType ) + { + _easeFunction = GoTweenUtils.easeFunctionForType( easeType ); + } + + + /// + /// each TweenProperty should override this to ensure the object is the correct type + /// + public virtual bool validateTarget( object target ) + { + return true; + } + + + /// + /// subclasses should get the eased time then set the new value on the object + /// + public abstract void tick( float totalElapsedTime ); + + + /// + /// called when a Tween is initially started. + /// subclasses should strongly type the start/end/target and handle isFrom with + /// regard to setting the proper start/end values + /// + public abstract void prepareForUse(); + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta new file mode 100644 index 0000000..961823f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf8a9f19ff8c84f3d9b75558baec7117 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs new file mode 100644 index 0000000..9910255 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs @@ -0,0 +1,49 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for position, scale, eulers and the generic Vector3 props +/// +public abstract class AbstractVector3TweenProperty : AbstractTweenProperty +{ + protected Transform _target; + + protected Vector3 _originalEndValue; + protected Vector3 _startValue; + protected Vector3 _endValue; + protected Vector3 _diffValue; + + + public AbstractVector3TweenProperty() + {} + + + public AbstractVector3TweenProperty( Vector3 endValue, bool isRelative = false ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public void resetWithNewEndValue( Vector3 endValue ) + { + _originalEndValue = endValue; + prepareForUse(); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta new file mode 100644 index 0000000..8c7cf0a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f73ba6304fca4593ac3756c9c01864e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes.meta new file mode 100644 index 0000000..c475535 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 568b4e56e499a47b6b1edebd41563940 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs new file mode 100644 index 0000000..2190267 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class ColorTweenProperty : AbstractColorTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + + public ColorTweenProperty( string propertyName, Color endValue, bool isRelative = false ) : base( endValue, isRelative ) + { + this.propertyName = propertyName; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var newColor = GoTweenUtils.unclampedColorLerp( _startValue, _diffValue, easedTime ); + + _setter( newColor ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta new file mode 100644 index 0000000..54df139 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8feba848df2ec4a0cb2b5c4b11d09fde +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs new file mode 100644 index 0000000..aff23cd --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs @@ -0,0 +1,66 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class FloatTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected float _originalEndValue; + protected float _startValue; + protected float _endValue; + protected float _diffValue; + + + public FloatTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // setup the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedValue = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + _setter( easedValue ); + } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta new file mode 100644 index 0000000..60e05fe --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69fddc80fa08840df95aeb0cc5631b3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs new file mode 100644 index 0000000..5877656 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using System.Collections; + + +/// +/// interface that simply defines that a generic property tween must have a propertyName. this has the side effect +/// of letting us easily compare generic property tweens vs stongly typed tweens +/// +public interface IGenericProperty +{ + string propertyName { get; } +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta new file mode 100644 index 0000000..80ed0c2 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21e55e5f9ed3e437ba9c943917440083 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs new file mode 100644 index 0000000..d5086d4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs @@ -0,0 +1,68 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class IntTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + + private Action _setter; + + protected int _originalEndValue; + protected int _startValue; + protected int _endValue; + protected int _diffValue; + + + public IntTweenProperty( string propertyName, int endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedValue = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + _setter( (int)Math.Round( easedValue ) ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta new file mode 100644 index 0000000..3792d14 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 26ecf98b31f464c3eab865287ed4f9b2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs new file mode 100644 index 0000000..083449e --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector2TweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected Vector2 _originalEndValue; + protected Vector2 _startValue; + protected Vector2 _endValue; + protected Vector2 _diffValue; + + + public Vector2TweenProperty( string propertyName, Vector2 endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector2Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta new file mode 100644 index 0000000..69e15cc --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22a05f02b0d2d4c579d00c2db33555b1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs new file mode 100644 index 0000000..78d039b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3PathTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + + private Action _setter; + private GoSpline _path; + private Vector3 _startValue; + + + public Vector3PathTweenProperty( string propertyName, GoSpline path, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _path = path; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // if this is a from tween first reverse the path then build it. we unreverse in case we were copied + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + { + _startValue = _path.getLastNode(); + } + else + { + // retrieve the getter only when needed + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + _startValue = getter(); + } + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta new file mode 100644 index 0000000..1a4153b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bf2fb33fe8d04ad2a177ab6038c1965 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs new file mode 100644 index 0000000..bd79c8b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3TweenProperty : AbstractVector3TweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + + public Vector3TweenProperty( string propertyName, Vector3 endValue, bool isRelative = false ) : base( endValue, isRelative ) + { + this.propertyName = propertyName; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta new file mode 100644 index 0000000..709bdae --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ccd327e369c14fac909ab0b6d1d0da5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs new file mode 100644 index 0000000..477bef6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs @@ -0,0 +1,71 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3XTweenProperty : AbstractVector3TweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + protected Action _setter; + protected Func _getter; + + protected new float _originalEndValue; + protected new float _startValue; + protected new float _endValue; + protected new float _diffValue; + + + public Vector3XTweenProperty( string propertyName, float endValue, bool isRelative = false ) + { + this.propertyName = propertyName; + _isRelative = isRelative; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().x; + } + else + { + _startValue = _getter().x; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.x = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta new file mode 100644 index 0000000..6b2acb5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e4e4541e602d4fbcba6aa19d256cf94 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs new file mode 100644 index 0000000..3096140 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3YTweenProperty : Vector3XTweenProperty +{ + public Vector3YTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( propertyName, endValue, isRelative ) + {} + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().y; + } + else + { + _startValue = _getter().y; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.y = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta new file mode 100644 index 0000000..e4d798f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 576b35d4282a84f26b445f338480bd4d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs new file mode 100644 index 0000000..50eff0c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3ZTweenProperty : Vector3XTweenProperty +{ + public Vector3ZTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( propertyName, endValue, isRelative ) + {} + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().z; + } + else + { + _startValue = _getter().z; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.z = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta new file mode 100644 index 0000000..334ca96 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31797a4f425d143babbdfd3ab73f8189 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs new file mode 100644 index 0000000..bac5b0d --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector4TweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected Vector4 _originalEndValue; + protected Vector4 _startValue; + protected Vector4 _endValue; + protected Vector4 _diffValue; + + + public Vector4TweenProperty( string propertyName, Vector4 endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _endValue = _startValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector4Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta new file mode 100644 index 0000000..546b274 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cb950a7d0cdd24204ac8d2be1336b0ea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing.meta new file mode 100644 index 0000000..b0abd80 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8c076f7b25e9c4c27b52cc7847d14056 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs new file mode 100644 index 0000000..18617ac --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs @@ -0,0 +1,123 @@ +using UnityEngine; +using System.Collections; + + +/// +/// based on the idea by Mike Talbot here http://whydoidoit.com/2012/04/01/smoothed-vector3-quaternions-and-floats-in-unity/ +/// +/// lerps or slerps a Quaternion over time. usage is like so: +/// +/// mySmoothedQuat = target.rotation; // creates the GoSmoothedQuaternion +/// mySmoothedQuat.smoothValue = someNewQuaternion; // update the smoothValue whenever you would normally set the value on your object +/// target.rotation = mySmoothedQuat.smoothValue; // use the smoothValue property in an Update method to lerp/slerp it +/// +/// +public struct GoSmoothedQuaternion +{ + public GoSmoothingType smoothingType; + public float duration; + + private Quaternion _currentValue; + private Quaternion _target; + private Quaternion _start; + private float _startTime; + + + public GoSmoothedQuaternion( Quaternion quat ) + { + _currentValue = quat; + _start = quat; + _target = quat; + _startTime = Time.time; + + // set sensible defaults + duration = 0.2f; + smoothingType = GoSmoothingType.Lerp; + } + + + public Quaternion smoothValue + { + get + { + // how far along are we? + var t = ( Time.time - _startTime ) / duration; + + switch( smoothingType ) + { + case GoSmoothingType.Lerp: + _currentValue = Quaternion.Lerp( _start, _target, t ); + break; + case GoSmoothingType.Slerp: + _currentValue = Quaternion.Slerp( _start, _target, t ); + break; + } + + return _currentValue; + } + set + { + _start = smoothValue; + _startTime = Time.time; + _target = value; + } + } + + + public float x + { + get + { + return _currentValue.x; + } + set + { + smoothValue = new Quaternion( value, _target.y, _target.z, _target.w ); + } + } + + public float y + { + get + { + return _currentValue.y; + } + set + { + smoothValue = new Quaternion( _target.x, value, _target.y, _target.w ); + } + } + + public float z + { + get + { + return _currentValue.z; + } + set + { + smoothValue = new Quaternion( _target.x, _target.y, value, _target.w ); + } + + } + + public float w + { + get + { + return _currentValue.w; + } + set + { + + smoothValue = new Quaternion( _target.x, _target.y, _target.z, value ); + } + } + + + public static implicit operator GoSmoothedQuaternion( Quaternion q ) + { + return new GoSmoothedQuaternion( q ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta new file mode 100644 index 0000000..3df77a4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 806c433a2491044ec8c3f50375392041 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs new file mode 100644 index 0000000..32bfc79 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs @@ -0,0 +1,101 @@ +using UnityEngine; +using System.Collections; + + + +public struct GoSmoothedVector3 +{ + public GoSmoothingType smoothingType; + public float duration; + + private Vector3 _currentValue; + private Vector3 _target; + private Vector3 _start; + private float _startTime; + + + public GoSmoothedVector3( Vector3 vector ) + { + _currentValue = vector; + _start = vector; + _target = vector; + _startTime = Time.time; + + // set sensible defaults + duration = 0.2f; + smoothingType = GoSmoothingType.Lerp; + } + + + public Vector3 smoothValue + { + get + { + // how far along are we? + var t = ( Time.time - _startTime ) / duration; + + switch( smoothingType ) + { + case GoSmoothingType.Lerp: + _currentValue = Vector3.Lerp( _start, _target, t ); + break; + case GoSmoothingType.Slerp: + _currentValue = Vector3.Slerp( _start, _target, t ); + break; + } + + return _currentValue; + } + private set + { + _start = smoothValue; + _startTime = Time.time; + _target = value; + } + } + + + public float x + { + get + { + return _currentValue.x; + } + set + { + smoothValue = new Vector3( value, _target.y, _target.z ); + } + } + + public float y + { + get + { + return _currentValue.y; + } + set + { + smoothValue = new Vector3( _target.x, value, _target.y ); + } + } + + public float z + { + get + { + return _currentValue.z; + } + set + { + smoothValue = new Vector3( _target.x, _target.y, value ); + } + + } + + + public static implicit operator GoSmoothedVector3( Vector3 v ) + { + return new GoSmoothedVector3( v ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta new file mode 100644 index 0000000..fd93a4a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b796c056272a04cfea12f664f35c98e5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs new file mode 100644 index 0000000..6e7a779 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs @@ -0,0 +1,9 @@ +using UnityEngine; +using System.Collections; + + +public enum GoSmoothingType +{ + Lerp, + Slerp +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta new file mode 100644 index 0000000..5ef58f7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b85c904ec09ed418abbdc697bdd916fc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes.meta new file mode 100644 index 0000000..f011a2a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5ad9b033696fb463ea98ab0fb95a3deb +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs new file mode 100644 index 0000000..966f7d8 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using System.Collections; + + +public class EulerAnglesTweenProperty : AbstractVector3TweenProperty +{ + private bool _useLocalEulers; + public bool useLocalEulers { get { return _useLocalEulers; } } + + public EulerAnglesTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalEulers = false ) : base( endValue, isRelative ) + { + _useLocalEulers = useLocalEulers; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalEulers == ((EulerAnglesTweenProperty)obj)._useLocalEulers; + + // if we get here, we need to see if the other object is a rotation tween of the same kind + var otherAsRotation = obj as RotationTweenProperty; + if( otherAsRotation != null ) + return this._useLocalEulers == otherAsRotation.useLocalRotation; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // swap the start and end if this is a from tween + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalEulers ) + _endValue = _target.localEulerAngles; + else + _endValue = _target.eulerAngles; + } + else + { + if( _useLocalEulers ) + _startValue = _target.localEulerAngles; + else + _startValue = _target.eulerAngles; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalEulers ) + _target.localEulerAngles = vec; + else + _target.eulerAngles = vec; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta new file mode 100644 index 0000000..96240d6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5bbfcb772b13641e1afec2d91d2940f7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs new file mode 100644 index 0000000..d9f3427 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs @@ -0,0 +1,63 @@ +using UnityEngine; +using System.Collections; + + +public class MaterialColorTweenProperty : AbstractColorTweenProperty +{ + private string _materialColorName; + + + public MaterialColorTweenProperty( Color endValue, string colorName = "_Color", bool isRelative = false ) : base( endValue, isRelative ) + { + _materialColorName = colorName; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare our material names + if( base.Equals( obj ) ) + return this._materialColorName == ((MaterialColorTweenProperty)obj)._materialColorName; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _target.GetColor( _materialColorName ); + } + else + { + _startValue = _target.GetColor( _materialColorName ); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var color = GoTweenUtils.unclampedColorLerp( _startValue, _diffValue, easedTime ); + + _target.SetColor( _materialColorName, color ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta new file mode 100644 index 0000000..fd33d2a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74b57762d8d034ccc9b9f37bb8c70019 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs new file mode 100644 index 0000000..fd4f425 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs @@ -0,0 +1,131 @@ +using UnityEngine; +using System.Collections; + + +/// +/// tweens position along a path at constant speed between nodes. isRelative makes the path movement +/// relative to the start position of the object. a "from" tween will reverse the path and make the start +/// position be the last node in the path. +/// +public class PositionPathTweenProperty : AbstractTweenProperty +{ + protected bool _useLocalPosition; + public bool useLocalPosition { get { return _useLocalPosition; } } + + protected Transform _target; + protected Vector3 _startValue; + + private GoSpline _path; + private GoLookAtType _lookAtType = GoLookAtType.None; + private Transform _lookTarget; + private GoSmoothedQuaternion _smoothedRotation; + + + public PositionPathTweenProperty( GoSpline path, bool isRelative = false, bool useLocalPosition = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null ) : base( isRelative ) + { + _path = path; + _useLocalPosition = useLocalPosition; + _lookAtType = lookAtType; + _lookTarget = lookTarget; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalPosition == ((PositionPathTweenProperty)obj)._useLocalPosition; + + // if we get here, we need to see if the other object is a position tween of the same kind + var otherAsPosition = obj as PositionTweenProperty; + if( otherAsPosition != null ) + return this._useLocalPosition == otherAsPosition.useLocalPosition; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + // if this is a from tween first reverse the path then build it + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + { + _startValue = _path.getLastNode(); + } + else + { + if( _useLocalPosition ) + _startValue = _target.localPosition; + else + _startValue = _target.position; + } + + // validate the lookTarget if we are set to look at it + if( _lookAtType == GoLookAtType.TargetTransform ) + { + if( _lookTarget == null ) + _lookAtType = GoLookAtType.None; + } + + // prep our smoothed rotation + _smoothedRotation = _target.rotation; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + + // handle look types + switch( _lookAtType ) + { + case GoLookAtType.NextPathNode: + { + _smoothedRotation.smoothValue = vec.Equals( _target.position ) ? Quaternion.identity : Quaternion.LookRotation( vec - _target.position ); + _target.rotation = _smoothedRotation.smoothValue; + //var lookAtNode = ( _ownerTween.isReversed || _ownerTween.isLoopoingBackOnPingPong ) ? _path.getPreviousNode() : _path.getNextNode(); + //_target.LookAt( lookAtNode, Vector3.up ); + break; + } + case GoLookAtType.TargetTransform: + { + _target.LookAt( _lookTarget, Vector3.up ); + break; + } + } + + + // assign the position + if( _useLocalPosition ) + _target.localPosition = vec; + else + _target.position = vec; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta new file mode 100644 index 0000000..a23bbef --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c9f58caa7cd847519c748a7132b4e9c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs new file mode 100644 index 0000000..ae458f1 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs @@ -0,0 +1,92 @@ +using UnityEngine; +using System.Collections; + + +public class PositionTweenProperty : AbstractVector3TweenProperty +{ + protected bool _useLocalPosition; + public bool useLocalPosition { get { return _useLocalPosition; } } + + public PositionTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalPosition = false ) : base( endValue, isRelative ) + { + _useLocalPosition = useLocalPosition; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalPosition == ((PositionTweenProperty)obj)._useLocalPosition; + + // if we get here, we need to see if the other object is a position path tween of the same kind + var otherAsPositionPath = obj as PositionPathTweenProperty; + if( otherAsPositionPath != null ) + return this._useLocalPosition == otherAsPositionPath.useLocalPosition; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + if( _useLocalPosition ) + { + if (_isRelative) + _startValue = _target.localPosition + _endValue; + else + _startValue = _endValue; + + _endValue = _target.localPosition; + } + else + { + if (_isRelative) + _startValue = _target.position + _endValue; + else + _startValue = _endValue; + + _endValue = _target.position; + } + } + else + { + if( _useLocalPosition ) + _startValue = _target.localPosition; + else + _startValue = _target.position; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalPosition ) + _target.localPosition = vec; + else + _target.position = vec; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta new file mode 100644 index 0000000..73cb0b2 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f372333393a1a4501a09d64bc262d2e4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs new file mode 100644 index 0000000..606d3cb --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs @@ -0,0 +1,76 @@ +using UnityEngine; +using System.Collections; + + +public class RotationQuaternionTweenProperty : AbstractQuaternionTweenProperty +{ + private bool _useLocalRotation; + public bool useLocalRotation { get { return _useLocalRotation; } } + + + public RotationQuaternionTweenProperty( Quaternion endValue, bool isRelative = false, bool useLocalRotation = false ) : base( endValue, isRelative ) + { + _useLocalRotation = useLocalRotation; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalRotation == ((RotationQuaternionTweenProperty)obj)._useLocalRotation; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalRotation ) + _endValue = _target.localRotation; + else + _endValue = _target.rotation; + } + else + { + if( _useLocalRotation ) + _startValue = _target.localRotation; + else + _startValue = _target.rotation; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + Quaternion newOrientation = Quaternion.Slerp (_startValue, _endValue, easedTime); + + if( _useLocalRotation ) + _target.localRotation = newOrientation; + else + _target.rotation = newOrientation; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta new file mode 100644 index 0000000..1a306eb --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5a476a934239a4681b4241f6cce8aa62 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs new file mode 100644 index 0000000..b858a0b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs @@ -0,0 +1,85 @@ +using UnityEngine; +using System.Collections; + + +public class RotationTweenProperty : AbstractVector3TweenProperty +{ + private bool _useLocalRotation; + public bool useLocalRotation { get { return _useLocalRotation; } } + + + public RotationTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalRotation = false ) : base( endValue, isRelative ) + { + _useLocalRotation = useLocalRotation; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalRotation == ((RotationTweenProperty)obj)._useLocalRotation; + + // if we get here, we need to see if the other object is a eulerAngles tween of the same kind + var otherAsEuler = obj as EulerAnglesTweenProperty; + if( otherAsEuler != null ) + return this._useLocalRotation == otherAsEuler.useLocalEulers; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalRotation ) + _endValue = _target.localRotation.eulerAngles; + else + _endValue = _target.rotation.eulerAngles; + } + else + { + if( _useLocalRotation ) + _startValue = _target.localRotation.eulerAngles; + else + _startValue = _target.rotation.eulerAngles; + } + + // handle rotation carefully: when not relative, we always want to go the shortest possible distance to the new angle + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _startValue + _endValue; + else + _diffValue = new Vector3( Mathf.DeltaAngle( _startValue.x, _endValue.x ), Mathf.DeltaAngle( _startValue.y, _endValue.y ), Mathf.DeltaAngle( _startValue.z, _endValue.z ) ); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalRotation ) + _target.localRotation = Quaternion.Euler( vec ); + else + _target.rotation = Quaternion.Euler( vec ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta new file mode 100644 index 0000000..2402d96 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e783a8e5c400d4037be1e46fe3c33ee0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs new file mode 100644 index 0000000..dbc3a58 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs @@ -0,0 +1,77 @@ +using UnityEngine; +using System.Collections; + + +/// +/// tweens scale along a path at constant speed between nodes. isRelative makes the path scale +/// relative to the start scale of the object. a "from" tween will reverse the path and make the start +/// scale be the last node in the path. +/// +public class ScalePathTweenProperty : AbstractTweenProperty +{ + protected Transform _target; + protected Vector3 _startValue; + + private GoSpline _path; + + + public ScalePathTweenProperty( GoSpline path, bool isRelative = false ) : base( isRelative ) + { + _path = path; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // if base already determined that we are equal no need to check further + if( base.Equals( obj ) ) + return true; + + // we can be equal if the other object is a ScaleTweenProperty + return obj.GetType() == typeof( ScaleTweenProperty ); + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + // if this is a from tween first reverse the path then build it + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + _startValue = _path.getLastNode(); + else + _startValue = _target.localScale; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + _target.localScale = vec; + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta new file mode 100644 index 0000000..abdd126 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed2a9c26628f648cd812a55c3cc09572 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs new file mode 100644 index 0000000..ee6fe66 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System.Collections; + + +public class ScaleTweenProperty : AbstractVector3TweenProperty +{ + public ScaleTweenProperty( Vector3 endValue, bool isRelative = false ) : base( endValue, isRelative ) + {} + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // if base already determined that we are equal no need to check further + if( base.Equals( obj ) ) + return true; + + // we can be equal if the other object is a ScalePathTweenProperty + return obj.GetType() == typeof( ScalePathTweenProperty ); + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _target.localScale; + } + else + { + _startValue = _target.localScale; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + _target.localScale = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta new file mode 100644 index 0000000..2e7d42f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af4196a114d624232b278034ec06ce24 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs new file mode 100644 index 0000000..ed25968 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs @@ -0,0 +1,135 @@ +using UnityEngine; +using System.Collections; + + +public class ShakeTweenProperty : AbstractTweenProperty +{ + private Transform _target; + private Vector3 _shakeMagnitude; + + private Vector3 _originalEndValue; + private Vector3 _startPosition; + private Vector3 _startScale; + private Vector3 _startEulers; + + private GoShakeType _shakeType; + private int _frameCount; + private int _frameMod; + private bool _useLocalProperties; + public bool useLocalProperties { get { return _useLocalProperties; } } + + + /// + /// you can shake any combination of position, scale and eulers by passing in a bitmask of the types you want to shake. frameMod + /// allows you to specify what frame count the shakes should occur on. for example, a frameMod of 3 would mean that only when + /// frameCount % 3 == 0 will the shake occur + /// + public ShakeTweenProperty( Vector3 shakeMagnitude, GoShakeType shakeType, int frameMod = 1, bool useLocalProperties = false ) : base( true ) + { + _shakeMagnitude = shakeMagnitude; + _shakeType = shakeType; + _frameMod = frameMod; + _useLocalProperties = useLocalProperties; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare our material names + if( base.Equals( obj ) ) + return this._shakeType == ((ShakeTweenProperty)obj)._shakeType; + + return false; + } + + #endregion + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + _frameCount = 0; + + // store off any properties we will be shaking + if( ( _shakeType & GoShakeType.Position ) != 0 ) + { + if( _useLocalProperties ) + _startPosition = _target.localPosition; + else + _startPosition = _target.position; + } + + if( ( _shakeType & GoShakeType.Eulers ) != 0 ) + { + if( _useLocalProperties ) + _startEulers = _target.eulerAngles; + else + _startEulers = _target.eulerAngles; + } + + if( ( _shakeType & GoShakeType.Scale ) != 0 ) + _startScale = _target.localScale; + } + + + private Vector3 randomDiminishingTarget( float falloffValue ) + { + return new Vector3 + ( + Random.Range( -_shakeMagnitude.x, _shakeMagnitude.x ) * falloffValue, + Random.Range( -_shakeMagnitude.y, _shakeMagnitude.y ) * falloffValue, + Random.Range( -_shakeMagnitude.z, _shakeMagnitude.z ) * falloffValue + ); + } + + + public override void tick( float totalElapsedTime ) + { + // should we skip any frames? + if( _frameMod > 1 && ++_frameCount % _frameMod != 0 ) + return; + + // we want 1 minus the eased time so that we go from 1 - 0 for a shake + var easedTime = 1 - _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + + + // shake any properties required + if( ( _shakeType & GoShakeType.Position ) != 0 ) + { + var val = _startPosition + randomDiminishingTarget( easedTime ); + if( _useLocalProperties ) + _target.localPosition = val; + else + _target.position = val; + } + + if( ( _shakeType & GoShakeType.Eulers ) != 0 ) + { + var val = _startEulers + randomDiminishingTarget( easedTime ); + if( _useLocalProperties ) + _target.localEulerAngles = val; + else + _target.eulerAngles = val; + } + + if( ( _shakeType & GoShakeType.Scale ) != 0 ) + { + _target.localScale = _startScale + randomDiminishingTarget( easedTime ); + } + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta new file mode 100644 index 0000000..fb16eaa --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cf366ef096364042b041e422af86bbc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines.meta new file mode 100644 index 0000000..b0a20f8 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 82ff7a332193a46a0aed718a4d6af4ba +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs new file mode 100644 index 0000000..055e0eb --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs @@ -0,0 +1,105 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public abstract class AbstractGoSplineSolver +{ + protected List _nodes; + public List nodes { get { return _nodes; } } + protected float _pathLength; + + // how many subdivisions should we divide each segment into? higher values take longer to build and lookup but + // result in closer to actual constant velocity + protected int totalSubdivisionsPerNodeForLookupTable = 5; + protected Dictionary _segmentTimeForDistance; // holds data in the form [time:distance] as a lookup table + + + + // the default implementation breaks the spline down into segments and approximates distance by adding up + // the length of each segment + public virtual void buildPath() + { + var totalSudivisions = _nodes.Count * totalSubdivisionsPerNodeForLookupTable; + _pathLength = 0; + float timePerSlice = 1f / totalSudivisions; + + // we dont care about the first node for distances because they are always t:0 and len:0 + _segmentTimeForDistance = new Dictionary( totalSudivisions ); + + + var lastPoint = getPoint( 0 ); + + // skip the first node and wrap 1 extra node + for( var i = 1; i < totalSudivisions + 1; i++ ) + { + // what is the current time along the path? + float currentTime = timePerSlice * i; + + var currentPoint = getPoint( currentTime ); + _pathLength += Vector3.Distance( currentPoint, lastPoint ); + lastPoint = currentPoint; + + _segmentTimeForDistance.Add( currentTime, _pathLength ); + } + } + + + public abstract void closePath(); + + + // gets the raw point not taking into account constant speed. used for drawing gizmos + public abstract Vector3 getPoint( float t ); + + + // gets the point taking in to account constant speed. the default implementation approximates the length of the spline + // by walking it and calculating the distance between each node + public virtual Vector3 getPointOnPath( float t ) + { + // we know exactly how far along the path we want to be from the passed in t + var targetDistance = _pathLength * t; + + // store the previous and next nodes in our lookup table + var previousNodeTime = 0f; + var previousNodeLength = 0f; + var nextNodeTime = 0f; + var nextNodeLength = 0f; + + // loop through all the values in our lookup table and find the two nodes our targetDistance falls between + foreach( var item in _segmentTimeForDistance ) + { + // have we passed our targetDistance yet? + if( item.Value >= targetDistance ) + { + nextNodeTime = item.Key; + nextNodeLength = item.Value; + + if( previousNodeTime > 0 ) + previousNodeLength = _segmentTimeForDistance[previousNodeTime]; + + break; + } + previousNodeTime = item.Key; + } + + // translate the values from the lookup table estimating the arc length between our known nodes from the lookup table + var segmentTime = nextNodeTime - previousNodeTime; + var segmentLength = nextNodeLength - previousNodeLength; + var distanceIntoSegment = targetDistance - previousNodeLength; + + t = previousNodeTime + ( distanceIntoSegment / segmentLength ) * segmentTime; + + return getPoint( t ); + } + + + public void reverseNodes() + { + _nodes.Reverse(); + } + + + public virtual void drawGizmos() + {} + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta new file mode 100644 index 0000000..a3d749f --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f87ecb9f470844d2abef8dbbd08a0102 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs new file mode 100644 index 0000000..b165a2a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs @@ -0,0 +1,240 @@ +// spline equation courtesy Andeeee's CRSpline (http://forum.unity3d.com/threads/32954-Waypoints-and-constant-variable-speed-problems?p=213942&viewfull=1#post213942) + +using UnityEngine; +using System.IO; +using System.Collections; +using System.Collections.Generic; + + +public class GoSpline +{ + public int currentSegment { get; private set; } + public bool isClosed { get; private set; } + public GoSplineType splineType { get; private set; } + + // used by the visual path editor + public List nodes { get { return _solver.nodes; } } + + private bool _isReversed; // internal flag that lets us know if our nodes are reversed or not + private AbstractGoSplineSolver _solver; + + + // default constructor + public GoSpline( List nodes, bool useStraightLines = false ) + { + // determine spline type and solver based on number of nodes + if( useStraightLines || nodes.Count == 2 ) + { + splineType = GoSplineType.StraightLine; + _solver = new GoSplineStraightLineSolver( nodes ); + } + else if( nodes.Count == 3 ) + { + splineType = GoSplineType.QuadraticBezier; + _solver = new GoSplineQuadraticBezierSolver( nodes ); + } + else if( nodes.Count == 4 ) + { + splineType = GoSplineType.CubicBezier; + _solver = new GoSplineCubicBezierSolver( nodes ); + } + else + { + splineType = GoSplineType.CatmullRom; + _solver = new GoSplineCatmullRomSolver( nodes ); + } + } + + + public GoSpline( Vector3[] nodes, bool useStraightLines = false ) : this( new List( nodes ), useStraightLines ) + {} + + + public GoSpline( string pathAssetName, bool useStraightLines = false ) : this( nodeListFromAsset( pathAssetName ), useStraightLines ) + {} + + + /// + /// helper to get a node list from an asset created with the visual editor + /// + private static List nodeListFromAsset( string pathAssetName ) + { + if( Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer ) + { + Debug.LogError( "The Web Player does not support loading files from disk." ); + return null; + } + + + var path = string.Empty; + if( !pathAssetName.EndsWith( ".asset" ) ) + pathAssetName += ".asset"; + + + if( Application.platform == RuntimePlatform.Android ) + { + path = Path.Combine( "jar:file://" + Application.dataPath + "!/assets/", pathAssetName ); + + WWW loadAsset = new WWW( path ); + while( !loadAsset.isDone ) { } // maybe make a safety check here + + return bytesToVector3List( loadAsset.bytes ); + } + else if( Application.platform == RuntimePlatform.IPhonePlayer ) + { + // at runtime on iOS, we load from the dataPath + path = Path.Combine( Path.Combine( Application.dataPath, "Raw" ), pathAssetName ); + } + else + { + // in the editor we default to looking in the StreamingAssets folder + path = Path.Combine( Path.Combine( Application.dataPath, "StreamingAssets" ), pathAssetName ); + } + +#if UNITY_WEBPLAYER || NETFX_CORE + // it isnt possible to get here but the compiler needs it to be here anyway + return null; +#else + var bytes = File.ReadAllBytes( path ); + return bytesToVector3List( bytes ); +#endif + } + + + /// + /// helper to get a node list from an asset created with the visual editor + /// + public static List bytesToVector3List( byte[] bytes ) + { + var vecs = new List(); + for( var i = 0; i < bytes.Length; i += 12 ) + { + var newVec = new Vector3( System.BitConverter.ToSingle( bytes, i ), System.BitConverter.ToSingle( bytes, i + 4 ), System.BitConverter.ToSingle( bytes, i + 8 ) ); + vecs.Add( newVec ); + } + + return vecs; + } + + + /// + /// gets the last node. used to setup relative tweens + /// + public Vector3 getLastNode() + { + return _solver.nodes[_solver.nodes.Count]; + } + + + /// + /// responsible for calculating total length, segmentStartLocations and segmentDistances + /// + public void buildPath() + { + _solver.buildPath(); + } + + + /// + /// directly gets the point for the current spline type with no lookup table to adjust for constant speed + /// + private Vector3 getPoint( float t ) + { + return _solver.getPoint( t ); + } + + + /// + /// returns the point that corresponds to the given t where t >= 0 and t <= 1 making sure that the + /// path is traversed at a constant speed. + /// + public Vector3 getPointOnPath( float t ) + { + // if the path is closed, we will allow t to wrap. if is not we need to clamp t + if( t < 0 || t > 1 ) + { + if( isClosed ) + { + if( t < 0 ) + t += 1; + else + t -= 1; + } + else + { + t = Mathf.Clamp01( t ); + } + } + + return _solver.getPointOnPath( t ); + } + + + /// + /// closes the path adding a new node at the end that is equal to the start node if it isn't already equal + /// + public void closePath() + { + // dont let this get closed twice! + if( isClosed ) + return; + + isClosed = true; + _solver.closePath(); + } + + + /// + /// reverses the order of the nodes + /// + public void reverseNodes() + { + if( !_isReversed ) + { + _solver.reverseNodes(); + _isReversed = true; + } + } + + + /// + /// unreverses the order of the nodes if they were reversed + /// + public void unreverseNodes() + { + if( _isReversed ) + { + _solver.reverseNodes(); + _isReversed = false; + } + } + + + public void drawGizmos( float resolution ) + { + _solver.drawGizmos(); + + var previousPoint = _solver.getPoint( 0 ); + + resolution *= _solver.nodes.Count; + for( var i = 1; i <= resolution; i++ ) + { + var t = (float)i / resolution; + var currentPoint = _solver.getPoint( t ); + Gizmos.DrawLine( currentPoint, previousPoint ); + previousPoint = currentPoint; + } + } + + + /// + /// helper for drawing gizmos in the editor + /// + public static void drawGizmos( Vector3[] path, float resolution = 50 ) + { + // horribly inefficient but it only runs in the editor + var spline = new GoSpline( path ); + spline.drawGizmos( resolution ); + } + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta new file mode 100644 index 0000000..c1e5956 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4ed66155442f6467bae99f410e969cc3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs new file mode 100644 index 0000000..d846b06 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs @@ -0,0 +1,87 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class GoSplineCatmullRomSolver : AbstractGoSplineSolver +{ + public GoSplineCatmullRomSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + // closing a Catmull-Rom spline: http://cl.ly/GOZv + public override void closePath() + { + // first, remove the control points + _nodes.RemoveAt( 0 ); + _nodes.RemoveAt( _nodes.Count - 1 ); + + // if the first and last node are not the same add one + if( _nodes[0] != _nodes[_nodes.Count - 1] ) + _nodes.Add( _nodes[0] ); + + + // figure out the distances from node 0 to the first node and the second to last node (remember above + // we made the last node equal to the first so node 0 and _nodes.Count - 1 are identical) + var distanceToFirstNode = Vector3.Distance( _nodes[0], _nodes[1] ); + var distanceToLastNode = Vector3.Distance( _nodes[0], _nodes[_nodes.Count - 2] ); + + + // handle the first node. we want to use the distance to the LAST (opposite segment) node to figure out where this control point should be + var distanceToFirstTarget = distanceToLastNode / Vector3.Distance( _nodes[1], _nodes[0] ); + var lastControlNode = ( _nodes[0] + ( _nodes[1] - _nodes[0] ) * distanceToFirstTarget ); + + + // handle the last node. for this one, we want the distance to the first node for the control point but it should + // be along the vector to the last node + var distanceToLastTarget = distanceToFirstNode / Vector3.Distance( _nodes[_nodes.Count - 2], _nodes[0] ); + var firstControlNode = ( _nodes[0] + ( _nodes[_nodes.Count - 2] - _nodes[0] ) * distanceToLastTarget ); + + _nodes.Insert( 0, firstControlNode ); + _nodes.Add( lastControlNode ); + } + + + public override Vector3 getPoint( float t ) + { + int numSections = _nodes.Count - 3; + int currentNode = Mathf.Min( Mathf.FloorToInt( t * (float)numSections ), numSections - 1 ); + float u = t * (float)numSections - (float)currentNode; + + Vector3 a = _nodes[currentNode]; + Vector3 b = _nodes[currentNode + 1]; + Vector3 c = _nodes[currentNode + 2]; + Vector3 d = _nodes[currentNode + 3]; + + return .5f * + ( + ( -a + 3f * b - 3f * c + d ) * ( u * u * u ) + + ( 2f * a - 5f * b + 4f * c - d ) * ( u * u ) + + ( -a + c ) * u + + 2f * b + ); + } + + + public override void drawGizmos() + { + if( _nodes.Count < 2 ) + return; + + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = new Color( 1, 1, 1, 0.3f ); + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[_nodes.Count - 1], _nodes[_nodes.Count - 2] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta new file mode 100644 index 0000000..729a658 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d4e3d83fc59fd47d3a469ac52b3955ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs new file mode 100644 index 0000000..c36505c --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// nodes should be in the order start, end, control1, control2 +/// +public class GoSplineCubicBezierSolver : AbstractGoSplineSolver +{ + public GoSplineCubicBezierSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + public override void closePath() + { + + } + + + public override Vector3 getPoint( float t ) + { + float d = 1f - t; + return d * d * d * _nodes[0] + 3f * d * d * t * _nodes[1] + 3f * d * t * t * _nodes[2] + t * t * t * _nodes[3]; + } + + + public override void drawGizmos() + { + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = Color.red; + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[2], _nodes[3] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta new file mode 100644 index 0000000..5638344 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0465a564e2fcd462eb4b5b4bdfd1532c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs new file mode 100644 index 0000000..152ab7b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// nodes should be in the order start, control, end +/// +public class GoSplineQuadraticBezierSolver : AbstractGoSplineSolver +{ + public GoSplineQuadraticBezierSolver( List nodes ) + { + _nodes = nodes; + } + + + // http://www.gamedev.net/topic/551455-length-of-a-generalized-quadratic-bezier-curve-in-3d/ + protected float quadBezierLength( Vector3 startPoint, Vector3 controlPoint, Vector3 endPoint ) + { + // ASSERT: all inputs are distinct points. + var A = new Vector3[2]; + A[0] = controlPoint - startPoint; + A[1] = startPoint - 2f * controlPoint + endPoint; + + float length; + + if( A[1] != Vector3.zero ) + { + // Coefficients of f(t) = c*t^2 + b*t + a. + float c = 4.0f * Vector3.Dot( A[1], A[1] ); // A[1].Dot(A[1]); // c > 0 to be in this block of code + float b = 8.0f * Vector3.Dot( A[0], A[1] ); // A[0].Dot(A[1]); + float a = 4.0f * Vector3.Dot( A[0], A[0] ); // A[0].Dot(A[0]); // a > 0 by assumption + float q = 4.0f * a * c - b * b; // = 16*|Cross(A0,A1)| >= 0 + + float twoCpB = 2.0f * c + b; + float sumCBA = c + b + a; + float mult0 = 0.25f / c; + float mult1 = q / ( 8.0f * Mathf.Pow( c, 1.5f ) ); + length = mult0 * ( twoCpB * Mathf.Sqrt( sumCBA ) - b * Mathf.Sqrt( a ) ) + + mult1 * ( Mathf.Log( 2.0f * Mathf.Sqrt( c * sumCBA ) + twoCpB ) - Mathf.Log( 2.0f * Mathf.Sqrt( c * a ) + b ) ); + } + else + { + length = 2.0f * A[0].magnitude; + } + + return length; + } + + + #region AbstractGoSplineSolver + + public override void closePath() + { + + } + + + public override Vector3 getPoint( float t ) + { + float d = 1f - t; + return d * d * _nodes[0] + 2f * d * t * _nodes[1] + t * t * _nodes[2]; + } + + + public override void drawGizmos() + { + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = Color.red; + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[1], _nodes[2] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta new file mode 100644 index 0000000..1cc45a0 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 474c1029fc1d848998185b77129ed5c0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs new file mode 100644 index 0000000..3729ad6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs @@ -0,0 +1,100 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class GoSplineStraightLineSolver : AbstractGoSplineSolver +{ + private Dictionary _segmentStartLocations; + private Dictionary _segmentDistances; + private int _currentSegment; + + + public GoSplineStraightLineSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + public override void buildPath() + { + // we need at least 3 nodes (more than 1 segment) to bother with building + if( _nodes.Count < 3 ) + return; + + // we dont care about the first node for distances because they are always t:0 and len:0 and we dont need the first or last for locations + _segmentStartLocations = new Dictionary( _nodes.Count - 2 ); + _segmentDistances = new Dictionary( _nodes.Count - 1 ); + + for( var i = 0; i < _nodes.Count - 1; i++ ) + { + // calculate the distance to the next node + var distance = Vector3.Distance( _nodes[i], _nodes[i + 1] ); + _segmentDistances.Add( i, distance ); + _pathLength += distance; + } + + + // now that we have the total length we can loop back through and calculate the segmentStartLocations + var accruedRouteLength = 0f; + for( var i = 0; i < _segmentDistances.Count - 1; i++ ) + { + accruedRouteLength += _segmentDistances[i]; + _segmentStartLocations.Add( i + 1, accruedRouteLength / _pathLength ); + } + } + + + public override void closePath() + { + // add a node to close the route if necessary + if( _nodes[0] != _nodes[_nodes.Count - 1] ) + _nodes.Add( _nodes[0] ); + } + + + public override Vector3 getPoint( float t ) + { + return getPointOnPath( t ); + } + + + public override Vector3 getPointOnPath( float t ) + { + // we need at least 3 nodes (more than 1 segment) to bother using the look up tables. else we just lerp directly from + // node 1 to node 2 + if( _nodes.Count < 3 ) + return Vector3.Lerp( _nodes[0], _nodes[1], t ); + + + // which segment are we on? + _currentSegment = 0; + foreach( var info in _segmentStartLocations ) + { + if( info.Value < t ) + { + _currentSegment = info.Key; + continue; + } + + break; + } + + // now we need to know the total distance travelled in all previous segments so we can subtract it from the total + // travelled to get exactly how far along the current segment we are + var totalDistanceTravelled = t * _pathLength; + var i = _currentSegment - 1; // we want all the previous segment lengths + while( i >= 0 ) + { + totalDistanceTravelled -= _segmentDistances[i]; + --i; + } + + return Vector3.Lerp( _nodes[_currentSegment], _nodes[_currentSegment + 1], totalDistanceTravelled / _segmentDistances[_currentSegment] ); + } + + #endregion + +} diff --git a/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta new file mode 100644 index 0000000..81185e5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 86af7ded131634ccfa3962417a095e05 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/Pixelplacement.meta b/UnityTests.Unity4/Assets/Plugins/Pixelplacement.meta new file mode 100644 index 0000000..75cdbd6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/Pixelplacement.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8a34e0eeedd2b4bb7a52529c26d5fd03 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween.meta b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween.meta new file mode 100644 index 0000000..dd0e45b --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 62c61d3ebfdbc4210b98849503e254dc +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs new file mode 100644 index 0000000..c8c95b7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs @@ -0,0 +1,7503 @@ +// Copyright (c) 2011 Bob Berkebile (pixelplacment) +// Please direct any bugs/comments/suggestions to http://pixelplacement.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* +TERMS OF USE - EASING EQUATIONS +Open source under the BSD License. +Copyright (c)2001 Robert Penner +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#region Namespaces +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +#endregion + +/// +/// Version: 2.0.46 +/// Author: Bob Berkebile (http://pixelplacement.com) +/// Support: http://itween.pixelplacement.com +/// +public class iTween : MonoBehaviour{ + + #region Variables + + //repository of all living iTweens: + public static List tweens = new List(); + + //camera fade object: + private static GameObject cameraFade; + + //status members (made public for visual troubleshooting in the inspector): + public string id, type, method; + public iTween.EaseType easeType; + public float time, delay; + public LoopType loopType; + public bool isRunning,isPaused; + /* GFX47 MOD START */ + public string _name; + /* GFX47 MOD END */ + + //private members: + private float runningTime, percentage; + private float delayStarted; //probably not neccesary that this be protected but it shuts Unity's compiler up about this being "never used" + private bool kinematic, isLocal, loop, reverse, wasPaused, physics; + private Hashtable tweenArguments; + private Space space; + private delegate float EasingFunction(float start, float end, float Value); + private delegate void ApplyTween(); + private EasingFunction ease; + private ApplyTween apply; + private AudioSource audioSource; + private Vector3[] vector3s; + private Vector2[] vector2s; + private Color[,] colors; + private float[] floats; + private Rect[] rects; + private CRSpline path; + private Vector3 preUpdate; + private Vector3 postUpdate; + private NamedValueColor namedcolorvalue; + + private float lastRealTime; // Added by PressPlay + private bool useRealTime; // Added by PressPlay + + private Transform thisTransform; + + + /// + /// The type of easing to use based on Robert Penner's open source easing equations (http://www.robertpenner.com/easing_terms_of_use.html). + /// + public enum EaseType{ + easeInQuad, + easeOutQuad, + easeInOutQuad, + easeInCubic, + easeOutCubic, + easeInOutCubic, + easeInQuart, + easeOutQuart, + easeInOutQuart, + easeInQuint, + easeOutQuint, + easeInOutQuint, + easeInSine, + easeOutSine, + easeInOutSine, + easeInExpo, + easeOutExpo, + easeInOutExpo, + easeInCirc, + easeOutCirc, + easeInOutCirc, + linear, + spring, + /* GFX47 MOD START */ + //bounce, + easeInBounce, + easeOutBounce, + easeInOutBounce, + /* GFX47 MOD END */ + easeInBack, + easeOutBack, + easeInOutBack, + /* GFX47 MOD START */ + //elastic, + easeInElastic, + easeOutElastic, + easeInOutElastic, + /* GFX47 MOD END */ + punch + } + + /// + /// The type of loop (if any) to use. + /// + public enum LoopType{ + /// + /// Do not loop. + /// + none, + /// + /// Rewind and replay. + /// + loop, + /// + /// Ping pong the animation back and forth. + /// + pingPong + } + + /// + /// Many shaders use more than one color. Use can have iTween's Color methods operate on them by name. + /// + public enum NamedValueColor{ + /// + /// The main color of a material. Used by default and not required for Color methods to work in iTween. + /// + _Color, + /// + /// The specular color of a material (used in specular/glossy/vertexlit shaders). + /// + _SpecColor, + /// + /// The emissive color of a material (used in vertexlit shaders). + /// + _Emission, + /// + /// The reflection color of the material (used in reflective shaders). + /// + _ReflectColor + } + + #endregion + + #region Defaults + + /// + /// A collection of baseline presets that iTween needs and utilizes if certain parameters are not provided. + /// + public static class Defaults{ + //general defaults: + public static float time = 1f; + public static float delay = 0f; + public static NamedValueColor namedColorValue = NamedValueColor._Color; + public static LoopType loopType = LoopType.none; + public static EaseType easeType = iTween.EaseType.easeOutExpo; + public static float lookSpeed = 3f; + public static bool isLocal = false; + public static Space space = Space.Self; + public static bool orientToPath = false; + public static Color color = Color.white; + //update defaults: + public static float updateTimePercentage = .05f; + public static float updateTime = 1f*updateTimePercentage; + //cameraFade defaults: + public static int cameraFadeDepth = 999999; + //path look ahead amount: + public static float lookAhead = .05f; + public static bool useRealTime = false; // Added by PressPlay + //look direction: + public static Vector3 up = Vector3.up; + } + + #endregion + + #region #1 Static Registers + + /// + /// Sets up a GameObject to avoid hiccups when an initial iTween is added. It's advisable to run this on every object you intend to run iTween on in its Start or Awake. + /// + /// + /// A to be the target to be initialized for iTween. + /// + public static void Init(GameObject target){ + MoveBy(target,Vector3.zero,0); + } + + /// + /// Instantly changes the amount(transparency) of a camera fade and then returns it back over time with MINIMUM customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void CameraFadeFrom(float amount, float time){ + if(cameraFade){ + CameraFadeFrom(Hash("amount",amount,"time",time)); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Instantly changes the amount(transparency) of a camera fade and then returns it back over time with FULL customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void CameraFadeFrom(Hashtable args){ + //establish iTween: + if(cameraFade){ + ColorFrom(cameraFade,args); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Changes the amount(transparency) of a camera fade over time with MINIMUM customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void CameraFadeTo(float amount, float time){ + if(cameraFade){ + CameraFadeTo(Hash("amount",amount,"time",time)); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Changes the amount(transparency) of a camera fade over time with FULL customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void CameraFadeTo(Hashtable args){ + /* + CameraFadeAdd(Defaults.cameraFadeDepth); + + //rescale cameraFade just in case screen size has changed to ensure it takes up the full screen: + cameraFade.guiTexture.pixelInset=new Rect(0,0,Screen.width,Screen.height); + */ + + if(cameraFade){ + //establish iTween: + ColorTo(cameraFade,args); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Returns a value to an 'oncallback' method interpolated between the supplied 'from' and 'to' values for application as desired. Requires an 'onupdate' callback that accepts the same type as the supplied 'from' and 'to' properties. + /// + /// + /// A or or or or or for the starting value. + /// + /// + /// A or or or or or for the ending value. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed (only works with Vector2, Vector3, and Floats) + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ValueTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to")) { + Debug.LogError("iTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!"); + return; + }else{ + //establish iTween: + args["type"]="value"; + + if (args["from"].GetType() == typeof(Vector2)) { + args["method"]="vector2"; + }else if (args["from"].GetType() == typeof(Vector3)) { + args["method"]="vector3"; + }else if (args["from"].GetType() == typeof(Rect)) { + args["method"]="rect"; + }else if (args["from"].GetType() == typeof(Single)) { + args["method"]="float"; + }else if (args["from"].GetType() == typeof(Color)) { + args["method"]="color"; + }else{ + Debug.LogError("iTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!"); + return; + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + Launch(target,args); + } + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeFrom(GameObject target, float alpha, float time){ + FadeFrom(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeFrom(GameObject target, Hashtable args){ + ColorFrom(target,args); + } + + /// + /// Changes a GameObject's alpha value over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeTo(GameObject target, float alpha, float time){ + FadeTo(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeTo(GameObject target, Hashtable args){ + ColorTo(target,args); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorFrom(GameObject target, Color color, float time){ + ColorFrom(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorFrom(GameObject target, Hashtable args){ + Color fromColor = new Color(); + Color tempColor = new Color(); + + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorFrom(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //set tempColor and base fromColor: + if(target.GetComponent()){ + tempColor=fromColor=target.guiTexture.color; + }else if(target.GetComponent()){ + tempColor=fromColor=target.guiText.material.color; + }else if(target.renderer){ + tempColor=fromColor=target.renderer.material.color; + }else if(target.light){ + tempColor=fromColor=target.light.color; + } + + //set augmented fromColor: + if(args.Contains("color")){ + fromColor=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + fromColor.r=(float)args["r"]; + } + if (args.Contains("g")) { + fromColor.g=(float)args["g"]; + } + if (args.Contains("b")) { + fromColor.b=(float)args["b"]; + } + if (args.Contains("a")) { + fromColor.a=(float)args["a"]; + } + } + + //alpha or amount? + if(args.Contains("amount")){ + fromColor.a=(float)args["amount"]; + args.Remove("amount"); + }else if(args.Contains("alpha")){ + fromColor.a=(float)args["alpha"]; + args.Remove("alpha"); + } + + //apply fromColor: + if(target.GetComponent()){ + target.guiTexture.color=fromColor; + }else if(target.GetComponent()){ + target.guiText.material.color=fromColor; + }else if(target.renderer){ + target.renderer.material.color=fromColor; + }else if(target.light){ + target.light.color=fromColor; + } + + //set new color arg: + args["color"]=tempColor; + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's color values over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, they will become the target of the animation. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorTo(GameObject target, Color color, float time){ + ColorTo(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values over time with FULL customization options. If a GUIText or GUITexture component is attached, they will become the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorTo(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioFrom(GameObject target, float volume, float pitch, float time){ + AudioFrom(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioFrom(GameObject target, Hashtable args){ + Vector2 tempAudioProperties; + Vector2 fromAudioProperties; + AudioSource tempAudioSource; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempAudioSource: + if(args.Contains("audiosource")){ + tempAudioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + tempAudioSource=target.audio; + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioFrom requires an AudioSource."); + return; + } + } + + //set tempAudioProperties: + tempAudioProperties.x=fromAudioProperties.x=tempAudioSource.volume; + tempAudioProperties.y=fromAudioProperties.y=tempAudioSource.pitch; + + //set augmented fromAudioProperties: + if(args.Contains("volume")){ + fromAudioProperties.x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + fromAudioProperties.y=(float)args["pitch"]; + } + + //apply fromAudioProperties: + tempAudioSource.volume=fromAudioProperties.x; + tempAudioSource.pitch=fromAudioProperties.y; + + //set new volume and pitch args: + args["volume"]=tempAudioProperties.x; + args["pitch"]=tempAudioProperties.y; + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Fades volume and pitch of an AudioSource with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioTo(GameObject target, float volume, float pitch, float time){ + AudioTo(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Fades volume and pitch of an AudioSource with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with MINIMUM customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be utilized. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for the time in seconds the action will wait before beginning. + /// + public static void Stab(GameObject target, AudioClip audioclip, float delay){ + Stab(target,Hash("audioclip",audioclip,"delay",delay)); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with FULL customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for which AudioSource to use + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the action will wait before beginning. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void Stab(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="stab"; + Launch(target,args); + } + + /// + /// Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookFrom(GameObject target, Vector3 looktarget, float time){ + LookFrom(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Instantly rotates a GameObject to look at a supplied Transform or Vector3 then returns it to it's starting rotation over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 tempRestriction; + + //clean args: + args = iTween.CleanArgs(args); + + //set look: + tempRotation=target.transform.eulerAngles; + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + + //axis restriction: + if(args.Contains("axis")){ + tempRestriction=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + tempRestriction.y=tempRotation.y; + tempRestriction.z=tempRotation.z; + break; + case "y": + tempRestriction.x=tempRotation.x; + tempRestriction.z=tempRotation.z; + break; + case "z": + tempRestriction.x=tempRotation.x; + tempRestriction.y=tempRotation.y; + break; + } + target.transform.eulerAngles=tempRestriction; + } + + //set new rotation: + args["rotation"] = tempRotation; + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to look at the supplied Vector3 over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookTo(GameObject target, Vector3 looktarget, float time){ + LookTo(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Rotates a GameObject to look at a supplied Transform or Vector3 over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["looktarget"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + } + } + + //establish iTween + args["type"]="look"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveTo(GameObject target, Vector3 position, float time){ + MoveTo(target,Hash("position",position,"time",time)); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["position"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveFrom(GameObject target, Vector3 position, float time){ + MoveFrom(target,Hash("position",position,"time",time)); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveFrom(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + bool tempIsLocal; + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + if(args.Contains("path")){ + Vector3[] fromPath; + Vector3[] suppliedPath; + if(args["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])args["path"]; + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])args["path"]; + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + if(suppliedPath[suppliedPath.Length-1] != target.transform.position){ + fromPath= new Vector3[suppliedPath.Length+1]; + Array.Copy(suppliedPath,fromPath,suppliedPath.Length); + if(tempIsLocal){ + fromPath[fromPath.Length-1] = target.transform.localPosition; + target.transform.localPosition=fromPath[0]; + }else{ + fromPath[fromPath.Length-1] = target.transform.position; + target.transform.position=fromPath[0]; + } + args["path"]=fromPath; + }else{ + if(tempIsLocal){ + target.transform.localPosition=suppliedPath[0]; + }else{ + target.transform.position=suppliedPath[0]; + } + args["path"]=suppliedPath; + } + }else{ + Vector3 tempPosition; + Vector3 fromPosition; + + //set tempPosition and base fromPosition: + if(tempIsLocal){ + tempPosition=fromPosition=target.transform.localPosition; + }else{ + tempPosition=fromPosition=target.transform.position; + } + + //set augmented fromPosition: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + fromPosition=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + fromPosition=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + fromPosition.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromPosition.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromPosition.z=(float)args["z"]; + } + } + + //apply fromPosition: + if(tempIsLocal){ + target.transform.localPosition = fromPosition; + }else{ + target.transform.position = fromPosition; + } + + //set new position arg: + args["position"]=tempPosition; + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Translates a GameObject's position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveAdd(GameObject target, Vector3 amount, float time){ + MoveAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Translates a GameObject's position over time with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Adds the supplied coordinates to a GameObject's postion with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveBy(GameObject target, Vector3 amount, float time){ + MoveBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds the supplied coordinates to a GameObject's position with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Changes a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleTo(GameObject target, Vector3 scale, float time){ + ScaleTo(target,Hash("scale",scale,"time",time)); + } + + /// + /// Changes a GameObject's scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["scale"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleFrom(GameObject target, Vector3 scale, float time){ + ScaleFrom(target,Hash("scale",scale,"time",time)); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleFrom(GameObject target, Hashtable args){ + Vector3 tempScale; + Vector3 fromScale; + + //clean args: + args = iTween.CleanArgs(args); + + //set base fromScale: + tempScale=fromScale=target.transform.localScale; + + //set augmented fromScale: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + fromScale=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + fromScale=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + fromScale.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromScale.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromScale.z=(float)args["z"]; + } + } + + //apply fromScale: + target.transform.localScale = fromScale; + + //set new scale arg: + args["scale"]=tempScale; + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be added to the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleAdd(GameObject target, Vector3 amount, float time){ + ScaleAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be added to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be multiplied by the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleBy(GameObject target, Vector3 amount, float time){ + ScaleBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateTo(GameObject target, Vector3 rotation, float time){ + RotateTo(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["rotation"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate from. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateFrom(GameObject target, Vector3 rotation, float time){ + RotateFrom(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 fromRotation; + bool tempIsLocal; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + //set tempRotation and base fromRotation: + if(tempIsLocal){ + tempRotation=fromRotation=target.transform.localEulerAngles; + }else{ + tempRotation=fromRotation=target.transform.eulerAngles; + } + + //set augmented fromRotation: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + fromRotation=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + fromRotation=(Vector3)args["rotation"]; + } + }else{ + if (args.Contains("x")) { + fromRotation.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromRotation.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromRotation.z=(float)args["z"]; + } + } + + //apply fromRotation: + if(tempIsLocal){ + target.transform.localEulerAngles = fromRotation; + }else{ + target.transform.eulerAngles = fromRotation; + } + + //set new rotation arg: + args["rotation"]=tempRotation; + + //establish iTween: + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateAdd(GameObject target, Vector3 amount, float time){ + RotateAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with FULL customization options. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="rotate"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateBy(GameObject target, Vector3 amount, float time){ + RotateBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="rotate"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakePosition(GameObject target, Vector3 amount, float time){ + ShakePosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakePosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="position"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeScale(GameObject target, Vector3 amount, float time){ + ShakeScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="scale"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeRotation(GameObject target, Vector3 amount, float time){ + ShakeRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="rotation"; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchPosition(GameObject target, Vector3 amount, float time){ + PunchPosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchPosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="position"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchRotation(GameObject target, Vector3 amount, float time){ + PunchRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="rotation"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchScale(GameObject target, Vector3 amount, float time){ + PunchScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="scale"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + #endregion + + #region #2 Generate Method Targets + + //call correct set target method and set tween application delegate: + void GenerateTargets(){ + switch (type) { + case "value": + switch (method) { + case "float": + GenerateFloatTargets(); + apply = new ApplyTween(ApplyFloatTargets); + break; + case "vector2": + GenerateVector2Targets(); + apply = new ApplyTween(ApplyVector2Targets); + break; + case "vector3": + GenerateVector3Targets(); + apply = new ApplyTween(ApplyVector3Targets); + break; + case "color": + GenerateColorTargets(); + apply = new ApplyTween(ApplyColorTargets); + break; + case "rect": + GenerateRectTargets(); + apply = new ApplyTween(ApplyRectTargets); + break; + } + break; + case "color": + switch (method) { + case "to": + GenerateColorToTargets(); + apply = new ApplyTween(ApplyColorToTargets); + break; + } + break; + case "audio": + switch (method) { + case "to": + GenerateAudioToTargets(); + apply = new ApplyTween(ApplyAudioToTargets); + break; + } + break; + case "move": + switch (method) { + case "to": + //using a path? + if(tweenArguments.Contains("path")){ + GenerateMoveToPathTargets(); + apply = new ApplyTween(ApplyMoveToPathTargets); + }else{ //not using a path? + GenerateMoveToTargets(); + apply = new ApplyTween(ApplyMoveToTargets); + } + break; + case "by": + case "add": + GenerateMoveByTargets(); + apply = new ApplyTween(ApplyMoveByTargets); + break; + } + break; + case "scale": + switch (method){ + case "to": + GenerateScaleToTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "by": + GenerateScaleByTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "add": + GenerateScaleAddTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + } + break; + case "rotate": + switch (method) { + case "to": + GenerateRotateToTargets(); + apply = new ApplyTween(ApplyRotateToTargets); + break; + case "add": + GenerateRotateAddTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + case "by": + GenerateRotateByTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + } + break; + case "shake": + switch (method) { + case "position": + GenerateShakePositionTargets(); + apply = new ApplyTween(ApplyShakePositionTargets); + break; + case "scale": + GenerateShakeScaleTargets(); + apply = new ApplyTween(ApplyShakeScaleTargets); + break; + case "rotation": + GenerateShakeRotationTargets(); + apply = new ApplyTween(ApplyShakeRotationTargets); + break; + } + break; + case "punch": + switch (method) { + case "position": + GeneratePunchPositionTargets(); + apply = new ApplyTween(ApplyPunchPositionTargets); + break; + case "rotation": + GeneratePunchRotationTargets(); + apply = new ApplyTween(ApplyPunchRotationTargets); + break; + case "scale": + GeneratePunchScaleTargets(); + apply = new ApplyTween(ApplyPunchScaleTargets); + break; + } + break; + case "look": + switch (method) { + case "to": + GenerateLookToTargets(); + apply = new ApplyTween(ApplyLookToTargets); + break; + } + break; + case "stab": + GenerateStabTargets(); + apply = new ApplyTween(ApplyStabTargets); + break; + } + } + + #endregion + + #region #3 Generate Specific Targets + + void GenerateRectTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + rects=new Rect[3]; + + //from and to values: + rects[0]=(Rect)tweenArguments["from"]; + rects[1]=(Rect)tweenArguments["to"]; + } + + void GenerateColorTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + colors=new Color[1,3]; + + //from and to values: + colors[0,0]=(Color)tweenArguments["from"]; + colors[0,1]=(Color)tweenArguments["to"]; + } + + void GenerateVector3Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from and to values: + vector3s[0]=(Vector3)tweenArguments["from"]; + vector3s[1]=(Vector3)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateVector2Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //from and to values: + vector2s[0]=(Vector2)tweenArguments["from"]; + vector2s[1]=(Vector2)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + Vector3 fromV3 = new Vector3(vector2s[0].x,vector2s[0].y,0); + Vector3 toV3 = new Vector3(vector2s[1].x,vector2s[1].y,0); + float distance = Math.Abs(Vector3.Distance(fromV3,toV3)); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateFloatTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + floats=new float[3]; + + //from and to values: + floats[0]=(float)tweenArguments["from"]; + floats[1]=(float)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(floats[0] - floats[1]); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateColorToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + //colors = new Color[3]; + + //from and init to values: + if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = guiTexture.color; + }else if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = guiText.material.color; + }else if(renderer){ + colors = new Color[renderer.materials.Length,3]; + for (int i = 0; i < renderer.materials.Length; i++) { + colors[i,0]=renderer.materials[i].GetColor(namedcolorvalue.ToString()); + colors[i,1]=renderer.materials[i].GetColor(namedcolorvalue.ToString()); + } + //colors[0] = colors[1] = renderer.material.color; + }else if(light){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = light.color; + }else{ + colors = new Color[1,3]; //empty placeholder incase the GO is perhaps an empty holder or something similar + } + + //to values: + if (tweenArguments.Contains("color")) { + //colors[1]=(Color)tweenArguments["color"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1]=(Color)tweenArguments["color"]; + } + }else{ + if (tweenArguments.Contains("r")) { + //colors[1].r=(float)tweenArguments["r"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].r=(float)tweenArguments["r"]; + } + } + if (tweenArguments.Contains("g")) { + //colors[1].g=(float)tweenArguments["g"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].g=(float)tweenArguments["g"]; + } + } + if (tweenArguments.Contains("b")) { + //colors[1].b=(float)tweenArguments["b"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].b=(float)tweenArguments["b"]; + } + } + if (tweenArguments.Contains("a")) { + //colors[1].a=(float)tweenArguments["a"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["a"]; + } + } + } + + //alpha or amount? + if(tweenArguments.Contains("amount")){ + //colors[1].a=(float)tweenArguments["amount"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["amount"]; + } + }else if(tweenArguments.Contains("alpha")){ + //colors[1].a=(float)tweenArguments["alpha"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["alpha"]; + } + } + } + + void GenerateAudioToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=audio; + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioTo requires an AudioSource."); + Dispose(); + } + } + + //from values and default to values: + vector2s[0]=vector2s[1]=new Vector2(audioSource.volume,audioSource.pitch); + + //to values: + if (tweenArguments.Contains("volume")) { + vector2s[1].x=(float)tweenArguments["volume"]; + } + if (tweenArguments.Contains("pitch")) { + vector2s[1].y=(float)tweenArguments["pitch"]; + } + } + + void GenerateStabTargets(){ + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=audio; + }else{ + //add and populate AudioSource if one doesn't exist: + gameObject.AddComponent(); + audioSource=audio; + audioSource.playOnAwake=false; + + } + } + + //populate audioSource's clip: + audioSource.clip=(AudioClip)tweenArguments["audioclip"]; + + //set audio's pitch and volume if requested: + if(tweenArguments.Contains("pitch")){ + audioSource.pitch=(float)tweenArguments["pitch"]; + } + if(tweenArguments.Contains("volume")){ + audioSource.volume=(float)tweenArguments["volume"]; + } + + //set run time based on length of clip after pitch is augmented + time=audioSource.clip.length/audioSource.pitch; + } + + void GenerateLookToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + + //set look: + if(tweenArguments.Contains("looktarget")){ + if (tweenArguments["looktarget"].GetType() == typeof(Transform)) { + //transform.LookAt((Transform)tweenArguments["looktarget"]); + thisTransform.LookAt((Transform)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + }else if(tweenArguments["looktarget"].GetType() == typeof(Vector3)){ + //transform.LookAt((Vector3)tweenArguments["looktarget"]); + thisTransform.LookAt((Vector3)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookTo needs a 'looktarget' property!"); + Dispose(); + } + + //to values: + vector3s[1]=thisTransform.eulerAngles; + thisTransform.eulerAngles=vector3s[0]; + + //axis restriction: + if(tweenArguments.Contains("axis")){ + switch((string)tweenArguments["axis"]){ + case "x": + vector3s[1].y=vector3s[0].y; + vector3s[1].z=vector3s[0].z; + break; + case "y": + vector3s[1].x=vector3s[0].x; + vector3s[1].z=vector3s[0].z; + break; + case "z": + vector3s[1].x=vector3s[0].x; + vector3s[1].y=vector3s[0].y; + break; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToPathTargets(){ + Vector3[] suppliedPath; + + //create and store path points: + if(tweenArguments["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + + //do we need to plot a path to get to the beginning of the supplied path? + bool plotStart; + int offset; + if(thisTransform.position != suppliedPath[0]){ + if(!tweenArguments.Contains("movetopath") || (bool)tweenArguments["movetopath"]==true){ + plotStart=true; + offset=3; + }else{ + plotStart=false; + offset=2; + } + }else{ + plotStart=false; + offset=2; + } + + //build calculated path: + vector3s = new Vector3[suppliedPath.Length+offset]; + if(plotStart){ + vector3s[1]=thisTransform.position; + offset=2; + }else{ + offset=1; + } + + //populate calculate path; + Array.Copy(suppliedPath,0,vector3s,offset,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + //create Catmull-Rom path: + path = new CRSpline(vector3s); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = PathLength(vector3s); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localPosition; + }else{ + vector3s[0]=vector3s[1]=thisTransform.position; + } + + //to values: + if (tweenArguments.Contains("position")) { + if (tweenArguments["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["position"]; + vector3s[1]=trans.position; + }else if(tweenArguments["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["position"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in, [5] for dial in location: + vector3s=new Vector3[6]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.position; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=vector3s[0] + (Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=vector3s[0].x + (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=vector3s[0].y +(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=vector3s[0].z + (float)tweenArguments["z"]; + } + } + + //calculation for dial in: + thisTransform.Translate(vector3s[1],space); + vector3s[5] = thisTransform.position; + thisTransform.position=vector3s[0]; + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("scale")) { + if (tweenArguments["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["scale"]; + vector3s[1]=trans.localScale; + }else if(tweenArguments["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["scale"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=Vector3.Scale(vector3s[1],(Vector3)tweenArguments["amount"]); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x*=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y*=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z*=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localEulerAngles; + }else{ + vector3s[0]=vector3s[1]=thisTransform.eulerAngles; + } + + //to values: + if (tweenArguments.Contains("rotation")) { + if (tweenArguments["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(tweenArguments["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["rotation"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[5]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=Vector3.Scale((Vector3)tweenArguments["amount"],new Vector3(360,360,360)); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=360 * (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=360 * (float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=360 * (float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateShakePositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[4]; + + //grab starting rotation: + vector3s[3] = thisTransform.eulerAngles; + + //root: + vector3s[0]=thisTransform.position; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeScaleTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.localScale; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeRotationTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.eulerAngles; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchPositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[5]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=thisTransform.position; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchRotationTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchScaleTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.localScale; + vector3s[1]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + #endregion + + #region #4 Apply Targets + + void ApplyRectTargets(){ + //calculate: + rects[2].x = ease(rects[0].x,rects[1].x,percentage); + rects[2].y = ease(rects[0].y,rects[1].y,percentage); + rects[2].width = ease(rects[0].width,rects[1].width,percentage); + rects[2].height = ease(rects[0].height,rects[1].height,percentage); + + //apply: + tweenArguments["onupdateparams"]=rects[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=rects[1]; + } + } + + void ApplyColorTargets(){ + //calculate: + colors[0,2].r = ease(colors[0,0].r,colors[0,1].r,percentage); + colors[0,2].g = ease(colors[0,0].g,colors[0,1].g,percentage); + colors[0,2].b = ease(colors[0,0].b,colors[0,1].b,percentage); + colors[0,2].a = ease(colors[0,0].a,colors[0,1].a,percentage); + + //apply: + tweenArguments["onupdateparams"]=colors[0,2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=colors[0,1]; + } + } + + void ApplyVector3Targets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector3s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector3s[1]; + } + } + + void ApplyVector2Targets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector2s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector2s[1]; + } + } + + void ApplyFloatTargets(){ + //calculate: + floats[2] = ease(floats[0],floats[1],percentage); + + //apply: + tweenArguments["onupdateparams"]=floats[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=floats[1]; + } + } + + void ApplyColorToTargets(){ + //calculate: + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,2].r = ease(colors[i,0].r,colors[i,1].r,percentage); + colors[i,2].g = ease(colors[i,0].g,colors[i,1].g,percentage); + colors[i,2].b = ease(colors[i,0].b,colors[i,1].b,percentage); + colors[i,2].a = ease(colors[i,0].a,colors[i,1].a,percentage); + } + /* + colors[2].r = ease(colors[0].r,colors[1].r,percentage); + colors[2].g = ease(colors[0].g,colors[1].g,percentage); + colors[2].b = ease(colors[0].b,colors[1].b,percentage); + colors[2].a = ease(colors[0].a,colors[1].a,percentage); + */ + + //apply: + if(GetComponent()){ + //guiTexture.color=colors[2]; + guiTexture.color=colors[0,2]; + }else if(GetComponent()){ + //guiText.material.color=colors[2]; + guiText.material.color=colors[0,2]; + }else if(renderer){ + //renderer.material.color=colors[2]; + for (int i = 0; i < colors.GetLength(0); i++) { + renderer.materials[i].SetColor(namedcolorvalue.ToString(),colors[i,2]); + } + }else if(light){ + //light.color=colors[2]; + light.color=colors[0,2]; + } + + //dial in: + if(percentage==1){ + if(GetComponent()){ + //guiTexture.color=colors[1]; + guiTexture.color=colors[0,1]; + }else if(GetComponent()){ + //guiText.material.color=colors[1]; + guiText.material.color=colors[0,1]; + }else if(renderer){ + //renderer.material.color=colors[1]; + for (int i = 0; i < colors.GetLength(0); i++) { + renderer.materials[i].SetColor(namedcolorvalue.ToString(),colors[i,1]); + } + }else if(light){ + //light.color=colors[1]; + light.color=colors[0,1]; + } + } + } + + void ApplyAudioToTargets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + audioSource.volume=vector2s[2].x; + audioSource.pitch=vector2s[2].y; + + //dial in: + if(percentage==1){ + audioSource.volume=vector2s[1].x; + audioSource.pitch=vector2s[1].y; + } + } + + void ApplyStabTargets(){ + //unnecessary but here just in case + } + + void ApplyMoveToPathTargets(){ + preUpdate = thisTransform.position; + float t = ease(0,1,percentage); + float lookAheadAmount; + + //clamp easing equation results as "back" will fail since overshoots aren't handled in the Catmull-Rom interpolation: + if(isLocal){ + thisTransform.localPosition=path.Interp(Mathf.Clamp(t,0,1)); + }else{ + thisTransform.position=path.Interp(Mathf.Clamp(t,0,1)); + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + + //plot a point slightly ahead in the interpolation by pushing the percentage forward using the default lookahead value: + float tLook; + if(tweenArguments.Contains("lookahead")){ + lookAheadAmount = (float)tweenArguments["lookahead"]; + }else{ + lookAheadAmount = Defaults.lookAhead; + } + //tLook = ease(0,1,percentage+lookAheadAmount); + tLook = ease(0,1, Mathf.Min(1f, percentage+lookAheadAmount)); + + //locate new leading point with a clamp as stated above: + //Vector3 lookDistance = path.Interp(Mathf.Clamp(tLook,0,1)) - transform.position; + tweenArguments["looktarget"] = path.Interp(Mathf.Clamp(tLook,0,1)); + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + rigidbody.MovePosition(postUpdate); + } + } + + void ApplyMoveToTargets(){ + //record current: + preUpdate=thisTransform.position; + + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localPosition=vector3s[2]; + }else{ + thisTransform.position=vector3s[2]; + } + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localPosition=vector3s[1]; + }else{ + thisTransform.position=vector3s[1]; + } + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + rigidbody.MovePosition(postUpdate); + } + } + + void ApplyMoveByTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + /* + //dial in: + if(percentage==1){ + transform.position=vector3s[5]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + rigidbody.MovePosition(postUpdate); + } + } + + void ApplyScaleToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.localScale=vector3s[2]; + + //dial in: + if(percentage==1){ + thisTransform.localScale=vector3s[1]; + } + } + + void ApplyLookToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + } + + void ApplyRotateToTargets(){ + preUpdate=thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[1]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[1]); + }; + } + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + rigidbody.MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyRotateAddTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + rigidbody.MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyShakePositionTargets(){ + //preUpdate = transform.position; + if (isLocal) { + preUpdate = thisTransform.localPosition; + }else{ + preUpdate = thisTransform.position; + } + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[3]; + } + + //impact: + if (percentage==0) { + thisTransform.Translate(vector3s[1],space); + } + + //transform.position=vector3s[0]; + //reset: + if (isLocal) { + thisTransform.localPosition=vector3s[0]; + }else{ + thisTransform.position=vector3s[0]; + } + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + //transform.Translate(vector3s[2],space); + if (isLocal) { + thisTransform.localPosition+=vector3s[2]; + }else{ + thisTransform.position+=vector3s[2]; + } + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + rigidbody.MovePosition(postUpdate); + } + } + + void ApplyShakeScaleTargets(){ + //impact: + if (percentage==0) { + thisTransform.localScale=vector3s[1]; + } + + //reset: + thisTransform.localScale=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.localScale+=vector3s[2]; + } + + void ApplyShakeRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //impact: + if (percentage==0) { + thisTransform.Rotate(vector3s[1],space); + } + + //reset: + thisTransform.eulerAngles=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.Rotate(vector3s[2],space); + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + rigidbody.MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchPositionTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //dial in: + /* + if(percentage==1){ + transform.position=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + rigidbody.MovePosition(postUpdate); + } + } + + void ApplyPunchRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.eulerAngles=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + rigidbody.MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchScaleTargets(){ + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.localScale=vector3s[0]+vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.localScale=vector3s[0]; + } + */ + } + + #endregion + + #region #5 Tween Steps + + IEnumerator TweenDelay(){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + if(wasPaused){ + wasPaused=false; + TweenStart(); + } + } + + void TweenStart(){ + CallBack("onstart"); + + if(!loop){//only if this is not a loop + ConflictCheck(); + GenerateTargets(); + } + + //run stab: + if(type == "stab"){ + audioSource.PlayOneShot(audioSource.clip); + } + + //toggle isKinematic for iTweens that may interfere with physics: + if (type == "move" || type=="scale" || type=="rotate" || type=="punch" || type=="shake" || type=="curve" || type=="look") { + EnableKinematic(); + } + + isRunning = true; + } + + IEnumerator TweenRestart(){ + if(delay > 0){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + } + loop=true; + TweenStart(); + } + + void TweenUpdate(){ + apply(); + CallBack("onupdate"); + UpdatePercentage(); + } + + void TweenComplete(){ + isRunning=false; + + //dial in percentage to 1 or 0 for final run: + if(percentage>.5f){ + percentage=1f; + }else{ + percentage=0; + } + + //apply dial in and final run: + apply(); + if(type == "value"){ + CallBack("onupdate"); //CallBack run for ValueTo since it only calculates and applies in the update callback + } + + //loop or dispose? + if(loopType==LoopType.none){ + Dispose(); + }else{ + TweenLoop(); + } + + CallBack("oncomplete"); + } + + void TweenLoop(){ + DisableKinematic(); //give physics control again + switch(loopType){ + case LoopType.loop: + //rewind: + percentage=0; + runningTime=0; + apply(); + + //replay: + StartCoroutine("TweenRestart"); + break; + case LoopType.pingPong: + reverse = !reverse; + runningTime=0; + + //replay: + StartCoroutine("TweenRestart"); + break; + } + } + + #endregion + + #region #6 Update Callable + + /// + /// Returns a Rect that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed){ + Rect diff = new Rect(FloatUpdate(currentValue.x, targetValue.x, speed), FloatUpdate(currentValue.y, targetValue.y, speed), FloatUpdate(currentValue.width, targetValue.width, speed), FloatUpdate(currentValue.height, targetValue.height, speed)); + return (diff); + } + + /// + /// Returns a Vector3 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed){ + Vector3 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a Vector2 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed){ + Vector2 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a float that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static float FloatUpdate(float currentValue, float targetValue, float speed){ + float diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, Hashtable args){ + args["a"]=args["alpha"]; + ColorUpdate(target,args); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, float alpha, float time){ + FadeUpdate(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Color[] colors = new Color[4]; + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + ColorUpdate(child.gameObject,args); + } + } + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + if(target.GetComponent()){ + colors[0] = colors[1] = target.guiTexture.color; + }else if(target.GetComponent()){ + colors[0] = colors[1] = target.guiText.material.color; + }else if(target.renderer){ + colors[0] = colors[1] = target.renderer.material.color; + }else if(target.light){ + colors[0] = colors[1] = target.light.color; + } + + //to values: + if (args.Contains("color")) { + colors[1]=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + colors[1].r=(float)args["r"]; + } + if (args.Contains("g")) { + colors[1].g=(float)args["g"]; + } + if (args.Contains("b")) { + colors[1].b=(float)args["b"]; + } + if (args.Contains("a")) { + colors[1].a=(float)args["a"]; + } + } + + //calculate: + colors[3].r=Mathf.SmoothDamp(colors[0].r,colors[1].r,ref colors[2].r,time); + colors[3].g=Mathf.SmoothDamp(colors[0].g,colors[1].g,ref colors[2].g,time); + colors[3].b=Mathf.SmoothDamp(colors[0].b,colors[1].b,ref colors[2].b,time); + colors[3].a=Mathf.SmoothDamp(colors[0].a,colors[1].a,ref colors[2].a,time); + + //apply: + if(target.GetComponent()){ + target.guiTexture.color=colors[3]; + }else if(target.GetComponent()){ + target.guiText.material.color=colors[3]; + }else if(target.renderer){ + target.renderer.material.color=colors[3]; + }else if(target.light){ + target.light.color=colors[3]; + } + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Color color, float time){ + ColorUpdate(target,Hash("color",color,"time",time)); + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + AudioSource audioSource; + float time; + Vector2[] vector2s = new Vector2[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set audioSource: + if(args.Contains("audiosource")){ + audioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + audioSource=target.audio; + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioUpdate requires an AudioSource."); + return; + } + } + + //from values: + vector2s[0] = vector2s[1] = new Vector2(audioSource.volume,audioSource.pitch); + + //set to: + if(args.Contains("volume")){ + vector2s[1].x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + vector2s[1].y=(float)args["pitch"]; + } + + //calculate: + vector2s[3].x=Mathf.SmoothDampAngle(vector2s[0].x,vector2s[1].x,ref vector2s[2].x,time); + vector2s[3].y=Mathf.SmoothDampAngle(vector2s[0].y,vector2s[1].y,ref vector2s[2].y,time); + + //apply: + audioSource.volume=vector2s[3].x; + audioSource.pitch=vector2s[3].y; + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target level of volume. + /// + /// + /// A for the target pitch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, float volume, float pitch, float time){ + AudioUpdate(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + bool isLocal; + float time; + Vector3[] vector3s = new Vector3[4]; + Vector3 preUpdate = target.transform.eulerAngles; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //from values: + if(isLocal){ + vector3s[0] = target.transform.localEulerAngles; + }else{ + vector3s[0] = target.transform.eulerAngles; + } + + //set to: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["rotation"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + if(isLocal){ + target.transform.localEulerAngles=vector3s[3]; + }else{ + target.transform.eulerAngles=vector3s[3]; + } + + //need physics? + if(target.rigidbody != null){ + Vector3 postUpdate=target.transform.eulerAngles; + target.transform.eulerAngles=preUpdate; + target.rigidbody.MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Vector3 rotation, float time){ + RotateUpdate(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + vector3s[0] = vector3s[1] = target.transform.localScale; + + //to values: + if (args.Contains("scale")) { + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + vector3s[1]=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.localScale=vector3s[3]; + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Vector3 scale, float time){ + ScaleUpdate(target,Hash("scale",scale,"time",time)); + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + public static void MoveUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + bool isLocal; + Vector3 preUpdate = target.transform.position; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //init values: + if(isLocal){ + vector3s[0] = vector3s[1] = target.transform.localPosition; + }else{ + vector3s[0] = vector3s[1] = target.transform.position; + } + + //to values: + if (args.Contains("position")) { + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + vector3s[1]=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //handle orient to path: + if(args.Contains("orienttopath") && (bool)args["orienttopath"]){ + args["looktarget"] = vector3s[3]; + } + + //look applications: + if(args.Contains("looktarget")){ + iTween.LookUpdate(target,args); + } + + //apply: + if(isLocal){ + target.transform.localPosition = vector3s[3]; + }else{ + target.transform.position=vector3s[3]; + } + + //need physics? + if(target.rigidbody != null){ + Vector3 postUpdate=target.transform.position; + target.transform.position=preUpdate; + target.rigidbody.MovePosition(postUpdate); + } + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a point in space the GameObject will animate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveUpdate(GameObject target, Vector3 position, float time){ + MoveUpdate(target,Hash("position",position,"time",time)); + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[5]; + + //set smooth time: + if(args.Contains("looktime")){ + time=(float)args["looktime"]; + time*=Defaults.updateTimePercentage; + }else if(args.Contains("time")){ + time=(float)args["time"]*.15f; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //from values: + vector3s[0] = target.transform.eulerAngles; + + //set look: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookUpdate needs a 'looktarget' property!"); + return; + } + + //to values and reset look: + vector3s[1]=target.transform.eulerAngles; + target.transform.eulerAngles=vector3s[0]; + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.eulerAngles=vector3s[3]; + + //axis restriction: + if(args.Contains("axis")){ + vector3s[4]=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + vector3s[4].y=vector3s[0].y; + vector3s[4].z=vector3s[0].z; + break; + case "y": + vector3s[4].x=vector3s[0].x; + vector3s[4].z=vector3s[0].z; + break; + case "z": + vector3s[4].x=vector3s[0].x; + vector3s[4].y=vector3s[0].y; + break; + } + + //apply axis restriction: + target.transform.eulerAngles=vector3s[4]; + } + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a target the GameObject will look at. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Vector3 looktarget, float time){ + LookUpdate(target,Hash("looktarget",looktarget,"time",time)); + } + + #endregion + + #region #7 External Utilities + + /// + /// Returns the length of a curved path drawn through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static float PathLength(Transform[] path){ + Vector3[] suppliedPath = new Vector3[path.Length]; + float pathLength = 0; + + //create and store path points: + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + Vector3[] vector3s = PathControlPointGenerator(suppliedPath); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + /// + /// Returns the length of a curved path drawn through the provided array of Vector3s. + /// + /// + /// The length. + /// + /// + /// A + /// + public static float PathLength(Vector3[] path){ + float pathLength = 0; + + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + /// + /// Creates and returns a full-screen Texture2D for use with CameraFade. + /// + /// + /// Texture2D + /// + /// + /// Color + /// + public static Texture2D CameraTexture(Color color){ + Texture2D texture = new Texture2D(Screen.width,Screen.height,TextureFormat.ARGB32, false); + Color[] colors = new Color[Screen.width*Screen.height]; + for (int i = 0; i < colors.Length; i++) { + colors[i]=color; + } + texture.SetPixels(colors); + texture.Apply(); + return(texture); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Vector3[] path, float percent){ + target.transform.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Vector3[] path, float percent){ + target.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.transform.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + return(Interp(PathControlPointGenerator(suppliedPath),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawLine(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"handles"); + } + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Vector3[] path, float percent){ + return(Interp(PathControlPointGenerator(path),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawPath(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"handles"); + } + } + + /// + /// Changes a camera fade's texture. + /// + /// + /// A + /// + public static void CameraFadeDepth(int depth){ + if(cameraFade){ + cameraFade.transform.position=new Vector3(cameraFade.transform.position.x,cameraFade.transform.position.y,depth); + } + } + + /// + /// Removes and destroyes a camera fade. + /// + public static void CameraFadeDestroy(){ + if(cameraFade){ + Destroy(cameraFade); + } + } + + /// + /// Changes a camera fade's texture. + /// + /// + /// A + /// + public static void CameraFadeSwap(Texture2D texture){ + if(cameraFade){ + cameraFade.guiTexture.texture=texture; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the supplied depth that can be used to simulate a camera fade. + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(Texture2D texture, int depth){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,depth); + cameraFade.AddComponent(); + cameraFade.guiTexture.texture=texture; + cameraFade.guiTexture.color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the default depth that can be used to simulate a camera fade. + /// + /// + /// A + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(Texture2D texture){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); + cameraFade.AddComponent(); + cameraFade.guiTexture.texture=texture; + cameraFade.guiTexture.color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the default depth filled with black that can be used to simulate a camera fade. + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); + cameraFade.AddComponent(); + cameraFade.guiTexture.texture=CameraTexture(Color.black); + cameraFade.guiTexture.color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + + //################################# + //# RESUME UTILITIES AND OVERLOADS # + //################################# + + /// + /// Resume all iTweens on a GameObject. + /// + public static void Resume(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.enabled=true; + } + } + + /// + /// Resume all iTweens on a GameObject including its children. + /// + public static void Resume(GameObject target, bool includechildren){ + Resume(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,true); + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,type,true); + } + } + } + + /// + /// Resume all iTweens in scene. + /// + public static void Resume(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Resume(target); + } + } + + /// + /// Resume all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(string type){ + ArrayList resumeArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + resumeArray.Insert(resumeArray.Count,target); + } + + for (int i = 0; i < resumeArray.Count; i++) { + Resume((GameObject)resumeArray[i],type); + } + } + + //################################# + //# PAUSE UTILITIES AND OVERLOADS # + //################################# + + /// + /// Pause all iTweens on a GameObject. + /// + public static void Pause(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + + /// + /// Pause all iTweens on a GameObject including its children. + /// + public static void Pause(GameObject target, bool includechildren){ + Pause(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,true); + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,type,true); + } + } + } + + /// + /// Pause all iTweens in scene. + /// + public static void Pause(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Pause(target); + } + } + + /// + /// Pause all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(string type){ + ArrayList pauseArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + pauseArray.Insert(pauseArray.Count,target); + } + + for (int i = 0; i < pauseArray.Count; i++) { + Pause((GameObject)pauseArray[i],type); + } + } + + //################################# + //# COUNT UTILITIES AND OVERLOADS # + //################################# + + /// + /// Count all iTweens in current scene. + /// + public static int Count(){ + return(tweens.Count); + } + + /// + /// Count all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(string type){ + int tweenCount = 0; + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + string targetType = (string)currentTween["type"]+(string)currentTween["method"]; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + + return(tweenCount); + } + + /// + /// Count all iTweens on a GameObject. + /// + public static int Count(GameObject target){ + Component[] tweens = target.GetComponents(); + return(tweens.Length); + } + + /// + /// Count all iTweens on a GameObject of a particular type. + /// + /// + /// A name of the type of iTween you would like to count. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(GameObject target, string type){ + int tweenCount = 0; + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + return(tweenCount); + } + + //################################ + //# STOP UTILITIES AND OVERLOADS # + //################################ + + /// + /// Stop and destroy all Tweens in current scene. + /// + public static void Stop(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Stop(target); + } + tweens.Clear(); + } + + /// + /// Stop and destroy all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(string type){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + Stop((GameObject)stopArray[i],type); + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens in current scene of a particular name. + /// + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(string name){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + StopByName((GameObject)stopArray[i],name); + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject. + /// + public static void Stop(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.Dispose(); + } + } + + /// + /// Stop and destroy all iTweens on a GameObject including its children. + /// + public static void Stop(GameObject target, bool includechildren){ + Stop(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,true); + } + } + } + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,type,true); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name including its children. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + //Stop(child.gameObject,type,true); + StopByName(child.gameObject,name,true); + } + } + } + /* GFX47 MOD END */ + + /// + /// Universal interface to help in the creation of Hashtables. Especially useful for C# users. + /// + /// + /// A of alternating name value pairs. For example "time",1,"delay",2... + /// + /// + /// A + /// + public static Hashtable Hash(params object[] args){ + Hashtable hashTable = new Hashtable(args.Length/2); + if (args.Length %2 != 0) { + Debug.LogError("Tween Error: Hash requires an even number of arguments!"); + return null; + }else{ + int i = 0; + while(i < args.Length - 1) { + hashTable.Add(args[i], args[i+1]); + i += 2; + } + return hashTable; + } + } + + #endregion + + #region Component Segments + + private iTween(Hashtable h) { + tweenArguments = h; + } + + void Awake(){ + thisTransform = transform; + + RetrieveArgs(); + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + IEnumerator Start(){ + if(delay > 0){ + yield return StartCoroutine("TweenDelay"); + } + TweenStart(); + } + + //non-physics + void Update(){ + if(isRunning && !physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + //physics + void FixedUpdate(){ + if(isRunning && physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + void LateUpdate(){ + //look applications: + if(tweenArguments.Contains("looktarget") && isRunning){ + if(type =="move" || type =="shake" || type=="punch"){ + LookUpdate(gameObject,tweenArguments); + } + } + } + + void OnEnable(){ + if(isRunning){ + EnableKinematic(); + } + + //resume delay: + if(isPaused){ + isPaused=false; + if(delay > 0){ + wasPaused=true; + ResumeDelay(); + } + } + } + + void OnDisable(){ + DisableKinematic(); + } + + #endregion + + #region Internal Helpers + + private static void DrawLineHelper(Vector3[] line, Color color, string method){ + Gizmos.color=color; + for (int i = 0; i < line.Length-1; i++) { + if(method == "gizmos"){ + Gizmos.DrawLine(line[i], line[i+1]);; + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(line[i], line[i+1]); + } + } + } + + private static void DrawPathHelper(Vector3[] path, Color color, string method){ + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + Gizmos.color=color; + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + if(method == "gizmos"){ + Gizmos.DrawLine(currPt, prevPt); + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(currPt, prevPt); + } + prevPt = currPt; + } + } + + private static Vector3[] PathControlPointGenerator(Vector3[] path){ + Vector3[] suppliedPath; + Vector3[] vector3s; + + //create and store path points: + suppliedPath = path; + + //populate calculate path; + int offset = 2; + vector3s = new Vector3[suppliedPath.Length+offset]; + Array.Copy(suppliedPath,0,vector3s,1,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + return(vector3s); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private static Vector3 Interp(Vector3[] pts, float t){ + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private class CRSpline { + public Vector3[] pts; + + public CRSpline(params Vector3[] pts) { + this.pts = new Vector3[pts.Length]; + Array.Copy(pts, this.pts, pts.Length); + } + + + public Vector3 Interp(float t) { + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + return .5f*((-a+3f*b-3f*c+d)*(u*u*u)+(2f*a-5f*b+4f*c-d)*(u*u)+(-a+c)*u+2f*b); + } + } + + //catalog new tween and add component phase of iTween: + static void Launch(GameObject target, Hashtable args){ + if(!args.Contains("id")){ + args["id"] = GenerateID(); + } + if(!args.Contains("target")){ + args["target"] = target; + + } + + tweens.Insert (0, args); + target.AddComponent(); + } + + //cast any accidentally supplied doubles and ints as floats as iTween only uses floats internally and unify parameter case: + static Hashtable CleanArgs(Hashtable args){ + Hashtable argsCopy = new Hashtable(args.Count); + Hashtable argsCaseUnified = new Hashtable(args.Count); + + foreach (DictionaryEntry item in args) { + argsCopy.Add(item.Key, item.Value); + } + + foreach (DictionaryEntry item in argsCopy) { + if(item.Value.GetType() == typeof(System.Int32)){ + int original = (int)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + if(item.Value.GetType() == typeof(System.Double)){ + double original = (double)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + } + + //unify parameter case: + foreach (DictionaryEntry item in args) { + argsCaseUnified.Add(item.Key.ToString().ToLower(), item.Value); + } + + //swap back case unification: + args = argsCaseUnified; + + return args; + } + + //random ID generator: + static string GenerateID(){ +// int strlen = 15; +// char[] chars = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8'}; +// int num_chars = chars.Length - 1; +// string randomChar = ""; +// for (int i = 0; i < strlen; i++) { +// randomChar += chars[(int)Mathf.Floor(UnityEngine.Random.Range(0,num_chars))]; +// } + return System.Guid.NewGuid().ToString(); + } + + //grab and set generic, neccesary iTween arguments: + void RetrieveArgs(){ + foreach (Hashtable item in tweens) { + if((GameObject)item["target"] == gameObject){ + tweenArguments=item; + break; + } + } + + id=(string)tweenArguments["id"]; + type=(string)tweenArguments["type"]; + /* GFX47 MOD START */ + _name=(string)tweenArguments["name"]; + /* GFX47 MOD END */ + method=(string)tweenArguments["method"]; + + if(tweenArguments.Contains("time")){ + time=(float)tweenArguments["time"]; + }else{ + time=Defaults.time; + } + + //do we need to use physics, is there a rigidbody? + if(rigidbody != null){ + physics=true; + } + + if(tweenArguments.Contains("delay")){ + delay=(float)tweenArguments["delay"]; + }else{ + delay=Defaults.delay; + } + + if(tweenArguments.Contains("namedcolorvalue")){ + //allows namedcolorvalue to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["namedcolorvalue"].GetType() == typeof(NamedValueColor)){ + namedcolorvalue=(NamedValueColor)tweenArguments["namedcolorvalue"]; + }else{ + try { + namedcolorvalue=(NamedValueColor)Enum.Parse(typeof(NamedValueColor),(string)tweenArguments["namedcolorvalue"],true); + } catch { + Debug.LogWarning("iTween: Unsupported namedcolorvalue supplied! Default will be used."); + namedcolorvalue = iTween.NamedValueColor._Color; + } + } + }else{ + namedcolorvalue=Defaults.namedColorValue; + } + + if(tweenArguments.Contains("looptype")){ + //allows loopType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["looptype"].GetType() == typeof(LoopType)){ + loopType=(LoopType)tweenArguments["looptype"]; + }else{ + try { + loopType=(LoopType)Enum.Parse(typeof(LoopType),(string)tweenArguments["looptype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported loopType supplied! Default will be used."); + loopType = iTween.LoopType.none; + } + } + }else{ + loopType = iTween.LoopType.none; + } + + if(tweenArguments.Contains("easetype")){ + //allows easeType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["easetype"].GetType() == typeof(EaseType)){ + easeType=(EaseType)tweenArguments["easetype"]; + }else{ + try { + easeType=(EaseType)Enum.Parse(typeof(EaseType),(string)tweenArguments["easetype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported easeType supplied! Default will be used."); + easeType=Defaults.easeType; + } + } + }else{ + easeType=Defaults.easeType; + } + + if(tweenArguments.Contains("space")){ + //allows space to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["space"].GetType() == typeof(Space)){ + space=(Space)tweenArguments["space"]; + }else{ + try { + space=(Space)Enum.Parse(typeof(Space),(string)tweenArguments["space"],true); + } catch { + Debug.LogWarning("iTween: Unsupported space supplied! Default will be used."); + space = Defaults.space; + } + } + }else{ + space = Defaults.space; + } + + if(tweenArguments.Contains("islocal")){ + isLocal = (bool)tweenArguments["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + // Added by PressPlay + if (tweenArguments.Contains("ignoretimescale")) + { + useRealTime = (bool)tweenArguments["ignoretimescale"]; + } + else + { + useRealTime = Defaults.useRealTime; + } + + //instantiates a cached ease equation reference: + GetEasingFunction(); + } + + //instantiates a cached ease equation refrence: + void GetEasingFunction(){ + switch (easeType){ + case EaseType.easeInQuad: + ease = new EasingFunction(easeInQuad); + break; + case EaseType.easeOutQuad: + ease = new EasingFunction(easeOutQuad); + break; + case EaseType.easeInOutQuad: + ease = new EasingFunction(easeInOutQuad); + break; + case EaseType.easeInCubic: + ease = new EasingFunction(easeInCubic); + break; + case EaseType.easeOutCubic: + ease = new EasingFunction(easeOutCubic); + break; + case EaseType.easeInOutCubic: + ease = new EasingFunction(easeInOutCubic); + break; + case EaseType.easeInQuart: + ease = new EasingFunction(easeInQuart); + break; + case EaseType.easeOutQuart: + ease = new EasingFunction(easeOutQuart); + break; + case EaseType.easeInOutQuart: + ease = new EasingFunction(easeInOutQuart); + break; + case EaseType.easeInQuint: + ease = new EasingFunction(easeInQuint); + break; + case EaseType.easeOutQuint: + ease = new EasingFunction(easeOutQuint); + break; + case EaseType.easeInOutQuint: + ease = new EasingFunction(easeInOutQuint); + break; + case EaseType.easeInSine: + ease = new EasingFunction(easeInSine); + break; + case EaseType.easeOutSine: + ease = new EasingFunction(easeOutSine); + break; + case EaseType.easeInOutSine: + ease = new EasingFunction(easeInOutSine); + break; + case EaseType.easeInExpo: + ease = new EasingFunction(easeInExpo); + break; + case EaseType.easeOutExpo: + ease = new EasingFunction(easeOutExpo); + break; + case EaseType.easeInOutExpo: + ease = new EasingFunction(easeInOutExpo); + break; + case EaseType.easeInCirc: + ease = new EasingFunction(easeInCirc); + break; + case EaseType.easeOutCirc: + ease = new EasingFunction(easeOutCirc); + break; + case EaseType.easeInOutCirc: + ease = new EasingFunction(easeInOutCirc); + break; + case EaseType.linear: + ease = new EasingFunction(linear); + break; + case EaseType.spring: + ease = new EasingFunction(spring); + break; + /* GFX47 MOD START */ + /*case EaseType.bounce: + ease = new EasingFunction(bounce); + break;*/ + case EaseType.easeInBounce: + ease = new EasingFunction(easeInBounce); + break; + case EaseType.easeOutBounce: + ease = new EasingFunction(easeOutBounce); + break; + case EaseType.easeInOutBounce: + ease = new EasingFunction(easeInOutBounce); + break; + /* GFX47 MOD END */ + case EaseType.easeInBack: + ease = new EasingFunction(easeInBack); + break; + case EaseType.easeOutBack: + ease = new EasingFunction(easeOutBack); + break; + case EaseType.easeInOutBack: + ease = new EasingFunction(easeInOutBack); + break; + /* GFX47 MOD START */ + /*case EaseType.elastic: + ease = new EasingFunction(elastic); + break;*/ + case EaseType.easeInElastic: + ease = new EasingFunction(easeInElastic); + break; + case EaseType.easeOutElastic: + ease = new EasingFunction(easeOutElastic); + break; + case EaseType.easeInOutElastic: + ease = new EasingFunction(easeInOutElastic); + break; + /* GFX47 MOD END */ + } + } + + //calculate percentage of tween based on time: + void UpdatePercentage(){ + + // Added by PressPlay + if (useRealTime) + { + runningTime += (Time.realtimeSinceStartup - lastRealTime); + } + else + { + runningTime += Time.deltaTime; + } + + if(reverse){ + percentage = 1 - runningTime/time; + }else{ + percentage = runningTime/time; + } + + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + void CallBack(string callbackType){ + if (tweenArguments.Contains(callbackType) && !tweenArguments.Contains("ischild")) { + //establish target: + GameObject target; + if (tweenArguments.Contains(callbackType+"target")) { + target=(GameObject)tweenArguments[callbackType+"target"]; + }else{ + target=gameObject; + } + + //throw an error if a string wasn't passed for callback: + if (tweenArguments[callbackType].GetType() == typeof(System.String)) { + target.SendMessage((string)tweenArguments[callbackType],(object)tweenArguments[callbackType+"params"],SendMessageOptions.DontRequireReceiver); + }else{ + Debug.LogError("iTween Error: Callback method references must be passed as a String!"); + Destroy (this); + } + } + } + + void Dispose(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable tweenEntry = tweens[i]; + if ((string)tweenEntry["id"] == id){ + tweens.RemoveAt(i); + break; + } + } + Destroy(this); + } + + void ConflictCheck(){//if a new iTween is about to run and is of the same type as an in progress iTween this will destroy the previous if the new one is NOT identical in every way or it will destroy the new iTween if they are: + Component[] tweens = GetComponents(); + foreach (iTween item in tweens) { + if(item.type == "value"){ + return; + }else if(item.isRunning && item.type==type){ + //cancel out if this is a shake or punch variant: + if (item.method != method) { + return; + } + + //step 1: check for length first since it's the fastest: + if(item.tweenArguments.Count != tweenArguments.Count){ + item.Dispose(); + return; + } + + //step 2: side-by-side check to figure out if this is an identical tween scenario to handle Update usages of iTween: + foreach (DictionaryEntry currentProp in tweenArguments) { + if(!item.tweenArguments.Contains(currentProp.Key)){ + item.Dispose(); + return; + }else{ + if(!item.tweenArguments[currentProp.Key].Equals(tweenArguments[currentProp.Key]) && (string)currentProp.Key != "id"){//if we aren't comparing ids and something isn't exactly the same replace the running iTween: + item.Dispose(); + return; + } + } + } + + //step 3: prevent a new iTween addition if it is identical to the currently running iTween + Dispose(); + //Destroy(this); + } + } + } + + void EnableKinematic(){ + /* + if(gameObject.GetComponent(typeof(Rigidbody))){ + if(!rigidbody.isKinematic){ + kinematic=true; + rigidbody.isKinematic=true; + } + } + */ + } + + void DisableKinematic(){ + /* + if(kinematic && rigidbody.isKinematic==true){ + kinematic=false; + rigidbody.isKinematic=false; + } + */ + } + + void ResumeDelay(){ + StartCoroutine("TweenDelay"); + } + + #endregion + + #region Easing Curves + + private float linear(float start, float end, float value){ + return Mathf.Lerp(start, end, value); + } + + private float clerp(float start, float end, float value){ + float min = 0.0f; + float max = 360.0f; + float half = Mathf.Abs((max - min) * 0.5f); + float retval = 0.0f; + float diff = 0.0f; + if ((end - start) < -half){ + diff = ((max - start) + end) * value; + retval = start + diff; + }else if ((end - start) > half){ + diff = -((max - end) + start) * value; + retval = start + diff; + }else retval = start + (end - start) * value; + return retval; + } + + private float spring(float start, float end, float value){ + value = Mathf.Clamp01(value); + value = (Mathf.Sin(value * Mathf.PI * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + (1.2f * (1f - value))); + return start + (end - start) * value; + } + + private float easeInQuad(float start, float end, float value){ + end -= start; + return end * value * value + start; + } + + private float easeOutQuad(float start, float end, float value){ + end -= start; + return -end * value * (value - 2) + start; + } + + private float easeInOutQuad(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value + start; + value--; + return -end * 0.5f * (value * (value - 2) - 1) + start; + } + + private float easeInCubic(float start, float end, float value){ + end -= start; + return end * value * value * value + start; + } + + private float easeOutCubic(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value + 1) + start; + } + + private float easeInOutCubic(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value + 2) + start; + } + + private float easeInQuart(float start, float end, float value){ + end -= start; + return end * value * value * value * value + start; + } + + private float easeOutQuart(float start, float end, float value){ + value--; + end -= start; + return -end * (value * value * value * value - 1) + start; + } + + private float easeInOutQuart(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value + start; + value -= 2; + return -end * 0.5f * (value * value * value * value - 2) + start; + } + + private float easeInQuint(float start, float end, float value){ + end -= start; + return end * value * value * value * value * value + start; + } + + private float easeOutQuint(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value * value * value + 1) + start; + } + + private float easeInOutQuint(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value * value * value + 2) + start; + } + + private float easeInSine(float start, float end, float value){ + end -= start; + return -end * Mathf.Cos(value * (Mathf.PI * 0.5f)) + end + start; + } + + private float easeOutSine(float start, float end, float value){ + end -= start; + return end * Mathf.Sin(value * (Mathf.PI * 0.5f)) + start; + } + + private float easeInOutSine(float start, float end, float value){ + end -= start; + return -end * 0.5f * (Mathf.Cos(Mathf.PI * value) - 1) + start; + } + + private float easeInExpo(float start, float end, float value){ + end -= start; + return end * Mathf.Pow(2, 10 * (value - 1)) + start; + } + + private float easeOutExpo(float start, float end, float value){ + end -= start; + return end * (-Mathf.Pow(2, -10 * value ) + 1) + start; + } + + private float easeInOutExpo(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * Mathf.Pow(2, 10 * (value - 1)) + start; + value--; + return end * 0.5f * (-Mathf.Pow(2, -10 * value) + 2) + start; + } + + private float easeInCirc(float start, float end, float value){ + end -= start; + return -end * (Mathf.Sqrt(1 - value * value) - 1) + start; + } + + private float easeOutCirc(float start, float end, float value){ + value--; + end -= start; + return end * Mathf.Sqrt(1 - value * value) + start; + } + + private float easeInOutCirc(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return -end * 0.5f * (Mathf.Sqrt(1 - value * value) - 1) + start; + value -= 2; + return end * 0.5f * (Mathf.Sqrt(1 - value * value) + 1) + start; + } + + /* GFX47 MOD START */ + private float easeInBounce(float start, float end, float value){ + end -= start; + float d = 1f; + return end - easeOutBounce(0, end, d-value) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float bounce(float start, float end, float value){ + private float easeOutBounce(float start, float end, float value){ + value /= 1f; + end -= start; + if (value < (1 / 2.75f)){ + return end * (7.5625f * value * value) + start; + }else if (value < (2 / 2.75f)){ + value -= (1.5f / 2.75f); + return end * (7.5625f * (value) * value + .75f) + start; + }else if (value < (2.5 / 2.75)){ + value -= (2.25f / 2.75f); + return end * (7.5625f * (value) * value + .9375f) + start; + }else{ + value -= (2.625f / 2.75f); + return end * (7.5625f * (value) * value + .984375f) + start; + } + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + private float easeInOutBounce(float start, float end, float value){ + end -= start; + float d = 1f; + if (value < d* 0.5f) return easeInBounce(0, end, value*2) * 0.5f + start; + else return easeOutBounce(0, end, value*2-d) * 0.5f + end*0.5f + start; + } + /* GFX47 MOD END */ + + private float easeInBack(float start, float end, float value){ + end -= start; + value /= 1; + float s = 1.70158f; + return end * (value) * value * ((s + 1) * value - s) + start; + } + + private float easeOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value = (value) - 1; + return end * ((value) * value * ((s + 1) * value + s) + 1) + start; + } + + private float easeInOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value /= .5f; + if ((value) < 1){ + s *= (1.525f); + return end * 0.5f * (value * value * (((s) + 1) * value - s)) + start; + } + value -= 2; + s *= (1.525f); + return end * 0.5f * ((value) * value * (((s) + 1) * value + s) + 2) + start; + } + + private float punch(float amplitude, float value){ + float s = 9; + if (value == 0){ + return 0; + } + else if (value == 1){ + return 0; + } + float period = 1 * 0.3f; + s = period / (2 * Mathf.PI) * Mathf.Asin(0); + return (amplitude * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * 1 - s) * (2 * Mathf.PI) / period)); + } + + /* GFX47 MOD START */ + private float easeInElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return -(a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float elastic(float start, float end, float value){ + private float easeOutElastic(float start, float end, float value){ + /* GFX47 MOD END */ + //Thank you to rafael.marteleto for fixing this as a port over from Pedro's UnityTween + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p * 0.25f; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return (a * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) + end + start); + } + + /* GFX47 MOD START */ + private float easeInOutElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d*0.5f) == 2) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + if (value < 1) return -0.5f * (a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + return a * Mathf.Pow(2, -10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) * 0.5f + end + start; + } + /* GFX47 MOD END */ + + #endregion + + #region Deprecated and Renamed + /* + public static void audioFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioFrom() has been renamed to AudioFrom().");} + public static void audioTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioTo() has been renamed to AudioTo().");} + public static void colorFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorFrom() has been renamed to ColorFrom().");} + public static void colorTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorTo() has been renamed to ColorTo().");} + public static void fadeFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeFrom() has been renamed to FadeFrom().");} + public static void fadeTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeTo() has been renamed to FadeTo().");} + public static void lookFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFrom() has been renamed to LookFrom().");} + public static void lookFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFromWorld() has been deprecated. Please investigate LookFrom().");} + public static void lookTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookTo() has been renamed to LookTo().");} + public static void lookToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdate() has been renamed to LookUpdate().");} + public static void lookToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdateWorld() has been deprecated. Please investigate LookUpdate().");} + public static void moveAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAdd() has been renamed to MoveAdd().");} + public static void moveAddWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveBy() has been renamed to MoveBy().");} + public static void moveByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFrom() has been renamed to MoveFrom().");} + public static void moveFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFromWorld() has been deprecated. Please investigate MoveFrom().");} + public static void moveTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveTo() has been renamed to MoveTo().");} + public static void moveToBezier(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezier() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToBezierWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezierWorld() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdate() has been renamed to MoveUpdate().");} + public static void moveToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdateWorld() has been deprecated. Please investigate MoveUpdate().");} + public static void moveToWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToWorld() has been deprecated. Please investigate MoveTo().");} + public static void punchPosition(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchPosition().");} + public static void punchPositionWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPositionWorld() has been deprecated. Please investigate PunchPosition().");} + public static void punchRotation(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchRotation().");} + public static void punchRotationWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchRotationWorld() has been deprecated. Please investigate PunchRotation().");} + public static void punchScale(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchScale() has been renamed to PunchScale().");} + public static void rotateAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateAdd() has been renamed to RotateAdd().");} + public static void rotateBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateBy() has been renamed to RotateBy().");} + public static void rotateByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateByWorld() has been deprecated. Please investigate RotateBy().");} + public static void rotateFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateFrom() has been renamed to RotateFrom().");} + public static void rotateTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateTo() has been renamed to RotateTo().");} + public static void scaleAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleAdd() has been renamed to ScaleAdd().");} + public static void scaleBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleBy() has been renamed to ScaleBy().");} + public static void scaleFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleFrom() has been renamed to ScaleFrom().");} + public static void scaleTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleTo() has been renamed to ScaleTo().");} + public static void shake(GameObject target, Hashtable args){Debug.LogError("iTween Error: scale() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void shakeWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: shakeWorld() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void stab(GameObject target, Hashtable args){Debug.LogError("iTween Error: stab() has been renamed to Stab().");} + public static void stop(GameObject target, Hashtable args){Debug.LogError("iTween Error: stop() has been renamed to Stop().");} + public static void stopType(GameObject target, Hashtable args){Debug.LogError("iTween Error: stopType() has been deprecated. Please investigate Stop().");} + public static void tweenCount(GameObject target, Hashtable args){Debug.LogError("iTween Error: tweenCount() has been deprecated. Please investigate Count().");} + */ + #endregion +} diff --git a/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta new file mode 100644 index 0000000..591fd5a --- /dev/null +++ b/UnityTests.Unity4/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 521257714fc9e437a9163df2d37f2ea2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/Resources.meta b/UnityTests.Unity4/Assets/Resources.meta new file mode 100644 index 0000000..ff8703e --- /dev/null +++ b/UnityTests.Unity4/Assets/Resources.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c4ba43af0a1577c44aed9e8ee47cbb81 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset b/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset new file mode 100644 index 0000000..defb19b Binary files /dev/null and b/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset differ diff --git a/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset.meta b/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset.meta new file mode 100644 index 0000000..229cbcc --- /dev/null +++ b/UnityTests.Unity4/Assets/Resources/DOTweenSettings.asset.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ce117ac50a01981468b64937132115fa +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/SampleClass.cs b/UnityTests.Unity4/Assets/SampleClass.cs new file mode 100644 index 0000000..120088a --- /dev/null +++ b/UnityTests.Unity4/Assets/SampleClass.cs @@ -0,0 +1,9 @@ +public class SampleClass +{ + public float floatVal; + + public SampleClass(float floatVal) + { + this.floatVal = floatVal; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/SampleClass.cs.meta b/UnityTests.Unity4/Assets/SampleClass.cs.meta new file mode 100644 index 0000000..535e7a2 --- /dev/null +++ b/UnityTests.Unity4/Assets/SampleClass.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5374fed20b767e240973bc047e1c7312 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/SampleCube.prefab b/UnityTests.Unity4/Assets/SampleCube.prefab new file mode 100644 index 0000000..ba31488 Binary files /dev/null and b/UnityTests.Unity4/Assets/SampleCube.prefab differ diff --git a/UnityTests.Unity4/Assets/SampleCube.prefab.meta b/UnityTests.Unity4/Assets/SampleCube.prefab.meta new file mode 100644 index 0000000..f39382d --- /dev/null +++ b/UnityTests.Unity4/Assets/SampleCube.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 569696ae7d0444f4cbcb038d5f6e9ab8 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/SampleMAT.mat b/UnityTests.Unity4/Assets/SampleMAT.mat new file mode 100644 index 0000000..17639ec Binary files /dev/null and b/UnityTests.Unity4/Assets/SampleMAT.mat differ diff --git a/UnityTests.Unity4/Assets/SampleMAT.mat.meta b/UnityTests.Unity4/Assets/SampleMAT.mat.meta new file mode 100644 index 0000000..4ebc617 --- /dev/null +++ b/UnityTests.Unity4/Assets/SampleMAT.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c58c23a68cd685a48a251f4b8c174b49 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets.meta b/UnityTests.Unity4/Assets/Standard Assets.meta new file mode 100644 index 0000000..72aa307 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9b6c3265fe95ef14eb69adc565411c57 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets.meta new file mode 100644 index 0000000..4e16ce4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7e6f84bf81c8d4de280f1133cff7e601 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta new file mode 100644 index 0000000..8ad03b6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: f2af333648c334319bd43c214449ab50 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd new file mode 100644 index 0000000..3ef205f Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta new file mode 100644 index 0000000..fa248b4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 2c528fec5d95e4ac28cf46399b887662 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd new file mode 100644 index 0000000..524c925 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta new file mode 100644 index 0000000..25f7643 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: d6cdc79ec19714fcd980ca3f6ac01a0a +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta new file mode 100644 index 0000000..4a01de4 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cba4562cece794697b418ce8e7c04b3c +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd new file mode 100644 index 0000000..6e22b60 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta new file mode 100644 index 0000000..3efa40d --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 18214e9d6af6248559d501391856f1c7 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd new file mode 100644 index 0000000..b53f25f Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta new file mode 100644 index 0000000..7ae4c98 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: bfd675cc0db1d4656b75dc6d6ba91142 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd new file mode 100644 index 0000000..ac22ca8 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta new file mode 100644 index 0000000..9beda07 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: c6e0767b1f8c34890ac245217f4b9731 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd new file mode 100644 index 0000000..38269a0 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta new file mode 100644 index 0000000..47ceaf7 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 440eb36db91ca410f800ff3cfe43572f +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta new file mode 100644 index 0000000..a682933 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ac865f55780124eeabc4a99d6d0b0115 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta new file mode 100644 index 0000000..9a85322 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5710a1f47af2947699139509aae39149 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta new file mode 100644 index 0000000..e2aefe5 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 527393b10fb66418bbaa072e104f5a30 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat new file mode 100644 index 0000000..51941d4 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta new file mode 100644 index 0000000..21100c6 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5bdb6135a74b444d8cebd065dbf9d08 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat new file mode 100644 index 0000000..b2ee33d Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta new file mode 100644 index 0000000..50c8c92 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3186f38ca67e7441e8299da2e169f9f9 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx new file mode 100644 index 0000000..7e890f6 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta new file mode 100644 index 0000000..8b2b582 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 4c85abd0a4d974473b97e81d10a3a6bc +ModelImporter: + serializedVersion: 16 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: polySurface1 + 11100000: //RootNode + materials: + importMaterials: 1 + materialName: 3 + materialSearch: 1 + animations: + legacyGenerateAnimations: 0 + bakeSimulation: 0 + optimizeGameObjects: 0 + motionNodeName: + animationCompression: 1 + animationRotationError: .5 + animationPositionError: .5 + animationScaleError: .5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + tangentSpace: + normalSmoothAngle: 60 + splitTangentsAcrossUV: 0 + normalImportMode: 0 + tangentImportMode: 1 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: .5 + foreArmTwist: .5 + upperLegTwist: .5 + legTwist: .5 + armStretch: .0500000007 + legStretch: .0500000007 + feetSpacing: 0 + rootMotionBoneName: + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 1 + additionalBone: 1 + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd new file mode 100644 index 0000000..7d219ec Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta new file mode 100644 index 0000000..179de37 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: f7d5f039a8e7848e889e1546d37dc39e +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 1 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd new file mode 100644 index 0000000..efb1392 Binary files /dev/null and b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd differ diff --git a/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta new file mode 100644 index 0000000..8290942 --- /dev/null +++ b/UnityTests.Unity4/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 54e03e659ab274dd9b12c0538a9c4983 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests.meta b/UnityTests.Unity4/Assets/_Tests.meta new file mode 100644 index 0000000..7d6c7d7 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ce8e63e0e1a0163489d2afcce127d357 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Basics.cs b/UnityTests.Unity4/Assets/_Tests/Basics.cs new file mode 100644 index 0000000..43c3811 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Basics.cs @@ -0,0 +1,246 @@ +using DG.Tweening; +using DG.Tweening.Plugins; +using UnityEngine; + +public class Basics : BrainBase +{ + public bool tweenLightAndCam = true; + public int loops = 100000; + public LoopType loopType = LoopType.Yoyo; + public Ease ease = Ease.OutQuad; + public AnimationCurve easeCurve; + public Vector3 toRotation = new Vector3(0, 180, 0); + public Color toCamColor, toLightColor, toSpriteColor; + public Transform[] targets; + public Light mainLight; + public SpriteRenderer spriteRenderer; + public GameObject specularSphere; + public Transform targetToDoLookAt, targetToDoLookFrom; + public GUITexture guiTexAlpha, guiTexColor; + public GUIText txtInfo, txtFloat, txtInt, txtUint, txtVector2, txtVector4, txtRect, txtRectOffset, txtString0, txtString1, txtString2; + public GameObject txtBackwards; + + int intId = 4; + string stringId = "hello"; + Tween[] tweens; + + int intToTween; + uint uintToTween; + float floatToTween; + Vector2 vector2toTween; + Vector4 vector4toTween; + Rect rectToTween; + RectOffset rectOffsetToTween; + string stringToTween0 = "Short text", stringToTween1 = "Long text to show how it gets completely replaced", stringToTween2 = "Relative text... "; + + void Start() + { + DOTween.logBehaviour = LogBehaviour.ErrorsOnly; + + txtInfo.text = txtInfo.text.Replace("#N", loops.ToString("N0")); + + // Set RectOffset since it can't be set before + rectOffsetToTween = new RectOffset(0, 0, 0, 0); + + TweenParams tp = new TweenParams(); + tp.SetLoops(loops, loopType).SetAutoKill(false); + if (ease == Ease.INTERNAL_Custom) tp.SetEase(easeCurve); + else tp.SetEase(ease); + + // Transform tweens + tweens = new Tween[targets.Length - 1]; + for (int i = 0; i < targets.Length; ++i) + { + Transform t = targets[i]; + switch (i) { + case 0: + tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetRelative().SetUpdate(true).SetAutoKill(true); + break; + case 1: + // Red cube (rotation) + tweens[i] = DOTween.To(()=> t.rotation, x=> t.rotation = x, toRotation, 1.5f).SetAs(tp).SetRelative(); + break; + case 2: + tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetOptions(true).SetRelative().SetAutoKill(true); + break; + case 3: + // Vector3Array (not stored) + Vector3[] path = new[] { + new Vector3(1,0,0), new Vector3(0,1,0), new Vector3(1,0,0), new Vector3(0,-1,0) + }; + float[] durations = new[] { 0.5f, 0.5f, 0.5f, 0.5f }; + DOTween.ToArray(() => t.position, x => t.position = x, path, durations) + .SetAs(tp).SetRelative().Pause(); + continue; + } + Tween tween = tweens[i]; + tween.OnStart(()=> Debug.Log("OnStart: " + t.name)) + .OnPlay(()=> Debug.Log("OnPlay: " + t.name)) + .OnPause(()=> Debug.Log("OnPause: " + t.name)) + .OnComplete(()=> Debug.Log("OnComplete: " + t.name)) + .Pause(); + switch (i) { + case 0: + tween.SetId(intId); + // tween.OnStart(()=>tweens[2].Kill()); + break; + case 1: + tween.SetId(stringId); + break; + case 2: + tween.SetId(this); + break; + } + } + // Additional tweens ////////////////////////// + // Float + DOTween.To(()=> floatToTween, x=> floatToTween = x, 100, 1.5f).SetAs(tp).Pause(); + // Int + DOTween.To(()=> intToTween, x=> intToTween = x, 100, 1.5f).SetAs(tp).Pause(); + // Uint + DOTween.To(()=> uintToTween, x=> uintToTween = x, 50, 1.5f).SetAs(tp).Pause(); + // Vector2 + DOTween.To(()=> vector2toTween, x=> vector2toTween = x, new Vector2(50,100), 1.5f).SetAs(tp).Pause(); + // Vector4 + DOTween.To(()=> vector4toTween, x=> vector4toTween = x, new Vector4(50,100,150,200), 1.5f).SetAs(tp).Pause(); + // Rect + DOTween.To(()=> rectToTween, x=> rectToTween = x, new Rect(10, 20, 50, 100), 1.5f).SetAs(tp).Pause(); + // RectOffset + DOTween.To(()=> rectOffsetToTween, x=> rectOffsetToTween = x, new RectOffset(10, 20, 50, 100), 1.5f).SetAs(tp).Pause(); + // Color + DOTween.To(()=> guiTexColor.color, x=> guiTexColor.color = x, Color.green, 1.5f).SetAs(tp).Pause(); + // Alpha + DOTween.ToAlpha(()=> guiTexAlpha.color, x=> guiTexAlpha.color = x, 0f, 1.5f).SetAs(tp).Pause(); + // String + DOTween.To(()=> stringToTween0, x=> stringToTween0 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause(); + // String + DOTween.To(()=> stringToTween1, x=> stringToTween1 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause(); + // String (relative) + DOTween.To(()=> stringToTween2, x=> stringToTween2 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).SetRelative().Pause(); + if (tweenLightAndCam) { + // Camera + Camera.main.DOColor(toCamColor, 1.5f).SetAs(tp).Pause(); + // Light + mainLight.DOColor(toLightColor, 1.5f).SetAs(tp).Pause(); + mainLight.DOIntensity(4, 1.5f).SetAs(tp).Pause(); + } + // SpriteRenderer + spriteRenderer.DOColor(toSpriteColor, 1.5f).SetAs(tp).Pause(); + // Specular material tween + specularSphere.renderer.material.DOColor(Color.green, "_SpecColor", 1.5f).SetAs(tp).Pause(); + // Rotate towards + targetToDoLookAt.DOLookAt(specularSphere.transform.position, 1.5f).SetAs(tp).Pause(); + targetToDoLookFrom.DOLookAt(specularSphere.transform.position, 1.5f).From().SetAs(tp).Pause(); + } + + void LateUpdate() + { + txtFloat.text = "float: " + floatToTween; + txtInt.text = "int: " + intToTween; + txtUint.text = "uint: " + uintToTween; + txtVector2.text = "Vector2: " + vector2toTween; + txtVector4.text = "Vector4: " + vector4toTween; + txtRect.text = "Rect: " + rectToTween; + txtRectOffset.text = "RectOffset: " + rectOffsetToTween; + txtString0.text = "String 0: " + stringToTween0; + txtString1.text = "String 1: " + stringToTween1; + txtString2.text = "String 2: " + stringToTween2; + + bool isBackwards = tweens[1] != null && tweens[1].IsBackwards(); + if (isBackwards && !txtBackwards.activeSelf || !isBackwards && txtBackwards.activeSelf) { + txtBackwards.SetActive(!txtBackwards.activeSelf); + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play All")) Debug.Log("Played tweens: " + DOTween.PlayAll()); + if (GUILayout.Button("Pause All")) Debug.Log("Paused tweens: " + DOTween.PauseAll()); + if (GUILayout.Button("Kill All")) Debug.Log("Killed tweens: " + DOTween.KillAll()); + if (GUILayout.Button("Complete+Kill All")) Debug.Log("Killed tweens: " + DOTween.KillAll(true)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Rewind All")) Debug.Log("Rewinded tweens: " + DOTween.RewindAll()); + if (GUILayout.Button("Restart All")) Debug.Log("Restarted tweens: " + DOTween.RestartAll()); + if (GUILayout.Button("Complete All")) Debug.Log("Completed tweens: " + DOTween.CompleteAll()); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("PlayForward All")) Debug.Log("PlayForwarded tweens: " + DOTween.PlayForwardAll()); + if (GUILayout.Button("PlayBackwards All")) Debug.Log("PlayBackwarded tweens: " + DOTween.PlayBackwardsAll()); + if (GUILayout.Button("Flip All")) Debug.Log("Flipped tweens: " + DOTween.FlipAll()); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto 1.5 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(1.5f)); + if (GUILayout.Button("Goto 3 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(3)); + if (GUILayout.Button("Goto 4.5 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(4.5f)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play by Id")) Debug.Log("Played tweens: " + DOTween.Play(intId)); + if (GUILayout.Button("Play by StringId")) Debug.Log("Played tweens: " + DOTween.Play(stringId)); + if (GUILayout.Button("Play by UnityObjectId")) Debug.Log("Played tweens: " + DOTween.Play(this)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Pause by Id")) Debug.Log("Paused tweens: " + DOTween.Pause(intId)); + if (GUILayout.Button("Pause by StringId")) Debug.Log("Paused tweens: " + DOTween.Pause(stringId)); + if (GUILayout.Button("Pause by UnityObjectId")) Debug.Log("PlaPausedyed tweens: " + DOTween.Pause(this)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Kill by Id")) Debug.Log("Killed tweens: " + DOTween.Kill(intId)); + if (GUILayout.Button("Complete+Kill by Id")) Debug.Log("Killed tweens: " + DOTween.Kill(intId, true)); + if (GUILayout.Button("Kill by StringId")) Debug.Log("Killed tweens: " + DOTween.Kill(stringId)); + if (GUILayout.Button("Kill by UnityObjectId")) Debug.Log("Killed tweens: " + DOTween.Kill(this)); + if (GUILayout.Button("Clear")) { + Debug.Log(":::::::::::: CLEAR"); + DOTween.Clear(); + } + if (GUILayout.Button("Clear & Reload")) { + Debug.Log(":::::::::::: CLEAR AND RELOAD"); + int level = Application.loadedLevel; + DOTween.Clear(); + Application.LoadLevel(level); + } + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + if (GUILayout.Button("Direct Kill")) t.Kill(); + } + GUILayout.EndHorizontal(); + + GUILayout.Space(5); + + GUILayout.Label("Global DOTween Timescale"); + GUILayout.BeginHorizontal(); + DOTween.timeScale = GUILayout.HorizontalSlider(DOTween.timeScale, 0.0f, 20.0f); + if (GUILayout.Button("Reset", GUILayout.Width(80))) DOTween.timeScale = 1; + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + for (int i = 0; i < tweens.Length; ++i) GUILayout.Label("Single Timescale"); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + t.timeScale = GUILayout.HorizontalSlider(t.timeScale, 0.0f, 20.0f, GUILayout.Width(60)); + if (GUILayout.Button("Reset", GUILayout.Width(80))) t.timeScale = 1; + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + GUILayout.Label("Elapsed: " + t.Elapsed(false) + + "\nFullElapsed: " + t.Elapsed() + + "\nElapsed %: " + t.ElapsedPercentage(false) + + "\nFullElapsed %: " + t.ElapsedPercentage() + + "\nCompleted Loops: " + t.CompletedLoops() + ); + } + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Basics.cs.meta b/UnityTests.Unity4/Assets/_Tests/Basics.cs.meta new file mode 100644 index 0000000..d491b9d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Basics.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a621cf8dd34803b4aa9f54590cd19c4d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Basics.unity b/UnityTests.Unity4/Assets/_Tests/Basics.unity new file mode 100644 index 0000000..77538d2 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Basics.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Basics.unity.meta b/UnityTests.Unity4/Assets/_Tests/Basics.unity.meta new file mode 100644 index 0000000..ef35012 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Basics.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fcbe7ea1e13cc024c822bc5ed6e7e751 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs.meta new file mode 100644 index 0000000..9c66c44 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 857866c1bf6ef0b4f906c2f07a781b5f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs new file mode 100644 index 0000000..0be7203 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class AddTweenIndexOutOfRange : BrainBase +{ + public GameObject prefab; + public Transform container; + public int totObjs = 300; + + Transform[] ts; + + void Start() + { + ts = new Transform[totObjs]; + for (int i = 0; i < totObjs; ++i) { + GameObject go = Instantiate(prefab) as GameObject; + go.transform.position = RandomV3(); + go.transform.parent = container; + ts[i] = go.transform; + } + } + + void OnGUI() + { + if (GUILayout.Button("Tween")) CreateTweens(); + if (GUILayout.Button("Kill All & Create Tweens")) { + DOTween.KillAll(); + CreateTweens(); + } + if (GUILayout.Button("Kill All & Create Tweens Combo")) { + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + } + if (GUILayout.Button("Kill All")) DOTween.KillAll(); + } + + void CreateTweens() + { + foreach (Transform trans in ts) trans.DOMove(RandomV3(), 2).SetLoops(-1, LoopType.Yoyo); + } + + Vector3 RandomV3() + { + const float range = 7; + return new Vector3(Random.Range(-range,range), Random.Range(-range,range), Random.Range(-range,range)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta new file mode 100644 index 0000000..16ae95c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8158f403c14d8ce42bc9e62a26d0b911 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity new file mode 100644 index 0000000..61a1782 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta new file mode 100644 index 0000000..085625d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 696584990385c1741970de5d0e4a3aec +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs new file mode 100644 index 0000000..bb14352 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs @@ -0,0 +1,20 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class AppendLookAt : MonoBehaviour +{ + public Transform target, lookAtTarget, moveToTarget; + + void Start() + { + DOTween.Sequence() + .Append(target.DOMove(moveToTarget.position,3,false)) + .Append(target.DOLookAt(lookAtTarget.position,3)); + + // DOTween.Sequence() + // .Append(target.DORotate(new Vector3(0, 180, 0), 1).SetRelative()) + // .Append(target.DOMoveX(-3, 1).SetRelative()) + // .Append(target.DORotate(new Vector3(0, 45, 0), 1).SetRelative()); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs.meta new file mode 100644 index 0000000..1e2146e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6778be44d281eda4d8fef812dfdebc18 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity new file mode 100644 index 0000000..141d453 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity.meta new file mode 100644 index 0000000..22f0795 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/AppendLookAt.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 147f778e86d76aa42b4bb2c2c9749ec9 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs new file mode 100644 index 0000000..663f403 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class ElasticDragAndRelease : MonoBehaviour +{ + public Transform target; + Vector3 orPos; + + void Start() + { + orPos = target.position; + } + + public void OnClick() + { + StartCoroutine(TweenCoroutine()); + } + + IEnumerator TweenCoroutine() + { + float range = 2; + Vector3 rnd = new Vector3(Random.Range(-range, range), Random.Range(-range, range), target.position.z); + target.position = orPos + rnd; + + yield return new WaitForSeconds(1); + + target.DOMove(orPos, 0.6f).SetEase(Ease.OutElastic, 4, 0); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta new file mode 100644 index 0000000..a28e0b2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3cfc6eb13ec575448bb58d1358e883b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity new file mode 100644 index 0000000..698a982 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta new file mode 100644 index 0000000..c527c14 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8a65a6b7b38cedf48855da0e69f45f6d +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs new file mode 100644 index 0000000..0f696ef --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs @@ -0,0 +1,17 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class KillVSKillTarget : MonoBehaviour +{ + public Transform[] targets; + + void Start() + { + targets[0].DOMoveX(2, 2).SetRelative().SetId(1); + targets[1].DOMoveY(2, 2).SetRelative(); + DOTween.Kill(targets[0]); + // DOTween.Kill(1); + // DOTween.Kill(null); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta new file mode 100644 index 0000000..0d2b13b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b70fff205e943c04786cfabc9a30e7f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity new file mode 100644 index 0000000..b06f9af Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta new file mode 100644 index 0000000..17d469b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3c9eec1da265e14478c514b4bf542423 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs new file mode 100644 index 0000000..ba143e9 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs @@ -0,0 +1,25 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class MultipleAxisRotation : MonoBehaviour +{ + public Transform target; + + void Update() + { + if (Input.GetKeyDown(KeyCode.LeftArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.RightArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(0, -90, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.UpArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.DownArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(-90, 0, 0), 1, RotateMode.LocalAxisAdd); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta new file mode 100644 index 0000000..2eabb12 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7afc1b695ba06204abc91b0d911ae17e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity new file mode 100644 index 0000000..ee7f844 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta new file mode 100644 index 0000000..5168c08 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 84109798bbec4c649965f4e489436325 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs new file mode 100644 index 0000000..aac5efb --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs @@ -0,0 +1,19 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class OnCompleteCreateNewTween : BrainBase +{ + public Transform target; + + void Start() + { + MakeTween(); + } + + void MakeTween() + { + target.position = Vector3.zero; + target.DOMoveX(3, 0.1f).SetRelative().OnComplete(MakeTween); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta new file mode 100644 index 0000000..5de8ed2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 244f01ea47e9ad246ad446f8abbbafb3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity new file mode 100644 index 0000000..56f4247 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta new file mode 100644 index 0000000..f072634 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2fbd785dc6b7ab6488ed3f24ad941696 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs new file mode 100644 index 0000000..7615a53 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs @@ -0,0 +1,22 @@ +using DG.Tweening; +using UnityEngine; + +public class PersistentComponent : BrainBase +{ + public Transform target; + + void OnDestroy() + { + Debug.Log("OnDestroy > Create tween"); + target.DOMoveX(3, 1); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Init")) DOTween.Init(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs.meta new file mode 100644 index 0000000..fb1de77 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdedd283199aaf34fa0a6bbabef2462b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity new file mode 100644 index 0000000..d7bcc01 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity.meta new file mode 100644 index 0000000..875adc4 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/PersistentComponent.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c89f9107ee8671b4aa4249f7522cfff3 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs new file mode 100644 index 0000000..afd5d41 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs @@ -0,0 +1,25 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class ReloadWithTimeScale0 : BrainBase +{ + public Transform target; + public bool independentUpdate; + + void Start() + { + Time.timeScale = 1; + target.DOMoveX(4, 2).SetRelative().SetUpdate(independentUpdate); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Set TimeScale to 0")) Time.timeScale = 0; + if (GUILayout.Button("Set TimeScale to 1")) Time.timeScale = 1; + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta new file mode 100644 index 0000000..41c55ca --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e379a3bcdd72854bab4fc01615e376b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity new file mode 100644 index 0000000..02c8a7a Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta new file mode 100644 index 0000000..f440971 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 735c78eb1e9d4654c9d7059a76dc74fd +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs new file mode 100644 index 0000000..dc25694 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class SequenceKillAndComplete : BrainBase +{ + public Transform target; + + Sequence sequence; + + IEnumerator Start() + { + sequence = DOTween.Sequence(); + sequence.Append(target.DOMoveX(3, 3).SetRelative()); + sequence.Join(target.DOMoveY(3, 3).SetRelative()); + + yield return new WaitForSeconds(1.5f); + + sequence.Kill(true); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta new file mode 100644 index 0000000..ccf637d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0fe1b1e1a0a7d344da6735c628e05d5b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity new file mode 100644 index 0000000..fb746ce Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta new file mode 100644 index 0000000..8bf0788 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 27f5b9d0bf456cd448c751c9108a2c5f +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs new file mode 100644 index 0000000..c72ff96 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs @@ -0,0 +1,28 @@ +using DG.Tweening; +using UnityEngine; +using UnityEngine.UI; +using System.Collections; + +public class Temp : MonoBehaviour +{ + void Start() + { + SpriteRenderer sprite = this.GetComponent(); + + DOTween.To( + () => sprite.color, + x => sprite.color = x, + new Color(sprite.color.r, + sprite.color.g, + sprite.color.b, + 0), + 0.2f).SetId("instructions").SetLoops(6, LoopType.Yoyo).OnComplete(OnComplete); + } + + void OnComplete() + { + DOTween.Kill("instructions"); + if(gameObject) + Destroy(gameObject); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs.meta new file mode 100644 index 0000000..4ac802a --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10b78de0ac241344fae8dae397a30133 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity new file mode 100644 index 0000000..ed1d7ca Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity.meta new file mode 100644 index 0000000..e6c74ce --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/Temp.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a49b8d05a761ad94194b140cf5b3e5d5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs new file mode 100644 index 0000000..0177d0f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs @@ -0,0 +1,7 @@ +using UnityEngine; +using System.Collections; + +public class TempMonoBehaviour : MonoBehaviour +{ + public float fval = 0; +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta new file mode 100644 index 0000000..71737d2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 72e758936dff21a40b1eec97be3ab362 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs new file mode 100644 index 0000000..df83d7d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class TweenCreationInCoroutine : BrainBase +{ + public Transform[] targets; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + for (int i = 0; i < targets.Length; ++i) { + // Doesnt work + Transform t = targets[i]; + // DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 2, 0), 1).SetRelative(); + t.DOMove(new Vector3(0, 2, 0), 1).SetRelative(); + } + // CreateTweens(); + } + + void CreateTweens() + { + // Works + for (int i = 0; i < targets.Length; ++i) { + Transform t = targets[i]; + DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 2, 0), 1).SetRelative(); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta new file mode 100644 index 0000000..90dd331 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 127bad5ad29e6ff4a8046375cc08a085 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity new file mode 100644 index 0000000..ce42a01 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta new file mode 100644 index 0000000..a94aaee --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 03423029b27428e4b8d43fab41200ed7 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs new file mode 100644 index 0000000..c0eaa22 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; + +public class TweenDuration : BrainBase +{ + public Transform target; + + void Start() + { + Tween(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Tween")) Tween(); + + DGUtils.EndGUI(); + } + + void Tween() + { + float startTime = Time.realtimeSinceStartup; + target.DOMove(target.position + new Vector3(1, 2, 1), 1) + .OnStart(()=> Debug.Log("START > " + (Time.realtimeSinceStartup - startTime))) + .OnUpdate(()=> Debug.Log("UPDATE > frameCount: " + Time.frameCount)) + .OnComplete(()=> Debug.Log("COMPLETE > " + (Time.realtimeSinceStartup - startTime))); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs.meta new file mode 100644 index 0000000..a01dbe3 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23b91610ba159ad4ab4637e369ccece5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity new file mode 100644 index 0000000..0e8e55b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity.meta new file mode 100644 index 0000000..e3f3a5e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenDuration.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1ee0035aa7676a544944cb358d51e787 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs new file mode 100644 index 0000000..2c0d5fd --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs @@ -0,0 +1,42 @@ +using DG.Tweening; +using UnityEngine; + +public class TweenLookAt : BrainBase +{ + public AxisConstraint axisConstraint; + public Transform target, lookAtTarget; + + Quaternion targetOrRot; + Vector3 lookAtPos; + + void Start() + { + targetOrRot = target.rotation; + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("LookAt")) { + // target.DOLookAt(lookAtTarget.position, 0.15f, axisConstraint, Vector3.up); + + lookAtPos = lookAtTarget.position; + lookAtPos = target.InverseTransformPoint(lookAtPos); + // lookAtPos.y = 0; + lookAtPos = target.TransformPoint(lookAtPos); + target.LookAt(lookAtPos, target.up); + } + if (GUILayout.Button("Reset")) target.rotation = targetOrRot; + + DGUtils.EndGUI(); + } + + void OnDrawGizmos() + { + // Gizmos.DrawLine(target.position, lookAtTarget.position); + + Gizmos.color = Color.red; + Gizmos.DrawLine(target.position, lookAtPos); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs.meta new file mode 100644 index 0000000..8ae6f37 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce9894082c906d54fb4278d80c469b88 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity new file mode 100644 index 0000000..df37bc1 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity.meta b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity.meta new file mode 100644 index 0000000..8c11846 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Bugs/TweenLookAt.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2bdb92d1c6d866f4a891506d53b3376e +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs new file mode 100644 index 0000000..10a7171 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs @@ -0,0 +1,20 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class CallbacksOnlySequence : BrainBase +{ + public Transform target; + + void Start() + { + DOTween.Sequence() + .OnComplete(()=>Debug.Log(target.position.x.ToString("N10"))) + // .SetLoops(3, LoopType.Yoyo) + // .SetLoops(3) + .AppendCallback(()=> Debug.Log("[" + Time.realtimeSinceStartup + "] Callback 0")) + .AppendInterval(1) + // .Append(target.DOMoveX(1, 0.05f).SetRelative()) + .AppendCallback(()=> Debug.Log("[" + Time.realtimeSinceStartup + "] Callback FINAL")); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs.meta b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs.meta new file mode 100644 index 0000000..4c2bed1 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e20cc2cc14b6aff438c7792cc55de3c5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity new file mode 100644 index 0000000..19e1564 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity.meta b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity.meta new file mode 100644 index 0000000..6a2df7c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CallbacksOnlySequence.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1fed93f4e807dab4e8d043ca4526bced +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Clone.cs b/UnityTests.Unity4/Assets/_Tests/Clone.cs new file mode 100644 index 0000000..b1eee8c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Clone.cs @@ -0,0 +1,31 @@ +using DG.Tweening; +using UnityEngine; + +public class Clone : BrainBase +{ + public GameObject prefab; + public AnimationCurve animCurve; + + void Start() + { + Transform t = NewTransform(); + Tween tween = t.DOMoveY(5f, 1) + .SetDelay(2f) + .SetRelative() + .SetEase(animCurve) + .OnStart(()=> Debug.Log("OnStart")) + .SetLoops(-1, LoopType.Yoyo); + for (int i = 0; i < 4; ++i) { + t = NewTransform(); + Transform t2 = t; + t2.DOMoveY(5f, 1).SetAs(tween); + } + } + + Transform NewTransform() + { + Transform t = ((GameObject)Instantiate(prefab)).transform; + t.position = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)); + return t; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Clone.cs.meta b/UnityTests.Unity4/Assets/_Tests/Clone.cs.meta new file mode 100644 index 0000000..2749b6c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Clone.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fc0a0c23ad59c54398a17eddc720cd0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Clone.unity b/UnityTests.Unity4/Assets/_Tests/Clone.unity new file mode 100644 index 0000000..f6016c5 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Clone.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Clone.unity.meta b/UnityTests.Unity4/Assets/_Tests/Clone.unity.meta new file mode 100644 index 0000000..11f36e5 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Clone.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ddf80ce391cc562479047f67ce99079b +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Coroutines.cs b/UnityTests.Unity4/Assets/_Tests/Coroutines.cs new file mode 100644 index 0000000..fa49653 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Coroutines.cs @@ -0,0 +1,74 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Coroutines : BrainBase +{ + public Transform[] targets; + + void Start() + { + foreach (Transform t in targets) { + Tween tween = t.DOMove(new Vector3(Random.Range(10f, 10f), Random.Range(10f, 10f), 0), 2f).SetLoops(3).Pause(); + StartCoroutine(WaitForCompletion(t, tween)); + StartCoroutine(WaitForRewind(t, tween)); + StartCoroutine(WaitForKill(t, tween)); + StartCoroutine(WaitForStart(t, tween)); + StartCoroutine(WaitForElapsedLoops(t, tween)); + StartCoroutine(WaitForPosition(t, tween)); + } + } + + IEnumerator WaitForCompletion(Transform t, Tween tween) + { + yield return tween.WaitForCompletion(); + + Debug.Log(t + " complete"); + } + + IEnumerator WaitForRewind(Transform t, Tween tween) + { + yield return tween.WaitForRewind(); + + Debug.Log(t + " rewinded"); + } + + IEnumerator WaitForKill(Transform t, Tween tween) + { + yield return tween.WaitForKill(); + + Debug.Log(t + " killed"); + } + + IEnumerator WaitForElapsedLoops(Transform t, Tween tween) + { + yield return tween.WaitForElapsedLoops(2); + + Debug.Log(t + " loops elapsed"); + } + + IEnumerator WaitForPosition(Transform t, Tween tween) + { + yield return tween.WaitForPosition(3.5f); + + Debug.Log(t + " position reached"); + } + + IEnumerator WaitForStart(Transform t, Tween tween) + { + yield return tween.WaitForStart(); + + Debug.Log(t + " started"); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Play")) DOTween.PlayAll(); + if (GUILayout.Button("Kill")) DOTween.KillAll(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Coroutines.cs.meta b/UnityTests.Unity4/Assets/_Tests/Coroutines.cs.meta new file mode 100644 index 0000000..4e87b84 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Coroutines.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2af5300fe59f6b841b1dd64964bff266 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Coroutines.unity b/UnityTests.Unity4/Assets/_Tests/Coroutines.unity new file mode 100644 index 0000000..cb0a380 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Coroutines.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Coroutines.unity.meta b/UnityTests.Unity4/Assets/_Tests/Coroutines.unity.meta new file mode 100644 index 0000000..f64d95c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Coroutines.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4d31163086b70424994035f87ad10213 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example.meta b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example.meta new file mode 100644 index 0000000..1db83cc --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 94fe2615fb2eb4d4c93cb7ae6e77d5ad +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity new file mode 100644 index 0000000..be74781 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta new file mode 100644 index 0000000..86a3f2f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fe402d14dcffa8347be8e541d667ef7b +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs new file mode 100644 index 0000000..fed5cd6 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using DG.Tweening.Plugins; +using UnityEngine; + +public class CustomPluginExampleBrain : BrainBase +{ + public Transform target; + + void Start() + { + // DOTween.To(()=>target.position, x=> target.position = x, new Vector3(4, 4, 0), 1.5f) + // DOTween.To(new PlugCustomPlugin(()=>target.position, x=> target.position = x, 4), 1.5f) + // .SetDelay(2).SetRelative().SetLoops(5, LoopType.Yoyo).SetAutoKill(false) + // .OnStart(()=> Debug.Log("Start")) + // .OnStepComplete(()=> Debug.Log("Step Complete")) + // .OnComplete(()=> Debug.Log("Complete")); + } + + void OnGUI() + { + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta new file mode 100644 index 0000000..ffa3dd2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 550efdefde1a031469b9f78b16066882 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs new file mode 100644 index 0000000..928b04b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs @@ -0,0 +1,73 @@ +using DG.Tweening; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using System; +using UnityEngine; + +public struct PlugCustomPlugin : IPlugSetter +{ + readonly Vector3 _endValue; + readonly DOGetter _getter; + readonly DOSetter _setter; + + public PlugCustomPlugin(DOGetter getter, DOSetter setter, float endValue) + { + _getter = getter; + _setter = setter; + _endValue = new Vector3(endValue, 0, 0); + } + + public DOGetter Getter() { return _getter; } + public DOSetter Setter() { return _setter; } + public Vector3 EndValue() { return _endValue; } + public NoOptions GetOptions() { return new NoOptions(); } +} + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// ||| CLASS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +public class CustomPlugin : ABSTweenPlugin +{ + public override void Reset(TweenerCore t) {} + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector3 prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + t.setter(t.startValue); + } + + public override Vector3 ConvertToStartValue(TweenerCore t, Vector3 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue = t.startValue + t.changeValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, Vector3 changeValue) + { + float res = changeValue.magnitude / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) + { + Vector3 res = getter(); + float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + res.x = startValue.x + changeValue.x * easeVal; + setter(res); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta new file mode 100644 index 0000000..58744b5 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af2497efc5625554ba3ad4d45cdad868 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs b/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs new file mode 100644 index 0000000..5a989f6 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs @@ -0,0 +1,92 @@ +using System; +using DG.Tweening; +using System.Collections; +using UnityEngine; +using UnityEngine.UI; + +public class EaseCurves : BrainBase +{ + public RawImage image; + public AnimationCurve easeCurve; + public float tweenDuration = 1; + public int txDistance = 2; + + int txH, txW; + int txBorder, easeH; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + Setup(); + } + + void Setup() + { + RectTransform rt = image.GetComponent(); + txW = (int)rt.sizeDelta.x; + txH = (int)rt.sizeDelta.y; + easeH = (int)(txH * 0.35f); + txBorder = (int)((txH - easeH) * 0.5f); + Color32[] colors = new Color32[txW * txH]; + for (int c = 0; c < colors.Length; ++c) colors[c] = new Color(0.1f, 0.1f, 0.1f, 1); + int lineP = txBorder * txW; + for (int c = lineP; c < lineP + txW; ++c) { + colors[c] = new Color(0.25f, 0.25f, 0.25f, 1); + colors[c + txW * easeH] = new Color(0.25f, 0.25f, 0.25f, 1); + } + + // Create a tween for each easeType + int totTypes = Enum.GetNames(typeof(Ease)).Length; + int distX = txW; + int distY = txH; + int totCols = Screen.width / txW - 1; + float startX = image.transform.position.x; + float startY = image.transform.position.y; + Vector2 gridCount = Vector2.zero; + for (int i = 0; i < totTypes + 1; ++i) { + // Instantiate and position new Images + Transform t = ((GameObject)Instantiate(image.gameObject)).transform; + t.SetParent(image.transform.parent); + t.position = new Vector3(startX + distX * gridCount.x + txDistance * gridCount.x, startY - distY * gridCount.y - txDistance * gridCount.y, 0); + gridCount.x++; + if (gridCount.x > totCols) { + gridCount.y++; + gridCount.x = 0; + } + // Set textures + Texture2D tx = new Texture2D(txW, txH, TextureFormat.ARGB32, false); + tx.filterMode = FilterMode.Point; + tx.SetPixels32(colors); + tx.Apply(); + RawImage img = t.GetComponent(); + img.texture = tx; + // Set tween and text + Ease easeType = (Ease)i; + float val = txBorder; + Tween tween = DOTween.To(() => val, x => val = x, txBorder + easeH, tweenDuration).SetDelay(1); + tween.OnUpdate(() => SetTextureEase(easeType, tx, tween.Elapsed(), (int)val)); + if (i == totTypes) { + img.GetComponentInChildren().text = "custom"; + tween.SetEase((time, duration, overshootOrAmplitude, period)=> { + return (float)Math.Sin(time /= duration) / (float)Math.Cos(time /= duration); + }); + } else { + img.GetComponentInChildren().text = easeType.ToString(); + if (easeType == Ease.INTERNAL_Custom) tween.SetEase(easeCurve); + else tween.SetEase(easeType); + } + } + // Disable original image + image.gameObject.SetActive(false); + } + + void SetTextureEase(Ease easeType, Texture2D tx, float elapsed, int y) + { + int x = (int)((txW - 1) * (elapsed / tweenDuration)); + if (y > txH - 1 || y < 0) return; // elastic/back eases + + tx.SetPixel(x, y, Color.white); + tx.Apply(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs.meta b/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs.meta new file mode 100644 index 0000000..7d37807 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/EaseCurves.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6e9584ee56ace64b9acf3120773f925 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity b/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity new file mode 100644 index 0000000..1078ddf Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity.meta b/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity.meta new file mode 100644 index 0000000..7eebc07 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/EaseCurves.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ab832caaf1412b246a8e3869250cd45c +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Eases.cs b/UnityTests.Unity4/Assets/_Tests/Eases.cs new file mode 100644 index 0000000..7b78600 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Eases.cs @@ -0,0 +1,35 @@ +using DG.Tweening; +using System; +using UnityEngine; + +public class Eases : BrainBase +{ + public GameObject prefab; + public AnimationCurve easeCurve; + + void Start() + { + // Create a tween for each easeType + int totTypes = Enum.GetNames(typeof(Ease)).Length; + const int distX = 2; + const int distY = 6; + const int totCols = 10; + float startX = -((totCols * distX) * 0.5f); + float startY = (int)(totTypes / totCols) * distY * 0.5f; + Vector2 gridCount = Vector2.zero; + for (int i = 0; i < totTypes; ++i) { + Transform t = ((GameObject)Instantiate(prefab)).transform; + t.position = new Vector3(startX + distX * gridCount.x, startY - distY * gridCount.y, 0); + gridCount.x++; + if (gridCount.x > totCols) { + gridCount.y++; + gridCount.x = 0; + } + Tween tween = t.DOMoveY(2, 1).SetRelative().SetLoops(-1, LoopType.Yoyo); + Ease easeType = (Ease)i; + Debug.Log(i + ", " + easeType); + if (easeType == Ease.INTERNAL_Custom) tween.SetEase(easeCurve); + else tween.SetEase(easeType); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Eases.cs.meta b/UnityTests.Unity4/Assets/_Tests/Eases.cs.meta new file mode 100644 index 0000000..50c9ece --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Eases.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d68cd89c84431274a9744a953a3a2a44 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Eases.unity b/UnityTests.Unity4/Assets/_Tests/Eases.unity new file mode 100644 index 0000000..0f28038 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Eases.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Eases.unity.meta b/UnityTests.Unity4/Assets/_Tests/Eases.unity.meta new file mode 100644 index 0000000..fdc9432 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Eases.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 65158459aebf1704daf4caba3ee3ed3b +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/From.cs b/UnityTests.Unity4/Assets/_Tests/From.cs new file mode 100644 index 0000000..25915d3 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/From.cs @@ -0,0 +1,34 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class From : BrainBase +{ + public GameObject prefab; + + Transform t; + + void LateUpdate() + { + if (t != null) Debug.Log(">>> " + t.position); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("New FROM")) FromTween(); + + DGUtils.EndGUI(); + } + + void FromTween() + { + t = ((GameObject)Instantiate(prefab)).transform; + t.DOMove(new Vector3(0, 2, 0), 1) + .From() + .OnKill(() => Destroy(t.gameObject)); + + Debug.Log(t.position); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/From.cs.meta b/UnityTests.Unity4/Assets/_Tests/From.cs.meta new file mode 100644 index 0000000..0983a32 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/From.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 350ccf9fa0f06cf4b8cbcda8552199ab +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/From.unity b/UnityTests.Unity4/Assets/_Tests/From.unity new file mode 100644 index 0000000..5d6bb5f Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/From.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/From.unity.meta b/UnityTests.Unity4/Assets/_Tests/From.unity.meta new file mode 100644 index 0000000..e5551f6 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/From.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 43b284bfbb56388479e1f04f912b9123 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Ids.cs b/UnityTests.Unity4/Assets/_Tests/Ids.cs new file mode 100644 index 0000000..c126256 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Ids.cs @@ -0,0 +1,53 @@ +using DG.Tweening; +using UnityEngine; + +public class Ids : BrainBase +{ + public GameObject prefab; + + Transform[] ts; + + void Start() + { + ts = new Transform[3]; + float startX = -3; + for (int i = 0; i < 3; ++i) { + Transform t = ((GameObject)Instantiate(prefab)).transform; + ts[i] = t; + t.position = new Vector3(startX + 3 * i, 0, 0); + Tween tween = t.DOMoveY(4, 1).SetLoops(-1, LoopType.Yoyo); + switch (i) { + case 0: + tween.SetId(0); + break; + case 1: + tween.SetId("string"); + break; + case 2: + tween.SetId(this); + break; + } + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + GUILayout.Space(50); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause by Id")) DOTween.TogglePause(0); + if (GUILayout.Button("TogglePause by StringId")) DOTween.TogglePause("string"); + if (GUILayout.Button("TogglePause by ObjId")) DOTween.TogglePause(this); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause by Transform (0)")) DOTween.TogglePause(ts[0]); + if (GUILayout.Button("TogglePause by Transform (1)")) DOTween.TogglePause(ts[1]); + // This won't work because target was changed by applying a different objId + if (GUILayout.Button("TogglePause by Transform (2)")) DOTween.TogglePause(ts[2]); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Ids.cs.meta b/UnityTests.Unity4/Assets/_Tests/Ids.cs.meta new file mode 100644 index 0000000..ea4f0f2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Ids.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 965349a46531ac94b8febb892226c312 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Ids.unity b/UnityTests.Unity4/Assets/_Tests/Ids.unity new file mode 100644 index 0000000..81f0672 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Ids.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Ids.unity.meta b/UnityTests.Unity4/Assets/_Tests/Ids.unity.meta new file mode 100644 index 0000000..039f838 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Ids.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c14641586e8c0e04881d0bfd0ef61751 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Loops.cs b/UnityTests.Unity4/Assets/_Tests/Loops.cs new file mode 100644 index 0000000..b95d70f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Loops.cs @@ -0,0 +1,18 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Loops : BrainBase +{ + public Transform[] targets; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + Vector3 rot = new Vector3(0, 0, 45); + targets[0].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Restart); + targets[1].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo); + targets[2].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Incremental); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Loops.cs.meta b/UnityTests.Unity4/Assets/_Tests/Loops.cs.meta new file mode 100644 index 0000000..bf714ff --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Loops.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b58c3976284ff642892a7340898e445 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Loops.unity b/UnityTests.Unity4/Assets/_Tests/Loops.unity new file mode 100644 index 0000000..c827bae Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Loops.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Loops.unity.meta b/UnityTests.Unity4/Assets/_Tests/Loops.unity.meta new file mode 100644 index 0000000..a6d2aeb --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Loops.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 85d2b1fa3aefe5646af1df95601a306a +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs new file mode 100644 index 0000000..c2548d2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs @@ -0,0 +1,53 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class PathWaypointReached : BrainBase +{ + public Vector3[] waypoints; + public float duration = 5; + public bool relative = true; + public bool closedPath; + public PathType pathType; + public LoopType loopType; + public int loops = -1; + public Transform[] targets; + + Tween[] pathTweens; + + void Start() + { + pathTweens = new Tween[targets.Length]; + + pathTweens[0] = targets[0].DOPath(waypoints, duration, pathType).SetOptions(closedPath); + pathTweens[0].SetRelative(relative) + .SetEase(Ease.Linear) + .SetLoops(loops, loopType) + .SetAutoKill(false) + .OnComplete(()=> Debug.Log(targets[0].name + " > complete")) + .OnWaypointChange(x=> { + Debug.Log(targets[0].name + " > waypoint reached: " + x + " > " + targets[0].position + " - completed loops: " + pathTweens[0].CompletedLoops()); + pathTweens[0].Pause(); + }); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.Label("Is backwards: " + pathTweens[0].isBackwards); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play")) DOTween.PlayAll(); + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto duration x 2")) DOTween.GotoAll(duration * 2); + if (GUILayout.Button("Goto duration x 0.5")) DOTween.GotoAll(duration * 0.5f); + if (GUILayout.Button("Goto WP 0")) pathTweens[0].GotoWaypoint(0); + if (GUILayout.Button("Goto WP 2")) pathTweens[0].GotoWaypoint(2); + if (GUILayout.Button("Goto WP 15")) pathTweens[0].GotoWaypoint(15); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs.meta b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs.meta new file mode 100644 index 0000000..e12e84e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d66587046eab2e4bbadb900677c3c16 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity new file mode 100644 index 0000000..1587bd1 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity.meta b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity.meta new file mode 100644 index 0000000..866c7cf --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathWaypointReached.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 92980e6627fb35644bdacde40b473d97 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/PathsFree.cs b/UnityTests.Unity4/Assets/_Tests/PathsFree.cs new file mode 100644 index 0000000..4572894 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathsFree.cs @@ -0,0 +1,19 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class PathsFree : BrainBase +{ + public Transform target; + public Ease ease = Ease.Linear; + public PathType pathType; + public bool closePath; + public Vector3[] waypoints; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + target.DOPath(waypoints, 3, pathType).SetOptions(closePath).SetEase(ease); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/PathsFree.cs.meta b/UnityTests.Unity4/Assets/_Tests/PathsFree.cs.meta new file mode 100644 index 0000000..86f6f69 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathsFree.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e29994a778b57941982cf357c77af8f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/PathsFree.unity b/UnityTests.Unity4/Assets/_Tests/PathsFree.unity new file mode 100644 index 0000000..996f04a Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/PathsFree.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/PathsFree.unity.meta b/UnityTests.Unity4/Assets/_Tests/PathsFree.unity.meta new file mode 100644 index 0000000..61bbaa8 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/PathsFree.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 24c80f8f3819bd44e95f4a095b78a88e +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Pooling.cs b/UnityTests.Unity4/Assets/_Tests/Pooling.cs new file mode 100644 index 0000000..c2efd91 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Pooling.cs @@ -0,0 +1,202 @@ +using DG.Tweening; +using UnityEngine; + +public class Pooling : BrainBase +{ + public GameObject prefab; + + bool recycle; + Transform spawnsParent; + + void Start() + { + DOTween.Init(true, false, LogBehaviour.Verbose); + spawnsParent = new GameObject("Spawn Container").transform; + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + + GUILayout.Label("Position Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPosition(1); + if (GUILayout.Button("Spawn 10")) SpawnPosition(10); + if (GUILayout.Button("Spawn 100")) SpawnPosition(100); + if (GUILayout.Button("Spawn 300")) SpawnPosition(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionX Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionX(1); + if (GUILayout.Button("Spawn 10")) SpawnPositionX(10); + if (GUILayout.Button("Spawn 100")) SpawnPositionX(100); + if (GUILayout.Button("Spawn 300")) SpawnPositionX(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionX Tweens with snapping"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionX(1, true); + if (GUILayout.Button("Spawn 10")) SpawnPositionX(10, true); + if (GUILayout.Button("Spawn 100")) SpawnPositionX(100, true); + if (GUILayout.Button("Spawn 300")) SpawnPositionX(300, true); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionY Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionY(1); + if (GUILayout.Button("Spawn 10")) SpawnPositionY(10); + if (GUILayout.Button("Spawn 100")) SpawnPositionY(100); + if (GUILayout.Button("Spawn 300")) SpawnPositionY(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("Rotation Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnRotation(1); + if (GUILayout.Button("Spawn 10")) SpawnRotation(10); + if (GUILayout.Button("Spawn 100")) SpawnRotation(100); + if (GUILayout.Button("Spawn 300")) SpawnRotation(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("Emit Particles Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnParticles(1); + if (GUILayout.Button("Spawn 10")) SpawnParticles(10); + if (GUILayout.Button("Spawn 100")) SpawnParticles(100); + if (GUILayout.Button("Spawn 300")) SpawnParticles(300); + if (GUILayout.Button("Spawn 1000")) SpawnParticles(1000); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Toggle Pause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Kill")) DOTween.KillAll(); + if (GUILayout.Button("Clear")) Clear(); + if (GUILayout.Button("Clear FULL")) Clear(true); + GUILayout.EndHorizontal(); + recycle = GUILayout.Toggle(recycle, "Recycle"); + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + void SpawnPosition(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.To(() => t.position, x => t.position = x, RandomVector3(), 1f) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + void SpawnPositionX(int tot, bool snapping = false) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(snapping) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + void SpawnPositionY(int tot, bool snapping = false) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + if (snapping) { + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(AxisConstraint.Y, true) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } else { + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(AxisConstraint.Y) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + } + fpsGadget.ResetFps(); + } + void SpawnRotation(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.To(() => t.rotation, x => t.rotation = x, RandomVector3(720), 1f) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + + void SpawnParticles(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + Material m = t.gameObject.renderer.material; + ResetParticleAndAssignTween(t, m); + } + fpsGadget.ResetFps(); + } + void ResetParticleAndAssignTween(Transform t, Material m) + { + t.position = Vector3.zero; + Color col = m.color; + col.a = 1; + m.color = col; + float duration = Random.Range(0.2f, 2f); + m.DOFade(0, duration).SetRecyclable(recycle); + t.DOMove(RandomVector3(), duration) + .SetRecyclable(recycle) + .OnComplete(()=> ResetParticleAndAssignTween(t, m)); + } + + void Clear(bool fullDOTweenClear = false) + { + DOTween.Clear(fullDOTweenClear); + Transform[] ts = spawnsParent.GetComponentsInChildren(); + foreach (Transform t in ts) { + if (t != spawnsParent) Destroy(t.gameObject); + } + } + + Vector3 RandomVector3(float limit = 10) + { + return new Vector3(Random.Range(-limit, limit), Random.Range(-limit, limit), Random.Range(-limit, limit)); + } + + float RandomFloat(float limit = 10) + { + return Random.Range(-limit, limit); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Pooling.cs.meta b/UnityTests.Unity4/Assets/_Tests/Pooling.cs.meta new file mode 100644 index 0000000..e672fc1 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Pooling.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f566ad46a388abe4d874c1f7fcdb7271 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Pooling.unity b/UnityTests.Unity4/Assets/_Tests/Pooling.unity new file mode 100644 index 0000000..421fcf4 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Pooling.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Pooling.unity.meta b/UnityTests.Unity4/Assets/_Tests/Pooling.unity.meta new file mode 100644 index 0000000..3d68218 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Pooling.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 98b859c0dc8e7e148a1733a2d04bbfe0 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs new file mode 100644 index 0000000..30315b2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs @@ -0,0 +1,29 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Rigidbodies : BrainBase +{ + public Transform[] targets; + public Rigidbody2D r2D; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + DOTween.Sequence() + .Append(targets[0].rigidbody.DORotate(new Vector3(0, 0, 90), 1, RotateMode.WorldAxisAdd)) + .Append(targets[0].rigidbody.DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)) + .Append(targets[0].rigidbody.DORotate(new Vector3(0, 810, 0), 1, RotateMode.LocalAxisAdd)); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Rotate 2D 360")) r2D.DORotate(360, 1); + if (GUILayout.Button("Rotate 2D 360 Relative")) r2D.DORotate(360, 1).SetRelative(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs.meta b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs.meta new file mode 100644 index 0000000..a8bf2bd --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dfa687efe27c93245b13f23cba1b9434 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity new file mode 100644 index 0000000..206f62b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity.meta b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity.meta new file mode 100644 index 0000000..e2b8d38 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rigidbodies.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: adcc3ccdde792334aa4e421d01039437 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/RotationModes.cs b/UnityTests.Unity4/Assets/_Tests/RotationModes.cs new file mode 100644 index 0000000..ff53798 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RotationModes.cs @@ -0,0 +1,70 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class RotationModes : BrainBase +{ + public Transform[] targets; + + void Start() + { + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[0].DORotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360)) + .Append(targets[0].DORotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[1].DORotate(new Vector3(0, 450, 0), 1, RotateMode.Fast)) + .Append(targets[1].DORotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[2].DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd)) + .Append(targets[2].DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[3].DORotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd)) + .Append(targets[3].DORotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + // FROM versions + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[4].DORotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360).From()) + .Append(targets[4].DORotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[5].DORotate(new Vector3(0, 450, 0), 1, RotateMode.Fast).From()) + .Append(targets[5].DORotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[6].DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd).From()) + .Append(targets[6].DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[7].DORotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd).From()) + .Append(targets[7].DORotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[4].DOLocalRotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360)) + // .Append(targets[4].DOLocalRotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[5].DOLocalRotate(new Vector3(0, 450, 0), 1, RotateMode.Fast)) + // .Append(targets[5].DOLocalRotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[6].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd)) + // .Append(targets[6].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[7].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd)) + // .Append(targets[7].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[8].DORotate(new Vector3(0, 90, 0), 1, RotateMode.Fast)) + .Append(targets[8].DORotate(new Vector3(90, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[9].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.Fast)) + .Append(targets[9].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.Fast)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/RotationModes.cs.meta b/UnityTests.Unity4/Assets/_Tests/RotationModes.cs.meta new file mode 100644 index 0000000..1a5cf1c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RotationModes.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78d2f0703a302b94c83f859af5297e01 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/RotationModes.unity b/UnityTests.Unity4/Assets/_Tests/RotationModes.unity new file mode 100644 index 0000000..c10f20a Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/RotationModes.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/RotationModes.unity.meta b/UnityTests.Unity4/Assets/_Tests/RotationModes.unity.meta new file mode 100644 index 0000000..0c3c29d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RotationModes.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: db9c94d9f8e8f394aa19efcafa835f07 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Rotations.cs b/UnityTests.Unity4/Assets/_Tests/Rotations.cs new file mode 100644 index 0000000..ec9ce8c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rotations.cs @@ -0,0 +1,48 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Rotations : BrainBase +{ + public Transform[] ts; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + // Should take shortest rotation route + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[0].DORotate(new Vector3(0, -45, 0), 1)) + .Append(ts[0].DORotate(new Vector3(0, 0, 0), 1)); + + // Should take longest rotation route (because Unity will change the start Vector when the first tween ends) + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[1].DORotate(new Vector3(0, -45, 0), 1, RotateMode.FastBeyond360)) + .Append(ts[1].DORotate(new Vector3(0, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[2].DORotate(new Vector3(0, -45, 0), 1) + .SetRelative()) + .Append(ts[2].DORotate(new Vector3(0, 360, 0), 1) + .SetRelative()); + + //////////////////////////////////////// + // FROM //////////////////////////////// + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[3].DORotate(new Vector3(0, -45, 0), 1) + .From()) + .Append(ts[3].DORotate(new Vector3(0, -45, 0), 1)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[4].DORotate(new Vector3(0, -45, 0), 1, RotateMode.FastBeyond360) + .From()) + .Append(ts[4].DORotate(new Vector3(0, 720, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[5].DORotate(new Vector3(0, -45, 0), 1) + .From(true)) + .Append(ts[5].DORotate(new Vector3(0, -90, 0), 1) + .SetRelative()); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Rotations.cs.meta b/UnityTests.Unity4/Assets/_Tests/Rotations.cs.meta new file mode 100644 index 0000000..6c0c247 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rotations.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9520a14363388bd4c95a970f942a9ca4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Rotations.unity b/UnityTests.Unity4/Assets/_Tests/Rotations.unity new file mode 100644 index 0000000..add0713 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Rotations.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Rotations.unity.meta b/UnityTests.Unity4/Assets/_Tests/Rotations.unity.meta new file mode 100644 index 0000000..9e30ffe --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Rotations.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 28ece09eec0b07241a39d81fc2deb6ae +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs new file mode 100644 index 0000000..2ee2cb6 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs @@ -0,0 +1,96 @@ +using DG.Tweening; +using System; +using UnityEngine; + +public class RuntimeChanges : BrainBase +{ + enum FollowMode + { + OnClick, + Continuous + } + + public bool speedBased; + public GUIText txtDuration; + public Transform[] targets; + + Tweener[] tweens = new Tweener[2]; + Vector3[] originalPos = new Vector3[2]; + float durationToApply = 2f; + Vector3 prevMousePos; + FollowMode followMode; + string[] followModeList; + + void Start() + { + followModeList = Enum.GetNames(typeof(FollowMode)); + SetGUITexts(); + + int len = targets.Length; + tweens = new Tweener[len]; + originalPos = new Vector3[len]; + + for (int i = 0; i < len; ++i) { + originalPos[i] = targets[i].position; + tweens[i] = targets[i].DOMove(Vector3.zero, durationToApply) + .SetLoops(-1, LoopType.Yoyo).SetEase(speedBased ? Ease.Linear : Ease.OutQuint) + .SetSpeedBased(speedBased) + .Pause(); + } + } + + void Update() + { + if (Input.GetKeyDown(KeyCode.P)) DOTween.TogglePauseAll(); + else if (Input.GetKeyDown(KeyCode.KeypadMinus)) { + durationToApply -= 0.25f; + if (durationToApply < 0.25f) durationToApply = 0.25f; + SetGUITexts(); + } else if (Input.GetKeyDown(KeyCode.KeypadPlus)) { + durationToApply += 0.25f; + SetGUITexts(); + } + + if (followMode == FollowMode.Continuous || Input.GetMouseButtonDown(0)) { + // Find mouse position to set as tween's new endValue + Vector3 clickPos = Input.mousePosition; + if (clickPos == prevMousePos) return; + + prevMousePos = clickPos; + clickPos.z = -Camera.main.transform.position.z; + clickPos = Camera.main.ScreenToWorldPoint(clickPos); + + // Change end value - snapStartValue + tweens[0].ChangeEndValue(clickPos, durationToApply, true); + // Change end value - NO snapStartValue + tweens[1].ChangeEndValue(clickPos, durationToApply); + // Change start value + originalPos[2] = clickPos; + tweens[2].ChangeStartValue(clickPos, durationToApply); + // Change start and end value + Vector3 newStartValue = new Vector3(UnityEngine.Random.Range(-10f, 10f), UnityEngine.Random.Range(-10f, 10f), 0); + originalPos[3] = newStartValue; + tweens[3].ChangeValues(newStartValue, clickPos, durationToApply); + } + } + + void OnDrawGizmos() + { + Gizmos.DrawWireSphere(Vector3.zero, 0.25f); + foreach (Vector3 pos in originalPos) Gizmos.DrawWireCube(pos, Vector3.one); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + followMode = (FollowMode)GUILayout.Toolbar((int)followMode, followModeList); + + DGUtils.EndGUI(); + } + + void SetGUITexts() + { + txtDuration.text = "Duration: " + durationToApply + " (-/+ to change)"; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs.meta b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs.meta new file mode 100644 index 0000000..9573d33 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56384294fdf20944485d9f0274b97958 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity new file mode 100644 index 0000000..8aa904e Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity.meta b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity.meta new file mode 100644 index 0000000..98fed4b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/RuntimeChanges.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fc757d5707dd71b498e452e9cb31896a +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SafeMode.cs b/UnityTests.Unity4/Assets/_Tests/SafeMode.cs new file mode 100644 index 0000000..c0a1f83 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SafeMode.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class SafeMode : BrainBase +{ + public Transform target0, target1; + public GameObject nullGO; + + IEnumerator Start() + { + DOTween.Init(); + DOTween.useSafeMode = true; + + yield return new WaitForSeconds(0.7f); + + // Tween that will fail on callback + target0.DOMoveX(4, 1).SetRelative().OnComplete(()=> Debug.Log(nullGO.transform)); + // Tween whose target will be destroyed at half tween + target1.DOMoveX(4, 1).SetRelative(); + + yield return new WaitForSeconds(0.5f); + Destroy(target1.gameObject); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/SafeMode.cs.meta b/UnityTests.Unity4/Assets/_Tests/SafeMode.cs.meta new file mode 100644 index 0000000..bc2e5e0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SafeMode.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19f40aedcc73ca94ebeb19a55f5c14fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SafeMode.unity b/UnityTests.Unity4/Assets/_Tests/SafeMode.unity new file mode 100644 index 0000000..43601aa Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/SafeMode.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/SafeMode.unity.meta b/UnityTests.Unity4/Assets/_Tests/SafeMode.unity.meta new file mode 100644 index 0000000..ca3d647 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SafeMode.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e6488453970ef3040bb44995f5fe529b +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs new file mode 100644 index 0000000..b245638 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs @@ -0,0 +1,83 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class SequenceCallbacks : BrainBase +{ + public Transform[] targets; + + Sequence main; + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + if (GUILayout.Button("Complete")) DOTween.CompleteAll(); + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + if (GUILayout.Button("Goto 0.5")) DOTween.GotoAll(0.5f); + if (GUILayout.Button("Goto 1")) DOTween.GotoAll(1); + if (GUILayout.Button("Goto 1.5")) DOTween.GotoAll(1.5f); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Sequence > LoopType.Restart")) NewSequence(LoopType.Restart, false); + if (GUILayout.Button("Sequence > LoopType.Restart > Flipped")) NewSequence(LoopType.Restart, true); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Sequence > LoopType.Yoyo")) NewSequence(LoopType.Yoyo, false); + if (GUILayout.Button("Sequence > LoopType.Yoyo > Flipped")) NewSequence(LoopType.Yoyo, true); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } + + void NewSequence(LoopType loopType, bool flip) + { + main.Rewind(); + main.Kill(); + + Sequence innerS0 = DOTween.Sequence() + .SetId("INNER") + // .SetLoops(3, loopType) + .OnStepComplete(()=>Debug.Log("INNER Step Complete")); + // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + // innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); + + Sequence innerS1 = DOTween.Sequence() + .SetId("INNER INNER") + // .SetLoops(3, loopType) + .OnStepComplete(()=> Debug.Log("INNER INNER Step Complete")); + innerS1.Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + innerS1.InsertCallback(0.25f, ()=> Callback("INNER INNER")); + innerS0.Append(innerS1); + innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); + + main = DOTween.Sequence() + .SetId("MAIN") + .SetLoops(3, loopType) + .SetAutoKill(false) + .OnStepComplete(()=> Debug.Log("MAIN Step Complete")); + // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + main.Append(innerS0); + main.InsertCallback(0.25f, ()=> Callback("MAIN")); + + if (flip) { + main.Complete(); + main.Flip(); + main.PlayBackwards(); + } + } + + void Callback(string id) + { + string prefix = ">>>"; + if (id == "INNER") prefix += ">>>"; + if (id == "INNER INNER") prefix += ">>>>>>"; + Debug.Log("" + prefix + " " + id + " > Callback > " + main.Elapsed(true) + ""); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs.meta b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs.meta new file mode 100644 index 0000000..4774e3e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad1abd97b06341d4ba034a86f24d639d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity new file mode 100644 index 0000000..2e2c121 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity.meta b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity.meta new file mode 100644 index 0000000..de81f42 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceCallbacks.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 431054a37e1666945a45e45adfc33c5c +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs b/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs new file mode 100644 index 0000000..55d0a61 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; +using System; + +public class SequenceEase : MonoBehaviour +{ + public Transform target; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + const float duration = 0.3f; + DOTween.Sequence() + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs.meta b/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs.meta new file mode 100644 index 0000000..597293e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceEase.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a50e1a8c7e9cde040866863cb046c193 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity b/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity new file mode 100644 index 0000000..1bcfa32 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity.meta b/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity.meta new file mode 100644 index 0000000..d9270be --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceEase.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9b6a786569f338d41976dd0d671b7926 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs new file mode 100644 index 0000000..b7f5a6b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs @@ -0,0 +1,18 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class SequenceIncremental : BrainBase +{ + public Transform target; + + void Start() + { + DOTween.Sequence() + .Append(target.DORotate(new Vector3(0, 45, 0), 1) + .SetLoops(2, LoopType.Incremental) + ) + .AppendInterval(0.5f) + .SetLoops(3, LoopType.Incremental); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs.meta b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs.meta new file mode 100644 index 0000000..2b8d027 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31bebc864b6c9c2459c51df1ad1718db +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity new file mode 100644 index 0000000..18499f0 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity.meta b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity.meta new file mode 100644 index 0000000..6b5bd42 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequenceIncremental.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 466fed659d30ce844a7cdf377bd80f03 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Sequences.cs b/UnityTests.Unity4/Assets/_Tests/Sequences.cs new file mode 100644 index 0000000..01937e2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Sequences.cs @@ -0,0 +1,165 @@ +using DG.Tweening; +using System.Text; +using UnityEngine; + +public class Sequences : BrainBase +{ + public int loops = 10001; + public LoopType loopType; + public GameObject prefab; + + Sequence mainSequence; + int stepCompleteMS, stepCompleteS1, stepCompleteS2, stepCompleteT1, stepCompleteT2, stepCompleteT3; + int completeMS, completeS1, completeS2, completeT1, completeT2, completeT3; + StringBuilder sb = new StringBuilder(); + + void Start() + { + mainSequence = CreateSequence(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Restart")) { + ResetStepsCounters(); + mainSequence.Restart(); + } + if (GUILayout.Button("Rewind")) { + ResetStepsCounters(); + mainSequence.Rewind(); + } + if (GUILayout.Button("Complete")) mainSequence.Complete(); + if (GUILayout.Button("Flip")) mainSequence.Flip(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) mainSequence.TogglePause(); + if (GUILayout.Button("PlayForward")) mainSequence.PlayForward(); + if (GUILayout.Button("PlayBackwards")) mainSequence.PlayBackwards(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Kill All")) DOTween.KillAll(); + if (GUILayout.Button("Create MAIN Sequence")) mainSequence = CreateSequence(); + if (GUILayout.Button("Create FROM Sequence")) CreateFromSequence(); + if (GUILayout.Button("Create Tween")) CreateTween(); + GUILayout.EndHorizontal(); + + GUILayout.Space(10); + sb.Remove(0, sb.Length); + sb.Append("IsPlaying: ").Append(mainSequence.IsPlaying()); + sb.Append("\nIsBackwards: ").Append(mainSequence.IsBackwards()); + sb.Append("\nElapsed: ").Append(mainSequence.Elapsed(false)); + sb.Append("\nFullElapsed: ").Append(mainSequence.Elapsed()); + sb.Append("\nCompletedLoops: ").Append(mainSequence.CompletedLoops()); + GUILayout.Label(sb.ToString()); + + GUILayout.Space(10); + sb.Remove(0, sb.Length); + sb.Append("MAINSequence Steps/Complete: ").Append(stepCompleteMS).Append("/").Append(completeMS); + sb.Append("\nSequence OUTER Steps/Complete: ").Append(stepCompleteS1).Append("/").Append(completeS1); + sb.Append("\nSequence INNER Steps/Complete: ").Append(stepCompleteS2).Append("/").Append(completeS2); + sb.Append("\nMove Steps/Complete: ").Append(stepCompleteT1).Append("/").Append(completeT1); + sb.Append("\nRotation Steps/Complete: ").Append(stepCompleteT2).Append("/").Append(completeT2); + sb.Append("\nColor Steps/Complete: ").Append(stepCompleteT3).Append("/").Append(completeT3); + GUILayout.Label(sb.ToString()); + + DGUtils.EndGUI(); + } + + Sequence CreateSequence() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + Material mat = target.gameObject.renderer.material; + + Sequence seq = DOTween.Sequence() + .SetId("Sequence INNER") + .OnStart(()=> DGUtils.Log("Sequence INNER Start")) + .OnStepComplete(()=> { stepCompleteS2++; DGUtils.Log("SEQUENCE INNER Step Complete"); }) + .OnComplete(()=> { completeS2++; }); + + seq.AppendInterval(0.5f); + seq.Append( + target.DOMove(new Vector3(2, 2, 2), 1f).SetLoops(3, LoopType.Yoyo) + .SetSpeedBased() // will not work since it's not allowed + .SetId("Move") + .OnStart(()=> DGUtils.Log("Move Start")) + .OnStepComplete(()=> { stepCompleteT1++; DGUtils.Log("Move Step Complete"); }) + .OnComplete(()=> { completeT1++; }) + ); + seq.Append( + target.DORotate(new Vector3(0, 225, 2), 1) + .SetId("Rotate") + .SetDelay(1) + .OnStart(()=> DGUtils.Log("Rotate Start")) + .OnStepComplete(()=> { stepCompleteT2++; DGUtils.Log("Rotate Step Complete"); }) + .OnComplete(()=> { completeT2++; }) + ); + seq.Insert( + 0.5f, mat.DOColor(Color.green, 1) + .SetId("Color") + .OnStart(()=> DGUtils.Log("Color Start")) + .OnStepComplete(()=> { stepCompleteT3++; DGUtils.Log("Color Step Complete"); }) + .OnComplete(()=> { completeT3++; }) + ); + seq.AppendInterval(0.5f); + + seq.InsertCallback(1.25f, ()=> DGUtils.Log("1.25f Sequence callback")); + + Sequence seqPre = DOTween.Sequence() + .SetId("Sequence OUTER") + .OnStart(()=> DGUtils.Log("Sequence OUTER Start")) + .OnStepComplete(()=> { stepCompleteS1++; DGUtils.Log("Sequence OUTER Step Complete"); }) + .OnComplete(()=> { completeS1++; }); + seqPre.Append(seq); + seqPre.PrependInterval(1); + + Sequence mainSeq = DOTween.Sequence().SetUpdate(true).SetLoops(loops, loopType).SetAutoKill(false) + .SetId("MAIN SEQUENCE") + .OnStart(()=> DGUtils.Log("MAINSequence Start")) + .OnStepComplete(()=> { stepCompleteMS++; DGUtils.Log("MAINSEQUENCE Step Complete"); }) + .OnComplete(()=> { completeMS++; }); + mainSeq.Append(seqPre); + mainSeq.PrependInterval(1); + target = ((GameObject)Instantiate(prefab)).transform; + target.position = new Vector3(-5, 0, 0); + mainSeq.Append(target.DOMove(Vector3.zero, 1)); + + mainSeq.InsertCallback(1.75f, ()=> DGUtils.Log("1.75f MAINSEQUENCE callback")); + mainSeq.PrependCallback(()=> DGUtils.Log("1.75f MAINSEQUENCE prepended callback")); + + return mainSeq; + } + + void CreateFromSequence() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + Sequence seq = DOTween.Sequence() + .SetId("FROM Sequence") + .OnStart(()=> DGUtils.Log("FROM Sequence Start")) + .OnStepComplete(()=> { stepCompleteS2++; DGUtils.Log("FROM SEQUENCE Step Complete"); }) + .OnComplete(()=> DGUtils.Log("FROM SEQUENCE Complete")); + seq.Append(target.DOMove(new Vector3(0, -3, 0), 1) + .From(true) + ); + seq.Append(target.DOMove(new Vector3(0, 3, 0), 1) + .From(true) + ); + } + + void CreateTween() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + + target.DOMove(new Vector3(2, 2, 2), 1f).SetLoops(1, LoopType.Yoyo) + .SetId("Move (Tween)") + .SetLoops(3) + .OnComplete(()=> Destroy(target.gameObject)); + } + + void ResetStepsCounters() + { + stepCompleteMS = stepCompleteS1 = stepCompleteS2 = stepCompleteT1 = stepCompleteT2 = stepCompleteT3 = completeMS = completeS1 = completeS2 = completeT1 = completeT2 = completeT3 = 0; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Sequences.cs.meta b/UnityTests.Unity4/Assets/_Tests/Sequences.cs.meta new file mode 100644 index 0000000..88f6fab --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Sequences.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da126d837a515384d9a9877047a2da50 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Sequences.unity b/UnityTests.Unity4/Assets/_Tests/Sequences.unity new file mode 100644 index 0000000..ea31b4a Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Sequences.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Sequences.unity.meta b/UnityTests.Unity4/Assets/_Tests/Sequences.unity.meta new file mode 100644 index 0000000..d1da681 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Sequences.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ecaf5a81b86e6e24a850d97f71635011 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs new file mode 100644 index 0000000..27462da --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs @@ -0,0 +1,72 @@ +using DG.Tweening; +using System; +using System.Collections.Generic; +using UnityEngine; + +public class SequencesExperiments : BrainBase +{ + public Camera cam; + public Transform multiCube; + + void Start() + { + CreateMultiCubeSequence(); + } + + void CreateMultiCubeSequence() + { + // Find and sort nested cubes from back to front, from TL clockwise + Transform[] children = multiCube.GetComponentsInChildren(); + List ts = new List(children.Length - 1); + foreach (Transform t in children) if (t != multiCube) ts.Add(t); + ts.Sort((x, y) => { + if (x.position.z > y.position.z) return -1; + if (x.position.z < y.position.z) return 1; + if (x.position.y > y.position.y) return -1; + if (x.position.y < y.position.y) return 1; + if (x.position.x < y.position.y) return -1; + if (x.position.x > y.position.y) return 1; + return 0; + }); + // Create sequence + const float duration = 1f; + const float delay = 1; + const Ease easeType = Ease.InCubic; + Sequence seq = DOTween.Sequence().SetId("MAIN").SetLoops(-1, LoopType.Yoyo).OnStepComplete(()=> Debug.Log("MultiCube :: Step Complete")); + seq.AppendInterval(delay); + seq.Insert(delay + (duration * 0.25f), multiCube.DORotate(new Vector3(0,450,45), (duration * 0.75f)).SetEase(easeType)); + seq.Insert(delay + (duration * 0.25f), multiCube.DOScale(new Vector3(0.001f,2,2), (duration * 0.75f)).SetEase(easeType)); + foreach (Transform t in ts) { + Vector3 to = t.localPosition; + to *= 4; + seq.Insert(delay, t.DOLocalMove(to, duration).SetEase(easeType)); + seq.Insert(delay, t.DOLocalRotate(new Vector3(0,360,0), duration).SetEase(easeType)); + seq.Insert(delay + (duration * 0.75f), t.gameObject.renderer.material.DOColor(cam.backgroundColor, duration * 0.25f)); + } + seq.Insert(delay + (duration * 0.75f), DOTween.To(()=> cam.backgroundColor, x=> cam.backgroundColor = x, Color.black, duration * 0.25f)); + seq.AppendInterval(0.5f); + } + + Color RandomColor() + { + return new Color(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value, 1); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Toggle Pause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Rewind")) { + Debug.Log("REWIND"); + DOTween.RewindAll(); + } + if (GUILayout.Button("Restart")) { + Debug.Log("RESTART"); + DOTween.RestartAll(); + } + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + GUILayout.EndHorizontal(); + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs.meta b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs.meta new file mode 100644 index 0000000..8742ce6 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 492c75105a1e9c047a963658350ce54a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity new file mode 100644 index 0000000..3d09a36 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity.meta b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity.meta new file mode 100644 index 0000000..628f85a --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/SequencesExperiments.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 526221f9a38d74a4a8430b449b94243d +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs b/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs new file mode 100644 index 0000000..60ac147 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs @@ -0,0 +1,141 @@ +using DG.Tweening; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ShakePunch : BrainBase +{ + public float duration = 1; // Shake duration + public float shakePosStrength = 2; // Shake position power + public Vector3 shakePosStrengthV3 = new Vector3(2,2,2); + public float shakeRotStrength = 90; // Shake rotation power + public Vector3 shakeRotStrengthV3 = new Vector3(90,90,90); + public float shakeScaleStrength = 2; // Shake scale power + public Vector3 shakeScaleStrengthV3 = new Vector3(2,2,2); + public bool useVectorStrength; + public int shakeVibrato = 10; // Shake iterations x seconds + public float shakeRandomness = 90; + public int punchVibrato = 10; + public float punchElasticity = 1; + public Vector3 punchDirection = Vector3.up; + public Vector3 punchScale = new Vector3(2,2,2); + public Vector3 punchRotation = new Vector3(0, 180, 0); + public Transform[] targets; + + Tween shakePositionTween, shakeRotationTween, shakeScaleTween, punchPositionTween, punchScaleTween, punchRotationTween; + + void Start() + { + DOTween.defaultRecyclable = false; + // DOTween.logBehaviour = LogBehaviour.Verbose; + Camera.main.transform.LookAt(targets[0]); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Shake Camera Position")) ShakePosition(true); + if (GUILayout.Button("Shake Camera Position + LookAt")) ShakePosition(true, targets[0].position); + if (GUILayout.Button("Shake Camera Rotation")) ShakeRotation(true); + if (GUILayout.Button("Shake Camera All")) { + ShakePosition(true); + ShakeRotation(true); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Shake Position")) ShakePosition(); + if (GUILayout.Button("Shake Rotation")) ShakeRotation(); + if (GUILayout.Button("Shake Scale")) ShakeScale(); + if (GUILayout.Button("Shake All")) { + ShakePosition(); + ShakeRotation(); + ShakeScale(); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Punch Position")) PunchPosition(); + if (GUILayout.Button("Punch Scale")) PunchScale(); + if (GUILayout.Button("Punch Rotation")) PunchRotation(); + if (GUILayout.Button("Punch All")) { + PunchPosition(); + PunchRotation(); + PunchScale(); + } + if (GUILayout.Button("Punch All Semi-Random")) { + PunchPosition(true); + PunchRotation(true); + PunchScale(true); + } + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } + + void ShakePosition(bool isCamera = false, Vector3? lookAt = null) + { + shakePositionTween.Complete(); + + shakePositionTween = isCamera + ? useVectorStrength + ? Camera.main.DOShakePosition(duration, shakePosStrengthV3, shakeVibrato, shakeRandomness) + : Camera.main.DOShakePosition(duration, shakePosStrength, shakeVibrato, shakeRandomness) + : useVectorStrength + ? targets[0].DOShakePosition(duration, shakePosStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakePosition(duration, shakePosStrength, shakeVibrato, shakeRandomness); + if (isCamera && lookAt != null) { + shakePositionTween.OnUpdate(()=> Camera.main.transform.LookAt((Vector3)lookAt)); + } + } + + void ShakeRotation(bool isCamera = false) + { + shakeRotationTween.Complete(); + + shakeRotationTween = isCamera + ? useVectorStrength + ? Camera.main.DOShakeRotation(duration, shakeRotStrengthV3, shakeVibrato, shakeRandomness) + : Camera.main.DOShakeRotation(duration, shakeRotStrength, shakeVibrato, shakeRandomness) + : useVectorStrength + ? targets[0].DOShakeRotation(duration, shakeRotStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakeRotation(duration, shakeRotStrength, shakeVibrato, shakeRandomness); + } + + void ShakeScale() + { + shakeScaleTween.Complete(); + + shakeScaleTween = useVectorStrength + ? targets[0].DOShakeScale(duration, shakeScaleStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakeScale(duration, shakeScaleStrength, shakeVibrato, shakeRandomness); + } + + void PunchPosition(bool random = false) + { + punchPositionTween.Complete(); + + punchPositionTween = targets[0].DOPunchPosition(random ? RandomVector3(-1, 1) : punchDirection, duration, punchVibrato, punchElasticity); + } + + void PunchScale(bool random = false) + { + punchScaleTween.Complete(); + + punchScaleTween = targets[0].DOPunchScale(random ? RandomVector3(0.5f, 1) : punchScale, duration, punchVibrato, punchElasticity); + } + + void PunchRotation(bool random = false) + { + punchRotationTween.Complete(); + + punchRotationTween = targets[0].DOPunchRotation(random ? RandomVector3(-180, 180) : punchRotation, duration, punchVibrato, punchElasticity); + } + + Vector3 RandomVector3(float min, float max) + { + return new Vector3(Random.Range(min, max), Random.Range(min, max), Random.Range(min, max)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs.meta b/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs.meta new file mode 100644 index 0000000..7091543 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/ShakePunch.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 60d403f9506094d499562cca7304b896 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity b/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity new file mode 100644 index 0000000..52eedaa Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity.meta b/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity.meta new file mode 100644 index 0000000..05dc9c0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/ShakePunch.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 80c5c33c61ea44a4a9bba554ed6c01e6 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs b/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs new file mode 100644 index 0000000..2895afe --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs @@ -0,0 +1,42 @@ +using DG.Tweening; +using UnityEngine; + +public class Shortcuts : MonoBehaviour +{ + public GameObject prefab; + + void Start() + { + //////////////////////////////////////////// + // Transform shortcuts ///////////////////// + + // Position + NewTransform().DOMove(RandomVector3(), 1).SetLoops(-1, LoopType.Yoyo); + // X Position + NewTransform().DOMoveX(Random.Range(-10f, 10f), 1).SetLoops(-1, LoopType.Yoyo); + // Local position + NewTransform().DOLocalMove(RandomVector3(), 1).SetLoops(-1, LoopType.Yoyo); + // Rotation + NewTransform().DORotate(RandomVector3(720), 1).SetLoops(-1, LoopType.Yoyo); + // Local rotation + NewTransform().DOLocalRotate(RandomVector3(720), 1).SetLoops(-1, LoopType.Yoyo); + // Scale + NewTransform().DOScale(RandomVector3(3), 1).SetLoops(-1, LoopType.Yoyo); + // Color + NewTransform().renderer.material.DOColor(Color.green, 1).SetLoops(-1, LoopType.Yoyo); + // Alpha + NewTransform().renderer.material.DOFade(0, 1).SetLoops(-1, LoopType.Yoyo); + } + + Transform NewTransform(bool randomPos = true) + { + Transform t = ((GameObject)Instantiate(prefab)).transform; + if (randomPos) t.position = RandomVector3(); + return t; + } + + Vector3 RandomVector3(float limit = 10f) + { + return new Vector3(Random.Range(-limit, limit), Random.Range(-limit, limit), Random.Range(-limit, limit)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs.meta b/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs.meta new file mode 100644 index 0000000..2c7b9ea --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Shortcuts.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f00c98fcdc2e0314a98e21aafd1e659f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity b/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity new file mode 100644 index 0000000..74148d7 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity.meta b/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity.meta new file mode 100644 index 0000000..fdc98b4 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Shortcuts.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0acb22747210d3e449c3d456f38fe8d8 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs new file mode 100644 index 0000000..502a903 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs @@ -0,0 +1,86 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class StartupSpeed : BrainBase +{ + const int maxIterations = 32000; + Vector3[] toPositions = new Vector3[maxIterations]; + float[] toValues = new float[maxIterations]; + Transform[] transforms = new Transform[maxIterations]; + SampleData[] sampleDatas = new SampleData[maxIterations]; + + float startupTime; + + void Start() + { + DOTween.Init(true, false, LogBehaviour.ErrorsOnly); + DOTween.SetTweensCapacity(maxIterations, 0); + + Transform container = new GameObject("Container").transform; + for (int i = 0; i < maxIterations; ++i) { + toPositions[i] = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)); + toValues[i] = Random.Range(1f, 100f); + + Transform t = new GameObject("T " + i).transform; + t.parent = container; + transforms[i] = t; + + sampleDatas[i] = new SampleData(); + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 2,000 position tweens")) StartCoroutine(StartupPos(2000)); + if (GUILayout.Button("Startup 2,000 float tweens")) StartCoroutine(StartupFloats(2000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 5,000 position tweens")) StartCoroutine(StartupPos(5000)); + if (GUILayout.Button("Startup 5,000 float tweens")) StartCoroutine(StartupFloats(5000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 10,000 position tweens")) StartCoroutine(StartupPos(10000)); + if (GUILayout.Button("Startup 10,000 float tweens")) StartCoroutine(StartupFloats(10000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 20,000 position tweens")) StartCoroutine(StartupPos(20000)); + if (GUILayout.Button("Startup 20,000 float tweens")) StartCoroutine(StartupFloats(20000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 32,000 position tweens")) StartCoroutine(StartupPos(32000)); + if (GUILayout.Button("Startup 32,000 float tweens")) StartCoroutine(StartupFloats(32000)); + GUILayout.EndHorizontal(); + + GUILayout.Label("Startup time: " + startupTime); + + DGUtils.EndGUI(); + } + + IEnumerator StartupPos(int tot) + { + DOTween.KillAll(); + yield return null; + + float time = Time.realtimeSinceStartup; + for (int i = 0; i < tot; ++i) transforms[i].DOMove(toPositions[i], 2); + startupTime = Time.realtimeSinceStartup - time; + } + + IEnumerator StartupFloats(int tot) + { + DOTween.KillAll(); + yield return null; + + float time = Time.realtimeSinceStartup; + for (int i = 0; i < tot; ++i) { + SampleData d = sampleDatas[i]; + SampleData dd = d; + DOTween.To(()=> dd.floatVal, x=> dd.floatVal = x, toValues[i], 2); + } + startupTime = Time.realtimeSinceStartup - time; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs.meta b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs.meta new file mode 100644 index 0000000..a584c72 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69f1048461841f445bd8f5bad2c7bba8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity new file mode 100644 index 0000000..3362cf9 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity.meta b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity.meta new file mode 100644 index 0000000..09bed5f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/StartupSpeed.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a9835b81837406b49b5190f2a1d583c3 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Strings.cs b/UnityTests.Unity4/Assets/_Tests/Strings.cs new file mode 100644 index 0000000..14f25e3 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Strings.cs @@ -0,0 +1,62 @@ +using DG.Tweening; +using UnityEngine; + +public class Strings : BrainBase +{ + public GUIText[] txts; + string stringToTween0 = "Short text", + stringToTween1 = "Long text to show how it gets completely replaced", + stringToTween2 = "Relative text... ", + stringToTween3 = "Scramble short text", + stringToTween4 = "Scramble long text to show how it gets completely replaced", + stringToTween5 = "Scramble relative text... "; + string[] strings; + + void Start() + { + // String + DOTween.To(()=> stringToTween0, x=> stringToTween0 = x, "Hello I'm a new string!", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween1, x=> stringToTween1 = x, "Hello I'm a new string!", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween2, x=> stringToTween2 = x, "Hello I'm a new string!", 1.5f).SetRelative().SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + // String scramble + DOTween.To(()=> stringToTween3, x=> stringToTween3 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween4, x=> stringToTween4 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween5, x=> stringToTween5 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetRelative().SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + + // Additional string + strings = new string[500]; + for (int i = 0; i < strings.Length; ++i) { + int index = i; + strings[i] = "Some String"; + DOTween.To(()=> strings[index], x=> strings[index] = x, "Modified string", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + } + } + + void LateUpdate() + { + txts[0].text = "String 0: " + stringToTween0; + txts[1].text = "String 1: " + stringToTween1; + txts[2].text = "String 2 (relative tween): " + stringToTween2; + txts[3].text = "String 3 (scramble): " + stringToTween3; + txts[4].text = "String 4 (scramble): " + stringToTween4; + txts[5].text = "String 5 (scramble relative): " + stringToTween5; + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + GUILayout.Space(100); + + if (GUILayout.Button("Toggle Pause")) { + DOTween.TogglePauseAll(); + } + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Strings.cs.meta b/UnityTests.Unity4/Assets/_Tests/Strings.cs.meta new file mode 100644 index 0000000..1960ac0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Strings.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06f6de75519c8114fa02a4891777e37a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Strings.unity b/UnityTests.Unity4/Assets/_Tests/Strings.unity new file mode 100644 index 0000000..dcc3dbe Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Strings.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Strings.unity.meta b/UnityTests.Unity4/Assets/_Tests/Strings.unity.meta new file mode 100644 index 0000000..9196f19 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Strings.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 99d5c6c4e6271cc4480cae0276f92884 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TempTests.cs b/UnityTests.Unity4/Assets/_Tests/TempTests.cs new file mode 100644 index 0000000..a7f06ed --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TempTests.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using System; + +public class TempTests : BrainBase +{ + public LoopType loopType = LoopType.Restart; + public Transform target; + + void Start() + { + Sequence s = DOTween.Sequence(); + s.AppendCallback(()=> Debug.Log(">>>>> Start Callback")) + .Append(target.DOMoveX(2, 1)) + .Append(target.DOMoveY(2, 1)) + .SetLoops(2, loopType) + .OnStepComplete(()=> Debug.Log("Step > " + s.CompletedLoops())); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/TempTests.cs.meta b/UnityTests.Unity4/Assets/_Tests/TempTests.cs.meta new file mode 100644 index 0000000..804625e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TempTests.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 501d8bd74a44ee2408a65e2d6289c416 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TempTests.unity b/UnityTests.Unity4/Assets/_Tests/TempTests.unity new file mode 100644 index 0000000..30fa31c Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/TempTests.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/TempTests.unity.meta b/UnityTests.Unity4/Assets/_Tests/TempTests.unity.meta new file mode 100644 index 0000000..4a84be8 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TempTests.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9aa6001cae7adc14f8692dfca268dd91 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs new file mode 100644 index 0000000..10a8137 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class TrailAndLineRenderer : BrainBase +{ + public LineRenderer lineRenderer; + public TrailRenderer trailRenderer; + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Tween LineRenderer Colors")) { + lineRenderer.DOColor(new Color2(Color.white, Color.white), new Color2(Color.red, Color.white), 2).SetLoops(-1, LoopType.Yoyo); + } + if (GUILayout.Button("Tween TrailRenderer's Sizes")) { + trailRenderer.DOResize(2, 4, 2).SetLoops(-1, LoopType.Yoyo); + } + if (GUILayout.Button("Tween TrailRenderer's Time")) { + trailRenderer.DOTime(0.001f, 2).SetLoops(-1, LoopType.Yoyo); + } + + DGUtils.EndGUI(); + } +} diff --git a/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs.meta b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs.meta new file mode 100644 index 0000000..2a89c8b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88aceceac9228c443a863b83351cced8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity new file mode 100644 index 0000000..0687b84 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity.meta b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity.meta new file mode 100644 index 0000000..0418308 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TrailAndLineRenderer.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7fd8661721a418648adbade214d315ef +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta new file mode 100644 index 0000000..167c788 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: eaee708f7b5912b458129998869b2edc +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs new file mode 100644 index 0000000..046f0e9 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +public class TestObjectData +{ + // Only for GoKit, since it can't tween fields + public float floatValueProperty { get; set; } + public float floatValue; +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta new file mode 100644 index 0000000..b587a19 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75e2185d1388639498cc3b6d066f2051 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs new file mode 100644 index 0000000..374e2de --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs @@ -0,0 +1,658 @@ +using DG.Tweening; +using Holoville.HOTween; +using System; +using System.Collections; +using UnityEngine; + +public class TweenEnginesComparisonInternal : BrainBase +{ + enum State { + Menu, + NoEmitWITween, + ConfirmGoKit, + ConfirmITween, + CreatingObjects, + TweensSetup, + Running + } + enum Engine { + DOTween, + HOTween, + LeanTween, + GoKit, + iTween + } + enum TestType { + Transforms, + Floats + } + enum TestSetup { + Emit, + Loop, + YoyoLoop + } + enum Easing { + Linear, + InOutQuad + } + + public bool doTweenSafeMode; + public GameObject prefab; + public float someVal; // used for iTween tests + + State state = State.Menu; + Engine engine = Engine.DOTween; + TestType testType = TestType.Transforms; + TestSetup testSetup = TestSetup.YoyoLoop; + Easing easing = Easing.Linear; + int numTweens; + float duration; + bool disableRenderers; + bool positionTween = true; + bool rotationTween, scaleTween; + Transform container; + GameObject[] testObjsGos; // Here to test LeanTween fairly + Transform[] testObjsTrans; + TestObjectData[] testObjsData; + Vector3[] rndPositions; + Vector3[] rndRotations; + Vector3[] rndStartupPos; + readonly Vector3 rndScale = new Vector3(6,6,6); + float[] rndFloats; + + float totCreationTime; + + bool guiInitialized; + GUIStyle labelStyle; + const int vspace = 10; + string[] engineList, testTypeList, testSetupList, easingList; + string[] durationList = new[] { + "0.25", "0.5", "1", "2", "4", "8", "16", "32" + }; + string[] numTweensList = new[] { + "1", "2", "50", "100", "500", "1000", "2000", "4000", "8000", "16000", "32000" + }; + int durationSelId = 2, numTweensSelId = 4; + + override protected void Awake() + { + base.Awake(); + DOTween.Init(true, false); + DOTween.useSafeMode = doTweenSafeMode; + HOTween.Init(true, false, false); + LeanTween.init(Convert.ToInt32(numTweensList[numTweensList.Length - 1]) + 1); + } + + void Start() + { + engineList = Enum.GetNames(typeof(Engine)); + testTypeList = Enum.GetNames(typeof(TestType)); + testSetupList = Enum.GetNames(typeof(TestSetup)); + easingList = Enum.GetNames(typeof(Easing)); + container = new GameObject("Test Objects Container").transform; + } + + IEnumerator StartRun() + { + state = State.CreatingObjects; + yield return null; + + duration = Convert.ToSingle(durationList[durationSelId]); + // Generate random values for tweens + rndStartupPos = new Vector3[numTweens]; + rndPositions = new Vector3[numTweens]; + rndRotations = new Vector3[numTweens]; + rndFloats = new float[numTweens]; + for (int i = 0; i < numTweens; ++i) { + rndStartupPos[i] = RandomVector3(50, 50, 20); + rndPositions[i] = RandomVector3(50, 50, 20); + rndRotations[i] = RandomVector3(180, 180, 180); + rndFloats[i] = UnityEngine.Random.Range(-1000f, 1000f); + } + // Generate testObjs + if (testType == TestType.Transforms) { + testObjsGos = new GameObject[numTweens]; + testObjsTrans = new Transform[numTweens]; + } else { + testObjsData = new TestObjectData[numTweens]; + } + for (int i = 0; i < numTweens; ++i) { + if (testType == TestType.Transforms) { + GameObject go = (GameObject)Instantiate(prefab); + go.SetActive(true); + Transform t = go.transform; + if (testSetup != TestSetup.Emit) t.position = rndStartupPos[i]; + t.parent = container; + testObjsGos[i] = go; + testObjsTrans[i] = t; + if (disableRenderers || testType == TestType.Floats) go.renderer.enabled = false; + } else testObjsData[i] = new TestObjectData(); + } + if (engine == Engine.DOTween) { + // Set max capacity for this run. + // We could set it to the correct amount, but it would be somehow unfair for LeanTween + int minCapacityToBeFair = Convert.ToInt32(numTweensList[numTweensList.Length - 1]); + int capacityX1 = Convert.ToInt32(numTweensList[numTweensSelId]); + int neededCapacity = 0; + int capacity = minCapacityToBeFair; + if (testType == TestType.Transforms && positionTween) neededCapacity += capacityX1; + if (testType == TestType.Transforms && rotationTween) neededCapacity += capacityX1; + if (testType == TestType.Transforms && scaleTween) neededCapacity += capacityX1; + if (minCapacityToBeFair < neededCapacity) capacity = neededCapacity; + DOTween.SetTweensCapacity(capacity, 0); + } + + yield return null; + state = State.TweensSetup; + yield return null; + totCreationTime = Time.realtimeSinceStartup; + SetupTweens(); + totCreationTime = Time.realtimeSinceStartup - totCreationTime; + yield return null; + state = State.Running; + // Reset FPS so average is more correct + fpsGadget.ResetFps(); + } + + void StopRun() + { + this.StopAllCoroutines(); + state = State.Menu; + // Clear tweens + if (engine == Engine.DOTween) DOTween.Clear(); + else if (engine == Engine.HOTween) HOTween.Kill(); + else if (engine == Engine.LeanTween) LeanTween.reset(); + else if (engine == Engine.GoKit) KillAllGoTweens(); + else if (engine == Engine.iTween) iTween.Stop(); + // Clean + if (testObjsGos != null) foreach (GameObject go in testObjsGos) Destroy(go); + testObjsGos = null; + testObjsTrans = null; + testObjsData = null; + rndPositions = null; + rndRotations = null; + } + + void Reset(bool complete = true) + { + if (complete) { + if (engine == Engine.DOTween) DOTween.Clear(); + else if (engine == Engine.HOTween) HOTween.Kill(); + else if (engine == Engine.LeanTween) LeanTween.reset(); + else if (engine == Engine.GoKit) KillAllGoTweens(); + else if (engine == Engine.iTween) iTween.Stop(); + } + if (testObjsTrans != null) { + for (int i = 0; i < testObjsTrans.Length; ++i) { + Transform t = testObjsTrans[i]; + t.position = rndStartupPos[i]; + t.localScale = Vector3.one; + t.rotation = Quaternion.identity; + } + } + } + + void SetupTweens() + { + // Ease + DG.Tweening.Ease dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad; + Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad; + LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad; + GoEaseType goEase = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut; + iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad; + // Loop + int loops = testSetup == TestSetup.Emit ? 1 : -1; + DG.Tweening.LoopType dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart; + Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart; + LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp; + GoLoopType goLoopType = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning; + iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop; + // Create tweens + switch (testType) { + case TestType.Floats: + for (int i = 0; i < numTweens; ++i) { + TestObjectData data = testObjsData[i]; + switch (engine) { + case Engine.HOTween: + HOTween.To(data, duration, new Holoville.HOTween.TweenParms() + .Prop("floatValue", rndFloats[i]) + .Ease(hotweenEase) + .Loops(loops, hotweenLoopType) + ); + break; + case Engine.LeanTween: + LeanTween.value(this.gameObject, x=> data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + break; + case Engine.GoKit: + Go.to(data, duration, new GoTweenConfig() + .floatProp("floatValueProperty", rndFloats[i]) + .setEaseType(goEase) + .setIterations(loops, goLoopType) + ); + break; + case Engine.iTween: + Hashtable hs = new Hashtable(); + hs.Add("from", data.floatValue); + hs.Add("to", rndFloats[i]); + hs.Add("time", duration); + hs.Add("onupdate", "UpdateiTweenFloat"); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.ValueTo(this.gameObject, hs); + break; + default: + // tCopy is needed to create correct closure object, + // otherwise closure will pass the same t to all the loop + TestObjectData dataCopy = data; + DOTween.To(()=> dataCopy.floatValue, x=> dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + break; + } + } + break; + default: + for (int i = 0; i < numTweens; ++i) { + float twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration; + Transform t = testObjsTrans[i]; + GameObject go = testObjsGos[i]; // Used by LeanTween and iTween + switch (engine) { + case Engine.HOTween: + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms() + .Ease(hotweenEase) + .Loops(loops, hotweenLoopType); + if (positionTween) { + Vector3 toPos = rndPositions[i]; + tp.Prop("position", toPos); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + tp.Prop("rotation", toRot); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase)); + } + if (scaleTween) { + tp.Prop("localScale", rndScale); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase)); + } + HOTween.To(t, twDuration, tp); + break; + case Engine.LeanTween: + LTDescr leanTween; + if (positionTween) { + Vector3 toPos = rndPositions[i]; + leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase)); + } + if (scaleTween) { + leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase)); + } + break; + case Engine.GoKit: + GoTweenConfig goConfig = new GoTweenConfig() + .setEaseType(goEase) + .setIterations(loops, goLoopType); + if (positionTween) { + Vector3 toPos = rndPositions[i]; + goConfig.addTweenProperty(new PositionTweenProperty(toPos)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitPositionFor(t, toPos, twDuration, goEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + goConfig.addTweenProperty(new RotationTweenProperty(toRot)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitRotationFor(t, toRot, twDuration, goEase)); + } + if (scaleTween) { + goConfig.addTweenProperty(new ScaleTweenProperty(rndScale)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitScaleFor(t, rndScale, twDuration, goEase)); + } + Go.to(t, twDuration, goConfig); + break; + case Engine.iTween: + Hashtable hs; + if (positionTween) { + hs = new Hashtable(); + hs.Add("position", rndPositions[i]); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.MoveTo(go, hs); + } + if (rotationTween) { + hs = new Hashtable(); + hs.Add("rotation", rndRotations[i]); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.RotateTo(go, hs); + } + if (scaleTween) { + hs = new Hashtable(); + hs.Add("scale", rndScale); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.ScaleTo(go, hs); + } + break; + default: + // tCopy is needed to create correct closure object, + // otherwise closure will pass the same t to all the loop + Transform tCopy = t; + DG.Tweening.Tween dotween; + if (positionTween) { + Vector3 toPos = rndPositions[i]; + dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase)); + } + if (scaleTween) { + dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase)); + } + break; + } + } + break; + } + } + + void EmitDOTweenPositionFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.position = Vector3.zero; + t.DOMove(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenPositionFor(t, to, twDuration, ease)); + } + void EmitDOTweenRotationFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.rotation = Quaternion.identity; + t.DORotate(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenRotationFor(t, to, twDuration, ease)); + } + void EmitDOTweenScaleFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.localScale = Vector3.one; + t.DOScale(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenScaleFor(t, to, twDuration, ease)); + } + + void EmitHOTweenPositionFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.position = Vector3.zero; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("position", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenPositionFor(t, to, twDuration, ease)) + ); + } + void EmitHOTweenRotationFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.rotation = Quaternion.identity; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("rotation", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenRotationFor(t, to, twDuration, ease)) + ); + } + void EmitHOTweenScaleFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.localScale = Vector3.one; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("localScale", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenScaleFor(t, to, twDuration, ease)) + ); + } + + void EmitLeanTweenPositionFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.position = Vector3.zero; + LeanTween.move(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenPositionFor(t, go, to, twDuration, ease)); + } + void EmitLeanTweenRotationFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.rotation = Quaternion.identity; + LeanTween.rotate(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenRotationFor(t, go, to, twDuration, ease)); + } + void EmitLeanTweenScaleFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.localScale = Vector3.one; + LeanTween.scale(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenScaleFor(t, go, to, twDuration, ease)); + } + + void EmitGoKitPositionFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.position = Vector3.zero; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new PositionTweenProperty(to)) + .onComplete(x=> EmitGoKitPositionFor(t, to, twDuration, ease)) + ); + } + void EmitGoKitRotationFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.rotation = Quaternion.identity; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new RotationTweenProperty(to)) + .onComplete(x=> EmitGoKitRotationFor(t, to, twDuration, ease)) + ); + } + void EmitGoKitScaleFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.localScale = Vector3.one; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new ScaleTweenProperty(to)) + .onComplete(x=> EmitGoKitScaleFor(t, to, twDuration, ease)) + ); + } + + Vector3 RandomVector3(float rangeX, float rangeY, float rangeZ) + { + return new Vector3(UnityEngine.Random.Range(-rangeX, rangeX), UnityEngine.Random.Range(-rangeY, rangeY), UnityEngine.Random.Range(-rangeZ, rangeZ)); + } + + // GoKit has no "KillAll" method, so we'll have to kill the tweens one by one based on target + void KillAllGoTweens() + { + if(testObjsTrans != null) foreach(Transform t in testObjsTrans) Go.killAllTweensWithTarget(t); + if(testObjsData != null) foreach(TestObjectData t in testObjsData) Go.killAllTweensWithTarget(t); + } + + public void UpdateiTweenFloat(float newVal) + { + // Practically does nothing: iTween can't logically tween many floats + // Still a valid test though, and even grants iTween some slack since it will do less than other engines + someVal = newVal; + } + + void OnGUI() + { + if (!guiInitialized) { + guiInitialized = true; + labelStyle = new GUIStyle(GUI.skin.label); + labelStyle.padding = new RectOffset(0, 0, 0, 0); + labelStyle.margin = new RectOffset(4, 4, 0, 0); + } + + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + + switch (state) { + case State.CreatingObjects: + DrawCreatingObjectsGUI(); + break; + case State.TweensSetup: + DrawTweensSetupGUI(); + break; + case State.Running: + DrawRunningGUI(); + break; + case State.NoEmitWITween: + DrawNoEmitWITweenGUI(); + break; + case State.ConfirmGoKit: + DrawConfirmGoKitGUI(); + break; + case State.ConfirmITween: + DrawConfirmITweenGUI(); + break; + default: + DrawMenuGUI(); + break; + } + + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + void DrawMenuGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Tween Duration", labelStyle); + durationSelId = GUILayout.Toolbar(durationSelId, durationList); + GUILayout.Space(vspace); + GUILayout.Label("Number of Tweens", labelStyle); + numTweensSelId = GUILayout.Toolbar(numTweensSelId, numTweensList); + GUILayout.Space(vspace); + GUILayout.Label("Tweens", labelStyle); + GUILayout.BeginHorizontal(); + positionTween = GUILayout.Toggle(positionTween, "Position"); + rotationTween = GUILayout.Toggle(rotationTween, "Rotation"); + scaleTween = GUILayout.Toggle(scaleTween, "Scale"); + if (!positionTween && !rotationTween && !scaleTween) positionTween = true; + GUILayout.EndHorizontal(); + GUILayout.Space(vspace); + GUILayout.Label("Test Type", labelStyle); + testType = (TestType)GUILayout.Toolbar((int)testType, testTypeList); + if (testType == TestType.Floats && testSetup == TestSetup.Emit) testSetup = TestSetup.Loop; + GUILayout.Space(vspace); + GUILayout.Label("Test Setup", labelStyle); + testSetup = (TestSetup)GUILayout.Toolbar((int)testSetup, testSetupList); + GUILayout.Space(vspace); + GUILayout.Label("Easing", labelStyle); + easing = (Easing)GUILayout.Toolbar((int)easing, easingList); + GUILayout.Space(vspace); + GUILayout.Label("Options", labelStyle); + disableRenderers = GUILayout.Toggle(disableRenderers, "Disable Renderers"); + GUILayout.Space(vspace); + GUILayout.Label("Engine", labelStyle); + engine = (Engine)GUILayout.Toolbar((int)engine, engineList); + GUILayout.Space(vspace); + if (GUILayout.Button("START")) { + numTweens = Convert.ToInt32(numTweensList[numTweensSelId]); + if (engine == Engine.GoKit && testType == TestType.Floats && numTweens >= 8000) state = State.ConfirmGoKit; + else if (engine == Engine.iTween) { + if (testSetup == TestSetup.Emit) state = State.NoEmitWITween; + else if (numTweens > 4000) state = State.ConfirmITween; + else StartCoroutine(StartRun()); + } + else StartCoroutine(StartRun()); + } + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawNoEmitWITweenGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Sorry, but iTween doesn't allow to create a good Emit test"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Ok")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawConfirmGoKitGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Beware, GoKit takes a long time to startup and to stop custom tweens,\nand your computer might hang for a while.\n\nAre you sure you want to proceed?"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Continue")) StartCoroutine(StartRun()); + if (GUILayout.Button("Cancel")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawConfirmITweenGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Beware, ITween takes a long time to startup and a longer time to stop tweens,\nand your computer might hang for a while.\n\nAre you sure you want to proceed?"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Continue")) StartCoroutine(StartRun()); + if (GUILayout.Button("Cancel")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawCreatingObjectsGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(GUI.skin.box); + GUILayout.Space(8); + GUILayout.Label("Preparing environment..."); + GUILayout.Space(8); + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawTweensSetupGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(GUI.skin.box); + GUILayout.Space(8); + GUILayout.Label("Starting up tweens..."); + GUILayout.Space(8); + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawRunningGUI() + { + GUILayout.BeginVertical(); + if (testType == TestType.Floats) { + GUILayout.FlexibleSpace(); + GUILayout.Label("Tweening random float values on each test object"); + } else if (disableRenderers) { + GUILayout.FlexibleSpace(); + GUILayout.Label("Tweening transforms even if you can't see them (renderers disabled)"); + } + GUILayout.FlexibleSpace(); + + GUILayout.Label(engine.ToString() + " (startup time: " + totCreationTime + ")"); + if (GUILayout.Button("STOP")) StopRun(); + + GUILayout.EndVertical(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta new file mode 100644 index 0000000..9d2693c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1edd352fa65b91e4b80a815c9087b31c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity new file mode 100644 index 0000000..a069e3e Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta new file mode 100644 index 0000000..4b1f8e4 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5fb5611ff399c14892c4a3cc52fa439 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs new file mode 100644 index 0000000..b82ae26 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class TweenDelegate : BrainBase +{ + public Transform[] targets; + public Tween[] tweens; + + void Start() + { + tweens = new Tween[targets.Length]; + for (int i = 0; i < targets.Length; ++i) { + tweens[i] = targets[i].DOMoveY(5, 2).SetRelative().SetLoops(-1, LoopType.Yoyo); + } + } + + void OnGUI() + { + if (GUILayout.Button("Assign delegates")) { + for (int i = 0; i < tweens.Length - 1; ++i) DelegateTester.TogglePause += tweens[i].TogglePause; + } + if (GUILayout.Button("TogglePause via Delegate")) if (DelegateTester.TogglePause != null) DelegateTester.TogglePause(); + if (GUILayout.Button("Clear delegates")) { + // DelegateTester.Clear(); + DelegateTester.TogglePause = null; + } + } +} + +public static class DelegateTester +{ + public delegate void TweenActionDelegate(); + public static TweenActionDelegate TogglePause; + + public static void Clear() + { + TogglePause = null; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs.meta b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs.meta new file mode 100644 index 0000000..876c8e4 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00da5ef4c984e724b9e50d82c859341b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity new file mode 100644 index 0000000..eec5864 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity.meta b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity.meta new file mode 100644 index 0000000..b439d99 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenDelegate.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3b31d9d04bbfcbc4baf6ddd3e693c3ff +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TweenParms.unity b/UnityTests.Unity4/Assets/_Tests/TweenParms.unity new file mode 100644 index 0000000..b4c10d2 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/TweenParms.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/TweenParms.unity.meta b/UnityTests.Unity4/Assets/_Tests/TweenParms.unity.meta new file mode 100644 index 0000000..b1bd37f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenParms.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: be16601f8ac4c064ea73ff289146e270 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs b/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs new file mode 100644 index 0000000..40f874f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class TweenParmsBrain : BrainBase +{ + public Transform[] ts; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + TweenParams tp = new TweenParams() + .SetRelative() + // .SetSpeedBased() + .SetEase(Ease.OutQuint) + .SetLoops(-1, LoopType.Yoyo); + + foreach (Transform t in ts) { + t.DOMoveY(2, 1).SetAs(tp); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs.meta b/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs.meta new file mode 100644 index 0000000..4bd2db9 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/TweenParmsBrain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 030dffb8b6b9361499a15144f2d0cbb4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/UIMisc.cs b/UnityTests.Unity4/Assets/_Tests/UIMisc.cs new file mode 100644 index 0000000..126bf13 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UIMisc.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using DG.Tweening; + +public class UIMisc : BrainBase +{ + public Image[] imgs; + public Text text, textScramble; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + // Radial + Sequence s = DOTween.Sequence(); + foreach (Image i in imgs) { + Image img = i; + img.fillAmount = 0; + s.Insert(0, img.DOFillAmount(1, 1).SetEase(Ease.Linear)) + .Join(img.DOFade(0, 1).From().SetEase(Ease.Linear)) + .SetLoops(-1, LoopType.Yoyo); + } + s.OnStepComplete(()=> { + foreach (Image img in imgs) img.fillClockwise = !img.fillClockwise; + }); + + // Text + DOTween.Sequence() + .AppendInterval(0.5f) + .Append(text.DOText("", 2).From().SetEase(Ease.Linear)) + .AppendInterval(0.5f) + .SetLoops(-1, LoopType.Yoyo); + DOTween.Sequence() + .AppendInterval(0.5f) + .Append(textScramble.DOText("", 2, true).From().SetEase(Ease.Linear)) + .AppendInterval(0.5f) + .SetLoops(-1, LoopType.Yoyo); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/UIMisc.cs.meta b/UnityTests.Unity4/Assets/_Tests/UIMisc.cs.meta new file mode 100644 index 0000000..0d10076 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UIMisc.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cc73e6408a0172e4fa41a0e280e6e5f4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/UIMisc.unity b/UnityTests.Unity4/Assets/_Tests/UIMisc.unity new file mode 100644 index 0000000..b0cc96c Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/UIMisc.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/UIMisc.unity.meta b/UnityTests.Unity4/Assets/_Tests/UIMisc.unity.meta new file mode 100644 index 0000000..43af70b --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UIMisc.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 61e0db642e1d48b4ebee4405b9ae6d6c +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs new file mode 100644 index 0000000..3aac6b5 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs @@ -0,0 +1,20 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class UpdateTypes : BrainBase +{ + public Transform[] targets; + public bool independentUpdate; + public float timeScale = 1; + + void Start() + { + Time.timeScale = timeScale; + + targets[0].DOMoveX(5, 2).SetUpdate(UpdateType.Normal, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[1].DOMoveX(5, 2).SetUpdate(UpdateType.Late, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[2].DOMoveX(5, 2).SetUpdate(UpdateType.Fixed, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[3].rigidbody.DOMoveX(5, 2).SetUpdate(UpdateType.Fixed, independentUpdate).SetLoops(-1, LoopType.Yoyo); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs.meta b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs.meta new file mode 100644 index 0000000..22e702a --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1c6c3b51a750cd342a9a29837d3680af +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity new file mode 100644 index 0000000..928db79 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity.meta b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity.meta new file mode 100644 index 0000000..44909d0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/UpdateTypes.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a549635edee7bdd47a10615951b52cf4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs b/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs new file mode 100644 index 0000000..ee4e5d7 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs @@ -0,0 +1,40 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Vector3Array : BrainBase +{ + public Transform target; + + void Start() + { + Vector3[] points = new[] { new Vector3(1,0,0), new Vector3(1,0,0), new Vector3(1,0,0), new Vector3(1,0,0) }; + float[] durations = new[] { 0.5f, 0.5f, 1.5f, 0.5f }; + DOTween.ToArray(()=> target.position, x=> target.localPosition = x, points, durations) + // .SetEase(Ease.Linear) + .SetRelative() + // .SetSpeedBased() + .SetEase(Ease.OutQuart) + .SetLoops(-1, LoopType.Yoyo) + .SetAutoKill(false); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Complete")) DOTween.CompleteAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto 1")) DOTween.GotoAll(1); + if (GUILayout.Button("Goto 2")) DOTween.GotoAll(2); + if (GUILayout.Button("Goto 3")) DOTween.GotoAll(3); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs.meta b/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs.meta new file mode 100644 index 0000000..1a399cf --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Vector3Array.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0162140f466b9f749a5847e9360b15b1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity b/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity new file mode 100644 index 0000000..a126a4b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity.meta b/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity.meta new file mode 100644 index 0000000..2c4c157 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/Vector3Array.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d08c471964b0b7a44b619b558765cea4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs new file mode 100644 index 0000000..1995d4a --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs @@ -0,0 +1,22 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class VirtualTweens : BrainBase +{ + Vector3 vector = Vector3.zero; + + void Start() + { + DOVirtual.Float(0, 1, 3, UpdateCallback); + + DOVirtual.DelayedCall(2, ()=> Debug.Log("" + Time.realtimeSinceStartup + " > Wait call complete")); + } + + void UpdateCallback(float val) + { + vector.x = DOVirtual.EasedValue(15, 100, val, Ease.InQuad); + vector.y = DOVirtual.EasedValue(15, 100, val, Ease.OutQuad); + Debug.Log(vector); + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs.meta b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs.meta new file mode 100644 index 0000000..f3fdac8 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b415dbc533166c64198cb655080524cc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity new file mode 100644 index 0000000..918d87b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity differ diff --git a/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity.meta b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity.meta new file mode 100644 index 0000000..ed76b0a --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/VirtualTweens.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a66d15bb354a48446a753f8eb8d478e4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials.meta new file mode 100644 index 0000000..846bc92 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d58d8181f8588024ea2527a867686066 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png new file mode 100644 index 0000000..09d70c4 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta new file mode 100644 index 0000000..88f0829 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 09c84f27f9a6cd749928d447a6b044ef +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 256 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat new file mode 100644 index 0000000..1baef30 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta new file mode 100644 index 0000000..3dc0299 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3e39a51ca5059ee4fb0c9c7f9ae9a2af +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat new file mode 100644 index 0000000..69cac64 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta new file mode 100644 index 0000000..bf6ca88 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7cd0a2470f229154da6e671fc3925884 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat new file mode 100644 index 0000000..9a3e98a Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta new file mode 100644 index 0000000..e1f32db --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4c8c2b254329d504f9e68c7b683fde02 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat new file mode 100644 index 0000000..ccea8db Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta new file mode 100644 index 0000000..28daaa0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a61c8e7218defef48a4bed6baf13a71f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat new file mode 100644 index 0000000..eb7633b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta new file mode 100644 index 0000000..db69985 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9ac1e5f6c3d257a4c9a3dbf5b5451161 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat new file mode 100644 index 0000000..b24ce3b Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta new file mode 100644 index 0000000..b2c7af0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 19a7ba0e0aeb10e42b4072c1d3054b41 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Misc.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Misc.meta new file mode 100644 index 0000000..cfd6ffb --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Misc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 38ca39821243ae346a651710299d93d5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset b/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset new file mode 100644 index 0000000..6f0efed Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset.meta new file mode 100644 index 0000000..f1553e0 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Misc/New Terrain.asset.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 67969eb0a70e0a648acb6bace4f19d5f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs.meta new file mode 100644 index 0000000..52f221d --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b58c526f8021c3949aa4558c9a1bb799 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab new file mode 100644 index 0000000..224558e Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta new file mode 100644 index 0000000..4bc983f --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2b5b9e91a5ac9f348bb19eff52368fbf +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab new file mode 100644 index 0000000..b376ee1 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta new file mode 100644 index 0000000..462cc73 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0134689cf2edc5a4faef1a6853b2d360 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab new file mode 100644 index 0000000..ed806c0 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta new file mode 100644 index 0000000..e022bc2 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6b0e36b42e0f7024eb9b052a60417e1b +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab new file mode 100644 index 0000000..7380a7f Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta new file mode 100644 index 0000000..d9a6512 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: aae2e9c3c4f059e4c8ec71aab1fb107f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab new file mode 100644 index 0000000..46b7ffc Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta new file mode 100644 index 0000000..6135173 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d591dccaf57e34d4a93162ea900c70ed +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts.meta new file mode 100644 index 0000000..9fc133c --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: f447fcda6440bc14bb521fbef4a76667 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs new file mode 100644 index 0000000..667a6f1 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using Holoville.DebugFramework.Components; +using UnityEngine; + +public class BrainBase : MonoBehaviour +{ + public bool forceFrameRate; + public int forcedFrameRate = 10; + // public bool recycleTweens = true; + // public bool safeMode = false; + // public LogBehaviour logBehaviour = LogBehaviour.Default; + + public static HOFpsGadget fpsGadget; + + virtual protected void Awake() + { + if (fpsGadget == null) { + GameObject fpsGadgetGo = new GameObject("FPS"); + DontDestroyOnLoad(fpsGadgetGo); + fpsGadget = fpsGadgetGo.AddComponent(); + if (forceFrameRate) fpsGadget.limitFrameRate = forcedFrameRate; + fpsGadget.showMemory = true; + } + + // DOTween.showUnityEditorReport = true; + // DOTween.useSafeMode = safeMode; + // DOTween.defaultRecyclable = recycleTweens; + // DOTween.logBehaviour = logBehaviour; + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta new file mode 100644 index 0000000..5d25e8e --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3f085c97b762654ebae62fd830d6d19 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs new file mode 100644 index 0000000..e910abb --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs @@ -0,0 +1,57 @@ +using DG.Tweening; +using UnityEngine; + +public static class DGUtils +{ + static float sliderPos; + + public static void Log(object o) { + Debug.Log(Time.frameCount + "/" + Time.realtimeSinceStartup + " : " + o); + } + + public static void BeginGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("RELOAD SCENE")) Application.LoadLevel(Application.loadedLevel); + if (GUILayout.Button("VALIDATE TWEENS")) Debug.Log("Invalid tweens found: " + DOTween.Validate()); + GUILayout.EndHorizontal(); + } + + public static void EndGUI() + { + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + public static void GUIScrubber(float duration) { + GUIScrubber(duration, null); + } + public static void GUIScrubber(Tween controller) { + GUIScrubber(-1, controller); + } + static void GUIScrubber(float duration, Tween controller) + { + if (controller == null) { + float prevSliderPos = sliderPos; + sliderPos = GUILayout.HorizontalSlider(sliderPos, 0.0f, duration); + if (!Mathf.Approximately(sliderPos, prevSliderPos)) DOTween.GotoAll(sliderPos); + } else { + // Get slider ID to be used to check mouseDown behaviour + int sliderId = GUIUtility.GetControlID(FocusType.Passive) + 1; + DOTween.GotoAll(GUILayout.HorizontalSlider(controller.Elapsed(false), 0.0f, controller.Duration(false)), controller.IsPlaying()); + // Check mouse down on slider, and pause tweens accordingly. + if (sliderId != 0 && Event.current.type == EventType.used) { + if (GUIUtility.hotControl == sliderId) DOTween.PauseAll(); + } + + // DOTween.Goto(GUILayout.HorizontalSlider(controller.Elapsed(false), 0.0f, controller.Duration(false)), controller.IsPlaying()); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta new file mode 100644 index 0000000..757a546 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29bb3778f841e6449b79136d7775b780 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs new file mode 100644 index 0000000..13fb868 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs @@ -0,0 +1,4 @@ +public struct SampleData +{ + public float floatVal; +} \ No newline at end of file diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs.meta new file mode 100644 index 0000000..1a827fe --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Scripts/SampleData.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91a9a4fa83b5d144a9e6de3be130621f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Sprites.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites.meta new file mode 100644 index 0000000..be2ee38 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ce8d71de69c2c334793ac308b4b74ff3 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png new file mode 100644 index 0000000..55960d4 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta new file mode 100644 index 0000000..056f5a3 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: ec4939dcfaa5ee9408157124a95b4daa +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 128 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 1 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png new file mode 100644 index 0000000..bedc536 Binary files /dev/null and b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png differ diff --git a/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta new file mode 100644 index 0000000..7ce0d95 --- /dev/null +++ b/UnityTests.Unity4/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: fb9d948a67273c648b8011f736e55470 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 32 + textureSettings: + filterMode: 0 + aniso: 16 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/Assets/dotween_logo.png b/UnityTests.Unity4/Assets/dotween_logo.png new file mode 100644 index 0000000..1b5f710 Binary files /dev/null and b/UnityTests.Unity4/Assets/dotween_logo.png differ diff --git a/UnityTests.Unity4/Assets/dotween_logo.png.meta b/UnityTests.Unity4/Assets/dotween_logo.png.meta new file mode 100644 index 0000000..f8edb04 --- /dev/null +++ b/UnityTests.Unity4/Assets/dotween_logo.png.meta @@ -0,0 +1,48 @@ +fileFormatVersion: 2 +guid: dcaad08c6db395947abb73f0d831b3d3 +TextureImporter: + fileIDToRecycleName: + 21300000: dotween_logo + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity4/ProjectSettings/AudioManager.asset b/UnityTests.Unity4/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..47d3cd3 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/AudioManager.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/DynamicsManager.asset b/UnityTests.Unity4/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..22d9747 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/DynamicsManager.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/EditorBuildSettings.asset b/UnityTests.Unity4/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..d8085a5 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/EditorBuildSettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/EditorSettings.asset b/UnityTests.Unity4/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..13aff1e Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/EditorSettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/GraphicsSettings.asset b/UnityTests.Unity4/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..a17fb50 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/GraphicsSettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/InputManager.asset b/UnityTests.Unity4/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..8af48d3 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/InputManager.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/NavMeshLayers.asset b/UnityTests.Unity4/ProjectSettings/NavMeshLayers.asset new file mode 100644 index 0000000..a2aa728 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/NavMeshLayers.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/NetworkManager.asset b/UnityTests.Unity4/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..735131d Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/NetworkManager.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/Physics2DSettings.asset b/UnityTests.Unity4/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..055659b Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/Physics2DSettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/ProjectSettings.asset b/UnityTests.Unity4/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..7c3e90a Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/ProjectSettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/QualitySettings.asset b/UnityTests.Unity4/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..7720878 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/QualitySettings.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/TagManager.asset b/UnityTests.Unity4/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..f73f240 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/TagManager.asset differ diff --git a/UnityTests.Unity4/ProjectSettings/TimeManager.asset b/UnityTests.Unity4/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..50bfc21 Binary files /dev/null and b/UnityTests.Unity4/ProjectSettings/TimeManager.asset differ diff --git a/UnityTests.Unity5/Assets/Demigiant.meta b/UnityTests.Unity5/Assets/Demigiant.meta new file mode 100644 index 0000000..8a58321 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cb9375ae14b7c6d4da5d6f1482cb5d29 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween.meta new file mode 100644 index 0000000..8bcf43b --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ad88d42122718d342a246e7d8d8c9983 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML new file mode 100644 index 0000000..b562aa2 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML @@ -0,0 +1,1906 @@ + + + + DOTween + + + + + Update type + + + + Updates every frame during Update calls + + + Updates every frame during LateUpdate calls + + + Updates using FixedUpdate calls + + + + Path mode (used to determine correct LookAt orientation) + + + + Ignores the path mode (and thus LookAt behaviour) + + + Regular 3D path + + + 2D top-down path + + + 2D side-scroller path + + + + Used internally + + + + + This class serves only as a utility class to store tween settings to apply on multiple tweens. + It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + + + + A variable you can eventually Clear and reuse when needed, + to avoid instantiating TweenParams objects + + + Creates a new TweenParams object, which you can use to store tween settings + to pass to multiple tweens via myTween.SetAs(myTweenParms) + + + Clears and resets this TweenParams instance using default values, + so it can be reused without instantiating another one + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function. + If applied to Sequences eases the whole sequence animation + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (default: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween reaches a new waypoint + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + + Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + Contains all instance-based methods + + + + + Used to allow method chaining with DOTween.Init + + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Controls other tweens as a group + + + + + Indicates either a Tweener or a Sequence + + + + Called the first time the tween is set in a playing state, after any eventual delay + + + TimeScale for the tween + + + If TRUE the tween wil go backwards + + + Id (usable for filtering with DOTween static methods). Can be an int, a string, an object, or anything else + + + Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shorcuts + + + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Called each time the tween updates + + + Called the moment the tween completes one loop cycle + + + Called the moment the tween reaches completion (loops included) + + + Called the moment the tween is killed + + + Called when a path tween's current waypoint changes + + + Gets and sets the time position (loops included, delays excluded) of the tween + + + + Rotation mode used with DORotate methods + + + + + Fastest way that never rotates beyond 360° + + + + + Fastest way that rotates beyond 360° + + + + + Adds the given rotation to the transform using world axis and an advanced precision mode + (like when using transform.Rotate(Space.World)). + In this mode the end value is is always considered relative + + + + + Adds the given rotation to the transform's local axis + (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + In this mode the end value is is always considered relative + + + + + This plugin generates some GC allocations at startup + + + + + Don't assign this! It's assigned automatically when creating 0 duration tweens + + + + + Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + + + + + Types of log behaviours + + + + Log only warnings and errors + + + Log warnings, errors and additional infos + + + Log only errors + + + + Methods that extend Tween objects and allow to set their parameters + + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot to use with Back ease (default is 1.70158) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual amplitude to use with Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + If applied to Sequences eases the whole sequence animation + + + Allows the tween to be recycled after being killed. + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (defalt: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onPlay callback for the tween. + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween's current waypoint changes + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + Has no effect if the tween has already started. + NOTE: the tween's target will not be changed + Tween from which to copy the parameters + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + Has no effect if the tween has already started. + TweenParams from which to copy the parameters + + + Adds the given tween to the end of the Sequence. + Has no effect if the Sequence has already started + The tween to append + + + Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The tween to prepend + + + Inserts the given tween at the same time position of the last tween added to the Sequence. + Has no effect if the Sequence has already started + + + Inserts the given tween at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the tween will be placed + The tween to insert + + + Adds the given interval to the end of the Sequence. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given callback to the end of the Sequence. + Has no effect if the Sequence has already started + The callback to append + + + Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The callback to prepend + + + Inserts the given callback at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the callback will be placed + The callback to insert + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + If TRUE the FROM value will be calculated as relative to the current one + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + Sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + Options for float tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Quaternion tweens + If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + + + Options for Color tweens + If TRUE only the alpha value of the color will be tweened + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL to use default ones + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Path tweens (created via the DOPath shortcut) + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Options for Path tweens (created via the DOPath shortcut) + If TRUE the path will be automatically closed + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target to the path, with the given lookAhead. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + + Methods that extend Tween objects and allow to control or get data from them + + + + Completes the tween + + + Flips the direction of this tween (backwards if it was going forward or viceversa) + + + Forces the tween to initialize its settings immediately + + + Send the tween to the given position in time + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Kills the tween + If TRUE completes the tween before killing it + + + Pauses the tween + + + Plays the tween + + + Sets the tween in a backwards direction and plays it + + + Sets the tween in a forward direction and plays it + + + Restarts the tween from the beginning + If TRUE includes the eventual tween delay, otherwise skips it + + + Rewinds the tween + If TRUE includes the eventual tween delay, otherwise skips it + + + Plays the tween if it was paused, pauses it if it was playing + + + Send a path tween to the given waypoint. + Has no effect if this is not a path tween. + BEWARE, this is a special utility method: + the lookAt direction might be wrong after calling this and might need to be set manually + (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + Waypoint index to reach + (if higher than the max waypoint index the tween will simply go to the last one) + If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + + + + Creates a yield instruction that waits until the tween is killed or complete. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForCompletion(); + + + + + Creates a yield instruction that waits until the tween is killed or rewinded. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForRewind(); + + + + + Creates a yield instruction that waits until the tween is killed. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForKill(); + + + + + Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForElapsedLoops(2); + + Elapsed loops to wait for + + + + Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForPosition(2.5f); + + Position (loops included, delays excluded) to wait for + + + + Creates a yield instruction that waits until the tween is killed or started + (meaning when the tween is set in a playing state the first time, after any eventual delay). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForStart(); + + + + Returns the total number of loops completed by this tween + + + Returns the eventual delay set for this tween + + + Returns the duration of this tween (delays excluded). + NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + If TRUE returns the full duration loops included, + otherwise the duration of a single loop cycle + + + Returns the elapsed time for this tween (delays exluded) + If TRUE returns the elapsed time since startup loops included, + otherwise the elapsed time within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + If TRUE returns the elapsed percentage since startup loops included, + otherwise the elapsed percentage within the current loop cycle + + + Returns FALSE if this tween has been killed. + BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + + + Returns TRUE if this tween was reversed and is set to go backwards + + + Returns TRUE if the tween is complete + (silently fails and returns FALSE if the tween has been killed) + + + Returns TRUE if this tween is playing + + + + Returns the length of a path (returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized). + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + + + + Used for tween callbacks + + + + + Used for tween callbacks + + + + + Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + Types of autoPlay behaviours + + + + No tween is automatically played + + + Only Sequences are automatically played + + + Only Tweeners are automatically played + + + All tweens are automatically played + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances + + + + Tweens an AudioSource's volume to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an AudioSource's pitch to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Camera's backgroundColor to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's color to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's intensity to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's shadowStrength to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a LineRenderer's color to the given value. + Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + Note that this method requires to also insert the start colors for the tween, + since LineRenderers have no way to get them. + The start value to tween from + The end value to reachThe duration of the tween + + + Tweens a Material's color to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named color property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named float property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Rigidbody's position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's X position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Y position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Z position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's rotation to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Rigidbody's rotation so that it will look towards the given position. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Tweens a TrailRenderer's startWidth/endWidth to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end startWidth to reachThe end endWidth to reach + The duration of the tween + + + Tweens a TrailRenderer's time to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's rotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localRotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's X localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Y localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Z localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's rotation so that it will look towards the given position. + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Punches a Transform's localPosition towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + The direction and strength of the punch (added to the Transform's current position) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the punch direction and the opposite direction, + while 0 oscillates only between the punch and the start position + If TRUE the tween will smoothly snap all values to integers + + + Punches a Transform's localScale towards the given size and then back to the starting one + as if it was connected to the starting scale via an elastic. + The punch strength (added to the Transform's current scale) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + 1 creates a full oscillation between the punch scale and the opposite scale, + while 0 oscillates only between the punch scale and the start scale + + + Punches a Transform's localRotation towards the given size and then back to the starting one + as if it was connected to the starting rotation via an elastic. + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoints to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoint to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + Type of path to use with DOPath tweens + + + + Linear, composed of straight segments between each waypoint + + + Curved path (which uses Catmull-Rom curves) + + + + Main DOTween class. Contains static methods to create and control tweens in a generic way + + + + DOTween's version + + + If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + Default: TRUE + + + If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + Beware, this will slightly slow down your tweens while inside Unity Editor. + Default: FALSE + + + Global DOTween timeScale. + Default: 1 + + + Default updateType for new tweens. + Default: UpdateType.Normal + + + Sets whether Unity's timeScale should be taken into account by default or not. + Default: false + + + Default autoPlay behaviour for new tweens. + Default: AutoPlay.All + + + Default autoKillOnComplete behaviour for new tweens. + Default: TRUE + + + Default loopType applied to all new tweens. + Default: LoopType.Restart + + + If TRUE all newly created tweens are set as recyclable, otherwise not. + Default: FALSE + + + Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + Default: Ease.InOutQuad + + + Default overshoot/amplitude used for eases + Default: 1.70158f + + + Default period used for eases + Default: 0 + + + + Must be called once, before the first ever DOTween call/reference, + otherwise it will be called automatically and will use default options. + Calling it a second time won't have any effect. + You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + + If TRUE all new tweens will be set for recycling, meaning that when killed, + instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + even if they were killed (since they might have been respawned and are now being used for other tweens). + If you want to automatically set your tween references to NULL when a tween is killed + you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + You can change this setting at any time by changing the static property, + or you can set the recycling behaviour for each tween separately, using: + SetRecyclable(bool recyclable) + Default: FALSE + If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + You can change this setting at any time by changing the static property. + Default: FALSE + Type of logging to use. + You can change this setting at any time by changing the static property. + Default: ErrorsOnly + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + + If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + (so that next time you use it it will need to be re-initialized) + + + + Clears all cached tween pools. + + + + + Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + and returns the total number of invalid tweens found and removed. + Automatically called when loading a new scene if is TRUE. + BEWARE: this is a slightly expensive operation so use it with care + + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using a custom plugin + The plugin to use. Each custom plugin implements a static Get() method + you'll need to call to assign the correct plugin in the correct way, like this: + CustomPlugin.Get() + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens only one axis of a Vector3 to the given value using default plugins. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + The axis to tween + + + Tweens only the alpha of a Color to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a virtual property from the given start to the given end value + and implements a setter that allows to use that value with an external method or a lambda + Example: + To(MyMethod, 0, 12, 0.5f); + Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + The action to perform with the tweened value + The value to start from + The end value to reach + The duration of the virtual tween + + + + Punches a Vector3 towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The direction and strength of the punch + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the direction and the opposite decaying direction, + while 0 oscillates only between the starting position and the decaying direction + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE only shakes on the X Y axis (looks better with things like cameras). + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + + + Tweens a property or field to the given values using default plugins. + Ease is applied between each segment and not as a whole. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end values to reach for each segment. This array must have the same length as durations + The duration of each segment. This array must have the same length as endValues + + + + Returns a new to be used for tween groups + + + + Completes all tweens and returns the number of actual tweens completed + (meaning tweens that don't have infinite loops and were not already complete) + + + Completes all tweens with the given ID or target and returns the number of actual tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + Flips all tweens (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + + + Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + and returns the actual tweens involved + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens with the given ID or target and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Pauses all tweens and returns the number of actual tweens paused + + + Pauses all tweens with the given ID or target and returns the number of actual tweens paused + (meaning the tweens that were actually playing and have been paused) + + + Plays all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing or complete) + + + Plays all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays backwards all tweens and returns the number of actual tweens played + (meaning tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays forward all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing forward or complete) + + + Restarts all tweens, then returns the number of actual tweens restarted + + + Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + + + Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + (meaning tweens that were not already rewinded) + + + Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + (meaning the tweens that were not already rewinded) + + + Toggles the play state of all tweens and returns the number of actual tweens toggled + (meaning tweens that could be played or paused, depending on the toggle state) + + + Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + (meaning the tweens that could be played or paused, depending on the toggle state) + + + + Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). + You can also use this to know if a shortcut tween is active for a given target. + Example: + transform.DOMoveX(45, 1); // transform is automatically added as the tween target + DOTween.IsTweening(transform); // Returns true + + + + + Returns the total number of active and playing tweens. + A tween is considered as playing even if its delay is actually playing + + + + + Returns a list of all active tweens in a playing state. + Returns NULL if there are no active playing tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens in a paused state. + Returns NULL if there are no active paused tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens with the given id. + Returns NULL if there are no active tweens with the given id. + Beware: each time you call this method a new list is generated + + + + + Returns a list of all active tweens with the given target. + Returns NULL if there are no active tweens with the given target. + Beware: each time you call this method a new list is generated + + + + DOTween's log behaviour. + Default: LogBehaviour.ErrorsOnly + + + + Path plugin works exclusively with Transforms + + + + + Types of loop + + + + Each loop cycle restarts from the beginning + + + The tween moves forward and backwards at alternate cycles + + + Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + In case of String tweens works only if the tween is set as relative + + + + Animates a single value + + + + Changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Creates virtual tweens that can be used to change other elements via their OnUpdate calls + + + + + Tweens a virtual float. + You can add regular settings to the generated tween, + but do not use SetUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type float, called at each update + + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Fires the given callback after the given time. + Callback delay + Callback to fire when the delay has expired + If TRUE (default) ignores Unity's timeScale + + + + Used to interpret AnimationCurves as eases. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Struct that stores two colors (used for LineRenderer tweens) + + + + + What axis to constrain in case of Vector tweens + + + + + Path control point + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a Vector3 with z = 0 + + + + + Returns the 2D angle between two vectors + + + + + Gets the point on the path at the given percentage (0 to 1) + + The percentage (0 to 1) at which to get the point + If TRUE constant speed is taken into account, otherwise not + + + + Public only so custom shortcuts can access some of these methods + + + + diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML.meta new file mode 100644 index 0000000..4b6638a --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 32d3af87ee00b2540b93b3d175025be1 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll new file mode 100644 index 0000000..842485e Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb new file mode 100644 index 0000000..7966c10 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta new file mode 100644 index 0000000..51f33fb --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 75fba9607a513b64984db6d29f41986c +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.meta new file mode 100644 index 0000000..500aef7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6cc6d4d0f1606b041be016a1b3105a6e +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll new file mode 100644 index 0000000..1c4d441 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb new file mode 100644 index 0000000..0c3b9cd Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta new file mode 100644 index 0000000..74052c0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 589b8271dd960624a8620bca5ed778db +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.meta new file mode 100644 index 0000000..c2b208c --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: cc98104edfc2736418636b4b8c0e3b0b +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml new file mode 100644 index 0000000..faa6a44 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml @@ -0,0 +1,47 @@ + + + + DOTween43 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween43 methods, require Unity 4.3 or later. + + + + Tweens a SpriteRenderer's color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's alpha color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Rigidbody2D's position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's X position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's Y position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's rotation to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml.meta new file mode 100644 index 0000000..21f2061 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6e08c600d5d981242b5d3c1d825106d6 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll new file mode 100644 index 0000000..ca86829 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb new file mode 100644 index 0000000..44d0a29 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta new file mode 100644 index 0000000..bcd85aa --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 773153d471589be45acb355405a2bcf5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.meta new file mode 100644 index 0000000..81473f7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: da65c15675bf19f4c953026614098b09 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml new file mode 100644 index 0000000..d630ed1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml @@ -0,0 +1,120 @@ + + + + DOTween46 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween46 methods, require Unity 4.6 or later. + + + + Tweens a CanvasGroup's alpha color to the given value. + Also stores the canvasGroup as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's fillAmount to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an LayoutElement's flexibleWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's minWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's preferredWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Outline's effectColor to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectColor alpha to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectDistance to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a RectTransform's anchoredPosition to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's anchoredPosition3D to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's sizeDelta to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Slider's value to the given value. + Also stores the Slider as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Text's color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's alpha color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's text to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end string to tween toThe duration of the tween + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL (default) to use default ones + + + diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml.meta new file mode 100644 index 0000000..e858ba5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d27835d6231b6aa48841c3f8b2214fa8 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor.meta new file mode 100644 index 0000000..1059025 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3500705e15d89ff43a4ee7740f47688f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML new file mode 100644 index 0000000..09c788c --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML @@ -0,0 +1,60 @@ + + + + DOTweenEditor + + + + + Not used as menu item anymore, but as a utiity function + + + + + Setups DOTween + + If TRUE, no warning window appears in case there is no need for setup + + + + Checks that the given editor texture use the correct import settings, + and applies them if they're incorrect. + + + + + Returns TRUE if addons setup is required. + + + + + Returns TRUE if the file/directory at the given path exists. + + Path, relative to Unity's project folder + + + + + Converts the given project-relative path to a full path, + with backward (\) slashes). + + + + + Converts the given full path to a path usable with AssetDatabase methods + (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + + + + + Connects to a asset. + If the asset already exists at the given path, loads it and returns it. + Otherwise, either returns NULL or automatically creates it before loading and returning it + (depending on the given parameters). + + Asset type + File path (relative to Unity's project folder) + If TRUE and the requested asset doesn't exist, forces its creation + + + diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta new file mode 100644 index 0000000..1481eb6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b1520efae3508be4a84aa316d04fc675 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll new file mode 100644 index 0000000..a19c6e8 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb new file mode 100644 index 0000000..eac2d43 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta new file mode 100644 index 0000000..43400aa --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f485bbcdc045cfb46ad37827b2f24d67 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta new file mode 100644 index 0000000..0d45498 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 15321a018ba7b9f49a6442a41ee5dc70 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta new file mode 100644 index 0000000..238209b --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d28015e4a90913243b173a19a95ff801 +timeCreated: 1426173527 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs.meta new file mode 100644 index 0000000..47e1b49 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b7c3cf2b694a2ab4d8e1b5a45b028052 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png new file mode 100644 index 0000000..d06fc7c Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta new file mode 100644 index 0000000..d0fd73a --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: b51ee612bc8b58e45b114f4f88219aa4 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 128 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png new file mode 100644 index 0000000..e29d02f Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta new file mode 100644 index 0000000..76dc75c --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: cbbac93ae244da644b3399f418baca2c +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 256 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png new file mode 100644 index 0000000..e48db5e Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta new file mode 100644 index 0000000..1dd185d --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 47b1c758170446e478d8369151ad68c0 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg new file mode 100644 index 0000000..4d710d7 Binary files /dev/null and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta new file mode 100644 index 0000000..9a96b8c --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: c75c360efddf317489499b0b8acad6be +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt b/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt new file mode 100644 index 0000000..3439db1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt @@ -0,0 +1,18 @@ +DOTween and DOTween Pro are copyright (c) 2014 Daniele Giardini - Demigiant + +// GET STARTED ////////////////////////////////////////////// + +- After importing a new DOTween update, select DOTween's Utility Panel from the Tools menu (if it doesn't open automatically) and press the "Setup DOTween..." button to set up additional features based on your Unity version. +- In your code, add "using DG.Tweening" to each class where you want to use DOTween. +- You're ready to tween. Check out the links below for full documentation and license info. + + +// LINKS /////////////////////////////////////////////////////// + +DOTween website (documentation, examples, etc): http://dotween.demigiant.com +DOTween license: http://dotween.demigiant.com/license.php +DOTween repository (Google Code): https://code.google.com/p/dotween/ + +// NOTES ////////////////////////////////////////////////////// + +- DOTween's Utility Panel can be found under "Tools > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt.meta b/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt.meta new file mode 100644 index 0000000..1c3d85b --- /dev/null +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/readme.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d528b87e51999eb4bb9bb1050815c97d +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice.meta b/UnityTests.Unity5/Assets/Dice.meta new file mode 100644 index 0000000..a7449c1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9208a251d3a0ed245a2207b7959b44b0 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt b/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt new file mode 100644 index 0000000..57a3f64 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt @@ -0,0 +1,48 @@ +INSTALLATION FROM UNITY ASSET STORE + +After you download and import this package from the Unity Asset Store, this product, containing the fully scripted and functional dice, will be automaticly installed. + +INSTALLATION AFTER DOWNLOAD FROM WWW.WYRMTALE.COM WEBSITE + +After you have downloaded the component archive file (Dices-Light.rar) you will find a Dices-Light.unitypackage when you extract the files from the archive. + +To install this package : + +- create an empty Unity Project. +- select [Menu] Assets->Import Package +- select the extracted Dices-Light.unitypackage and import all assets. + +After importing is complete, you will be ready to go. + +---------------- + +!!IMPORTANT!! - Set you project gravity to [-60] for the best rolling physics simulation behaviour +[Menu] Edit->Project Settings->Physics + + +USAGE + +Under [Project] Dice->Resources->Prefabs , you will find the full scripted and textured dice prefabs that you +can use in your project. The prefabs already have collider and rigid body components. + +If you would want to change physics behaviour you could alter the physics material that all dice use. This physics material can be found at [Project] Dice->Materials->general = 'dice-material' + +Each prefab has a Class Die (subclassed) script that contains a 'value' attribute that displays the 'side-up' value at all times. + +Under [Project] Dice->Plugins, you find a Dice.cs script file that holds some static 'helper' methods that you can use to roll dice and calculate or display the values. + +Under [Project] Dice->Scenes->Demo you will find the demo scene that makes use of the static helper functions. + +All c# code in this project has 'inline' code documentation. + +---------------- + +If you have any questions regarding this product send us an email at +support@wyrmtale.com + + + +Thanks for you interest in our components + + The WyrmTale Team. + diff --git a/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt.meta b/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt.meta new file mode 100644 index 0000000..d879931 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/-Read-Me-.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3c108f41fea98c449ae540d327852ac2 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Materials.meta b/UnityTests.Unity5/Assets/Dice/Materials.meta new file mode 100644 index 0000000..c7ddd70 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2c042466e7fa4ef43a6ae76ff8e1692f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Materials/d6.meta b/UnityTests.Unity5/Assets/Dice/Materials/d6.meta new file mode 100644 index 0000000..ccb15ea --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Materials/d6.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ea1263503347eb34ea2604b95084ea6f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat b/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat new file mode 100644 index 0000000..e4f5dfd Binary files /dev/null and b/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat differ diff --git a/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat.meta b/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat.meta new file mode 100644 index 0000000..b5fefe1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Materials/d6/d6-white-dots.mat.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 90eb9b65faccf864a8ec41e32802c85c +labels: +- d6 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs.meta b/UnityTests.Unity5/Assets/Dice/Prefabs.meta new file mode 100644 index 0000000..07ed7c0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Prefabs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7b6b8bf2adac7f148a19f09b7dba5a76 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab b/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab new file mode 100644 index 0000000..e9bd728 Binary files /dev/null and b/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab differ diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab.meta b/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab.meta new file mode 100644 index 0000000..b42b669 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Prefabs/Dice.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c79f2f6981de7cd469e2dce06afe35c7 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX.meta b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX.meta new file mode 100644 index 0000000..992a655 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 37ba839696bf2ba41a1585af770bb7f1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx new file mode 100644 index 0000000..296c215 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx @@ -0,0 +1,3155 @@ +; FBX 6.1.0 project file +; Created by Blender FBX Exporter +; for support mail: ideasman42@gmail.com +; ---------------------------------------------------- + +FBXHeaderExtension: { + FBXHeaderVersion: 1003 + FBXVersion: 6100 + CreationTimeStamp: { + Version: 1000 + Year: 2010 + Month: 12 + Day: 31 + Hour: 12 + Minute: 43 + Second: 09 + Millisecond: 0 + } + Creator: "FBX SDK/FBX Plugins build 20070228" + OtherFlags: { + FlagPLE: 0 + } +} +CreationTime: "2010-12-31 12:43:09:000" +Creator: "Blender version 2.55 (sub 0)" + +; Object definitions +;------------------------------------------------------------------ + +Definitions: { + Version: 100 + Count: 22 + ObjectType: "Model" { + Count: 13 + } + ObjectType: "Geometry" { + Count: 4 + } + ObjectType: "Material" { + Count: 4 + } + ObjectType: "Texture" { + Count: 2 + } + ObjectType: "Video" { + Count: 2 + } + ObjectType: "Pose" { + Count: 1 + } + ObjectType: "GlobalSettings" { + Count: 1 + } +} + +; Object properties +;------------------------------------------------------------------ + +Objects: { + Model: "Model::Camera Switcher", "CameraSwitcher" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Camera Index", "Integer", "A+",100 + } + MultiLayer: 0 + MultiTake: 1 + Hidden: "True" + Shading: W + Culling: "CullingOff" + Version: 101 + Name: "Model::Camera Switcher" + CameraId: 0 + CameraName: 100 + CameraIndexName: + } + Model: "Model::blend_root", "Null" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + TypeFlags: "Null" + } + Model: "Model::d10Low", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 0.000750,0.011625,1.612802,-1.620013,-0.528873,0.149860,0.017342,-1.699249,0.149860,1.578616,0.528534,-0.137692,0.000118,1.669586,-0.137692,1.594383,-0.484776,0.138533,0.972043,1.360849,0.143062 + ,-0.975570,1.339298,0.143041,-1.618205,0.530150,-0.146483,1.024217,-1.365776,-0.152291,-0.983349,-1.376488,-0.152284,0.009668,0.015116,-1.610717 + PolygonVertexIndex: 0,7,8,-2,0,6,4,-8,0,5,3,-7,0,2,9,-6,0,1,10,-3,1,8,11,-11,2,10,11,-10,5,9,11,-4,6,3,11,-5,7,4,11,-9 + Edges: 0,2,0,1,8,11,9,11,10,11,7,8,5,9,3,11,1,10,3,5,2,9,1,8,4,7 + ,2,10,3,6,4,6,4,11,0,6,0,7,0,5 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.006591998040676,0.012024292722344,0.999877929687500,-0.892696917057037,-0.287820070981979,0.346720784902573 + ,0.012939848005772,-0.937406539916992,0.347972035408020,0.890438556671143,0.305246144533157,-0.337473690509796 + ,0.000610370188951,0.941648602485657,-0.336588650941849,0.901242077350616,-0.263649404048920,0.343791007995605 + ,0.547013759613037,0.764488637447357,0.341044336557388,-0.542649626731873,0.766838610172272,0.342692345380783 + ,-0.887875020503998,0.304971456527710,-0.344431906938553,0.572923958301544,-0.743064641952515,-0.345835745334625 + ,-0.545854032039642,-0.761192679405212,-0.350108325481415,0.008911404758692,0.013702810741961,-0.999847412109375 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.262641,0.384300,0.381728,0.624013,0.264874,0.681146,0.142234,0.628914,0.448802,0.553664,0.324241,0.302287,0.446706,0.248573 + ,0.570490,0.302401,0.852791,0.933422,0.733158,0.681154,0.854822,0.630760,0.977318,0.684656,0.505522,0.955324,0.381581,0.707416 + ,0.505500,0.651899,0.626649,0.709335,0.147976,0.966032,0.020675,0.717623,0.145525,0.661723,0.270423,0.714939,0.142212,0.246712 + ,0.267820,0.303016,0.141835,0.554794,0.016284,0.303097,0.605807,0.671740,0.481671,0.616130,0.606368,0.366102,0.731284,0.616439 + ,0.678718,0.979700,0.551989,0.928908,0.679227,0.677116,0.799452,0.927098,0.782111,0.246292,0.902442,0.301806,0.776366,0.545822 + ,0.660708,0.296323,0.315838,0.982302,0.194916,0.929357,0.317625,0.684493,0.439577,0.934429 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + Materials: 0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + } + Model: "Model::d10", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: -0.139987,0.055448,1.516454,-1.028753,1.260882,0.186687,-1.605425,0.523939,-0.083602,-1.613689,-0.433901,0.192402,0.000125,0.158906,1.514090,0.879220,1.383134,0.186860,0.000662,1.655530,-0.073787 + ,-0.883211,1.363086,0.187380,0.141427,0.058792,1.514007,1.586040,-0.389634,0.182364,1.566364,0.524210,-0.073032,1.022350,1.279983,0.187098,0.087939,-0.106873,1.517277,0.105045,-1.663498,0.191895 + ,1.014767,-1.355213,-0.089797,1.537226,-0.560305,0.181925,-0.085039,-0.108415,1.519401,-1.558262,-0.600657,0.191948,-0.977596,-1.368303,-0.086092,-0.070857,-1.664173,0.191693,-1.608615,-0.524767,0.085698 + ,-1.611870,0.435809,-0.188874,-0.130207,-0.031510,-1.517143,-1.034822,-1.296821,-0.194265,0.017676,-1.688349,0.084462,-0.891239,-1.399198,-0.194063,0.011008,-0.132948,-1.517346,0.932732,-1.389304,-0.194210 + ,1.583630,-0.482929,0.072372,1.071010,-1.281975,-0.194972,0.150500,-0.030835,-1.514207,1.573212,0.433700,-0.181782,0.963819,1.349612,0.079383,1.517057,0.601532,-0.181793,0.095683,0.134517,-1.511520 + ,0.088844,1.634364,-0.181477,-0.970709,1.330503,0.075953,-0.087551,1.632649,-0.181729,-0.078141,0.133456,-1.514246,-1.553747,0.601164,-0.188940 + PolygonVertexIndex: 0,1,2,-4,6,7,4,-6,10,11,8,-10,14,15,12,-14,18,19,16,-18,22,23,20,-22,26,27,24,-26,30,31,28,-30,34,35,32,-34,38,39,36,-38,0,4,7,-2,39,2,1,-37,16,0,3,-18 + ,2,21,20,-4,11,5,4,-9,5,32,35,-7,36,7,6,-38,15,9,8,-13,9,28,31,-11,32,11,10,-34,19,13,12,-17,27,14,13,-25,14,29,28,-16,23,18,17,-21,18,25,24,-20,38,22,21,-40 + ,22,26,25,-24,26,30,29,-28,30,34,33,-32,34,38,37,-36,8,0,16,-13,3,20,-18,13,19,-25,10,31,-34,6,35,-38,9,15,-29,5,11,-33,1,7,-37,2,39,-22 + ,14,27,-30,18,23,-26,30,22,38,-35,0,8,-5,22,30,-27 + Edges: 0,3,0,1,1,2,2,3,4,7,4,5,5,6,6,7,8,11,8,9,9,10,10,11,12,15 + ,12,13,13,14,14,15,16,19,12,16,16,17,17,18,18,19,20,23,17,20,20,21,21,22,22,23 + ,24,27,19,24,24,25,23,25,25,26,26,27,28,31,15,28,28,29,27,29,29,30,30,31,32,35 + ,11,32,32,33,31,33,33,34,34,35,36,39,7,36,36,37,35,37,37,38,34,38,21,39,38,39 + ,0,16,0,4,4,8,8,12,3,20,3,17,13,19,13,24,10,31,10,33,6,35,6,37,9,15 + ,9,28,5,11,5,32,1,7,1,36,2,39,2,21,14,27,14,29,18,23,18,25,22,38,22,26 + ,26,30,30,34,0,8,22,30 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: -0.365153968334198,0.133335366845131,0.921323299407959,-0.659230351448059,0.598681628704071,0.454908907413483 + ,-0.935300767421722,0.325785100460052,0.138096258044243,-0.884914696216583,-0.073519088327885,0.459852904081345 + ,-0.000152592547238,0.495834231376648,0.868373692035675,0.342570275068283,0.825220465660095,0.449018836021423 + ,-0.008270516060293,0.990508735179901,0.136997595429420,-0.346568197011948,0.822504341602325,0.450910985469818 + ,0.377544492483139,0.134006768465042,0.916226685047150,0.890896320343018,-0.056550797075033,0.450605779886246 + ,0.939451277256012,0.315195173025131,0.134311959147453,0.671742916107178,0.589587092399597,0.448438972234726 + ,0.298806726932526,-0.377971738576889,0.876247465610504,0.211645856499672,-0.860713541507721,0.462935268878937 + ,0.606097579002380,-0.783165991306305,0.138676106929779,0.779412209987640,-0.429395437240601,0.456160157918930 + ,-0.278450876474380,-0.387279897928238,0.878872036933899,-0.758659601211548,-0.464674830436707,0.456587433815002 + ,-0.576433598995209,-0.807458698749542,0.125309005379677,-0.195410013198853,-0.866939306259155,0.458479553461075 + ,-0.940916180610657,-0.311166733503342,-0.133579522371292,-0.884426414966583,0.086428418755531,-0.458571135997772 + ,-0.362010568380356,-0.111117891967297,-0.925504326820374,-0.663991212844849,-0.586748838424683,-0.463484615087509 + ,0.005554368719459,-0.991546392440796,-0.129520550370216,-0.340647608041763,-0.818720042705536,-0.462202817201614 + ,0.008453627116978,-0.475692003965378,-0.879543423652649,0.361430704593658,-0.811761856079102,-0.458662688732147 + ,0.953398227691650,-0.274056226015091,-0.125949889421463,0.694173991680145,-0.558549761772156,-0.453993350267410 + ,0.381725519895554,-0.101565599441528,-0.918637633323669,0.890255451202393,0.094332709908485,-0.445539712905884 + ,0.579332888126373,0.804193258285522,-0.132602930068970,0.763390004634857,0.466628015041351,-0.446577340364456 + ,0.291451752185822,0.405316323041916,-0.866451025009155,0.197546318173409,0.872615754604340,-0.446638375520706 + ,-0.570848703384399,0.811914443969727,-0.121890924870968,-0.202764973044395,0.873165071010590,-0.443220317363739 + ,-0.277779459953308,0.406445503234863,-0.870387911796570,-0.752647459506989,0.480330824851990,-0.450300604104996 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.262707,0.403336,0.371514,0.621403,0.264246,0.674226,0.152454,0.626308,0.445956,0.253666,0.561235,0.303243,0.448132,0.542238 + ,0.333120,0.305228,0.854365,0.637833,0.968535,0.687023,0.852300,0.921426,0.742619,0.686589,0.503829,0.661024,0.614770,0.713421 + ,0.504993,0.937504,0.393169,0.709841,0.144818,0.669044,0.259327,0.717165,0.146912,0.951778,0.026844,0.721275,0.141403,0.543550 + ,0.024694,0.306354,0.142129,0.252792,0.257831,0.305285,0.605870,0.377811,0.721621,0.612775,0.605581,0.665122,0.491101,0.613114 + ,0.679370,0.691697,0.791509,0.924353,0.678445,0.974989,0.560151,0.927009,0.776926,0.534245,0.668777,0.299264,0.781551,0.251624 + ,0.893636,0.303167,0.317959,0.697639,0.430480,0.931115,0.316478,0.976017,0.201723,0.926726,0.607536,0.077748,0.557520,0.151522 + ,0.539438,0.122458,0.589167,0.108173,0.572502,0.228693,0.539808,0.165431,0.557520,0.151522,0.553892,0.243330,0.521425,0.152261 + ,0.489364,0.188749,0.508459,0.218833,0.539438,0.122458,0.539808,0.165431,0.526106,0.082959,0.507177,0.067111,0.521425,0.152261 + ,0.716530,0.180028,0.570423,0.077731,0.589167,0.108173,0.697870,0.210046,0.570423,0.077731,0.678502,0.066496,0.660029,0.081346 + ,0.588858,0.064053,0.553892,0.243330,0.607536,0.077748,0.588858,0.064053,0.535628,0.227928,0.622763,0.186363,0.679732,0.179500 + ,0.697870,0.210046,0.604402,0.216260,0.679732,0.179500,0.650657,0.242424,0.669098,0.226991,0.698149,0.166299,0.678502,0.066496 + ,0.716530,0.180028,0.698149,0.166299,0.696462,0.082172,0.527004,0.188344,0.585828,0.186074,0.604402,0.216260,0.508459,0.218833 + ,0.650373,0.143809,0.604425,0.172324,0.585828,0.186074,0.631491,0.159481,0.604425,0.172324,0.631802,0.227263,0.650657,0.242424 + ,0.622763,0.186363,0.488196,0.082971,0.508112,0.174808,0.489364,0.188749,0.507177,0.067111,0.508112,0.174808,0.612752,0.143763 + ,0.631491,0.159481,0.527004,0.188344,0.554152,0.196591,0.507120,0.115384,0.526106,0.082959,0.572502,0.228693,0.507120,0.115384 + ,0.631568,0.111583,0.612752,0.143763,0.488196,0.082971,0.631568,0.111583,0.650795,0.194944,0.631802,0.227263,0.650373,0.143809 + ,0.650795,0.194944,0.677592,0.113467,0.696462,0.082172,0.669098,0.226991,0.677592,0.113467,0.554152,0.196591,0.535628,0.227928 + ,0.660029,0.081346,0.697870,0.210046,0.539438,0.122458,0.508459,0.218833,0.604402,0.216260,0.521425,0.152261,0.507177,0.067111 + ,0.489364,0.188749,0.585828,0.186074,0.527004,0.188344,0.631491,0.159481,0.698149,0.166299,0.669098,0.226991,0.696462,0.082172 + ,0.588858,0.064053,0.660029,0.081346,0.535628,0.227928,0.679732,0.179500,0.622763,0.186363,0.650657,0.242424,0.570423,0.077731 + ,0.716530,0.180028,0.678502,0.066496,0.557520,0.151522,0.607536,0.077748,0.553892,0.243330,0.539808,0.165431,0.572502,0.228693 + ,0.526106,0.082959,0.604425,0.172324,0.650373,0.143809,0.631802,0.227263,0.508112,0.174808,0.488196,0.082971,0.612752,0.143763 + ,0.650795,0.194944,0.507120,0.115384,0.554152,0.196591,0.677592,0.113467,0.539438,0.122458,0.697870,0.210046,0.589167,0.108173 + ,0.507120,0.115384,0.650795,0.194944,0.631568,0.111583 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163 + } + LayerElementTexture: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + Materials: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + Layer: 1 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 1 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 1 + } + } + } + Model: "Model::d6Low", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000,1.000000,0.999999,-1.000001,1.000000,-1.000000,-1.000000,1.000000 + ,-1.000000,1.000000,1.000000 + PolygonVertexIndex: 0,1,2,-4,4,7,6,-6,0,4,5,-2,1,5,6,-3,2,6,7,-4,4,0,3,-8 + Edges: 1,2,0,1,0,3,2,3,4,5,5,6,6,7,4,7,1,5,0,4,2,6,3,7 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,-0.577349185943604 + ,-0.577349185943604,-0.577349185943604,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604 + ,0.577349185943604,0.577349185943604,0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604 + ,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,0.577349185943604 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.318633,0.349476,0.318645,0.647602,0.020520,0.647614,0.020507,0.349489,0.648345,0.315093,0.353934,0.315093,0.353934,0.020682 + ,0.648345,0.020682,0.350206,0.350181,0.649819,0.350206,0.649794,0.649819,0.350181,0.649794,0.691822,0.025304,0.974615,0.025237 + ,0.974682,0.308029,0.691889,0.308097,0.679717,0.645987,0.679717,0.350198,0.975506,0.350198,0.975506,0.645987,0.311233,0.021648 + ,0.311233,0.310780,0.022101,0.310780,0.022101,0.021648 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "AllSame" + ReferenceInformationType: "IndexToDirect" + Materials: 0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + } + Model: "Model::d6", "Mesh" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000000000000000,-0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Size", "double", "",100 + Property: "Look", "enum", "",1 + } + MultiLayer: 0 + MultiTake: 1 + Shading: Y + Culling: "CullingOff" + Vertices: 0.929588,0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929588,-0.929587,-1.000000,-0.929587,0.929588,-1.000000,-0.929588,-0.929587,1.000000,0.929587,-0.929588,1.000000,0.929588,0.929587,1.000000 + ,-0.929587,0.929588,1.000000,0.999999,-0.929588,0.929588,1.000000,-0.929588,-0.929588,1.000000,0.929587,-0.929588,1.000000,0.929587,0.929588,-0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929588 + ,0.929588,-1.000000,-0.929588,0.929587,-1.000001,0.929588,-1.000000,0.929588,0.929588,-1.000000,0.929588,-0.929588,-1.000000,-0.929587,-0.929588,-1.000000,-0.929587,0.929588,-0.929587,1.000000,-0.929588 + ,-0.929587,1.000000,0.929588,0.929588,0.999999,0.929588,0.929588,1.000000,-0.929588,0.964434,0.929587,-0.985566,0.985566,0.929587,-0.964434,0.985566,-0.929588,-0.964434,0.964434,-0.929588,-0.985566 + ,-0.929588,-0.985566,-0.964434,-0.929588,-0.964434,-0.985566,0.929588,-0.964434,-0.985566,0.929588,-0.985566,-0.964434,0.929588,0.985566,-0.964434,0.929588,0.964434,-0.985566,-0.929587,0.964434,-0.985566 + ,-0.929587,0.985567,-0.964434,-0.985566,0.929588,-0.964434,-0.964433,0.929588,-0.985566,-0.964434,-0.929587,-0.985566,-0.985566,-0.929587,-0.964434,-0.929587,0.985566,0.964434,-0.929587,0.964434,0.985566 + ,0.929588,0.964433,0.985566,0.929588,0.985566,0.964434,-0.964434,0.929588,0.985566,-0.985566,0.929588,0.964434,-0.985567,-0.929587,0.964434,-0.964434,-0.929587,0.985566,0.964433,-0.929588,0.985566 + ,0.985566,-0.929588,0.964434,0.985567,0.929587,0.964434,0.964434,0.929587,0.985566,-0.929588,-0.964433,0.985566,-0.929588,-0.985566,0.964434,0.929587,-0.985567,0.964434,0.929587,-0.964434,0.985566 + ,0.964434,0.985566,0.929588,0.985567,0.964433,0.929588,0.985566,0.964434,-0.929588,0.964434,0.985566,-0.929588,0.985566,-0.964434,0.929588,0.964433,-0.985567,0.929588,0.964434,-0.985566,-0.929588 + ,0.985566,-0.964434,-0.929588,-0.964434,-0.985566,0.929588,-0.985567,-0.964433,0.929588,-0.985566,-0.964434,-0.929588,-0.964434,-0.985566,-0.929588,-0.985566,0.964434,0.929588,-0.964434,0.985566,0.929588 + ,-0.964433,0.985567,-0.929588,-0.985566,0.964434,-0.929588,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,-0.966667,-0.966667,0.966667,-0.966667,-0.966667 + ,0.966667,-0.966667,-0.966667,-0.966667,-0.966666,-0.966667,-0.966667,-0.966666,-0.966667,-0.966667,-0.966666,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667 + ,0.966667,0.966666,0.966667,0.966667,0.966666,0.966667,0.966667,0.966666,0.966667,0.966666,-0.966667,0.966667,0.966666,-0.966667,0.966667,0.966666,-0.966667,0.966667,-0.966667,-0.966666,0.966667 + ,-0.966667,-0.966666,0.966667,-0.966667,-0.966666,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667,-0.966667,0.966667,0.966667 + PolygonVertexIndex: 0,1,2,-4,6,7,4,-6,10,11,8,-10,14,15,12,-14,18,19,16,-18,22,23,20,-22,26,27,24,-26,30,31,28,-30,34,35,32,-34,38,39,36,-38,42,43,40,-42,46,47,44,-46,50,51,48,-50 + ,54,55,52,-54,58,59,56,-58,62,63,60,-62,66,67,64,-66,70,71,68,-70,73,74,-73,76,77,-76,79,80,-79,82,83,-82,85,86,-85,88,89,-88,91,92,-91,94,95,-94 + ,0,24,27,-2,29,2,1,-31,33,0,3,-35,37,3,2,-39,55,5,4,-53,5,48,51,-7,47,4,7,-45,41,7,6,-43,63,9,8,-61,9,26,25,-11,49,8,11,-51,57,11,10,-59,67,13,12,-65 + ,13,28,31,-15,53,12,15,-55,61,15,14,-63,71,17,16,-69,17,36,39,-19,45,16,19,-47,65,19,18,-67,69,21,20,-71,21,40,43,-23,35,20,23,-33,59,23,22,-57,74,25,24,-73,26,76,75,-28 + ,28,79,78,-30,77,31,30,-76,32,73,72,-34,83,35,34,-82,36,82,81,-38,80,39,38,-79,40,94,93,-42,86,43,42,-85,95,45,44,-94,46,91,90,-48,89,49,48,-88,50,85,84,-52,92,53,52,-91 + ,54,88,87,-56,56,86,85,-58,73,59,58,-75,88,61,60,-90,62,77,76,-64,91,65,64,-93,66,80,79,-68,94,69,68,-96,70,83,82,-72,0,33,72,-25,27,75,30,-2,29,78,38,-3,3,37,81,-35 + ,6,51,84,-43,41,93,44,-8,47,90,52,-5,5,55,87,-49,25,74,58,-11,11,57,85,-51,49,89,60,-9,9,63,76,-27,31,77,62,-15,15,61,88,-55,53,92,64,-13,13,67,79,-29,39,80,66,-19 + ,19,65,91,-47,45,95,68,-17,17,71,82,-37,43,86,56,-23,23,59,73,-33,35,83,70,-21,21,69,94,-41 + Edges: 0,3,0,1,1,2,2,3,4,7,4,5,5,6,6,7,8,11,8,9,9,10,10,11,12,15 + ,12,13,13,14,14,15,16,19,16,17,17,18,18,19,20,23,20,21,21,22,22,23,24,27,24,25 + ,25,26,26,27,28,31,28,29,29,30,30,31,32,35,32,33,33,34,34,35,36,39,36,37,37,38 + ,38,39,40,43,40,41,41,42,42,43,44,47,44,45,45,46,46,47,48,51,48,49,49,50,50,51 + ,52,55,52,53,53,54,54,55,56,59,56,57,57,58,58,59,60,63,60,61,61,62,62,63,64,67 + ,64,65,65,66,66,67,68,71,68,69,69,70,70,71,72,74,33,72,72,73,59,73,58,74,73,74 + ,75,77,30,75,75,76,63,76,62,77,76,77,78,80,38,78,78,79,67,79,66,80,79,80,81,83 + ,37,81,81,82,71,82,70,83,82,83,84,86,51,84,84,85,57,85,56,86,85,86,87,89,55,87 + ,87,88,61,88,60,89,88,89,90,92,52,90,90,91,65,91,64,92,91,92,93,95,44,93,93,94 + ,69,94,68,95,94,95,0,33,0,24,24,72,1,27,1,30,27,75,2,29,2,38,29,78,3,37 + ,3,34,34,81,6,51,6,42,42,84,7,41,7,44,41,93,4,47,4,52,47,90,5,55,5,48 + ,48,87,10,25,10,58,25,74,11,57,11,50,50,85,8,49,8,60,49,89,9,63,9,26,26,76 + ,14,31,14,62,31,77,15,61,15,54,54,88,12,53,12,64,53,92,13,67,13,28,28,79,18,39 + ,18,66,39,80,19,65,19,46,46,91,16,45,16,68,45,95,17,71,17,36,36,82,22,43,22,56 + ,43,86,23,59,23,32,32,73,20,35,20,70,35,83,21,69,21,40,40,94 + GeometryVersion: 124 + LayerElementNormal: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByVertice" + ReferenceInformationType: "Direct" + Normals: 0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945,-0.959929168224335 + ,-0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945,-0.959929168224335 + ,-0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945,-0.198126167058945,0.959929168224335 + ,0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945,0.198126167058945,0.959929168224335 + ,0.959929168224335,-0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945,-0.198126167058945 + ,0.959929168224335,0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945,0.198126167058945 + ,-0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945 + ,0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945 + ,-0.959929168224335,0.198126167058945,0.198126167058945,-0.959929168224335,0.198126167058945,-0.198126167058945 + ,-0.959929168224335,-0.198126167058945,-0.198126167058945,-0.959929168224335,-0.198126167058945,0.198126167058945 + ,-0.198126167058945,0.959929168224335,-0.198126167058945,-0.198126167058945,0.959929168224335,0.198126167058945 + ,0.198126167058945,0.959929168224335,0.198126167058945,0.198126167058945,0.959929168224335,-0.198126167058945 + ,0.553819417953491,0.176305428147316,-0.813745558261871,0.813745558261871,0.176305428147316,-0.553819417953491 + ,0.813745558261871,-0.176305428147316,-0.553819417953491,0.553819417953491,-0.176305428147316,-0.813745558261871 + ,-0.176305428147316,-0.813745558261871,-0.553819417953491,-0.176305428147316,-0.553819417953491,-0.813745558261871 + ,0.176305428147316,-0.553819417953491,-0.813745558261871,0.176305428147316,-0.813745558261871,-0.553819417953491 + ,0.176305428147316,0.813745558261871,-0.553819417953491,0.176305428147316,0.553819417953491,-0.813745558261871 + ,-0.176305428147316,0.553819417953491,-0.813745558261871,-0.176305428147316,0.813745558261871,-0.553819417953491 + ,-0.813745558261871,0.176305428147316,-0.553819417953491,-0.553819417953491,0.176305428147316,-0.813745558261871 + ,-0.553819417953491,-0.176305428147316,-0.813745558261871,-0.813745558261871,-0.176305428147316,-0.553819417953491 + ,-0.176305428147316,0.813745558261871,0.553819417953491,-0.176305428147316,0.553819417953491,0.813745558261871 + ,0.176305428147316,0.553819417953491,0.813745558261871,0.176305428147316,0.813745558261871,0.553819417953491 + ,-0.553819417953491,0.176305428147316,0.813745558261871,-0.813745558261871,0.176305428147316,0.553819417953491 + ,-0.813745558261871,-0.176305428147316,0.553819417953491,-0.553819417953491,-0.176305428147316,0.813745558261871 + ,0.553819417953491,-0.176305428147316,0.813745558261871,0.813745558261871,-0.176305428147316,0.553819417953491 + ,0.813745558261871,0.176305428147316,0.553819417953491,0.553819417953491,0.176305428147316,0.813745558261871 + ,-0.176305428147316,-0.553819417953491,0.813745558261871,-0.176305428147316,-0.813745558261871,0.553819417953491 + ,0.176305428147316,-0.813745558261871,0.553819417953491,0.176305428147316,-0.553819417953491,0.813745558261871 + ,0.553819417953491,0.813745558261871,0.176305428147316,0.813745558261871,0.553819417953491,0.176305428147316 + ,0.813745558261871,0.553819417953491,-0.176305428147316,0.553819417953491,0.813745558261871,-0.176305428147316 + ,0.813745558261871,-0.553819417953491,0.176305428147316,0.553819417953491,-0.813745558261871,0.176305428147316 + ,0.553819417953491,-0.813745558261871,-0.176305428147316,0.813745558261871,-0.553819417953491,-0.176305428147316 + ,-0.553819417953491,-0.813745558261871,0.176305428147316,-0.813745558261871,-0.553819417953491,0.176305428147316 + ,-0.813745558261871,-0.553819417953491,-0.176305428147316,-0.553819417953491,-0.813745558261871,-0.176305428147316 + ,-0.813745558261871,0.553819417953491,0.176305428147316,-0.553819417953491,0.813745558261871,0.176305428147316 + ,-0.553819417953491,0.813745558261871,-0.176305428147316,-0.813745558261871,0.553819417953491,-0.176305428147316 + ,0.465620905160904,0.465620905160904,-0.752555906772614,0.465620905160904,0.752555906772614,-0.465620905160904 + ,0.752555906772614,0.465620905160904,-0.465620905160904,0.465620905160904,-0.465620905160904,-0.752555906772614 + ,0.752555906772614,-0.465620905160904,-0.465620905160904,0.465620905160904,-0.752555906772614,-0.465620905160904 + ,-0.465620905160904,-0.465620905160904,-0.752555906772614,-0.465620905160904,-0.752555906772614,-0.465620905160904 + ,-0.752555906772614,-0.465620905160904,-0.465620905160904,-0.465620905160904,0.465620905160904,-0.752555906772614 + ,-0.752555906772614,0.465620905160904,-0.465620905160904,-0.465620905160904,0.752555906772614,-0.465620905160904 + ,0.465620905160904,0.465620905160904,0.752555906772614,0.752555906772614,0.465620905160904,0.465620905160904 + ,0.465620905160904,0.752555906772614,0.465620905160904,0.465620905160904,-0.465620905160904,0.752525389194489 + ,0.465620905160904,-0.752555906772614,0.465620905160904,0.752555906772614,-0.465620905160904,0.465620905160904 + ,-0.465620905160904,-0.465620905160904,0.752555906772614,-0.752555906772614,-0.465620905160904,0.465620905160904 + ,-0.465620905160904,-0.752555906772614,0.465620905160904,-0.465620905160904,0.465620905160904,0.752555906772614 + ,-0.465620905160904,0.752555906772614,0.465620905160904,-0.752555906772614,0.465620905160904,0.465620905160904 + } + LayerElementSmoothing: 0 { + Version: 102 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementSmoothing: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByEdge" + ReferenceInformationType: "Direct" + Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.302069,0.365621,0.302486,0.629558,0.035546,0.628254,0.035242,0.364379,0.623184,0.291488,0.376116,0.290753,0.375857,0.045830 + ,0.623630,0.044722,0.636631,0.630823,0.369248,0.630838,0.369233,0.363455,0.636615,0.363440,0.959514,0.300275,0.698728,0.300319 + ,0.698684,0.039533,0.959470,0.039489,0.696899,0.625532,0.696899,0.371559,0.950872,0.371559,0.950872,0.625532,0.294762,0.041516 + ,0.294749,0.294584,0.041682,0.294571,0.041694,0.041503,0.331041,0.352661,0.327779,0.348447,0.358379,0.335238,0.362415,0.337772 + ,0.320346,0.348893,0.317659,0.352921,0.288883,0.339337,0.293134,0.336095,0.331820,0.298787,0.331861,0.294558,0.362144,0.324607 + ,0.357916,0.327742,0.839007,0.345103,0.838329,0.336772,0.893656,0.338675,0.895801,0.347395,0.745939,0.024641,0.747798,0.033866 + ,0.664159,0.033331,0.665679,0.023117,0.668072,0.352472,0.682305,0.354552,0.680430,0.466356,0.667609,0.468959,0.692394,0.274055 + ,0.678490,0.273697,0.676116,0.167078,0.690060,0.166884,0.846902,0.024799,0.846181,0.030235,0.803332,0.029610,0.802321,0.024711 + ,0.650561,0.061948,0.661507,0.061241,0.661507,0.145092,0.650561,0.145798,0.666632,0.516855,0.682005,0.521438,0.677122,0.642336 + ,0.662725,0.644590,0.334714,0.488480,0.324552,0.489136,0.324552,0.411295,0.334714,0.410639,0.335555,0.651102,0.317992,0.652140 + ,0.320933,0.522245,0.335469,0.522672,0.363423,0.331099,0.363367,0.331246,0.362533,0.330864,0.324441,0.353969,0.324292,0.353912 + ,0.324681,0.353071,0.287473,0.332792,0.287528,0.332641,0.288381,0.333016,0.325062,0.293625,0.325212,0.293679,0.324840,0.294528 + ,0.758584,0.025925,0.758300,0.026052,0.757668,0.024356,0.852937,0.028567,0.853016,0.028709,0.852143,0.029193,0.796611,0.028957 + ,0.796762,0.028889,0.797101,0.029788,0.653373,0.026160,0.653246,0.025876,0.654935,0.025245,0.354143,0.331604,0.358379,0.335238 + ,0.327779,0.348447,0.323993,0.344550,0.293134,0.336095,0.294515,0.335015,0.323993,0.344550,0.320346,0.348893,0.357916,0.327742 + ,0.354143,0.331604,0.330020,0.303168,0.331820,0.298787,0.895801,0.347395,0.899483,0.355901,0.839558,0.358758,0.839007,0.345103 + ,0.846181,0.030235,0.846255,0.035867,0.803940,0.035389,0.803332,0.029610,0.660920,0.166399,0.676116,0.167078,0.678490,0.273697 + ,0.663321,0.275234,0.682305,0.354552,0.697183,0.354238,0.695544,0.464809,0.680430,0.466356,0.665679,0.023117,0.666887,0.014894 + ,0.744830,0.013776,0.745939,0.024641,0.682005,0.521438,0.692499,0.521158,0.689569,0.644010,0.677122,0.642336,0.334182,0.358162 + ,0.331041,0.352661,0.362415,0.337772,0.367831,0.340739,0.690060,0.166884,0.703268,0.164732,0.702298,0.272268,0.692394,0.274055 + ,0.650561,0.145798,0.639614,0.146498,0.639614,0.062648,0.650561,0.061948,0.324552,0.489136,0.314390,0.489786,0.314390,0.411945 + ,0.324552,0.411295,0.283527,0.342728,0.288883,0.339337,0.317659,0.352921,0.314832,0.358538,0.802321,0.024711,0.800260,0.018543 + ,0.848354,0.018379,0.846902,0.024799,0.662725,0.644590,0.652232,0.643893,0.654185,0.520065,0.666632,0.516855,0.317992,0.652140 + ,0.304332,0.652184,0.306297,0.521312,0.320933,0.522245,0.892011,0.328123,0.893656,0.338675,0.838329,0.336772,0.835452,0.327882 + ,0.667609,0.468959,0.651462,0.474299,0.651462,0.348575,0.668072,0.352472,0.334714,0.410639,0.344876,0.409989,0.344876,0.487830 + ,0.334714,0.488480,0.335469,0.522672,0.353132,0.521164,0.351167,0.652035,0.335555,0.651102,0.663432,0.039286,0.664159,0.033331 + ,0.747798,0.033866,0.749508,0.038818,0.331861,0.294558,0.334614,0.288935,0.367481,0.321303,0.362144,0.324607,0.661507,0.061241 + ,0.672454,0.060541,0.672454,0.144391,0.661507,0.145092,0.363367,0.331246,0.362415,0.337772,0.358379,0.335238,0.362533,0.330864 + ,0.331041,0.352661,0.324441,0.353969,0.324681,0.353071,0.327779,0.348447,0.288883,0.339337,0.287473,0.332792,0.288381,0.333016 + ,0.293134,0.336095,0.324292,0.353912,0.317659,0.352921,0.320346,0.348893,0.324681,0.353071,0.362144,0.324607,0.363423,0.331099 + ,0.362533,0.330864,0.357916,0.327742,0.325212,0.293679,0.331861,0.294558,0.331820,0.298787,0.324840,0.294528,0.320747,0.295220 + ,0.325062,0.293625,0.324840,0.294528,0.325268,0.297784,0.287528,0.332641,0.288398,0.325959,0.291931,0.330780,0.288381,0.333016 + ,0.664159,0.033331,0.653373,0.026160,0.654935,0.025245,0.665679,0.023117,0.758300,0.026052,0.747798,0.033866,0.745939,0.024641 + ,0.757668,0.024356,0.653246,0.025876,0.648592,0.018224,0.658145,0.015654,0.654935,0.025245,0.792808,0.034713,0.796611,0.028957 + ,0.797101,0.029788,0.798251,0.035509,0.853016,0.028709,0.857067,0.034277,0.851968,0.035249,0.852143,0.029193,0.765800,0.015106 + ,0.758584,0.025925,0.757668,0.024356,0.755542,0.013575,0.796762,0.028889,0.802321,0.024711,0.803332,0.029610,0.797101,0.029788 + ,0.846902,0.024799,0.852937,0.028567,0.852143,0.029193,0.846181,0.030235,0.759581,0.035180,0.758300,0.026052,0.758584,0.025925 + ,0.768429,0.029713,0.363423,0.331099,0.369895,0.328169,0.369799,0.333755,0.363367,0.331246,0.852937,0.028567,0.855293,0.021538 + ,0.859434,0.025570,0.853016,0.028709,0.321819,0.360320,0.324292,0.353912,0.324441,0.353969,0.327335,0.360411,0.796611,0.028957 + ,0.789700,0.026423,0.793813,0.022381,0.796762,0.028889,0.281019,0.330273,0.287528,0.332641,0.287473,0.332792,0.281027,0.335861 + ,0.653373,0.026160,0.652787,0.035964,0.643818,0.029270,0.653246,0.025876,0.327582,0.287197,0.325212,0.293679,0.325062,0.293625 + ,0.322000,0.287197,0.354143,0.331604,0.357916,0.327742,0.362533,0.330864,0.358379,0.335238,0.327779,0.348447,0.324681,0.353071 + ,0.320346,0.348893,0.323993,0.344550,0.293134,0.336095,0.288381,0.333016,0.291931,0.330780,0.294515,0.335015,0.330020,0.303168 + ,0.325268,0.297784,0.324840,0.294528,0.331820,0.298787,0.744830,0.013776,0.755542,0.013575,0.757668,0.024356,0.745939,0.024641 + ,0.665679,0.023117,0.654935,0.025245,0.658145,0.015654,0.666887,0.014894,0.798251,0.035509,0.797101,0.029788,0.803332,0.029610 + ,0.803940,0.035389,0.846255,0.035867,0.846181,0.030235,0.852143,0.029193,0.851968,0.035249,0.362415,0.337772,0.363367,0.331246 + ,0.369799,0.333755,0.367831,0.340739,0.777777,0.017973,0.768429,0.029713,0.758584,0.025925,0.765800,0.015106,0.857067,0.034277 + ,0.853016,0.028709,0.859434,0.025570,0.860343,0.030874,0.334182,0.358162,0.327335,0.360411,0.324441,0.353969,0.331041,0.352661 + ,0.317659,0.352921,0.324292,0.353912,0.321819,0.360320,0.314832,0.358538,0.848354,0.018379,0.855293,0.021538,0.852937,0.028567 + ,0.846902,0.024799,0.802321,0.024711,0.796762,0.028889,0.793813,0.022381,0.800260,0.018543,0.283527,0.342728,0.281027,0.335861 + ,0.287473,0.332792,0.288883,0.339337,0.288398,0.325959,0.287528,0.332641,0.281019,0.330273,0.282727,0.323211,0.786456,0.033223 + ,0.789700,0.026423,0.796611,0.028957,0.792808,0.034713,0.648592,0.018224,0.653246,0.025876,0.643818,0.029270,0.640512,0.022407 + ,0.318263,0.291177,0.322000,0.287197,0.325062,0.293625,0.320747,0.295220,0.747798,0.033866,0.758300,0.026052,0.759581,0.035180 + ,0.749508,0.038818,0.367481,0.321303,0.369895,0.328169,0.363423,0.331099,0.362144,0.324607,0.331861,0.294558,0.325212,0.293679 + ,0.327582,0.287197,0.334614,0.288935,0.663432,0.039286,0.652787,0.035964,0.653373,0.026160,0.664159,0.033331 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 0 { + Version: 101 + Name: "UVTex" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + LayerElementUV: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 1 { + Version: 101 + Name: "UVTex.001" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementUV: 2 { + Version: 101 + Name: "UVTex.002" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 2 { + Version: 101 + Name: "UVTex.002" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementUV: 3 { + Version: 101 + Name: "UVTex.003" + MappingInformationType: "ByPolygonVertex" + ReferenceInformationType: "IndexToDirect" + UV: 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + ,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000 + UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54 + ,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109 + ,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + ,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219 + ,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274 + ,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329 + ,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383 + } + LayerElementTexture: 3 { + Version: 101 + Name: "UVTex.003" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + BlendMode: "Translucent" + TextureAlpha: 1 + TextureId: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + LayerElementMaterial: 0 { + Version: 101 + Name: "" + MappingInformationType: "ByPolygon" + ReferenceInformationType: "IndexToDirect" + Materials: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + } + Layer: 0 { + Version: 100 + LayerElement: { + Type: "LayerElementNormal" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementMaterial" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 0 + } + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 0 + } + } + Layer: 1 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 1 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 1 + } + } + Layer: 2 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 2 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 2 + } + } + Layer: 3 { + Version: 100 + LayerElement: { + Type: "LayerElementUV" + TypedIndex: 3 + } + LayerElement: { + Type: "LayerElementTexture" + TypedIndex: 3 + } + } + } + Model: "Model::Producer Perspective", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,71.299999999999997,287.500000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",10.000000 + Property: "FarPlane", "double", "",4000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",0 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,71.300000,287.500000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Top", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,4000.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,4000.000000,0.000000 + Up: 0,0,-1 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Bottom", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,-4000.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,-4000.000000,0.000000 + Up: 0,0,-1 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Front", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,4000.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,0.000000,4000.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Back", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,-4000.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 0.000000,0.000000,-4000.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Right", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",4000.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: 4000.000000,0.000000,0.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Model: "Model::Producer Left", "Camera" { + Version: 232 + Properties60: { + Property: "QuaternionInterpolate", "bool", "",0 + Property: "Visibility", "Visibility", "A+",1 + Property: "Lcl Translation", "Lcl Translation", "A+",-4000.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,0.000000000000000,0.000000000000000 + Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000 + Property: "RotationOffset", "Vector3D", "",0,0,0 + Property: "RotationPivot", "Vector3D", "",0,0,0 + Property: "ScalingOffset", "Vector3D", "",0,0,0 + Property: "ScalingPivot", "Vector3D", "",0,0,0 + Property: "TranslationActive", "bool", "",0 + Property: "TranslationMin", "Vector3D", "",0,0,0 + Property: "TranslationMax", "Vector3D", "",0,0,0 + Property: "TranslationMinX", "bool", "",0 + Property: "TranslationMinY", "bool", "",0 + Property: "TranslationMinZ", "bool", "",0 + Property: "TranslationMaxX", "bool", "",0 + Property: "TranslationMaxY", "bool", "",0 + Property: "TranslationMaxZ", "bool", "",0 + Property: "RotationOrder", "enum", "",0 + Property: "RotationSpaceForLimitOnly", "bool", "",0 + Property: "AxisLen", "double", "",10 + Property: "PreRotation", "Vector3D", "",0,0,0 + Property: "PostRotation", "Vector3D", "",0,0,0 + Property: "RotationActive", "bool", "",0 + Property: "RotationMin", "Vector3D", "",0,0,0 + Property: "RotationMax", "Vector3D", "",0,0,0 + Property: "RotationMinX", "bool", "",0 + Property: "RotationMinY", "bool", "",0 + Property: "RotationMinZ", "bool", "",0 + Property: "RotationMaxX", "bool", "",0 + Property: "RotationMaxY", "bool", "",0 + Property: "RotationMaxZ", "bool", "",0 + Property: "RotationStiffnessX", "double", "",0 + Property: "RotationStiffnessY", "double", "",0 + Property: "RotationStiffnessZ", "double", "",0 + Property: "MinDampRangeX", "double", "",0 + Property: "MinDampRangeY", "double", "",0 + Property: "MinDampRangeZ", "double", "",0 + Property: "MaxDampRangeX", "double", "",0 + Property: "MaxDampRangeY", "double", "",0 + Property: "MaxDampRangeZ", "double", "",0 + Property: "MinDampStrengthX", "double", "",0 + Property: "MinDampStrengthY", "double", "",0 + Property: "MinDampStrengthZ", "double", "",0 + Property: "MaxDampStrengthX", "double", "",0 + Property: "MaxDampStrengthY", "double", "",0 + Property: "MaxDampStrengthZ", "double", "",0 + Property: "PreferedAngleX", "double", "",0 + Property: "PreferedAngleY", "double", "",0 + Property: "PreferedAngleZ", "double", "",0 + Property: "InheritType", "enum", "",0 + Property: "ScalingActive", "bool", "",0 + Property: "ScalingMin", "Vector3D", "",1,1,1 + Property: "ScalingMax", "Vector3D", "",1,1,1 + Property: "ScalingMinX", "bool", "",0 + Property: "ScalingMinY", "bool", "",0 + Property: "ScalingMinZ", "bool", "",0 + Property: "ScalingMaxX", "bool", "",0 + Property: "ScalingMaxY", "bool", "",0 + Property: "ScalingMaxZ", "bool", "",0 + Property: "GeometricTranslation", "Vector3D", "",0,0,0 + Property: "GeometricRotation", "Vector3D", "",0,0,0 + Property: "GeometricScaling", "Vector3D", "",1,1,1 + Property: "LookAtProperty", "object", "" + Property: "UpVectorProperty", "object", "" + Property: "Show", "bool", "",1 + Property: "NegativePercentShapeSupport", "bool", "",1 + Property: "DefaultAttributeIndex", "int", "",0 + Property: "Color", "Color", "A",0.8,0.8,0.8 + Property: "Roll", "Roll", "A+",0 + Property: "FieldOfView", "FieldOfView", "A+",40 + Property: "FieldOfViewX", "FieldOfView", "A+",1 + Property: "FieldOfViewY", "FieldOfView", "A+",1 + Property: "OpticalCenterX", "Real", "A+",0 + Property: "OpticalCenterY", "Real", "A+",0 + Property: "BackgroundColor", "Color", "A+",0.63,0.63,0.63 + Property: "TurnTable", "Real", "A+",0 + Property: "DisplayTurnTableIcon", "bool", "",1 + Property: "Motion Blur Intensity", "Real", "A+",1 + Property: "UseMotionBlur", "bool", "",0 + Property: "UseRealTimeMotionBlur", "bool", "",1 + Property: "ResolutionMode", "enum", "",0 + Property: "ApertureMode", "enum", "",2 + Property: "GateFit", "enum", "",0 + Property: "FocalLength", "Real", "A+",21.3544940948486 + Property: "CameraFormat", "enum", "",0 + Property: "AspectW", "double", "",320 + Property: "AspectH", "double", "",200 + Property: "PixelAspectRatio", "double", "",1 + Property: "UseFrameColor", "bool", "",0 + Property: "FrameColor", "ColorRGB", "",0.3,0.3,0.3 + Property: "ShowName", "bool", "",1 + Property: "ShowGrid", "bool", "",1 + Property: "ShowOpticalCenter", "bool", "",0 + Property: "ShowAzimut", "bool", "",1 + Property: "ShowTimeCode", "bool", "",0 + Property: "NearPlane", "double", "",1.000000 + Property: "FarPlane", "double", "",30000.000000 + Property: "FilmWidth", "double", "",0.816 + Property: "FilmHeight", "double", "",0.612 + Property: "FilmAspectRatio", "double", "",1.33333333333333 + Property: "FilmSqueezeRatio", "double", "",1 + Property: "FilmFormatIndex", "enum", "",4 + Property: "ViewFrustum", "bool", "",1 + Property: "ViewFrustumNearFarPlane", "bool", "",0 + Property: "ViewFrustumBackPlaneMode", "enum", "",2 + Property: "BackPlaneDistance", "double", "",100 + Property: "BackPlaneDistanceMode", "enum", "",0 + Property: "ViewCameraToLookAt", "bool", "",1 + Property: "LockMode", "bool", "",0 + Property: "LockInterestNavigation", "bool", "",0 + Property: "FitImage", "bool", "",0 + Property: "Crop", "bool", "",0 + Property: "Center", "bool", "",1 + Property: "KeepRatio", "bool", "",1 + Property: "BackgroundMode", "enum", "",0 + Property: "BackgroundAlphaTreshold", "double", "",0.5 + Property: "ForegroundTransparent", "bool", "",1 + Property: "DisplaySafeArea", "bool", "",0 + Property: "SafeAreaDisplayStyle", "enum", "",1 + Property: "SafeAreaAspectRatio", "double", "",1.33333333333333 + Property: "Use2DMagnifierZoom", "bool", "",0 + Property: "2D Magnifier Zoom", "Real", "A+",100 + Property: "2D Magnifier X", "Real", "A+",50 + Property: "2D Magnifier Y", "Real", "A+",50 + Property: "CameraProjectionType", "enum", "",1 + Property: "UseRealTimeDOFAndAA", "bool", "",0 + Property: "UseDepthOfField", "bool", "",0 + Property: "FocusSource", "enum", "",0 + Property: "FocusAngle", "double", "",3.5 + Property: "FocusDistance", "double", "",200 + Property: "UseAntialiasing", "bool", "",0 + Property: "AntialiasingIntensity", "double", "",0.77777 + Property: "UseAccumulationBuffer", "bool", "",0 + Property: "FrameSamplingCount", "int", "",7 + } + MultiLayer: 0 + MultiTake: 0 + Hidden: "True" + Shading: Y + Culling: "CullingOff" + TypeFlags: "Camera" + GeometryVersion: 124 + Position: -4000.000000,0.000000,0.000000 + Up: 0,1,0 + LookAt: 0,0,0 + ShowInfoOnMoving: 1 + ShowAudio: 0 + AudioColor: 0,1,0 + CameraOrthoZoom: 1 + } + Material: "Material::D6-red", "" { + Version: 102 + ShadingModel: "lambert" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",1.0000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "DiffuseFactor", "double", "",0.8000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",1.0000,1.0000,1.0000 + Property: "SpecularFactor", "double", "",0.2500 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.0,0.0 + Property: "Specular", "ColorRGB", "",1.0,1.0,1.0 + Property: "Shininess", "double", "",9.6 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::D6-red__d6-red-dots_png", "" { + Version: 102 + ShadingModel: "lambert" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Lambert" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",1.0000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.0000,0.0092 + Property: "DiffuseFactor", "double", "",0.8000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",1.0000,1.0000,1.0000 + Property: "SpecularFactor", "double", "",0.2500 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.0,0.0 + Property: "Specular", "ColorRGB", "",1.0,1.0,1.0 + Property: "Shininess", "double", "",9.6 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::None__d10-red_png", "" { + Version: 102 + ShadingModel: "phong" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Phong" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",0.5000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "SpecularFactor", "double", "",0.2000 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8 + Property: "Specular", "ColorRGB", "",0.8,0.8,0.8 + Property: "Shininess", "double", "",20.0 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Material: "Material::unnamed", "" { + Version: 102 + ShadingModel: "phong" + MultiLayer: 0 + Properties60: { + Property: "ShadingModel", "KString", "", "Phong" + Property: "MultiLayer", "bool", "",0 + Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "EmissiveFactor", "double", "",0.0000 + Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000 + Property: "AmbientFactor", "double", "",0.5000 + Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "DiffuseFactor", "double", "",1.0000 + Property: "Bump", "Vector3D", "",0,0,0 + Property: "TransparentColor", "ColorRGB", "",1,1,1 + Property: "TransparencyFactor", "double", "",0.0000 + Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000 + Property: "SpecularFactor", "double", "",0.2000 + Property: "ShininessExponent", "double", "",80.0 + Property: "ReflectionColor", "ColorRGB", "",0,0,0 + Property: "ReflectionFactor", "double", "",1 + Property: "Emissive", "ColorRGB", "",0,0,0 + Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0 + Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8 + Property: "Specular", "ColorRGB", "",0.8,0.8,0.8 + Property: "Shininess", "double", "",20.0 + Property: "Opacity", "double", "",1.0 + Property: "Reflectivity", "double", "",0 + } + } + Video: "Video::d10-red_png", "Clip" { + Type: "Clip" + Properties60: { + Property: "FrameRate", "double", "",0 + Property: "LastFrame", "int", "",0 + Property: "Width", "int", "",0 + Property: "Height", "int", "",0 + Property: "Path", "charptr", "", "d10-red.png" + Property: "StartFrame", "int", "",0 + Property: "StopFrame", "int", "",0 + Property: "PlaySpeed", "double", "",1 + Property: "Offset", "KTime", "",0 + Property: "InterlaceMode", "enum", "",0 + Property: "FreeRunning", "bool", "",0 + Property: "Loop", "bool", "",0 + Property: "AccessMode", "enum", "",0 + } + UseMipMap: 0 + Filename: "d10-red.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d10-red.png" + } + Video: "Video::d6-red-dots_png", "Clip" { + Type: "Clip" + Properties60: { + Property: "FrameRate", "double", "",0 + Property: "LastFrame", "int", "",0 + Property: "Width", "int", "",0 + Property: "Height", "int", "",0 + Property: "Path", "charptr", "", "d6-red-dots.png" + Property: "StartFrame", "int", "",0 + Property: "StopFrame", "int", "",0 + Property: "PlaySpeed", "double", "",1 + Property: "Offset", "KTime", "",0 + Property: "InterlaceMode", "enum", "",0 + Property: "FreeRunning", "bool", "",0 + Property: "Loop", "bool", "",0 + Property: "AccessMode", "enum", "",0 + } + UseMipMap: 0 + Filename: "d6-red-dots.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d6-red-dots.png" + } + Texture: "Texture::d10-red_png", "TextureVideoClip" { + Type: "TextureVideoClip" + Version: 202 + TextureName: "Texture::d10-red_png" + Properties60: { + Property: "Translation", "Vector", "A+",0,0,0 + Property: "Rotation", "Vector", "A+",0,0,0 + Property: "Scaling", "Vector", "A+",1,1,1 + Property: "Texture alpha", "Number", "A+",0 + Property: "TextureTypeUse", "enum", "",0 + Property: "CurrentTextureBlendMode", "enum", "",1 + Property: "UseMaterial", "bool", "",0 + Property: "UseMipMap", "bool", "",0 + Property: "CurrentMappingType", "enum", "",0 + Property: "UVSwap", "bool", "",0 + Property: "WrapModeU", "enum", "",0 + Property: "WrapModeV", "enum", "",0 + Property: "TextureRotationPivot", "Vector3D", "",0,0,0 + Property: "TextureScalingPivot", "Vector3D", "",0,0,0 + Property: "VideoProperty", "object", "" + } + Media: "Video::d10-red_png" + FileName: "d10-red.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d10-red.png" + ModelUVTranslation: 0,0 + ModelUVScaling: 1,1 + Texture_Alpha_Source: "None" + Cropping: 0,0,0,0 + } + Texture: "Texture::d6-red-dots_png", "TextureVideoClip" { + Type: "TextureVideoClip" + Version: 202 + TextureName: "Texture::d6-red-dots_png" + Properties60: { + Property: "Translation", "Vector", "A+",0,0,0 + Property: "Rotation", "Vector", "A+",0,0,0 + Property: "Scaling", "Vector", "A+",1,1,1 + Property: "Texture alpha", "Number", "A+",1 + Property: "TextureTypeUse", "enum", "",0 + Property: "CurrentTextureBlendMode", "enum", "",1 + Property: "UseMaterial", "bool", "",0 + Property: "UseMipMap", "bool", "",0 + Property: "CurrentMappingType", "enum", "",0 + Property: "UVSwap", "bool", "",0 + Property: "WrapModeU", "enum", "",0 + Property: "WrapModeV", "enum", "",0 + Property: "TextureRotationPivot", "Vector3D", "",0,0,0 + Property: "TextureScalingPivot", "Vector3D", "",0,0,0 + Property: "VideoProperty", "object", "" + } + Media: "Video::d6-red-dots_png" + FileName: "d6-red-dots.png" + RelativeFilename: "..\..\..\..\..\..\..\..\..\..\blender\wyrmtale\Dice\d6-red-dots.png" + ModelUVTranslation: 0,0 + ModelUVScaling: 1,1 + Texture_Alpha_Source: "None" + Cropping: 0,0,0,0 + } + Pose: "Pose::BIND_POSES", "BindPose" { + Type: "BindPose" + Version: 100 + Properties60: { + } + NbPoseNodes: 5 + PoseNode: { + Node: "Model::blend_root" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d10Low" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d10" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d6Low" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + PoseNode: { + Node: "Model::d6" + Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,-1.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000 + } + } + GlobalSettings: { + Version: 1000 + Properties60: { + Property: "UpAxis", "int", "",1 + Property: "UpAxisSign", "int", "",1 + Property: "FrontAxis", "int", "",2 + Property: "FrontAxisSign", "int", "",1 + Property: "CoordAxis", "int", "",0 + Property: "CoordAxisSign", "int", "",1 + Property: "UnitScaleFactor", "double", "",100 + } + } +} + +; Object relations +;------------------------------------------------------------------ + +Relations: { + Model: "Model::blend_root", "Null" { + } + Model: "Model::d10Low", "Mesh" { + } + Model: "Model::d10", "Mesh" { + } + Model: "Model::d6Low", "Mesh" { + } + Model: "Model::d6", "Mesh" { + } + Model: "Model::Producer Perspective", "Camera" { + } + Model: "Model::Producer Top", "Camera" { + } + Model: "Model::Producer Bottom", "Camera" { + } + Model: "Model::Producer Front", "Camera" { + } + Model: "Model::Producer Back", "Camera" { + } + Model: "Model::Producer Right", "Camera" { + } + Model: "Model::Producer Left", "Camera" { + } + Model: "Model::Camera Switcher", "CameraSwitcher" { + } + Material: "Material::D6-red", "" { + } + Material: "Material::D6-red__d6-red-dots_png", "" { + } + Material: "Material::None__d10-red_png", "" { + } + Material: "Material::unnamed", "" { + } + Texture: "Texture::d10-red_png", "TextureVideoClip" { + } + Texture: "Texture::d6-red-dots_png", "TextureVideoClip" { + } + Video: "Video::d10-red_png", "Clip" { + } + Video: "Video::d6-red-dots_png", "Clip" { + } +} + +; Object connections +;------------------------------------------------------------------ + +Connections: { + Connect: "OO", "Model::blend_root", "Model::Scene" + Connect: "OO", "Model::d10Low", "Model::blend_root" + Connect: "OO", "Model::d10", "Model::blend_root" + Connect: "OO", "Model::d6Low", "Model::blend_root" + Connect: "OO", "Model::d6", "Model::blend_root" + Connect: "OO", "Material::None__d10-red_png", "Model::d10Low" + Connect: "OO", "Material::None__d10-red_png", "Model::d10" + Connect: "OO", "Material::unnamed", "Model::d10" + Connect: "OO", "Material::D6-red__d6-red-dots_png", "Model::d6Low" + Connect: "OO", "Material::D6-red__d6-red-dots_png", "Model::d6" + Connect: "OO", "Material::D6-red", "Model::d6" + Connect: "OO", "Texture::d10-red_png", "Model::d10Low" + Connect: "OO", "Texture::d10-red_png", "Model::d10" + Connect: "OO", "Texture::d6-red-dots_png", "Model::d6Low" + Connect: "OO", "Texture::d6-red-dots_png", "Model::d6" + Connect: "OO", "Video::d10-red_png", "Texture::d10-red_png" + Connect: "OO", "Video::d6-red-dots_png", "Texture::d6-red-dots_png" +} +;Takes and animation section +;---------------------------------------------------- + +Takes: { + Current: "Default Take" + Take: "Default Take" { + FileName: "Default_Take.tak" + LocalTime: 0,479181389250 + ReferenceTime: 0,479181389250 + + ;Models animation + ;---------------------------------------------------- + Model: "Model::d10Low" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d10" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d6Low" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + Model: "Model::d6" { + Version: 1.1 + Channel: "Transform" { + Channel: "T" { + Channel: "X" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 1 + } + Channel: "R" { + Channel: "X" { + Default: -90.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-90.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: -0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,-0.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 0.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,0.000000000000000,L + Color: 0,0,1 + } + LayerType: 2 + } + Channel: "S" { + Channel: "X" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 1,0,0 + } + Channel: "Y" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,1,0 + } + Channel: "Z" { + Default: 1.000000000000000 + KeyVer: 4005 + KeyCount: 1 + Key: + 1924423250,1.000000000000000,L + Color: 0,0,1 + } + LayerType: 3 + } + } + } + } +} +;Version 5 settings +;------------------------------------------------------------------ + +Version5: { + AmbientRenderSettings: { + Version: 101 + AmbientLightColor: 0.0,0.0,0.0,0 + } + FogOptions: { + FlogEnable: 0 + FogMode: 0 + FogDensity: 0.000 + FogStart: 5.000 + FogEnd: 25.000 + FogColor: 0.1,0.1,0.1,1 + } + Settings: { + FrameRate: "24" + TimeFormat: 1 + SnapOnFrames: 0 + ReferenceTimeIndex: -1 + TimeLineStartTime: 0 + TimeLineStopTime: 479181389250 + } + RendererSetting: { + DefaultCamera: "Producer Perspective" + DefaultViewingMode: 0 + } +} diff --git a/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta new file mode 100644 index 0000000..cb1500f --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Prefabs/_FBX/Dice.fbx.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: e80dc46523d8f9f4cb6de5ffdb7b8639 +ModelImporter: + serializedVersion: 16 + fileIDToRecycleName: + 100000: //RootNode + 100002: d6 + 100006: d6Low + 100016: d10 + 100018: d10Low + 400000: //RootNode + 400002: d6 + 400006: d6Low + 400016: d10 + 400018: d10Low + 2300000: d6 + 2300004: d6Low + 2300014: d10 + 2300016: d10Low + 3300000: d6 + 3300004: d6Low + 3300014: d10 + 3300016: d10Low + 4300000: Cube + 4300002: d6 + 4300004: d6_beveled + 4300006: d4 + 4300008: d12 + 4300010: d8 + 4300012: d8Low + 4300014: d4Low + 4300016: d6Low + 4300018: d10Low + 4300020: d10 + 4300022: d12Low_001 + 4300024: d12Low + 4300026: d20Low + 4300028: d20 + 4300030: galery + 7400000: Default Take + 11100000: //RootNode + materials: + importMaterials: 0 + materialName: 3 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + optimizeGameObjects: 0 + motionNodeName: + animationCompression: 1 + animationRotationError: .5 + animationPositionError: .5 + animationScaleError: .5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + tangentSpace: + normalSmoothAngle: 99 + splitTangentsAcrossUV: 1 + normalImportMode: 0 + tangentImportMode: 0 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: .5 + foreArmTwist: .5 + upperLegTwist: .5 + legTwist: .5 + armStretch: .0500000007 + legStretch: .0500000007 + feetSpacing: 0 + rootMotionBoneName: + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + additionalBone: 0 + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Textures.meta b/UnityTests.Unity5/Assets/Dice/Textures.meta new file mode 100644 index 0000000..431d001 --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: edc7fb94cecaa6242ae70fea7401c11a +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Textures/d6.meta b/UnityTests.Unity5/Assets/Dice/Textures/d6.meta new file mode 100644 index 0000000..1a246bf --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Textures/d6.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a38ffb9a09e9db44182065c0bedd905b +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png b/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png new file mode 100644 index 0000000..468e20b Binary files /dev/null and b/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png differ diff --git a/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png.meta b/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png.meta new file mode 100644 index 0000000..55aae5b --- /dev/null +++ b/UnityTests.Unity5/Assets/Dice/Textures/d6/d6-white-dots.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 9e9c1db26c117a54b95cb11b5c5c4925 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Editor.meta b/UnityTests.Unity5/Assets/Editor.meta new file mode 100644 index 0000000..863b598 --- /dev/null +++ b/UnityTests.Unity5/Assets/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 805cdb447a0a94f85a92205ddec8d72e +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs b/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs new file mode 100644 index 0000000..31e51b8 --- /dev/null +++ b/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs @@ -0,0 +1,504 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; +using System.Linq; +using System.Collections.Generic; +using System.IO; + + + +[CustomEditor( typeof( GoDummyPath ) )] +public class GoDummyPathEditor : Editor +{ + private GoDummyPath _target; + private GUIStyle _labelStyle; + private GUIStyle _indexStyle; + + private int _insertIndex = 0; + private float _snapDistance = 5f; + private bool _showNodeDetails; + private bool _fileLoadSaveDetails; + private int _selectedNodeIndex = -1; + + + #region Monobehaviour and Editor + + void OnEnable() + { + // setup the font for the 'begin' 'end' text + _labelStyle = new GUIStyle(); + _labelStyle.fontStyle = FontStyle.Bold; + _labelStyle.normal.textColor = Color.white; + _labelStyle.fontSize = 16; + + _indexStyle = new GUIStyle(); + _indexStyle.fontStyle = FontStyle.Bold; + _indexStyle.normal.textColor = Color.white; + _indexStyle.fontSize = 12; + + _target = (GoDummyPath)target; + } + + + public override void OnInspectorGUI() + { + // what kind of handles shall we use? + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Use Standard Handles" ); + _target.useStandardHandles = EditorGUILayout.Toggle( _target.useStandardHandles ); + EditorGUILayout.EndHorizontal(); + + + // path name: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Route Name" ); + _target.pathName = EditorGUILayout.TextField( _target.pathName ); + EditorGUILayout.EndHorizontal(); + + if( _target.pathName == string.Empty ) + _target.pathName = "route" + Random.Range( 1, 100000 ); + + + // path color: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Route Color" ); + _target.pathColor = EditorGUILayout.ColorField( _target.pathColor ); + EditorGUILayout.EndHorizontal(); + + + // force straight lines: + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Force Straight Line Path" ); + _target.forceStraightLinePath = EditorGUILayout.Toggle( _target.forceStraightLinePath ); + EditorGUILayout.EndHorizontal(); + + + // resolution + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Editor Drawing Resolution" ); + _target.pathResolution = EditorGUILayout.IntSlider( _target.pathResolution, 2, 100 ); + EditorGUILayout.EndHorizontal(); + + + EditorGUILayout.Separator(); + + + // insert node - we need 3 or more nodes for insert to make sense + if( _target.nodes.Count > 2 ) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Insert Node" ); + _insertIndex = EditorGUILayout.IntField( _insertIndex ); + if( GUILayout.Button( "Insert" ) ) + { + // validate the index + if( _insertIndex >= 0 && _insertIndex < _target.nodes.Count ) + { + // insert the node offsetting it a bit from the previous node + var copyNodeIndex = _insertIndex == 0 ? 0 : _insertIndex; + var copyNode = _target.nodes[copyNodeIndex]; + copyNode.x += 10; + copyNode.z += 10; + + insertNodeAtIndex( copyNode, _insertIndex ); + } + } + EditorGUILayout.EndHorizontal(); + } + + + // close route? + if( GUILayout.Button( "Close Path" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + closeRoute(); + GUI.changed = true; + } + + + // shift the start point to the origin + if( GUILayout.Button( "Shift Path to Start at Origin" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + + var offset = Vector3.zero; + + // see what kind of path we are. the simplest case is just a straight line + var path = new GoSpline( _target.nodes, _target.forceStraightLinePath ); + if( path.splineType == GoSplineType.StraightLine || _target.nodes.Count < 5 ) + offset = Vector3.zero - _target.nodes[0]; + else + offset = Vector3.zero - _target.nodes[1]; + + for( var i = 0; i < _target.nodes.Count; i++ ) + _target.nodes[i] += offset; + + GUI.changed = true; + } + + + // reverse + if( GUILayout.Button( "Reverse Path" ) ) + { + Undo.RecordObject( _target, "Path Vector Changed" ); + _target.nodes.Reverse(); + GUI.changed = true; + } + + + // persist to disk + EditorGUILayout.Space(); + EditorGUILayout.LabelField( "Save to/Read from Disk" ); + + EditorGUILayout.Space(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Serialize and Save Path" ); + if( GUILayout.Button( "Save" ) ) + { + var path = EditorUtility.SaveFilePanel( "Save path", Application.dataPath + "/StreamingAssets", _target.pathName + ".asset", "asset" ); + if( path != string.Empty ) + { + persistRouteToDisk( path ); + + // fetch the filename and set it as the routeName + _target.pathName = Path.GetFileName( path ).Replace( ".asset", string.Empty ); + GUI.changed = true; + } + } + EditorGUILayout.EndHorizontal(); + + + // load from disk + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Load saved path" ); + if( GUILayout.Button( "Load" ) ) + { + var path = EditorUtility.OpenFilePanel( "Choose path to load", Path.Combine( Application.dataPath, "StreamingAssets" ), "asset" ); + if( path != string.Empty ) + { + if( !File.Exists( path ) ) + { + EditorUtility.DisplayDialog( "File does not exist", "Path couldn't find the file you specified", "Close" ); + } + else + { + _target.nodes = GoSpline.bytesToVector3List( File.ReadAllBytes( path ) ); + _target.pathName = Path.GetFileName( path ).Replace( ".asset", string.Empty ); + GUI.changed = true; + } + } + } + EditorGUILayout.EndHorizontal(); + + + // node display + EditorGUILayout.Space(); + _showNodeDetails = EditorGUILayout.Foldout( _showNodeDetails, "Show Node Values" ); + if( _showNodeDetails ) + { + EditorGUI.indentLevel++; + for( int i = 0; i < _target.nodes.Count; i++ ) + _target.nodes[i] = EditorGUILayout.Vector3Field( "Node " + ( i + 1 ), _target.nodes[i] ); + EditorGUI.indentLevel--; + } + + + // instructions + EditorGUILayout.Space(); + EditorGUILayout.HelpBox( "While dragging a node, hold down Ctrl and slowly move the cursor to snap to a nearby point\n\n" + + "Click the 'Close Path' button to add a new node that will close out the current path.\n\n" + + "Hold Command while dragging a node to snap in 5 point increments\n\n" + + "Double click to add a new node at the end of the path\n\n" + + "Hold down alt while adding a node to prepend the new node at the front of the route\n\n" + + "Press delete or backspace to delete the selected node\n\n" + + "NOTE: make sure you have the pan tool selected while editing paths", MessageType.None ); + + + // update and redraw: + if( GUI.changed ) + { + EditorUtility.SetDirty( _target ); + Repaint(); + } + } + + + void OnSceneGUI() + { + if( !_target.gameObject.activeSelf ) + return; + + // handle current selection and node addition via double click or ctrl click + if( Event.current.type == EventType.mouseDown ) + { + var nearestIndex = getNearestNodeForMousePosition( Event.current.mousePosition ); + _selectedNodeIndex = nearestIndex; + + // double click to add + if( Event.current.clickCount > 1 ) + { + var translatedPoint = HandleUtility.GUIPointToWorldRay( Event.current.mousePosition ) + .GetPoint( ( _target.transform.position - Camera.current.transform.position ).magnitude ); + + Undo.RecordObject( _target, "Path Node Added" ); + + // if alt is down then prepend the node to the beginning + if( Event.current.alt ) + insertNodeAtIndex( translatedPoint, 0 ); + else + appendNodeAtPoint( translatedPoint ); + } + } + + + if( _selectedNodeIndex >= 0 ) + { + // shall we delete the selected node? + if( Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Backspace ) + { + if (_target.nodes.Count > 2) { + Undo.RecordObject( _target, "Path Node Deleted" ); + Event.current.Use(); + removeNodeAtIndex( _selectedNodeIndex ); + _selectedNodeIndex = -1; + } + } + } + + + if( _target.nodes.Count > 1 ) + { + // allow path adjustment undo: + Undo.RecordObject( _target, "Path Vector Changed" ); + + // path begin and end labels or just one if the path is closed + if( Vector3.Distance( _target.nodes[0], _target.nodes[_target.nodes.Count - 1] ) == 0 ) + { + Handles.Label( _target.nodes[0], " Begin and End", _labelStyle ); + } + else + { + Handles.Label( _target.nodes[0], " Begin", _labelStyle ); + Handles.Label( _target.nodes[_target.nodes.Count - 1], " End", _labelStyle ); + } + + // draw the handles, arrows and lines + drawRoute(); + + for( var i = 0; i < _target.nodes.Count; i++ ) + { + Handles.color = _target.pathColor; + + // dont label the first and last nodes + if( i > 0 && i < _target.nodes.Count - 1 ) + Handles.Label( _target.nodes[i] + new Vector3( 3f, 0, 1.5f ), i.ToString(), _indexStyle ); + + Handles.color = Color.white; + if( _target.useStandardHandles ) + { + _target.nodes[i] = Handles.PositionHandle( _target.nodes[i], Quaternion.identity ); + } + else + { + // how big shall we draw the handles? + var distanceToTarget = Vector3.Distance( SceneView.lastActiveSceneView.camera.transform.position, _target.transform.position ); + distanceToTarget = Mathf.Abs( distanceToTarget ); + var handleSize = Mathf.Ceil( distanceToTarget / 75 ); + + _target.nodes[i] = Handles.FreeMoveHandle( _target.nodes[i], + Quaternion.identity, + handleSize, + new Vector3( 5, 0, 5 ), + Handles.SphereCap ); + } + + + // should we snap? we need at least 4 nodes because we dont snap to the previous and next nodes + if( Event.current.control && _target.nodes.Count > 3 ) + { + // dont even bother checking for snapping to the previous/next nodes + var index = getNearestNode( _target.nodes[i], i, i + 1, i - 1 ); + var nearest = _target.nodes[index]; + var distanceToNearestNode = Vector3.Distance( nearest, _target.nodes[i] ); + + // is it close enough to snap? + if( distanceToNearestNode <= _snapDistance ) + { + GUI.changed = true; + _target.nodes[i] = nearest; + } + else if( distanceToNearestNode <= _snapDistance * 2 ) + { + // show which nodes are getting close enough to snap to + var color = Color.red; + color.a = 0.3f; + Handles.color = color; + Handles.SphereCap( 0, _target.nodes[i], Quaternion.identity, _snapDistance * 2 ); + //Handles.DrawWireDisc( _target.nodes[i], Vector3.up, _snapDistance ); + Handles.color = Color.white; + } + } + } // end for + + + if( GUI.changed ) + { + Repaint(); + EditorUtility.SetDirty( _target ); + } + } // end if + } + + #endregion + + + #region Private methods + + private void appendNodeAtPoint( Vector3 node ) + { + _target.nodes.Add( node ); + + GUI.changed = true; + } + + + private void removeNodeAtIndex( int index ) + { + if( index >= _target.nodes.Count || index < 0 ) + return; + + _target.nodes.RemoveAt( index ); + + GUI.changed = true; + } + + + private void insertNodeAtIndex( Vector3 node, int index ) + { + // validate the index + if( index >= 0 && index < _target.nodes.Count ) + { + _target.nodes.Insert( index, node ); + + GUI.changed = true; + } + } + + + private void drawArrowBetweenPoints( Vector3 point1, Vector3 point2 ) + { + // no need to draw arrows for tiny segments + var distance = Vector3.Distance( point1, point2 ); + if( distance < 40 ) + return; + + // we dont want to be exactly in the middle so we offset the length of the arrow + var lerpModifier = ( distance * 0.5f - 25 ) / distance; + + Handles.color = _target.pathColor; + + // get the midpoint between the 2 points + var dir = Vector3.Lerp( point1, point2, lerpModifier ); + var quat = Quaternion.LookRotation( point2 - point1 ); + Handles.ArrowCap( 0, dir, quat, 25 ); + + Handles.color = Color.white; + } + + + private int getNearestNode( Vector3 pos, params int[] excludeNodes ) + { + var excludeNodesList = new System.Collections.Generic.List( excludeNodes ); + var bestDistance = float.MaxValue; + var index = -1; + + var distance = float.MaxValue; + for( var i = _target.nodes.Count - 1; i >= 0; i-- ) + { + if( excludeNodesList.Contains( i ) ) + continue; + + distance = Vector3.Distance( pos, _target.nodes[i] ); + if( distance < bestDistance ) + { + bestDistance = distance; + index = i; + } + } + return index; + } + + + private int getNearestNodeForMousePosition( Vector3 mousePos ) + { + var bestDistance = float.MaxValue; + var index = -1; + + var distance = float.MaxValue; + for( var i = _target.nodes.Count - 1; i >= 0; i-- ) + { + var nodeToGui = HandleUtility.WorldToGUIPoint( _target.nodes[i] ); + distance = Vector2.Distance( nodeToGui, mousePos ); + + if( distance < bestDistance ) + { + bestDistance = distance; + index = i; + } + } + + // make sure we are close enough to a node + if( bestDistance < 10 ) + return index; + return -1; + } + + + private void closeRoute() + { + // we will use the GoSpline class to handle the dirtywork of closing the path + var path = new GoSpline( _target.nodes, _target.forceStraightLinePath ); + path.closePath(); + + _target.nodes = path.nodes; + + GUI.changed = true; + } + + + private void persistRouteToDisk( string path ) + { + var bytes = new List(); + + foreach( var vec in _target.nodes ) + { + bytes.AddRange( System.BitConverter.GetBytes( vec.x ) ); + bytes.AddRange( System.BitConverter.GetBytes( vec.y ) ); + bytes.AddRange( System.BitConverter.GetBytes( vec.z ) ); + } + + File.WriteAllBytes( path, bytes.ToArray() ); + } + + + private void drawRoute() + { + // if we are forcing straight lines just use this setup + if( _target.forceStraightLinePath ) + { + // draw just the route here and optional arrows + for( var i = 0; i < _target.nodes.Count; i++ ) + { + Handles.color = _target.pathColor; + if( i < _target.nodes.Count - 1 ) + { + Handles.DrawLine( _target.nodes[i], _target.nodes[i + 1] ); + drawArrowBetweenPoints( _target.nodes[i], _target.nodes[i + 1] ); + } + } + } + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs.meta b/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs.meta new file mode 100644 index 0000000..8e6d794 --- /dev/null +++ b/UnityTests.Unity5/Assets/Editor/GoDummyPathEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 14be03d8aa8eb4defb30eb2e964df151 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/EnginesComparison.cs b/UnityTests.Unity5/Assets/EnginesComparison.cs new file mode 100644 index 0000000..73e1a35 --- /dev/null +++ b/UnityTests.Unity5/Assets/EnginesComparison.cs @@ -0,0 +1,346 @@ +using DG.Tweening; +using Holoville.DebugFramework.Components; +using Holoville.HOTween; +using System; +using System.Collections; +using UnityEngine; + +public class EnginesComparison : MonoBehaviour +{ + public GameObject prefab; + + enum State { + Menu, + Starting, + Executing + } + enum TestType { + Transforms, + GenericFloats + } + enum EngineType { + DOTween, HOTween, LeanTween, GoKit, iTween + } + string[] tweensList = new[] { + "1", "10", "100", "500", "1,000", "2,000", "4,000", "8,000", "16,000", "32,000", "64,000", "128,000" + }; + + TestType testType; + EngineType engineType; + public static int totTweens; + bool disableRenderers; + + State state = State.Menu; + HOFpsGadget fpsGadget; + float startupTime; + Transform container; + Action concludeTest; + public static Transform[] ts; + public static GameObject[] gos; + [System.NonSerialized] public float floatVal; // Used by iTween to at least do something during its update + + string testTitle; + string[] testTypeList, engineTypeList; + int tweensListId = 4; + + + void Start() + { + GameObject fpsGadgetGo = new GameObject("FPS"); + DontDestroyOnLoad(fpsGadgetGo); + fpsGadget = fpsGadgetGo.AddComponent(); + fpsGadget.showMemory = true; + + testTypeList = Enum.GetNames(typeof(TestType)); + engineTypeList = Enum.GetNames(typeof(EngineType)); + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + switch (state) { + case State.Menu: + testType = (TestType)GUILayout.Toolbar((int)testType, testTypeList); + engineType = (EngineType)GUILayout.Toolbar((int)engineType, engineTypeList); + tweensListId = GUILayout.Toolbar(tweensListId, tweensList); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("START")) StartCoroutine(StartTest()); + if (testType == TestType.Transforms) { + if (GUILayout.Button("START (renderers disabled)")) { + disableRenderers = true; + StartCoroutine(StartTest()); + } + } + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); + break; + case State.Starting: + GUILayout.Label("Starting the test..."); + GUILayout.FlexibleSpace(); + break; + case State.Executing: + GUILayout.Label(testTitle); + if (GUILayout.Button("STOP")) StopTest(); + break; + } + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + IEnumerator StartTest() + { + state = State.Starting; + totTweens = int.Parse(tweensList[tweensListId], System.Globalization.NumberStyles.AllowThousands); + testTitle = engineType.ToString(); + SampleClass[] cs = null; + Vector3[] toPositions = null; + float[] toFloats = null; + // Prepare test + switch (testType) { + case TestType.Transforms: + ts = new Transform[totTweens]; + gos = new GameObject[totTweens]; + toPositions = new Vector3[totTweens]; + container = new GameObject("Container").transform; + for (int i = 0; i < totTweens; ++i) { + GameObject go = (GameObject)Instantiate(prefab); + if (disableRenderers) go.GetComponent().enabled = false; + Transform t = go.transform; + t.parent = container; + t.position = new Vector3(UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f)); + gos[i] = go; + ts[i] = t; + toPositions[i] = new Vector3(UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f), UnityEngine.Random.Range(-40f, 40f)); + } + break; + case TestType.GenericFloats: + cs = new SampleClass[totTweens]; + toFloats = new float[totTweens]; + for (int i = 0; i < totTweens; ++i) { + SampleClass c = new SampleClass(UnityEngine.Random.Range(-100f, 100f)); + cs[i] = c; + toFloats[i] = UnityEngine.Random.Range(-100f, 100f); + } + break; + } + yield return null; + + // Prepare and start engine + float time; + switch (engineType) { + case EngineType.DOTween: + testTitle += " v" + DOTween.Version; + concludeTest = DOTweenTester.Conclude; + DOTween.Init(true, false); + DOTween.SetTweensCapacity(totTweens, 0); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) DOTweenTester.Start(ts, toPositions); + else DOTweenTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.HOTween: + testTitle += " v" + HOTween.VERSION; + concludeTest = HOTweenTester.Conclude; + HOTween.Init(true, false, false); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) HOTweenTester.Start(ts, toPositions); + else HOTweenTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.LeanTween: + concludeTest = LeanTweenTester.Conclude; + LeanTween.init(totTweens + 1); + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) LeanTweenTester.Start(gos, toPositions); + else LeanTweenTester.Start(this.gameObject, cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.GoKit: + concludeTest = GoKitTester.Conclude; + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) GoKitTester.Start(ts, toPositions); + else GoKitTester.Start(cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + case EngineType.iTween: + concludeTest = iTweenTester.Conclude; + yield return null; + // Start + time = Time.realtimeSinceStartup; + if (testType == TestType.Transforms) iTweenTester.Start(gos, toPositions); + else iTweenTester.Start(this.gameObject, cs, toFloats); + startupTime = Time.realtimeSinceStartup - time; + break; + } + testTitle += " (startup time: " + startupTime + ")"; + yield return null; + + state = State.Executing; + fpsGadget.ResetFps(); + } + + void StopTest() + { + state = State.Menu; + this.StopAllCoroutines(); + concludeTest(); + if (container != null) { + Destroy(container.gameObject); + container = null; + } + ts = null; + gos = null; + disableRenderers = false; + GC.Collect(); + fpsGadget.ResetFps(); + } + + public void UpdateiTweenFloat(float newVal) + { + // Practically does nothing: iTween can't logically tween many floats + // Still a valid test though, and even grants iTween some slack since it will do a LOT less than other engines + floatVal = newVal; + } +} + +public static class DOTweenTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + for (int i = 0; i < ts.Length; ++i) { + ts[i].DOMove(to[i], 1).SetEase(Ease.InOutQuad).SetLoops(-1, DG.Tweening.LoopType.Yoyo); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + DOTween.To(()=> c.floatVal, x=> c.floatVal = x, to[i], 1).SetEase(Ease.InOutQuad).SetLoops(-1, DG.Tweening.LoopType.Yoyo); + } + } + public static void Conclude() + { + DOTween.Clear(true); + } +} + +public static class HOTweenTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo); + for (int i = 0; i < ts.Length; ++i) { + HOTween.To(ts[i], 1, tp.NewProp("position", to[i])); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo); + for (int i = 0; i < cs.Length; ++i) { + HOTween.To(cs[i], 1, tp.NewProp("floatVal", to[i])); + } + } + public static void Conclude() + { + HOTween.Kill(); + UnityEngine.Object.Destroy(GameObject.Find("HOTween")); + } +} + +public static class LeanTweenTester +{ + public static void Start(GameObject[] gos, Vector3[] to) + { + for (int i = 0; i < gos.Length; ++i) { + LeanTween.move(gos[i], to[i], 1).setEase(LeanTweenType.easeInOutQuad).setRepeat(-1).setLoopType(LeanTweenType.pingPong); + } + } + public static void Start(GameObject target, SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + LeanTween.value(target, x=> c.floatVal = x, c.floatVal, to[i], 1).setEase(LeanTweenType.easeInOutQuad).setRepeat(-1).setLoopType(LeanTweenType.pingPong); + } + } + public static void Conclude() + { + LeanTween.reset(); + UnityEngine.Object.Destroy(GameObject.Find("~LeanTween")); + } +} + +public static class GoKitTester +{ + public static void Start(Transform[] ts, Vector3[] to) + { + GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); + for (int i = 0; i < ts.Length; ++i) { + goConfig.clearProperties(); + goConfig.addTweenProperty(new PositionTweenProperty(to[i])); + Go.to(ts[i], 1, goConfig); + } + } + public static void Start(SampleClass[] cs, float[] to) + { + GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); + for (int i = 0; i < cs.Length; ++i) { + goConfig.clearProperties(); + goConfig.floatProp("floatVal", to[i]); + Go.to(cs[i], 1, goConfig); + } + } + public static void Conclude() + { + if(EnginesComparison.ts != null) for(int i = 0; i < EnginesComparison.ts.Length; ++i) Go.killAllTweensWithTarget(EnginesComparison.ts[i]); + UnityEngine.Object.Destroy(GameObject.Find("GoKit (" + EnginesComparison.totTweens + " tweens)")); + } +} + +public static class iTweenTester +{ + public static void Start(GameObject[] gos, Vector3[] to) + { + for (int i = 0; i < gos.Length; ++i) { + Hashtable hs = new Hashtable(); + hs.Add("position", to[i]); + hs.Add("time", 1); + hs.Add("looptype", iTween.LoopType.pingPong); + hs.Add("easetype", iTween.EaseType.easeInOutQuad); + iTween.MoveTo(gos[i], hs); + } + } + public static void Start(GameObject target, SampleClass[] cs, float[] to) + { + for (int i = 0; i < cs.Length; ++i) { + SampleClass c = cs[i]; + Hashtable hs = new Hashtable(); + hs.Add("from", c.floatVal); + hs.Add("to", to[i]); + hs.Add("time", 1); + hs.Add("onupdate", "UpdateiTweenFloat"); + hs.Add("looptype", iTween.LoopType.pingPong); + hs.Add("easetype", iTween.EaseType.easeInOutQuad); + iTween.ValueTo(target, hs); + } + } + public static void Conclude() + { + iTween.Stop(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/EnginesComparison.cs.meta b/UnityTests.Unity5/Assets/EnginesComparison.cs.meta new file mode 100644 index 0000000..c8747f3 --- /dev/null +++ b/UnityTests.Unity5/Assets/EnginesComparison.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c24d57978826984a85ca1454246503a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/EnginesComparison.unity b/UnityTests.Unity5/Assets/EnginesComparison.unity new file mode 100644 index 0000000..d4f74e1 Binary files /dev/null and b/UnityTests.Unity5/Assets/EnginesComparison.unity differ diff --git a/UnityTests.Unity5/Assets/EnginesComparison.unity.meta b/UnityTests.Unity5/Assets/EnginesComparison.unity.meta new file mode 100644 index 0000000..6dce113 --- /dev/null +++ b/UnityTests.Unity5/Assets/EnginesComparison.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 411badc256d3c2c4ea41a29a75696d47 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville.meta b/UnityTests.Unity5/Assets/Holoville.meta new file mode 100644 index 0000000..736152d --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 48295f5b83676ed48b64d5dfbf9c9e8a +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework.meta b/UnityTests.Unity5/Assets/Holoville/HODebugFramework.meta new file mode 100644 index 0000000..3c96d6c --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HODebugFramework.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 62ab9f3b6ce5e114a872c9da4424e294 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll new file mode 100644 index 0000000..f08b3a8 Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll differ diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb new file mode 100644 index 0000000..96049cf Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta new file mode 100644 index 0000000..bfa95d5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 222eef240842c49489f37f9f3f8426d5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta new file mode 100644 index 0000000..7563eb3 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0e219f6858bc6be4899178b7a17cefcc +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml new file mode 100644 index 0000000..476ae76 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml @@ -0,0 +1,97 @@ + + + + HODebugFramework + + + + + Shows framerate and eventual memory info during runtime. + Can also force a specific framerate. + + + + + If TRUE also shows memory info. + + + + + Delay between each update of the fps calculation. + + + + + Alignment of the info gadget. + + + + + If different than 0 forces the given framerate. + Set it to 0 if you don't want HOFpsGadget to do anything with Application.targetFrameRate. + + + + + Static methods to draw gizmos automatically every frame. + + + + + if is set to TRUE, + this is just a reference size used to create points of random sizes + (useful to avoid overlapping points being hidden). + + + + + If TRUE, points will have a random radius. + + + + + If TRUE and no color is passed to methods, uses a random color. + + + + + Default color. + + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a point to be constantly shown as a gizmo. + + + Adds a target to be constantly evidenced. + + + Adds a target to be constantly evidenced. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + Adds a line to be constantly drawn as a gizmo. + + + + Clears all gizmos managed by . + + + + diff --git a/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta new file mode 100644 index 0000000..eca140e --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HODebugFramework/HODebugFramework.xml.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 99c0393477c34c34d88070193f029429 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween.meta b/UnityTests.Unity5/Assets/Holoville/HOTween.meta new file mode 100644 index 0000000..438d26f --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ac42016c2e6cec747a60d52ef7ec66a1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/Editor.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor.meta new file mode 100644 index 0000000..988ec32 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 908988ff5c69010448c95aeec9824ee7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll new file mode 100644 index 0000000..d86831a Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll differ diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb new file mode 100644 index 0000000..22e55bd Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta new file mode 100644 index 0000000..3a8659f --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5f25b9ebc7cf994e84b23d5cc679c11 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta new file mode 100644 index 0000000..e485605 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/Editor/HOTweenV1_Editor.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 93bb3a583aeaea948a20ab316d0b585a +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML new file mode 100644 index 0000000..4716c85 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML @@ -0,0 +1,8450 @@ + + + + HOTween + + + + + Plugin for the tweening of the color of your choice. + Used for changing material colors different from the default one (like _SpecColor or _Emission). + Target for this tween must be of type . + + + + + ABSTRACT base class for all classes. + + + + + Untyped start value. + + + + + Untyped end value. + + + + + Stored so it can be set indipendently in case of speed-based tweens. + + + + + Name of the property being tweened. Stored during Init, used by overwrite manager and log messages. + + + + + Stored to be used during recreation of plugin for partial tweens. + + + + + Ease type. + + + + + Indicates that the end value is relative instead than absolute. + Default: false. + + + + + Some plugins (like PlugSetColor) may set this to false when instantiated, + to prevent the creation of a useless valAccessor. + + + + + Reference to the Tweener controlling this plugin. + + + + + Creates a new instance of this plugin with the given options. + Used because easeType can't be null, and otherwise there's no way + to understand if the ease was voluntarily set by the user or not. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin with the given options. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin with the given options. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Initializes the plugin after its instantiation. + Called by Tweener after a property and plugin have been validated, and the plugin has to be set and added. + Virtual because some classes (like PlugVector3Path) override it to avoid isRelative being TRUE. + + + The to refer to. + + + The name of the property to control. + + + The to use. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + Directly passed from TweenParms to speed up MemberAccessor creation. + + + + + Starts up the plugin, getting the actual start and change values. + Called by Tweener right before starting the effective animations. + + + + + Starts up the plugin, getting the actual start and change values. + Called by Tweener right before starting the effective animations. + + + Set to true by , + to calculate only the speed based duration and then reset any startup changes + (so Startup can be called from scratch when truly starting up). + + + + + If speed based duration was not already set (meaning Startup has not yet been called), + calculates the duration and then resets the plugin so that Startup will restart from scratch. + Used by . + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup (loops excluded). + + + + + Updates the plugin. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Reverses the ease of this plugin. + + + + + Sets the ease type (called during Init, but can also be called by Tweener to change easeType while playing). + + + + + Returns the speed-based duration based on the given speed. + + + + + Returns a clone of the basic plugin + (as it was at construction, without anything that was set during Init). + + + + + Sets the typed changeVal based on the current startVal and endVal. + Can only be called once, otherwise some typedEndVal (like HOTPluginColor) will be set incorrectly. + + + + + Used by Tweeners to force SetIncremental + (SetIncremental can't be made internal since + it needs to be overridden outside of HOTweem for custom plugin). + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor or PlugQuaterion) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Used by TweenParms to understand if this plugin was initialized with + another Tweener, and thus clone it. + + + + + Used by to get the property name. + + + + + Some plugins might override this to specify a different ID (like PlugVector3X). + Used by to check if two plugins are the same (for overwrite purposes). + Plugins with -1 ids always overwrite and are overwritten. + Plugins with different ids are always overwritten by plugins with -1 ids, + but overwrite only identical ids. + + + The plugin identifier. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Selects the color property to change. + + + The propertyName/colorName to change (see Unity's if you don't know how it works), + set via the enum. + + + + + Selects the color property to change. + + + The propertyName/colorName to change (see Unity's if you don't know how it works). + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enumeration of color properties names. + + + + + Main color of a material. + + + + + Specular color of a material (used in specular/glossy/vertexlit shaders). + + + + + Emissive color of a material (used in vertexlit shaders). + + + + + Reflection color of a material (used in reflective shaders). + + + + + Default plugin for the tweening of Vector4 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + Tween. + + + Time. + + + Begin value. + + + Change value. + + + Duration. + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + A + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Plugin for uint values + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Default plugin for the tweening of Vector3 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Public interface shared by and . + + + + + Kills this Tweener/Sequence. + + + + + Resumes this Tweener/Sequence (tween delay included). + + + + + Resumes this Tweener/Sequence (tween delay included) and plays it forward. + + + + + Resumes this Tweener/Sequence and plays it backwards. + + + + + Pauses this Tweener/Sequence. + + + + + Rewinds this Tweener/Sequence (loops and tween delay included), and pauses it. + + + + + Restarts this Tweener/Sequence from the beginning (loops and tween delay included). + + + + + Reverses this Tweener/Sequence, + animating it backwards from its current position. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + + + Completes this Tweener/Sequence. + Where a loop was involved and not infinite, the Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + A coroutine that waits until the Tweener/Sequence is complete (delays and loops included). + You can use it inside a coroutin as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForCompletion() ); + + + + + A coroutine that waits until the Tweener/Sequence is rewinded (loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForRewind() ); + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + + Returns true if the given target is currently involved in this Tweener/Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside this Tweener/Sequence, than if the relative Tweener/Sequence is paused. + To simply check if the target is attached to this Tweener/Sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + A value of true if the given target is currently involved in a running tween or sequence. + + + + + Returns true if the given target is linked to this Tweener/Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to this Tweener/Sequence (running or not, taking into account also nested tweens). + + + + + Eventual ID of this tween + (more than one tween can share the same ID, thus allowing for grouped operations). + You can also use intId instead of id for faster operations. + + + + + Default is -1. + Eventual int ID of this tween + (more than one tween can share the same intId, thus allowing for grouped operations). + The main difference from id is that while id is more legible, intId allows for faster operations. + + + + + Default is true. + If false doesn't remove this Tweener/Sequence from HOTween's list when it is completed + (useful if you want to be able to control it independently with GoTo, instead than letting it run), + and you will need to call an HOTween.Kill to remove this Tweener/Sequence. + + + + + Default is true. + If set to false, this Tweener/Sequence will not be updated, + and any use of animation methods (Play/Pause/Rewind/etc) will be ignored + (both if called directly via this instance, than if using HOTween.Play/Pause/Rewind/etc.). + + + + + Time scale that will be used by this Tweener/Sequence. + + + + + Number of times the Tweener/Sequence will run (-1 means the tween has infinite loops, 1 means the tween will run only once). + + + + + Type of loop for this Tweener/Sequence, in case is greater than 1 (or infinite). + + + + + Gets and sets the time position of the Tweener/Sequence (loops are included when not infinite, delay is not). + + + + + Duration of this Tweener/Sequence, loops and tween delay excluded. + + + + + Full duration of this Tweener/Sequence, loops included (when not infinite) but tween delay excluded. + + + + + Elapsed time within the current loop (tween delay excluded). + Note that elapsed will be equal to duration only when all the loops are completed, + otherwise each time a loop is completed, completedLoops is augmented by 1 and elapsed is reset to 0. + + + + + Full elapsed time including loops (but without considering tween delay). + + + + + The update type for this Tweener/Sequence. + + + + + Number of loops that have been executed. + + + + + Returns a value of true if this Tweener/Sequence contains no tweens + (if this is a Tweener, it means that no valid property to tween was set; + if this is a Sequence, it means no valid was added). + + + + + Returns a value of true if this Tweener/Sequence is set to go backwards (because of a call to Reverse. + + + + + Returns a value of true when this Tweener/Sequence is in the "going backwards" part of a Yoyo loop. + + + + + Returns a value of true if this Tweener/Sequence is paused. + + + + + Returns a value of true after this Tweener/Sequence was started the first time, + or if a call to GoTo or GoToAndPlay was executed. + + + + + Returns a value of true when this Tweener/Sequence is complete. + + + + + Returns a value of true if this Tweener/Sequence was added to a Sequence. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Base class for all HOTween members + ( and ). + + + + + Always set to TRUE by Update(), if isStartupIteration is true, + and reset to FALSE in the last line of Update(). + Can also be set to TRUE by Sequence.TweenStartupIteration, + and then immediately reset to FALSE. + + + + + Used by main Sequences to set an ignoreCallbacks value to all its items/subitems, + which the items/subitmes themselves won't be able to reset. + Necessary during TweenStartupIteration. + + + + + Completed loops. + + + + + Duration. + + + + + Memorized when a partial tween is applied. + + + + + Memorized when applying speedBased duration. + + + + + Full duration. + + + + + Elapsed. + + + + + Full elapsed. + + + + + Destroyed. + + + + + Is empty. + + + + + Running backwards. + + + + + Yoyo looping back. + + + + + Has started. + + + + + Is complete. + + + + + Used to determine if OnUpdate callbacks should be called. + Refreshed at the end of each update. + + + + + Previously completed loops. + Refrehsed at the end of each update. + + + + + True if there are behaviours to manage + + + + + True if there are gameObject to manage + + + + + Behaviours to activate + + + + + Behaviours to deactivate + + + + + GameObjects to activate + + + + + GameObejcts to deactivate + + + + + True = enabled, False = disabled + + + + + True = active, False = inactive + + + + + Kills this Tweener/Sequence, removes it from HOTween, and cleans it. + + + + + Kills this Tweener/Sequence and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Resumes this Tweener/Sequence (tween delay included). + + + + + Resumes this Tweener/Sequence (tween delay included) and plays it forward. + + + + + Resumes this Tweener/Sequence and plays it backwards. + + + + + Pauses this Tweener/Sequence. + + + + + Rewinds this Tweener/Sequence (loops and tween delay included), and pauses it. + + + + + Restarts this Tweener/Sequence from the beginning (loops and tween delay included). + + + + + Reverses this Tweener/Sequence, + animating it backwards from its curren position. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + + + Completes this Tweener/Sequence. + Where a loop was involved, the Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account). + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + By default, if a Tweener/Sequence is already at the exact given time, it will not be refreshed. + Setting this to true will force it to refresh + (useful only if you want to be sure that any changes you made to the tweened property, + outside of HOTween, are reset). + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + The time where the Tweener/Sequence should be sent. + + + By default, if a Tweener/Sequence is already at the exact given time, it will not be refreshed. + Setting this to true will force it to refresh + (useful only if you want to be sure that any changes you made to the tweened property, + outside of HOTween, are reset). + + + Returns true if the Tweener/Sequence reached its end and was completed. + + + + + A coroutine that waits until the Tweener/Sequence is complete (delays and loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForCompletion() ); + + + + + A coroutine that waits until the Tweener/Sequence is rewinded (loops included). + You can use it inside a coroutine as a yield. Ex: + yield return StartCoroutine( myTweenComponent.WaitForRewind() ); + + + + + Completely resets this tween, except its target (in case of Tweeners). + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call, who must return void and accept no parameters + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + The type of callback to apply + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + This overload will use sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + The type of callback to apply + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + + + + Returns true if the given target is currently involved in a running tween or sequence. + Returns false both if the given target is not inside a tween, than if the relative tween is paused. + To simply check if the target is attached to a tween or sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + A value of true if the given target is currently involved in a running tween or sequence. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the given target is linked to a tween or sequence (running or not). + + + The target to check. + + + A value of true if the given target is linked to a tween or sequence (running or not). + + + + + Returns a list of all the targets of this tween, or NULL if there are none. + + A list of all the targets of this tween, or NULL if there are none. + + + + Returns a list of the eventual existing tweens with the given Id within this ABSTweenComponent, + nested tweens included (or an empty list if no tweens were found). + + + + + Returns a list of the eventual existing tweens with the given intId within this ABSTweenComponent, + nested tweens included (or an empty list if no tweens were found). + + + + + Used internally by HOTween, to avoid having the tween calling a kill while HOTween will already be killing it. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + A value of true if the tween is not reversed and is complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Updates the Tweener/Sequence by the given elapsed time, + and returns a value of true if the Tweener/Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener/Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener/Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + A value of true if the tween is not reversed and complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Applies the correct Incremental Sequence loop value. + Called by Sequences when they need to change the increment value of nested Sequences/Tweeners. + + + The difference from the previous main Sequence loop increment. + + + + + Sends the Tweener/Sequence to the given time (taking also loops into account) and plays it. + If the time is bigger than the total Tweener/Sequence duration, it goes to the end. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Manages on first start behaviour. + + + + + Manages on update behaviour. + + + + + Manages on plugin results behaviour. + + + + + Manages on pause behaviour. + + + + + Manages on resume behaviour (also called when the tween starts). + + + + + Manages on rewinded behaviour. + + + + + Manages step on complete behaviour. + + + + + Manages on complete behaviour. + + + + + Called by HOTween if this tween was placed inside its onCompletes list during this.OnComplete(). + + + + + Sets the current fullDuration, based on the current duration and loops values. + Remember to call this method each time you change the duration or loops of a tween. + + + + + Sets the current elapsed time, based on the current fullElapsed and completedLoops values. + Remember to call this method each time you set fullElapsed (after changing the eventual loops count where needed). + + + + + Sets completedLoops and isLoopingBack, based on the current fullElapsed value. + + + + + Manages the components/gameObjects that should be activated/deactivated. + + + + + Fills the given list with all the plugins inside this sequence tween, + while also looking for them recursively through inner sequences. + Used by HOTween.GetPlugins. + + + + + Eventual string ID of this Tweener/Sequence + (more than one Tweener/Sequence can share the same ID, thus allowing for grouped operations). + You can also use intId instead of id for faster operations. + + + + + Eventual int ID of this Tweener/Sequence + (more than one Tweener/Sequence can share the same intId, thus allowing for grouped operations). + The main difference from id is that while id is more legible, intId allows for faster operations. + + + + + Default is true, which means this Tweener/Sequence will be killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Tweener/Sequence from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Tweener/Sequence. + + + + + Default is true. + If set to false, this Tweener/Sequence will not be updated, + and any use of animation methods (Play/Pause/Rewind/etc) will be ignored + (both if called directly via this instance, than if using HOTween.Play/Pause/Rewind/etc.). + + + + + Time scale that will be used by this Tweener/Sequence. + + + + + Number of times the Tweener/Sequence will run (-1 means the tween has infinite loops). + + + + + Type of loop for this Tweener/Sequence, in case is greater than 1 (or infinite). + + + + + Gets and sets the time position of the Tweener/Sequence (loops are included when not infinite, delay is not). + + + + + Duration of this Tweener/Sequence, loops and tween delay excluded. + + + + + Full duration of this Tweener/Sequence, loops included (when not infinite) but tween delay excluded. + + + + + Elapsed time within the current loop (tween delay excluded). + + + + + Full elapsed time including loops (but without considering tween delay). + + + + + The update type for this Tweener/Sequence. + + + + + Number of loops that have been executed. + + + + + Returns a value of true if this Tweener/Sequence was destroyed + (either because it was manually destroyed, because it was completed, or because its target was destroyed). + + + + + Returns a value of true if this Tweener/Sequence contains no tweens + (if this is a tween, it means that no valid property to tween was set; + if this is a sequence, it means no valid was yet added). + + + + + Returns a value of true if this Tweener/Sequence is set to go backwards (because of a call to Reverse. + + + + + Returns a value of true when this Tweener/Sequence is in the "going backwards" part of a Yoyo loop. + + + + + Returns a value of true if this Tweener/Sequence is paused. + + + + + Returns a value of true after this Tweener/Sequence was started the first time, + or if a call to GoTo or GoToAndPlay was executed. + + + + + Returns a value of true when this Tweener/Sequence is complete. + + + + + Returns a value of true if this Tweener/Sequence was added to a Sequence. + + + + + Default plugin for the tweening of Vector2 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Tween type + + + + + Tween to value + + + + + Tween from value + + + + + Sequence component. Manager for sequence of Tweeners or other nested Sequences. + Author: Daniele Giardini (http://www.holoville.com) + + + + + Creates a new Sequence without any parameter. + + + + + Creates a new Sequence. + + + A representing the Sequence parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new SequenceParms().Id("sequence1").Loops(2).OnComplete(myFunction) + + + + Appends the given callback to this Sequence. + The function to call, who must return void and accept no parameters + + + Appends the given callback to this Sequence. + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + Appends the given SendMessage callback to this Sequence. + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + Inserts the given callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + The function to call, who must return void and accept no parameters + + + Inserts the given callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + The function to call. + It must return void and has to accept a single parameter of type + Additional comma separated parameters to pass to the function + + + Inserts the given SendMessage callback at the given time position. + Time position where this callback will be placed + (if longer than the whole sequence duration, the callback will never be called) + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Appends an interval to the right of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The duration of the interval. + + + The new Sequence total time length (loops excluded). + + + + + Adds the given to the right of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The to append. + + + The new Sequence total time length (loops excluded). + + + + + Prepends an interval to the left of the sequence, + and returns the new Sequence total time length (loops excluded). + + + The duration of the interval. + + + The new Sequence total time length (loops excluded). + + + + + Adds the given to the left of the sequence, + moving all the existing sequence elements to the right, + and returns the new Sequence total time length (loops excluded). + + + The to prepend. + + + The new Sequence total time length (loops excluded). + + + + + Inserts the given at the given time, + and returns the new Sequence total time length (loops excluded). + + + The time at which the element must be placed. + + + The to insert. + + + The new Sequence total time length (loops excluded). + + + + + Clears this sequence and resets its parameters, so it can be re-used. + You can check if a Sequence is clean by querying its isEmpty property. + + + New parameters for the Sequence + (if NULL, note that the dafult ones will be used, and not the previous ones) + + + + + Kills this Sequence and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Rewinds this Sequence (loops included), and pauses it. + + + + + Restarts this Sequence from the beginning (loops included). + + + + + Returns true if the given target is currently involved in a running tween of this Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside any of this Sequence tweens, than if the relative tween is paused. + To simply check if the target is attached to a tween of this Sequence, use IsLinkedTo( target ) instead. + + + The target to check. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + + + The id to check for. + + + + + Returns true if the given target is linked to a tween of this Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to a tween of this Sequence (running or not, taking into account also nested tweens). + + + + + Returns a list of all the targets of this Sequence, or NULL if there are none. + + A list of all the targets of this Sequence, or NULL if there are none. + + + + Returns a list of the eventual nested objects whose target is the given one, + or an empty list if none was found. + + + + + Returns a list of the eventual existing tweens with the given Id within this Sequence, + nested tweens included (or an empty list if no tweens were found). + + + + + Returns a list of the eventual existing tweens with the given Id within this Sequence, + nested tweens included (or an empty list if no tweens were found). + + + + + Removes the given tween from this Sequence, + and eventually kills the Sequence if all items have been removed. + Used by to remove overwritten tweens. + + + + + Completes this Sequence. + Where a loop was involved, the Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Updates the Sequence by the given elapsed time, + and returns a value of true if the Sequence is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Sequence is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Sequence wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + A value of true if the Sequence is not reversed and is complete (or all the Sequence tween targets don't exist anymore), otherwise false. + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + Sends the sequence to the given time (taking also loops into account) and eventually plays it. + If the time is bigger than the total sequence duration, it goes to the end. + + + Returns true if the sequence reached its end and was completed. + + + + + Iterates through all the elements in order, to startup the plugins correctly. + Called at OnStart and during Append/Insert/Prepend for speedBased tweens (to calculate correct duration). + + + + + If the given is a speedBased , + forces it to calculate the correct duration. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Fills the given list with all the plugins inside this sequence tween, + while also looking for them recursively through inner sequences. + Used by HOTween.GetPlugins. + + + + + Single sequencer item. + Tween value can be null (in case this is simply used as a spacer). + + + + + Default plugin for the tweening of number values. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enumeration of ease types. + + + + + Linear. + + + + + Ease in sine. + + + + + Ease out sine. + + + + + Ease in out sine. + + + + + Ease in quad. + + + + + Ease out quad. + + + + + Ease in out quad. + + + + + Ease in cubic. + + + + + Ease out cubic. + + + + + Ease in out cubic. + + + + + Ease in quart. + + + + + Ease out quart. + + + + + Ease in out quart. + + + + + Ease in quint. + + + + + Ease out quint. + + + + + Ease in out quint. + + + + + Ease in expo. + + + + + Ease out expo. + + + + + Ease in out expo. + + + + + Ease in circ. + + + + + Ease out circ. + + + + + Ease in out circ. + + + + + Ease in elastic. + + + + + Ease out elastic. + + + + + Ease in out elastic. + + + + + Ease in back. + + + + + Ease out back. + + + + + Ease in out back. + + + + + Ease in bounce. + + + + + Ease out bounce. + + + + + Ease in out bounce. + + + + + Don't assign this! It's assigned internally when setting the ease to an AnimationCurve + + + + + Ease in strong. + OBSOLETE: use EaseInQuint instead. + + + + + OBSOLETE: use EaseOutQuint instead. + Ease out strong. + + + + + OBSOLETE: use EaseInOutQuint instead. + Ease in out strong. + + + + + Enumeration of ease types. + + + + + Ease function. + + + + + Inverse ease function. + + + + + Creates a new instance. + + + The ease function. + + + Inverse ease function. + + + + + Returns an instance based on the given . + + + An . + + + + + Plugin for the tweening of only the Z value of Vector3 objects. + + + + + Plugin for the tweening of only the X value of Vector3 objects. + + + + + Start val. + + + + + End val. + + + + + Change val. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Various utils used by HOTween. + + + + + Converts the given Matrix4x4 to a Quaternion and returns it. + + + The matrix to convert. + + + The resulting . + + + + + Returns a string representing the given Type without the packages + (like Single instead than System.Single). + + + + + Returns the 2D angle between two vectors + + + + + Used by and HOTweenInspector, + to store info about tweens that can be displayed. + + + + + Tween. + + + + + Is sequence. + + + + + Targets. + + + + + Creates a new TweenInfo object. + + + + + Is paused. + + + + + Is complete. + + + + + Is enabled. + + + + + PropertyAccessorException class. + + + + + The IMemberAccessor interface defines a member + accessor. + + + + + Gets the value stored in the member for + the specified target. + + Object to retrieve + the member from. + Member value. + + + + Sets the value for the member of + the specified target. + + Object to set the + member on. + Member value. + + + + Creates a new member accessor. + + Member + + + + Added by Daniele Giardini for HOTween, + because if a Make is called we already know that a PropertyInfo or FieldInfo exist, + and we can directly pass them as parameters. + + + + + Thanks to Ben Ratzlaff for this snippet of code + http://www.codeproject.com/cs/miscctrl/CustomPropGrid.asp + + "Initialize a private hashtable with type-opCode pairs + so i dont have to write a long if/else statement when outputting msil" + + + + + Gets the member value from the specified target. + + Target object. + Member value. + + + + Sets the member for the specified target. + + Target object. + Value to set. + + + + This method generates creates a new assembly containing + the Type that will provide dynamic access. + + + + + Create an assembly that will provide the get and set methods. + + + + + Whether or not the Member supports read access. + + + + + Whether or not the Member supports write access. + + + + + The Type of object this member accessor was + created for. + + + + + The Type of the Member being accessed. + + + + + Used to interpret AnimationCurves as eases. + + + + + Plugin for the tweening of only the Y value of Vector3 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Rewinds the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Completes the tween. + Should be overriden by tweens that control only part of the property (like HOTPluginVector3X). + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Default plugin for the tweening of Color objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + The eased value. + + + + + Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Amplitude. + + + Period. + + + The eased value. + + + + + Enumeration of the levels of warning that should be used to output messages in case of auto-resolved errors. + + + + + No messages will be logged. + + + + + Only important messages will be logged + (this will exclude warnings when a tween is overwritten). + + + + + All messages will be logged. + + + + + Enumeration of types of update that can be applied to a tween. + + + + + Normal update. + + + + + Late update. + + + + + Fixed update (useful for rigidBodies). + + + + + Timescale independent update. + Contrary to the other types, this one is not subject to changes in Time.timeScale, + thus it's the best way for tweens that happen inside GUI methods + (so that even if the game is paused, the GUI will still have animated tweens). + + + + + This object is passed as the only parameter of all HOTween's callbacks. + + + + + A reference to the IHOTweenComponent that invoked the callback method. + + + + + An array of eventual parameters that were passed to the callback. + + + + + The plugin (if any) that triggered the callback. + + + + + Plugin for the tweening of strings. + + + + + Creates a new instance of this plugin using the main ease type, + substituting any existing string with the given one over time. + + + The value to tween to. + + + + + Creates a new instance of this plugin, + substituting any existing string with the given one over time. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given value will be added to any existing string, + if false the existing string will be completely overwritten. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given value will be added to any existing string, + if false the existing string will be completely overwritten. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + HOTweenException class. + A new HOTweenException is thrown each time HOTween encounters an error. + + + + + Creates a new HOTweenException with the given message. + + + The exception message. + + + + + The PropertyAccessor class provides fast dynamic access + to a property of a specified target class. + + + + + Creates a new property accessor. + + + + + The Type of the Property being accessed. + + + + + Whether or not the Property supports read access. + + + + + Whether or not the Property supports write access. + + + + + Tween component, created by HOTween for each separate tween. + Author: Daniele Giardini (http://www.holoville.com) + + + + + Called by HOTween each time a new tween is generated via To or similar methods. + + + + + Kills this Tweener and cleans it. + + + If true also calls HOTween.Kill(this) to remove it from HOTween. + Set internally to false when I already know that HOTween is going to remove it. + + + + + Resumes this Tweener. + + + If true skips any initial delay. + + + + + Resumes this Tweener and plays it forward. + + + If true skips any initial delay. + + + + + Rewinds this Tweener (loops and tween delay included), and pauses it. + + + + + Rewinds this Tweener (loops included), and pauses it. + + + If true skips any initial delay. + + + + + Restarts this Tweener from the beginning (loops and tween delay included). + + + + + Restarts this Tweener from the beginning (loops and tween delay included). + + + If true skips any initial delay. + + + + + Restarts the tween from position 0, but takes the current target value as start value, + and diffs to find the change value (as if it was a relative tween). + + + + + Completes this Tweener. + Where a loop was involved, the Tweener completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + + + Completely resets the Tweener except its target, + and applies a new , duration, and . + + New tween type (to/from) + New duration + New parameters + + + + Completely resets this Tweener, except its target + + + + + Assigns the given callback to this Tweener/Sequence, + overwriting any existing callbacks of the same type. + + + + + Returns true if the given target and this Tweener target are the same, and the Tweener is running. + Returns false both if the given target is not the same as this Tweener's, than if this Tweener is paused. + This method is here to uniform with . + + + The target to check. + + + + + Returns true if the tween with the given string id is currently involved in a running tween or sequence. + This method is here to uniform with . + + + The id to check for. + + + + + Returns true if the tween with the given int id is currently involved in a running tween or sequence. + This method is here to uniform with . + + + The id to check for. + + + + + Returns true if the given target and this Tweener target are the same. + This method is here to uniform with . + + + The target to check. + + + A value of true if the given target and this Tweener target are the same. + + + + + Returns a list containing the target of this tween. + + A list containing the target of this tween. + + + + Returns a list containing this tween if the id is the same as the given one + (or and empty list if no tweens were found). + + + + + Returns a list containing this tween if the id is the same as the given one + (or and empty list if no tweens were found). + + + + + If this Tweener contains a tween, + returns a point on the path at the given percentage (0 to 1). + Returns a zero Vector if there's no path tween associated with this tween. + Note that, if the tween wasn't started, the OnStart callback will be called + the first time you call this method, because the tween needs to be initialized. + + The percentage (0 to 1) at which to get the point + + + + If this Tweener contains a tween returns the length of the path, + otherwise returns -1 + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + also re-adapting the duration to the correct partial, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + + Tween duration of the partial path (if -1 auto-calculates the correct partial based on the original duration) + + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to (easing included), + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + Id of the new ending waypoint on the current path + New EaseType to apply + + + + If this Tweener contains a tween, + defines a portion of that path to use and re-adapt to, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + Id of the new starting waypoint on the current path. + If you want to be sure you're targeting the first point in the path, pass -1 + (this is because the first waypoint of the path might be different from the first waypoint you passed, + in case the target Transform was not already on the starting position, and thus needed to reach it). + + + Id of the new ending waypoint on the current path + (-1 in case you want to target the ending waypoint of a closed path) + + + Tween duration of the partial path (if -1 auto-calculates the correct partial based on the original duration) + + New EaseType to apply + + + + If this Tweener contains a tween + that had been partialized, returns it to its original size, easing, and duration, + and rewinds/restarts the tween in its partial form (depending if it was paused or not). + + + + + If this Tweener contains a , returns it. + Otherwise returns null. + + + + + + Updates the Tweener by the given elapsed time, + and returns a value of true if the Tweener is complete. + + + The elapsed time since the last update. + + + If true forces the update even if the Tweener is complete or paused, + but ignores onUpdate, and sends onComplete and onStepComplete calls only if the Tweener wasn't complete before this call. + + + If true means the update is due to a startup iteration (managed by Sequence Startup or HOTween.From), + and all callbacks will be ignored. + + + If true doesn't call any callback method. + + + If true uses p_shortElapsed fully ignoring the delay + (useful when setting the initial FROM state). + + + A value of true if the Tweener is not reversed and is complete (or the tween target doesn't exist anymore), otherwise false. + + + + + Sets the correct values in case of Incremental loop type. + Also called by Tweener.ApplySequenceIncrement (used by Sequences during Incremental loops). + + + The difference from the previous loop increment. + + + + + If speed based duration was not already set (meaning OnStart has not yet been called), + calculates the duration and then resets the tween so that OnStart can be called from scratch. + Used by Sequences when Appending/Prepending/Inserting speed based tweens. + + + + + Sends the tween to the given time (taking also loops into account) and eventually plays it. + If the time is bigger than the total tween duration, it goes to the end. + + + Returns true if the tween reached its end and was completed. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + + + + Startup this tween + (might or might not call OnStart, depending if the tween is in a Sequence or not). + Can be executed only once per tween. + + If TRUE forces startup even if it had already been executed + + + + Manages on first start behaviour. + + + + + Manages on play behaviour + + + + + Fills the given list with all the plugins inside this tween. + Used by HOTween.GetPlugins. + + + + + Returns the correct id of the given waypoint, converted to path id. + + Vector3 path plugin to use + Waypoint to convert + If TRUE indicates that the given waypoint is the starting one, + otherwise it's the ending one + + + + + Indicates whether this is a FROM or a TO tween. + + + + + Ease type of this tweener + (consider that the plugins you have set might have different ease types). + Setting it will change the ease of all the plugins used by this tweener. + + + + + Ease type of this tweener + (consider that the plugins you have set might have different ease types). + Setting it will change the ease of all the plugins used by this tweener. + + + + + Eventual overshoot to use with Back easeTypes. + + + + + Eventual period to use with Elastic easeTypes. + + + + + Target of this tween. + + + + + true if this tween is animated via integers values only. + + + + + true if this tween is animated by speed instead than by duration. + + + + + The delay that was set for this tween. + + + + + The currently elapsed delay time. + + + + + Default plugin for the tweening of Rect objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Type of path (used with ) + + + + + Straight path + + + + + Curved (Catmull-Rom) path + + + + + Main tween manager. + Controls all tween types ( and ), + and is used to directly create Tweeners (to create Sequences, directly create a new instead). + Author: Daniele Giardini (http://www.holoville.com) + + + + + HOTween author - me! :P + + + + + HOTween version. + + + + + Default that will be used by any new Tweener/Sequence that doesn't implement a specific ease + (default = EaseType.easeOutQuad) + + + + + Default time scale that will be used by any new Tweener/Sequence that doesn't implement a specific timeScale + (default = 1). + + + + + Default that will be used by any new Tweener/Sequence that doesn't implement a specific ease + (default = EaseType.easeOutQuad). + + + + + Default overshoot to use with Back easeTypes. + + + + + Default period to use with Elastic easeTypes. + + + + + Default that will be used by any Tweener/Sequence that doesn't implement a specific loopType + (default = LoopType.Restart). + + + + + If true, shows the eventual paths in use by + while playing inside Unity's Editor (and if the Editor's Gizmos button is on). + + + + + Level of message output in case an error is encountered. + Warnings are logged when HOTween encounters an error, and automatically resolves it without throwing any exception + (like if you try to tween an unexisting property, in which case the tween simply won't be generated, + and an eventual warning will appear in the output window). + + + + + true if the current player is iOS (iPhone). + Used so simple Reflection instead than unsupported MemberAccessorCacher will be applyed + (iOS doesn't support Reflection.Emit). + + + + + true if the current player is running in the Editor. + + + + + Filled by tweens that are completed, so that their onCompleteDispatch method can be called AFTER HOTween has eventually removed them + (otherwise a Kill + To on the same target won't work). + This field is emptied as soon as all onCompletes are called. + + + + + Reference to overwrite manager (if in use). + + + + + Initializes and sets it as non-permanent + (meaning HOTween instance will be destroyed when all tweens are killed, + and re-created when needed). + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + + + Initializes . + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + If set to true, doesn't destroy HOTween manager when no tween is present, + otherwise the manager is destroyed when all tweens have been killed, + and re-created when needed. + + + + + Initializes . + Call this method once when your application starts up, + to avoid auto-initialization when the first tween is started or created, + and to set options. + + + If set to true, doesn't destroy HOTween manager when no tween is present, + otherwise the manager is destroyed when all tweens have been killed, + and re-created when needed. + + + If true, renames HOTween's instance to show + the current number of running tweens (only while in the Editor). + + + If true, allows HOTween's instance to enable or disable + the OverwriteManager to improve performance if it is never needed. + + + + + Called internally each time a new is created. + Adds the given Sequence to the tween list. + + + The to add. + + + + + Creates a new absolute tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The ease to use. + + + The eventual delay to apply. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween with default values, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + The name of the property or field to tween. + + + The end value the property should reach with the tween. + + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + + The ease to use. + + + The eventual delay to apply. + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new FROM tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + + The duration in seconds of the tween. + + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute PUNCH tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The end value the property should reach with the tween. + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new PUNCH tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The end value the property should reach with the tween. + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new PUNCH tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + Any ease type passed won't be considered, since punch uses its own one. + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + Default: 0.5f - amplitude of the punch effect + Default: 0.1f - oscillation period of punch effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new absolute SHAKE tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The amount of shaking to apply. + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new SHAKE tween, and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + The name of the property or field to tween. + The amount of shaking to apply. + + If true treats the end value as relative (tween BY instead than tween TO), otherwise as absolute. + + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Creates a new SHAKE tween and returns the representing it, + or null if the tween was invalid (no valid property to tween was given). + Any ease type passed won't be considered, since shake uses its own one. + + + The tweening target (must be the object containing the properties or fields to tween). + + The duration in seconds of the tween. + + A representing the tween parameters. + You can pass an existing one, or create a new one inline via method chaining, + like new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction) + + Default: 0.1f - amplitude of the shake effect + Default: 0.12f - oscillation period of shake effect + + The newly created , + or null if the parameters were invalid. + + + + + Updates normal tweens. + + + + + Updates lateUpdate tweens. + + + + + Updates fixedUpdate tweens. + + + + + Updates timeScaleIndependent tweens. + + + + + Enables the overwrite manager (disabled by default). + + If TRUE, the overwriteManager will log a warning each time a tween is overwritten + + + + Disables the overwrite manager (disabled by default). + + + + + Pauses all the tweens for the given target, and returns the total number of paused Tweeners. + + + The target whose tweens to pause. + + + The total number of paused Tweeners. + + + + + Pauses all the Tweeners/Sequences with the given ID, and returns the total number of paused Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to pause. + + + The total number of paused Tweeners/Sequences. + + + + + Pauses all the Tweeners/Sequences with the given intId, and returns the total number of paused Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to pause. + + + The total number of paused Tweeners/Sequences. + + + + + Pauses the given Tweener, and returns the total number of paused ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to pause. + + + The total number of paused Tweener (1 if the Tweener existed, otherwise 0). + + + + + Pauses the given Sequence, and returns the total number of paused ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to pause. + + + The total number of paused Sequence (1 if the sequence existed, otherwise 0). + + + + + Pauses all Tweeners/Sequences, and returns the total number of paused Tweeners/Sequences. + + + The total number of paused Tweeners/Sequences. + + + + + Resumes all the tweens (delays included) for the given target, and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the tweens for the given target, and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given ID, and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener (delays included), and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Tweener, and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners (delays included) and Sequences, and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all Tweeners/Sequences, and returns the total number of resumed Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the tweens (delays included) for the given target, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the tweens for the given target, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given ID, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given ID, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners (delays included) and Sequences with the given intId, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener (delays included), + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Tweener, + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + If true skips any initial delay. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, + sets it so that it moves forward and not backwards, + and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners (delays included) and Sequences, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all Tweeners/Sequences, + sets the tweens so that they move forward and not backwards, + and returns the total number of resumed Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the tweens for the given target, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners. + + + The target whose tweens to resume. + + + The total number of resumed Tweeners. + + + + + Resumes all the Tweeners/Sequences with the given ID, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes all the Tweeners/Sequences with the given intId, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to resume. + + + The total number of resumed Tweeners/Sequences. + + + + + Resumes the given Tweener, + sets it so that it moves backwards instead than forward, + and returns the total number of resumed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to resume. + + + The total number of resumed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Resumes the given Sequence, + sets it so that it moves backwards instead than forward, + and returns the total number of resumed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to resume. + + + The total number of resumed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Resumes all Tweeners/Sequences, + sets the tweens so that they move backwards instead than forward, + and returns the total number of resumed Tweeners/Sequences. + + + The total number of resumed Tweeners/Sequences. + + + + + Rewinds all the tweens (delays included) for the given target, and returns the total number of rewinded Tweeners. + + + The target whose tweens to rewind. + + + The total number of rewinded Tweeners. + + + + + Rewinds all the tweens for the given target, and returns the total number of rewinded Tweeners. + + + The target whose tweens to rewind. + + + If true skips any initial delay. + + + The total number of rewinded Tweeners. + + + + + Rewinds all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of rewinded Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to rewind. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners/Sequences with the given ID, and returns the total number of rewinded Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to rewind. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of rewinded Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to rewind. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all the Tweeners/Sequences with the given intId, and returns the total number of rewinded Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to rewind. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds the given Tweener (delays included), and returns the total number of rewinded ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to rewind. + + + The total number of rewinded Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Rewinds the given Tweener, and returns the total number of rewinded ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to rewind. + + + If true skips any initial delay. + + + The total number of rewinded Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Rewinds the given Sequence, and returns the total number of rewinded ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to rewind. + + + The total number of rewinded Sequences (1 if the Sequence existed, otherwise 0). + + + + + Rewinds all Tweeners (delay included) and Sequences, and returns the total number of rewinded Tweeners/Sequences. + + + The total number of rewinded Tweeners/Sequences. + + + + + Rewinds all Tweeners/Sequences, and returns the total number of rewinded Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of rewinded Tweeners/Sequences. + + + + + Restarts all the tweens (delays included) for the given target, and returns the total number of restarted Tweeners. + + + The target whose tweens to restart. + + + The total number of restarted Tweeners. + + + + + Restarts all the tweens for the given target, and returns the total number of restarted Tweeners. + + + The target whose tweens to restart. + + + If true skips any initial delay. + + + The total number of restarted Tweeners. + + + + + Restarts all the Tweeners (delays included) and Sequences with the given ID, and returns the total number of restarted Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners/Sequences with the given ID, and returns the total number of restarted Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to restart. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners (delays included) and Sequences with the given intId, and returns the total number of restarted Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners/Sequences with the given intId, and returns the total number of restarted Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to restart. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts the given Tweener (delays included), and returns the total number of restarted ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to restart. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts the given Tweener, and returns the total number of restarted ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to restart. + + + If true skips any initial delay. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts the given Sequence, and returns the total number of restarted ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to restart. + + + The total number of restarted Sequences (1 if the Sequence existed, otherwise 0). + + + + + Restarts all Tweeners/Sequences (delay included) and Sequences, and returns the total number of restarted Tweeners/Sequences. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all Tweeners/Sequences and returns the total number of restarted Tweeners/Sequences. + + + If true skips any initial tween delay. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all tweens from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The target whose tweens to restart. + + + The total number of restarted Tweeners. + + + + + Restarts all the Tweeners from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The ID of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts all the Tweeners from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The intId of the Tweeners/Sequences to restart. + + + The total number of restarted Tweeners/Sequences. + + + + + Restarts the given Tweener from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The Tweener to restart. + + + The total number of restarted Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Restarts all Tweeners/Sequences from position 0, but recalculating them by taking their current targets values as start values, + and the currently changed value to determine the end values. + + + The total number of restarted Tweeners/Sequences. + + + + + Reverses all the tweens for the given target, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners. + + + The target whose tweens to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners. + + + + + Reverses all the Tweeners/Sequences with the given ID, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Reverses all the Tweeners/Sequences with the given intId, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Reverses the given Tweener, + animating it from its current value back to the starting one, + and returns the total number of reversed Tweeners (1 if the Tweener existed, otherwise 0). + + + The Tweener to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Reverses the given Sequence, and returns the total number of reversed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to reverse. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Reverses all Tweeners/Sequences, + animating them from their current value back to the starting one, + and returns the total number of reversed Tweeners/Sequences. + + + If TRUE, the tween will also start playing in case it was paused, + otherwise it will maintain its current play/pause state (default). + + + The total number of reversed Tweeners/Sequences. + + + + + Completes all the tweens for the given target, and returns the total number of completed Tweeners. + Where a loop was involved and not infinite, the relative tween completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The target whose tweens to complete. + + + The total number of completed Tweeners. + + + + + Completes all the Tweeners/Sequences with the given ID, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The ID of the Tweeners/Sequences to complete. + + + The total number of completed Tweeners/Sequences. + + + + + Completes all the Tweeners/Sequences with the given intId, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The intId of the Tweeners/Sequences to complete. + + + The total number of completed Tweeners/Sequences. + + + + + Completes the given Tweener, and returns the total number of completed ones (1 if the Tweener existed, otherwise 0). + Where a loop was involved and not infinite, the relative Tweener completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The Tweener to complete. + + + The total number of completed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Completes the given Sequence, and returns the total number of completed ones (1 if the Sequence existed, otherwise 0). + Where a loop was involved and not infinite, the relative Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The Sequence to complete. + + + The total number of completed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Completes all Tweeners/Sequences, and returns the total number of completed Tweeners/Sequences. + Where a loop was involved and not infinite, the relative Tweener/Sequence completes at the position where it would actually be after the set number of loops. + If there were infinite loops, this method will have no effect. + + + The total number of completed Tweeners/Sequences. + + + + + Kills all the tweens for the given target (unless they're were created inside a ), + and returns the total number of killed Tweeners. + + + The target whose Tweeners to kill. + + + The total number of killed Tweeners. + + + + + Kills all the Tweeners/Sequences with the given ID, and returns the total number of killed Tweeners/Sequences. + + + The ID of the Tweeners/Sequences to kill. + + + The total number of killed Tweeners/Sequences. + + + + + Kills all the Tweeners/Sequences with the given intId, and returns the total number of killed Tweeners/Sequences. + + + The intId of the Tweeners/Sequences to kill. + + + The total number of killed Tweeners/Sequences. + + + + + Kills the given Tweener, and returns the total number of killed ones (1 if the Tweener existed, otherwise 0). + + + The Tweener to kill. + + + The total number of killed Tweeners (1 if the Tweener existed, otherwise 0). + + + + + Kills the given Sequence, and returns the total number of killed ones (1 if the Sequence existed, otherwise 0). + + + The Sequence to kill. + + + The total number of killed Sequences (1 if the Sequence existed, otherwise 0). + + + + + Kills all Tweeners/Sequences, and returns the total number of killed Tweeners/Sequences. + + + The total number of killed Tweeners/Sequences. + + + + + Used by Sequences to remove added tweens from main tweens list. + + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences, paused or not. + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences that are currently playing. + + + + + Returns all existing Tweeners (excluding nested ones) and Sequences that are currently paused. + + + + + Returns a list of the eventual existing tweens with the given Id, + (empty if no Tweener/Sequence was found). + + Id to look for + If TRUE also searches inside nested tweens + + + + + Returns a list of the eventual existing tweens with the given intId, + (empty if no Tweener/Sequence was found). + + IntId to look for + If TRUE also searches inside nested tweens + + + + + Returns a list with all the existing objects whose target is the given one, + or an empty list if none was found. + + Target to look for + If TRUE also searches inside nested Tweeners + + + + + Returns true if the given target is currently involved in any running Tweener or Sequence (taking into account also nested tweens). + Returns false both if the given target is not inside a Tweener, than if the relative Tweener is paused. + To simply check if the target is attached to a Tweener or Sequence use instead. + + + The target to check. + + + A value of true if the given target is currently involved in any running Tweener or Sequence (taking into account also nested tweens). + + + + + Returns true if the given id is involved in any running Tweener or Sequence (taking into account also nested tweens). + + + The target to check. + + + + + Returns true if the given id is involved in any running Tweener or Sequence (taking into account also nested tweens). + + + The target to check. + + + + + Returns true if the given target is linked to any Tweener or Sequence (running or not, taking into account also nested tweens). + + + The target to check. + + + A value of true if the given target is linked to any Tweener or Sequence (running or not, taking into account also nested tweens). + + + + + Returns a list of the current tweens (paused and delayed included), + or null if there are no tweens. + + + + + + Used by callbacks that are wired to sendMessage. + + + + + Filter filters for: + - ID if + - Tweener if + - Sequence if + - Tweener target if (doesn't look inside sequence tweens) + - Everything if null + + + + + Returns all the currently existing plugins involved in any tween, even if nested or paused, + or null if there are none. + + + + + TRUE while inside the update loop + + + + + Total number of tweeners/sequences (paused and delayed ones are included). + Tweeners and sequences contained into other sequences don't count: + for example, if there's only one sequence that contains 2 tweeners, totTweens will be 1. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a simple linear tweening, with no easing. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Base class for all HOTParms. + + + + + ID. + + + + + Int ID. + + + + + Auto kill on complete. + + + + + Update type. + + + + + Time scale. + + + + + Loops + + + + + Loop type. + + + + + Paused. + + + + + On start. + + + + + On start with parms. + + + + + On start parameters. + + + + + On update. + + + + + On update with parms. + + + + + On update parameters. + + + + + On plugin results. + + + + + On plugin results with parms. + + + + + On plugin results parameters. + + + + + On pause. + + + + + On pause with parms. + + + + + On pause parameters. + + + + + On play. + + + + + On play with parms. + + + + + On play parameters. + + + + + On rewinded. + + + + + On rewinded with parms. + + + + + On rewinded parameters. + + + + + On step complete. + + + + + On step complete with parms. + + + + + On step complete parameters. + + + + + On complete. + + + + + On complete with parms. + + + + + On complete parameters. + + + + + True if there are behaviours to manage + + + + + True if there are gameObject to manage + + + + + Behaviours to activate + + + + + Behaviours to deactivate + + + + + GameObjects to activate + + + + + GameObejcts to deactivate + + + + + Initializes the given owner with the stored parameters. + + + The to initialize. + + + + + Only used with ApplyCallback method. + + + + + Called when the tween is starting + + + + + Called each time the tween is updated + + + + + Called each time a single loop is completed + + + + + Called when the whole tween (loops included) is complete + + + + + Called when the tween is paused + + + + + Called when the tween is played + + + + + Called when the tween is rewinded + + + + + Works only with Tweeners, and not with Sequences. + Called when a plugin of the Tweens is overwritten by the OverwriteManager. + + + + + Cache manager for James Nies' MemberAccessor classes + + + + + Returns the cached memberAccessor if it alread exists, + or calls MemberAccessor.Make and caches and returns the newly created MemberAccessor. + + + + + Clears the cache. + + + + + The PropertyAccessor class provides fast dynamic access + to a property of a specified target class. + + + + + Creates a new property accessor. + + + + + The Type of the Property being accessed. + + + + + Whether or not the Property supports read access. + + + + + Whether or not the Property supports write access. + + + + + Enumeration of axis. + + + + + No axis. + + + + + X axis. + + + + + Y axis. + + + + + Z axis. + + + + + W axis. + + + + + Plugin for the tweening of Vector3 objects along a Vector3 path. + + + + + Creates a new instance of this plugin using the main ease type and an absolute path. + + + The path to tween through. + + Type of path + + + + Creates a new instance of this plugin using an absolute path. + + + The path to tween through. + + + The to use. + + Type of path + + + + Creates a new instance of this plugin using the main ease type. + + + The path to tween through. + + + If true, the path is considered relative to the starting value of the property, instead than absolute. + Not compatible with HOTween.From. + + Type of path + + + + Creates a new instance of this plugin. + + + The path to tween through. + + + The to use. + + + If true, the path is considered relative to the starting value of the property, instead than absolute. + Not compatible with HOTween.From. + + Type of path + + + + Creates a new instance of this plugin. + + + The path to tween through. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + Type of path + + + + Init override. + Used to check that isRelative is FALSE, + and otherwise use the given parameters to send a decent warning message. + + + + + Parameter > Smoothly closes the path, so that it can be used for cycling loops. + + + A + + + + + Parameter > Choose whether to smoothly close the path, so that it can be used for cycling loops. + + + Set to true to close the path. + + + + + Parameter > If the tween target is a , orients the tween target to the path. + + + A + + + + + Parameter > Choose whether to orient the tween target to the path (only if it's a ). + + + Set to true to orient the tween target to the path. + + + + + Parameter > If the tween target is a , orients the tween target to the path, + using the given lookAhead percentage. + + + The look ahead percentage (0 to 1). + + + + + Parameter > If the tween target is a , orients the tween target to the path, + locking its rotation on the given axis. + + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > If the tween target is a , orients the tween target to the path, + using the given lookAhead percentage and locking its rotation on the given axis. + + The look ahead percentage (0 to 1) + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > Choose whether to orient the tween target to the path (only if it's a ), + and which lookAhead percentage ad lockRotation to use. + + + Set to true to orient the tween target to the path. + + + The look ahead percentage (0 to 1). + + + Sets one or more axis to lock while rotating. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y). + + + + + Parameter > If the tween target is a , sets the tween so that the target will always look at the given transform. + + + The to look at. + + + + + Parameter > If the tween target is a , sets the tween so that the target will always look at the given position. + + + The to look at. + + + + + Parameter > locks the given position axis. + + Sets one or more axis to lock. + To lock more than one axis, use the bitwise OR operator (ex: Axis.X | Axis.Y) + + + + + Indicates that the path works must be calculated in 2D + + If TRUE the target will be considered as moving from a side-scrolling perspective, + if FALSE (default) the target will be considered as moving from a top-down perspective + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Adds the correct starting and ending point so the path can be reached from the property's actual position. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the point at the given percentage (0 to 1), + considering the path at constant speed. + Used by DoUpdate and by Tweener.GetPointOnPath. + + + The percentage (0 to 1) at which to get the point. + + + + + Returns the point at the given percentage (0 to 1), + considering the path at constant speed. + Used by DoUpdate and by Tweener.GetPointOnPath. + + + The percentage (0 to 1) at which to get the point. + + + IF true updates also value + (necessary if this method is called for an update). + + + IF not NULL uses the given path instead than the default one. + + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Returns the percentage of the path length occupied by the given path waypoints interval. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Manager used for automatic control of eventual overwriting of tweens. + It is disabled by default, you need to call to enable it. + + + + + List of currently running Tweeners + (meaning all Tweeners whose OnStart has been called, paused or not). + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Default plugin for the tweening of Color32 objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Used internally to generate warnings that are managed without throwing exceptions. + + + + + Used to manage movement on a Cardinal spline (of Catmull-Rom type). + Contains code from Andeeee's CRSpline (http://forum.unity3d.com/threads/32954-Waypoints-and-constant-variable-speed-problems). + + + + + Creates a new based on the given array of points. + + Type of path + + The array used to create the path. + + + + + Gets the point on the path at the given percentage (0 to 1). + + + The percentage (0 to 1) at which to get the point. + + + + + Gets the point on the path at the given percentage (0 to 1). + + + The percentage (0 to 1) at which to get the point. + + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Gets the velocity at the given time position. + OBSOLETE since path now uses constant velocity. + + + + + Draws the full path. + + + + + Draws the full path, and if t is not -1 also draws the velocity at t. + + + The point where to calculate velocity and eventual additional trigonometry. + + + If true also draws the normal, tangent, and binormal of t. + + + + + Returns the point at the given time percentage (0 to 1), + considering the path at constant speed. + + The time percentage (0 to 1) at which to get the point + + + + Returns the point at the given time percentage (0 to 1), + considering the path at constant speed. + + The time percentage (0 to 1) at which to get the point + Outputs the calculated path percentage value + + Index of waypoint we're moving to (or where we are). Only used for Linear paths. + + + + + Gets the constant path percentage for the given time percentage + that can be used with GetConstPoint. + + The time percentage (0 to 1) to use + + + + + Method chaining parameters for a . + + + + + Initializes the given with the stored parameters. + + + The to initialize. + + + The target. + + + + + Sets this tween so that it works with pixel perfect values. + Only works with , , , + , , + plugins. + + + + + + Sets this tween to work by speed instead than time. + When a tween is based on speed instead than time, + duration is considered as the amount that the property will change every second, + and ease is automatically set to Linear. + In case of Vectors, the amount represents the vector length x second; + in case of Quaternions, the amount represents the full rotation (360°) speed x second; + in case of strings, the amount represents the amount of changed letters x second. + + + + + Sets whether to tween by speed or not. + When a tween is based on speed instead than time, + duration is considered as the amount that the property will change every second, + and ease is automatically set to Linear. + In case of Vectors, the amount represents the vector length x second; + in case of strings, the amount represents the amount of changed letters x second. + + + If true this tween will work by speed instead than by time. + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + Eventual overshoot to use with Back easeType (default is 1.70158). + + + + + Sets the ease type to use (default = EaseType.easeOutQuad). + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + Eventual amplitude to use with Elastic easeType (default is 0). + + + Eventual period to use with Elastic easeType (default is 0). + + + + + Sets the ease to use the given AnimationCurve. + If you set this tween to use speed instead than time, + this parameter becomes useless, because it will be managed internally. + + + The to use. + + + + + Sets the seconds of delay before the tween should start (default = 0). + + + The seconds of delay. + + + + + Sets the Tweener in a paused state. + + + + + Choose whether to set the Tweener in a paused state. + + + + + Sets a property or field to tween, + directly assigning the given TweenPlugin to it. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The to use. + + + + + Sets a property or field to tween. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The absolute end value the object should reach with the tween. + + + + + Sets a property or field to tween. + Behaves as Prop(), but removes any other property tween previously set in this + (useful if you want to reuse the same parameters with a new set of property tweens). + + + The name of the property. + + + The end value the object should reach with the tween. + + + If true treats the end value as relative, otherwise as absolute. + + + + + Sets a property or field to tween, + directly assigning the given TweenPlugin to it. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The to use. + + + + + Sets a property or field to tween. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The absolute end value the object should reach with the tween. + + + + + Sets a property or field to tween. + Behaves as NewProp(), but without removing the other property tweens that were set in this . + + + The name of the property. + + + The end value the object should reach with the tween. + + + If true treats the end value as relative, otherwise as absolute. + + + + + Sets the ID of this Tweener (default = ""). + The same ID can be applied to multiple Tweeners, thus allowing for group operations. + You can also use IntId instead of Id for faster operations. + + + The ID for this Tweener. + + + + + Sets the int ID of this Tweener (default = 0). + The same intId can be applied to multiple Tweeners, thus allowing for group operations. + The main difference from Id is that while Id is more legible, IntId allows for faster operations. + + + The int ID for this Tweener. + + + + + Sets auto-kill behaviour for when the Tweener reaches its end (default = false). + + + If true the Tweener is killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Tweener from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Tweener. + + + + + Sets the type of update to use for this Tweener (default = .Update). + + + The type of update to use. + + + + + Sets the time scale that will be used by this Tweener. + + + The time scale to use. + + + + + Sets the number of times the Tweener will run (default = 1, meaning only one go and no other loops). + + + Number of loops (set it to -1 or to apply infinite loops). + + + + + Sets the number of times the Tweener will run, + and the type of loop behaviour to apply + (default = 1, LoopType.Restart). + + + Number of loops (set it to -1 or to apply infinite loops). + + + The behaviour to use. + + + + + Function to call when the Tweener is started for the very first time. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener is started for the very first time. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Tweener is updated. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Tweener is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a plugin is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Tweener switches from a playing state to a paused state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener switches from a playing state to a paused state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Tweener switches from a paused state to a playing state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Tweener switches from a paused state to a playing state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Tweener is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Tweener is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a single loop of the Tweener is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time a single loop of the Tweener is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when the full Tweener, loops included, is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the full Tweener, loops included, is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when one of the plugins used in the tween gets overwritten + (available only if OverwriteManager is active). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when one of the plugins used in the tween gets overwritten + (available only if OverwriteManager is active). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Keeps the given component enabled while the tween is playing + + + + + Keeps the given gameObject activated while the tween is playing + + + + + Keeps the given components enabled while the tween is playing + + + + + Keeps the given GameObject activated while the tween is playing + + + + + Keeps the given component disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Keeps the given components disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Used by HOTween.From to set isFrom property. + + + A + + + + + Returns true if at least one property tween was added to these parameters, + either via Prop() or NewProp(). + + + + + Enumeration of types of loops to apply. + + + + + When a tween completes, rewinds the animation and restarts (X to Y, repeat). + + + + + Tweens to the end values then back to the original ones and so on (X to Y, Y to X, repeat). + + + + + Like , but also inverts the easing (meaning if it was easeInSomething, it will become easeOutSomething, and viceversa). + + + + + Continuously increments the tween (X to Y, Y to Y+(Y-X), and so on), + thus always moving "onward". + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Starting value. + + + Change needed in value. + + + Expected easing duration (in frames or seconds). + + + Overshoot ammount: higher means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Plugin for the tweening of the float of your choice. + Used for changing material floats. + Target for this tween must be of type . + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Selects the color property to change. + + + The propertyName/floatName to change (see Unity's if you don't know how it works). + + + + + Overridden by plugins that need a specific type of target, to check it and validate it. + Returns true if the tween target is valid. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Sets the value of the controlled property. + Some plugins (like PlugSetColor) might override this to get values from different properties. + + + The new value. + + + + + Gets the current value of the controlled property. + Some plugins (like PlugSetColor) might override this to set values on different properties. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Default plugin for the tweening of Quaternion objects. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin using the main ease type. + + + The euler angles to tween to. + + + + + Creates a new instance of this plugin. + + + The euler angles to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The euler angles to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The euler angles to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Parameter > Sets rotations to be calculated fully, + and the end value will be reached using the full degrees of the given rotation, even if beyond 360 degrees. + + + + + Parameter > Choose whether you want to calculate angles bigger than 360 degrees or not. + In the first case, the end value will be reached using the full degrees of the given rotation. + In the second case, the end value will be reached from the shortest direction. + If the endValue is set as relative, this option will have no effect, and full beyond 360 rotations will always be used. + + + Set to true to use angles bigger than 360 degrees. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + + Enum of delegates used by HOTween. + + + + + Delegate used to store OnEvent (OnStart, OnComplete, etc) functions that will accept a parameter. + + + + + Delegate used to store OnEvent (OnStart, OnComplete, etc) functions without parameters. + + + + + Delegate used internally for ease functions. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + A special class used to setup a "virtual" tween, + which will not actually be tweened nor updated, + but will just set and return a value when you call Update. + + + + + Virtual duration + (you could also set it to 1 or 100 to treat it as a percentage). + + + + + Creates a new TweenVar instance using Linear ease. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + + + Creates a new TweenVar instance. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + Ease type. + + + + + Creates a new TweenVar instance. + + + Start value (FROM). + + + End value (TO). + + + Virtual duration. + (you could also set it to 1 or 100 to treat it as a percentage). + + + AnimationCurve used for ease. + + + + + Sets and returns the value at which this + would be after the given absolute time. + + + The elapsed time to calculate. + + + + + Sets and returns the value at which this + would be after the given time. + + + The elapsed time to calculate. + + + If true consideres p_elapsed as relative, + meaning it will be added to the previous elapsed time, + otherwise it is considered absolute. + + + + + Start value (FROM). + + + + + End value (TO). + + + + + Ease type. + + + + + Ease type as AnimationCurve. + + + + + The current value of this + + + + + The current elapsed time. + + + + + Method chaining parameters for a . + + + + + Initializes the given with the stored parameters. + + + The to initialize. + + + + + Sets the ID of this Sequence (default = ""). + The same ID can be applied to multiple Sequences, thus allowing for group operations. + You can also use IntId instead of Id for faster operations. + + + The ID for this Sequence. + + + + + Sets the int ID of this Tweener (default = 0). + The same intId can be applied to multiple Tweeners, thus allowing for group operations. + The main difference from Id is that while Id is more legible, IntId allows for faster operations. + + + The int ID for this Tweener. + + + + + Sets auto-kill behaviour for when the Sequence reaches its end (default = false). + + + If true the Sequence is killed and removed from HOTween as soon as it's completed. + If false doesn't remove this Sequence from HOTween when it is completed, + and you will need to call an HOTween.Kill to remove this Sequence. + + + + + Sets the type of update to use for this Sequence (default = .Update). + + + The type of update to use. + + + + + Sets the time scale that will be used by this Sequence. + + + The time scale to use. + + + + + Sets the number of times the Sequence will run (default = 1, meaning only one go and no other loops). + + + Number of loops (set it to -1 or to apply infinite loops). + + + + + Sets the number of times the Sequence will run, + and the type of loop behaviour to apply + (default = 1, LoopType.Restart). + + + Number of loops (set it to -1 or to apply infinite loops). + + + The behaviour to use. + Note the is available, but as an experimental feature. + It works with simple Sequences, but you should check that your animation + works as intended with more complex Sequences. + + + + + Function to call when the Sequence is started for the very first time. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence is started for the very first time. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the Sequence is updated. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the Sequence is updated. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Sequence switches from a playing state to a paused state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence switches from a playing state to a paused state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call when the Sequence switches from a paused state to a playing state. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the Sequence switches from a paused state to a playing state. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time the sequence is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time the sequence is rewinded from a non-rewinded state + (either because of a direct call to Rewind, + or because the tween's virtual playehead reached the start due to a playing backwards behaviour). + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Function to call each time a single loop of the Sequence is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call each time a single loop of the Sequence is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Function to call when the full Sequence, loops included, is completed. + + + The function to call, who must return void and accept no parameters. + + + + + Function to call when the full Sequence, loops included, is completed. + + + The function to call. + It must return void and has to accept a single parameter of type . + + + Additional comma separated parameters to pass to the function. + + + + + Uses sendMessage to call the method named p_methodName + on every MonoBehaviour in the p_sendMessageTarget GameObject. + + GameObject to target for sendMessage + Name of the method to call + Eventual additional parameter + SendMessageOptions + + + + Keeps the given component enabled while the tween is playing + + + + + Keeps the given gameObject activated while the tween is playing + + + + + Keeps the given components enabled while the tween is playing + + + + + Keeps the given GameObject activated while the tween is playing + + + + + Keeps the given component disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Keeps the given components disabled while the tween is playing + + + + + Keeps the given GameObject disabled while the tween is playing + + + + + Plugin for the tweening of number values only through integers. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + + + Creates a new instance of this plugin using the main ease type. + + + The value to tween to. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use. + + + If true, the given end value is considered relative instead than absolute. + + + + + Creates a new instance of this plugin. + + + The value to tween to. + + + The to use for easing. + + + If true, the given end value is considered relative instead than absolute. + + + + + Returns the speed-based duration based on the given speed x second. + + + + + Sets the typed changeVal based on the current startVal and endVal. + + + + + Sets the correct values in case of Incremental loop type. + + + The difference from the previous loop increment. + + + + + Sets the correct values in case of RestartIncremental. + + + + + Updates the tween. + + + The total elapsed time since startup. + + + + + Gets the untyped start value, + sets both the untyped and the typed start value. + + + + + Gets the untyped end value, + sets both the untyped and the typed end value. + + + + diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML.meta new file mode 100644 index 0000000..1f987b1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.XML.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4112ba0757d9aa94f9f4ff3a1f079fbc +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll new file mode 100644 index 0000000..448df80 Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll differ diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb new file mode 100644 index 0000000..f47cbe6 Binary files /dev/null and b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb.meta new file mode 100644 index 0000000..ce141ba --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.mdb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e11b7548cea2849468e735d5cf8684ec +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.meta new file mode 100644 index 0000000..120e495 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 219563a788c6c504f8aedb4eae97878e +MonoAssemblyImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + userData: diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt new file mode 100644 index 0000000..42e55f7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt @@ -0,0 +1,7 @@ +Copyright (c) 2012 Daniele Giardini + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt.meta b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt.meta new file mode 100644 index 0000000..562c282 --- /dev/null +++ b/UnityTests.Unity5/Assets/Holoville/HOTween/HOTween_License.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: bb5422ae1d7e10944baa3e4201d73647 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/LeanTween.meta b/UnityTests.Unity5/Assets/LeanTween.meta new file mode 100644 index 0000000..3bfcb5d --- /dev/null +++ b/UnityTests.Unity5/Assets/LeanTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9e5ab3de744409e40807ac0f286b66e8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/LeanTween/Plugins.meta b/UnityTests.Unity5/Assets/LeanTween/Plugins.meta new file mode 100644 index 0000000..f3cbad4 --- /dev/null +++ b/UnityTests.Unity5/Assets/LeanTween/Plugins.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1839327a1a81c4d979f53b07027ab4b9 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs b/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs new file mode 100644 index 0000000..218e4c8 --- /dev/null +++ b/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs @@ -0,0 +1,4031 @@ +// Copyright (c) 2013 Russell Savage - Dented Pixel +// +// LeanTween version 2.14 - http://dentedpixel.com/developer-diary/ +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* +TERMS OF USE - EASING EQUATIONS# +Open source under the BSD License. +Copyright (c)2001 Robert Penner +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** +* Pass this to the "ease" parameter in the optional hashtable, to get a different easing behavior

+* Example:
LeanTween.rotateX(gameObject, 270.0f, 1.5f).setEase(LeanTweenType.easeInBack); +* +* @class LeanTweenType +*/ + +/** +* @property {integer} linear +*/ +/** +* @property {integer} easeOutQuad +*/ +/** +* @property {integer} easeInQuad +*/ +/** +* @property {integer} easeInOutQuad +*/ +/** +* @property {integer} easeInCubic +*/ +/** +* @property {integer} easeOutCubic +*/ +/** +* @property {integer} easeInOutCubic +*/ +/** +* @property {integer} easeInQuart +*/ +/** +* @property {integer} easeOutQuart +*/ +/** +* @property {integer} easeInOutQuart +*/ +/** +* @property {integer} easeInQuint +*/ +/** +* @property {integer} easeOutQuint +*/ +/** +* @property {integer} easeInOutQuint +*/ +/** +* @property {integer} easeInSine +*/ +/** +* @property {integer} easeOutSine +*/ +/** +* @property {integer} easeInOutSine +*/ +/** +* @property {integer} easeInExpo +*/ +/** +* @property {integer} easeOutExpo +*/ +/** +* @property {integer} easeInOutExpo +*/ +/** +* @property {integer} easeInCirc +*/ +/** +* @property {integer} easeOutCirc +*/ +/** +* @property {integer} easeInOutCirc +*/ +/** +* @property {integer} easeInBounce +*/ +/** +* @property {integer} easeOutBounce +*/ +/** +* @property {integer} easeInOutBounce +*/ +/** +* @property {integer} easeInBack +*/ +/** +* @property {integer} easeOutBack +*/ +/** +* @property {integer} easeInOutBack +*/ +/** +* @property {integer} easeInElastic +*/ +/** +* @property {integer} easeOutElastic +*/ +/** +* @property {integer} easeInOutElastic +*/ +/** +* @property {integer} punch +*/ +using UnityEngine; +using System.Collections; +using System; +public enum LeanTweenType{ + notUsed, linear, easeOutQuad, easeInQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, + easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, + easeInBounce, easeOutBounce, easeInOutBounce, easeInBack, easeOutBack, easeInOutBack, easeInElastic, easeOutElastic, easeInOutElastic, easeSpring, easeShake, punch, once, clamp, pingPong, animationCurve +} + +/** +* Internal Representation of a Tween
+*
+* This class represents all of the optional parameters you can pass to a method (it also represents the internal representation of the tween).

+* Optional Parameters are passed at the end of every method:
+*
+*   Example:
+*   LeanTween.moveX( gameObject, 1f, 1f).setEase( LeanTweenType.easeInQuad ).setDelay(1f);
+*
+* You can pass the optional parameters in any order, and chain on as many as you wish.
+* You can also pass parameters at a later time by saving a reference to what is returned.
+*
+*   Example:
+*   LTDescr d = LeanTween.moveX(gameObject, 1f, 1f);
+*     ...later set some parameters
+*   d.setOnComplete( onCompleteFunc ).setEase( LeanTweenType.easeInOutBack );
+*
+* Retrieve a unique id for the tween by using the "id" property. You can pass this to LeanTween.pause, LeanTween.resume, LeanTween.cancel methods
+*
+*   Example:
+*   int id = LeanTween.moveX(gameObject, 1f, 3f).id;
+*   LeanTween.pause( id );
+* @class LTDescr +* @constructor +*/ +public class LTDescr{ + public bool toggle; + public bool useEstimatedTime; + public bool useFrames; + public bool hasInitiliazed; + public bool hasPhysics; + public float passed; + public float delay; + public float time; + public float lastVal; + private uint _id; + public int loopCount; + public uint counter; + public float direction; + public bool destroyOnComplete; + public Transform trans; + public LTRect ltRect; + public Vector3 from; + public Vector3 to; + public Vector3 diff; + public Vector3 point; + public Vector3 axis; + public Vector3 origRotation; + public LTBezierPath path; + public LTSpline spline; + public TweenAction type; + public LeanTweenType tweenType; + public AnimationCurve animationCurve; + public LeanTweenType loopType; + public Action onUpdateFloat; + public Action onUpdateFloatObject; + public Action onUpdateVector3; + public Action onUpdateVector3Object; + public Action onComplete; + public Action onCompleteObject; + public object onCompleteParam; + public object onUpdateParam; + #if !UNITY_METRO + public Hashtable optional; + #endif + + private static uint global_counter = 0; + + public override string ToString(){ + return (trans!=null ? "gameObject:"+trans.gameObject : "gameObject:null")+" toggle:"+toggle+" passed:"+passed+" time:"+time+" delay:"+delay+" from:"+from+" to:"+to+" type:"+type+" useEstimatedTime:"+useEstimatedTime+" id:"+id+" hasInitiliazed:"+hasInitiliazed; + } + + public LTDescr(){ + + } + + /** + * Cancel a tween + * + * @method cancel + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr cancel(){ + LeanTween.removeTween((int)this._id); + return this; + } + + public int uniqueId{ + get{ + uint toId = _id | counter << 16; + + /*uint backId = toId & 0xFFFF; + uint backCounter = toId >> 16; + if(_id!=backId || backCounter!=counter){ + Debug.LogError("BAD CONVERSION toId:"+_id); + }*/ + + return (int)toId; + } + } + + public int id{ + get{ + return uniqueId; + } + } + + public void reset(){ + this.toggle = true; + #if !UNITY_METRO + this.optional = null; + #endif + this.destroyOnComplete = false; + this.passed = this.delay = 0.0f; + this.useEstimatedTime = this.useFrames = this.hasInitiliazed = false; + this.animationCurve = null; + this.tweenType = LeanTweenType.linear; + this.loopType = LeanTweenType.once; + this.loopCount = 0; + this.direction = this.lastVal = 1.0f; + this.onUpdateFloat = null; + this.onUpdateVector3 = null; + this.onUpdateFloatObject = null; + this.onUpdateVector3Object = null; + this.onComplete = null; + this.onCompleteObject = null; + this.onCompleteParam = null; + this.point = Vector3.zero; + global_counter++; + } + + /** + * Pause a tween + * + * @method pause + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr pause(){ + if(this.direction != 0.0f){ // check if tween is already paused + this.lastVal = this.direction; + this.direction = 0.0f; + } + + return this; + } + + /** + * Resume a paused tween + * + * @method resume + * @return {LTDescr} LTDescr an object that distinguishes the tween + */ + public LTDescr resume(){ + this.direction = this.lastVal; + return this; + } + + public LTDescr setAxis( Vector3 axis ){ + this.axis = axis; + return this; + } + + /** + * Delay the start of a tween + * + * @method setDelay + * @param {float} float time The time to complete the tween in + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setDelay( 1.5f ); + */ + public LTDescr setDelay( float delay ){ + if(this.useEstimatedTime){ + this.delay = delay; + }else{ + this.delay = delay*Time.timeScale; + } + + return this; + } + + /** + * Set the type of easing used for the tween.
+ * + * + * @method setEase + * @param {LeanTweenType} easeType:LeanTweenType the easing type to use + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setEase( LeanTweenType.easeInBounce ); + */ + public LTDescr setEase( LeanTweenType easeType ){ + this.tweenType = easeType; + return this; + } + + /** + * Set the type of easing used for the tween with a custom curve.
+ * @method setEase (AnimationCurve) + * @param {AnimationCurve} easeDefinition:AnimationCurve an AnimationCure that describes the type of easing you want, this is great for when you want a unique type of movement + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setEase( LeanTweenType.easeInBounce ); + */ + public LTDescr setEase( AnimationCurve easeCurve ){ + this.animationCurve = easeCurve; + return this; + } + + public LTDescr setTo( Vector3 to ){ + this.to = to; + return this; + } + + public LTDescr setFrom( Vector3 from ){ + this.from = from; + this.hasInitiliazed = true; // this is set, so that the "from" value isn't overwritten later on when the tween starts + this.diff = this.to - this.from; + return this; + } + + public LTDescr setId( uint id ){ + this._id = id; + this.counter = global_counter; + return this; + } + + /** + * Set the tween to repeat a number of times. + * @method setRepeat + * @param {int} repeatNum:int the number of times to repeat the tween. -1 to repeat infinite times + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 10 ).setLoopPingPong(); + */ + public LTDescr setRepeat( int repeat ){ + this.loopCount = repeat; + if((repeat>1 && this.loopType == LeanTweenType.once) || (repeat < 0 && this.loopType == LeanTweenType.once)){ + this.loopType = LeanTweenType.clamp; + } + return this; + } + + public LTDescr setLoopType( LeanTweenType loopType ){ + this.loopType = loopType; + return this; + } + + /** + * Use estimated time when tweening an object. Great for pause screens, when you want all other action to be stopped (or slowed down) + * @method setUseEstimatedTime + * @param {bool} useEstimatedTime:bool whether to use estimated time or not + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 2 ).setUseEstimatedTime( true ); + */ + public LTDescr setUseEstimatedTime( bool useEstimatedTime ){ + this.useEstimatedTime = useEstimatedTime; + return this; + } + + /** + * Use frames when tweening an object, when you don't want the animation to be time-frame independent... + * @method setUseFrames + * @param {bool} useFrames:bool whether to use estimated time or not + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 2 ).setUseFrames( true ); + */ + public LTDescr setUseFrames( bool useFrames ){ + this.useFrames = useFrames; + return this; + } + + public LTDescr setLoopCount( int loopCount ){ + this.loopCount = loopCount; + return this; + } + + /** + * No looping involved, just run once (the default) + * @method setLoopOnce + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setLoopOnce(); + */ + public LTDescr setLoopOnce(){ this.loopType = LeanTweenType.once; return this; } + + /** + * When the animation gets to the end it starts back at where it began + * @method setLoopClamp + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat(2).setLoopClamp(); + */ + public LTDescr setLoopClamp(){ + this.loopType = LeanTweenType.clamp; + if(this.loopCount==0) + this.loopCount = -1; + return this; + } + + /** + * When the animation gets to the end it then tweens back to where it started (and on, and on) + * @method setLoopPingPong + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat(2).setLoopPingPong(); + */ + public LTDescr setLoopPingPong(){ + this.loopType = LeanTweenType.pingPong; + if(this.loopCount==0) + this.loopCount = -1; + return this; + } + + /** + * Have a method called when the tween finishes + * @method setOnComplete + * @param {Action} onComplete:Action the method that should be called when the tween is finished ex: tweenFinished(){ } + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnComplete( Action onComplete ){ + this.onComplete = onComplete; + return this; + } + + /** + * Have a method called when the tween finishes + * @method setOnComplete (object) + * @param {Action} onComplete:Action the method that should be called when the tween is finished ex: tweenFinished( object myObj ){ } + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnComplete( Action onComplete ){ + this.onCompleteObject = onComplete; + return this; + } + public LTDescr setOnComplete( Action onComplete, object onCompleteParam ){ + this.onCompleteObject = onComplete; + if(onCompleteParam!=null) + this.onCompleteParam = onCompleteParam; + return this; + } + + /** + * Pass an object to along with the onComplete Function + * @method setOnCompleteParam + * @param {object} onComplete:object an object that + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnComplete( tweenFinished ); + */ + public LTDescr setOnCompleteParam( object onCompleteParam ){ + this.onCompleteParam = onCompleteParam; + return this; + } + + + /** + * Have a method called on each frame that the tween is being animated (passes a float value) + * @method setOnUpdate + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved );
+ *
+ * void tweenMoved( float val ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate ){ + this.onUpdateFloat = onUpdate; + return this; + } + + public LTDescr setOnUpdateObject( Action onUpdate ){ + this.onUpdateFloatObject = onUpdate; + return this; + } + public LTDescr setOnUpdateVector3( Action onUpdate ){ + this.onUpdateVector3 = onUpdate; + return this; + } + + #if !UNITY_FLASH + /** + * Have a method called on each frame that the tween is being animated (passes a float value and a object) + * @method setOnUpdate (object) + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object, and an object of the person's choosing + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved ).setOnUpdateParam( myObject );
+ *
+ * void tweenMoved( float val, object obj ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateFloatObject = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateVector3Object = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + + /** + * Have a method called on each frame that the tween is being animated (passes a float value) + * @method setOnUpdate (Vector3) + * @param {Action} onUpdate:Action a method that will be called on every frame with the float value of the tweened object + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved );
+ *
+ * void tweenMoved( Vector3 val ){ }
+ */ + public LTDescr setOnUpdate( Action onUpdate, object onUpdateParam = null ){ + this.onUpdateVector3 = onUpdate; + if(onUpdateParam!=null) + this.onUpdateParam = onUpdateParam; + return this; + } + #endif + + + /** + * Have an object passed along with the onUpdate method + * @method setOnUpdateParam + * @param {object} onUpdateParam:object an object that will be passed along with the onUpdate method + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.moveX(gameObject, 5f, 2.0f ).setOnUpdate( tweenMoved ).setOnUpdateParam( myObject );
+ *
+ * void tweenMoved( float val, object obj ){ }
+ */ + public LTDescr setOnUpdateParam( object onUpdateParam ){ + this.onUpdateParam = onUpdateParam; + return this; + } + + /** + * While tweening along a curve, set this property to true, to be perpendicalur to the path it is moving upon + * @method setOrientToPath + * @param {bool} doesOrient:bool whether the gameobject will orient to the path it is animating along + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.move( ltLogo, path, 1.0f ).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true).setAxis(Vector3.forward);
+ */ + public LTDescr setOrientToPath( bool doesOrient ){ + if(this.type==TweenAction.MOVE_CURVED || this.type==TweenAction.MOVE_CURVED_LOCAL){ + if(this.path==null) + this.path = new LTBezierPath(); + this.path.orientToPath = doesOrient; + }else{ + this.spline.orientToPath = doesOrient; + } + return this; + } + + public LTDescr setRect( LTRect rect ){ + this.ltRect = rect; + return this; + } + + public LTDescr setRect( Rect rect ){ + this.ltRect = new LTRect(rect); + return this; + } + + public LTDescr setPath( LTBezierPath path ){ + this.path = path; + return this; + } + + /** + * Set the point at which the GameObject will be rotated around + * @method setPoint + * @param {Vector3} point:Vector3 point at which you want the object to rotate around (local space) + * @return {LTDescr} LTDescr an object that distinguishes the tween + * @example + * LeanTween.rotateAround( cube, Vector3.up, 360.0f, 1.0f ) .setPoint( new Vector3(1f,0f,0f) ) .setEase( LeanTweenType.easeInOutBounce );
+ */ + public LTDescr setPoint( Vector3 point ){ + this.point = point; + return this; + } + + public LTDescr setDestroyOnComplete( bool doesDestroy ){ + this.destroyOnComplete = doesDestroy; + return this; + } + + public LTDescr setAudio( object audio ){ + this.onCompleteParam = audio; + return this; + } + +} + +/** +* Animate GUI Elements by creating this object and passing the *.rect variable to the GUI method

+* Example Javascript:
var bRect:LTRect = new LTRect( 0, 0, 100, 50 );
+* LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 );
+* function OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*
+* Example C#:
+* LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );
+* LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f );
+* void OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+* +* @class LTRect +* @constructor +* @param {float} x:float X location +* @param {float} y:float Y location +* @param {float} width:float Width +* @param {float} height:float Height +* @param {float} alpha:float (Optional) initial alpha amount (0-1) +* @param {float} rotation:float (Optional) initial rotation in degrees (0-360) +*/ + +[System.Serializable] +public class LTRect : System.Object{ + /** + * Pass this value to the GUI Methods + * + * @property rect + * @type {Rect} rect:Rect Rect object that controls the positioning and size + */ + public Rect _rect; + public float alpha = 1f; + public float rotation; + public Vector2 pivot; + public Vector2 margin; + public Rect relativeRect = new Rect(0f,0f,float.PositiveInfinity,float.PositiveInfinity); + + public bool rotateEnabled; + [HideInInspector] + public bool rotateFinished; + public bool alphaEnabled; + public string labelStr; + public LTGUI.Element_Type type; + public GUIStyle style; + public bool useColor = false; + public Color color = Color.white; + public bool fontScaleToFit; + public bool useSimpleScale; + public bool sizeByHeight; + + public Texture texture; + + private int _id = -1; + [HideInInspector] + public int counter; + + public static bool colorTouched; + + public LTRect(){ + reset(); + this.rotateEnabled = this.alphaEnabled = true; + _rect = new Rect(0f,0f,1f,1f); + } + + public LTRect(Rect rect){ + _rect = rect; + reset(); + } + + public LTRect(float x, float y, float width, float height){ + _rect = new Rect(x,y,width,height); + this.alpha = 1.0f; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + } + + public LTRect(float x, float y, float width, float height, float alpha){ + _rect = new Rect(x,y,width,height); + this.alpha = alpha; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + } + + public LTRect(float x, float y, float width, float height, float alpha, float rotation){ + _rect = new Rect(x,y,width,height); + this.alpha = alpha; + this.rotation = rotation; + this.rotateEnabled = this.alphaEnabled = false; + if(rotation!=0.0f){ + this.rotateEnabled = true; + resetForRotation(); + } + } + + public bool hasInitiliazed{ + get{ + return _id!=-1; + } + } + + public int id{ + get{ + int toId = _id | counter << 16; + + /*uint backId = toId & 0xFFFF; + uint backCounter = toId >> 16; + if(_id!=backId || backCounter!=counter){ + Debug.LogError("BAD CONVERSION toId:"+_id); + }*/ + + return toId; + } + } + + public void setId( int id, int counter){ + this._id = id; + this.counter = counter; + } + + public void reset(){ + this.alpha = 1.0f; + this.rotation = 0.0f; + this.rotateEnabled = this.alphaEnabled = false; + this.margin = Vector2.zero; + this.sizeByHeight = false; + this.useColor = false; + } + + public void resetForRotation(){ + Vector3 scale = new Vector3(GUI.matrix[0,0], GUI.matrix[1,1], GUI.matrix[2,2]); + if(pivot==Vector2.zero){ + pivot = new Vector2((_rect.x+((_rect.width)*0.5f )) * scale.x + GUI.matrix[0,3], (_rect.y+((_rect.height)*0.5f )) * scale.y + GUI.matrix[1,3]); + } + } + + public float x{ + get{ return _rect.x; } + set{ _rect.x = value; } + } + + public float y{ + get{ return _rect.y; } + set{ _rect.y = value; } + } + + public float width{ + get{ return _rect.width; } + set{ _rect.width = value; } + } + + public float height{ + get{ return _rect.height; } + set{ _rect.height = value; } + } + + public Rect rect{ + + get{ + if(colorTouched){ + colorTouched = false; + GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,1.0f); + } + if(rotateEnabled){ + if(rotateFinished){ + rotateFinished = false; + rotateEnabled = false; + //this.rotation = 0.0f; + pivot = Vector2.zero; + }else{ + GUIUtility.RotateAroundPivot(rotation, pivot); + } + } + if(alphaEnabled){ + GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,alpha); + colorTouched = true; + } + if(fontScaleToFit){ + if(this.useSimpleScale){ + style.fontSize = (int)(_rect.height*this.relativeRect.height); + }else{ + style.fontSize = (int)_rect.height; + } + } + return _rect; + } + + set{ + _rect = value; + } + } + + public LTRect setStyle( GUIStyle style ){ + this.style = style; + return this; + } + + public LTRect setFontScaleToFit( bool fontScaleToFit ){ + this.fontScaleToFit = fontScaleToFit; + return this; + } + + public LTRect setColor( Color color ){ + this.color = color; + this.useColor = true; + return this; + } + + public LTRect setAlpha( float alpha ){ + this.alpha = alpha; + return this; + } + + public LTRect setLabel( String str ){ + this.labelStr = str; + return this; + } + + public LTRect setUseSimpleScale( bool useSimpleScale, Rect relativeRect){ + this.useSimpleScale = useSimpleScale; + this.relativeRect = relativeRect; + return this; + } + + public LTRect setUseSimpleScale( bool useSimpleScale){ + this.useSimpleScale = useSimpleScale; + this.relativeRect = new Rect(0f,0f,Screen.width,Screen.height); + return this; + } + + public LTRect setSizeByHeight( bool sizeByHeight){ + this.sizeByHeight = sizeByHeight; + return this; + } + + public override string ToString(){ + return "x:"+_rect.x+" y:"+_rect.y+" width:"+_rect.width+" height:"+_rect.height; + } +} + +public class LTBezier{ + public float length; + + private Vector3 a; + private Vector3 aa; + private Vector3 bb; + private Vector3 cc; + private float len; + private float[] arcLengths; + + public LTBezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float precision){ + this.a = a; + aa = (-a + 3*(b-c) + d); + bb = 3*(a+c) - 6*b; + cc = 3*(b-a); + + this.len = 1.0f / precision; + arcLengths = new float[(int)this.len + (int)1]; + arcLengths[0] = 0; + + Vector3 ov = a; + Vector3 v; + float clen = 0.0f; + for(int i = 1; i <= this.len; i++) { + v = bezierPoint(i * precision); + clen += (ov - v).magnitude; + this.arcLengths[i] = clen; + ov = v; + } + this.length = clen; + } + + private float map(float u) { + float targetLength = u * this.arcLengths[(int)this.len]; + int low = 0; + int high = (int)this.len; + int index = 0; + while (low < high) { + index = low + ((int)((high - low) / 2.0f) | 0); + if (this.arcLengths[index] < targetLength) { + low = index + 1; + } else { + high = index; + } + } + if(this.arcLengths[index] > targetLength) + index--; + if(index<0) + index = 0; + + return (index + (targetLength - arcLengths[index]) / (arcLengths[index + 1] - arcLengths[index])) / this.len; + } + + private Vector3 bezierPoint(float t){ + return ((aa* t + (bb))* t + cc)* t + a; + } + + public Vector3 point(float t){ + return bezierPoint( map(t) ); + } +} + +/** +* Manually animate along a bezier path with this class +* @class LTBezierPath +* @constructor +* @param {Vector3 Array} pts A set of points that define one or many bezier paths (the paths should be passed in multiples of 4, which correspond to each individual bezier curve) +* @example +* LTBezierPath ltPath = new LTBezierPath( new Vector3[] { new Vector3(0f,0f,0f),new Vector3(1f,0f,0f), new Vector3(1f,0f,0f), new Vector3(1f,1f,0f)} );

+* LeanTween.move(lt, ltPath.vec3, 4.0f).setOrientToPath(true).setDelay(1f).setEase(LeanTweenType.easeInOutQuad); // animate
+* Vector3 pt = ltPath.point( 0.6f ); // retrieve a point along the path +*/ +public class LTBezierPath{ + public Vector3[] pts; + public float length; + public bool orientToPath; + + private LTBezier[] beziers; + private float[] lengthRatio; + + public LTBezierPath(){ } + public LTBezierPath( Vector3[] pts_ ){ + setPoints( pts_ ); + } + + public void setPoints( Vector3[] pts_ ){ + if(pts_.Length<4) + LeanTween.logError( "LeanTween - When passing values for a vector path, you must pass four or more values!" ); + if(pts_.Length%4!=0) + LeanTween.logError( "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..." ); + + pts = pts_; + + int k = 0; + beziers = new LTBezier[ pts.Length / 4 ]; + lengthRatio = new float[ beziers.Length ]; + int i; + length = 0; + for(i = 0; i < pts.Length; i+=4){ + beziers[k] = new LTBezier(pts[i+0],pts[i+2],pts[i+1],pts[i+3],0.05f); + length += beziers[k].length; + k++; + } + // Debug.Log("beziers.Length:"+beziers.Length + " beziers:"+beziers); + for(i = 0; i < beziers.Length; i++){ + lengthRatio[i] = beziers[i].length / length; + } + } + + /** + * Retrieve a point along a path + * + * @method point + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @return {Vector3} Vector3 position of the point along the path + * @example + * transform.position = ltPath.point( 0.6f ); + */ + public Vector3 point( float ratio ){ + float added = 0.0f; + for(int i = 0; i < lengthRatio.Length; i++){ + added += lengthRatio[i]; + if(added >= ratio) + return beziers[i].point( (ratio-(added-lengthRatio[i])) / lengthRatio[i] ); + } + return beziers[lengthRatio.Length-1].point( 1.0f ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.place( transform, 0.6f ); + */ + public void place( Transform transform, float ratio ){ + place( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.place( transform, 0.6f, Vector3.left ); + */ + public void place( Transform transform, float ratio, Vector3 worldUp ){ + transform.position = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( point( ratio ), worldUp ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.placeLocal( transform, 0.6f ); + */ + public void placeLocal( Transform transform, float ratio ){ + placeLocal( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.placeLocal( transform, 0.6f, Vector3.left ); + */ + public void placeLocal( Transform transform, float ratio, Vector3 worldUp ){ + transform.localPosition = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( transform.parent.TransformPoint( point( ratio ) ), worldUp ); + } +} + +/** +* Animate along a set of points that need to be in the format: controlPoint, point1, point2.... pointLast, endControlPoint +* @class LTSpline +* @constructor +* @param {Vector3 Array} pts A set of points that define the points the path will pass through (starting with starting control point, and ending with a control point) +* @example +* LTSpline ltSpline = new LTSpline( new Vector3[] { new Vector3(0f,0f,0f),new Vector3(0f,0f,0f), new Vector3(0f,0.5f,0f), new Vector3(1f,1f,0f), new Vector3(1f,1f,0f)} );

+* LeanTween.moveSpline(lt, ltSpline.vec3, 4.0f).setOrientToPath(true).setDelay(1f).setEase(LeanTweenType.easeInOutQuad); // animate
+* Vector3 pt = ltSpline.point( 0.6f ); // retrieve a point along the path +*/ +[System.Serializable] +public class LTSpline { + public Vector3[] pts; + public bool orientToPath; + private float[] lengthRatio; + private float[] lengths; + private int numSections; + private int currPt; + private float totalLength; + + public LTSpline(params Vector3[] pts) { + this.pts = new Vector3[pts.Length]; + System.Array.Copy(pts, this.pts, pts.Length); + + numSections = pts.Length - 3; + int precision = 20; + lengthRatio = new float[precision]; + lengths = new float[precision]; + + Vector3 lastPoint = new Vector3(Mathf.Infinity,0,0); + + totalLength = 0f; + for(int i = 0; i < precision; i++){ + //Debug.Log("i:"+i); + float fract = (i*1f) / precision; + Vector3 point = interp( fract ); + + if(i>=1){ + lengths[ i ] = (point - lastPoint).magnitude; + // Debug.Log("fract:"+fract+" mag:"+lengths[ i ] + " i:"+i); + } + totalLength += lengths[ i ]; + + lastPoint = point; + } + + float ratioTotal = 0f; + for(int i = 0; i < lengths.Length; i++){ + float t = i *1f / (lengths.Length-1); + currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + + float ratioLength = lengths[i] / totalLength; + ratioTotal += ratioLength; + lengthRatio[i] = ratioTotal; + + //Debug.Log("lengthRatio["+i+"]:"+lengthRatio[i]+" lengths["+i+"]:"+lengths[i] + " t:"+t); + } + } + + public float map( float t ){ + //Debug.Log("map t:"+t); + for(int i = 0; i < lengthRatio.Length; i++){ + if(lengthRatio[i] >= t){ + // Debug.Log("map lengthRatio["+i+"]:"+lengthRatio[i]); + return lengthRatio[i]+(t-lengthRatio[i]); + } + } + return 1f; + } + + public Vector3 interp(float t) { + // The adjustments done to numSections, I am not sure why I needed to add them + /*int numSections = this.numSections+1; + if(numSections>=3) + numSections += 1;*/ + currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + // Debug.Log("currPt:"+currPt+" numSections:"+numSections+" pts.Length :"+pts.Length ); + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + /** + * Retrieve a point along a path + * + * @method point + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @return {Vector3} Vector3 position of the point along the path + * @example + * transform.position = ltSpline.point( 0.6f ); + */ + public Vector3 point( float ratio ){ + float t = map( ratio ); + //Debug.Log("t:"+t+" ratio:"+ratio); + //float t = ratio; + return interp( t ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.place( transform, 0.6f ); + */ + public void place( Transform transform, float ratio ){ + place(transform, ratio, Vector3.up); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path + * + * @method place + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.place( transform, 0.6f, Vector3.left ); + */ + public void place( Transform transform, float ratio, Vector3 worldUp ){ + transform.position = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( point( ratio ), worldUp ); + } + + /** + * Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @example + * ltPath.placeLocal( transform, 0.6f ); + */ + public void placeLocal( Transform transform, float ratio ){ + placeLocal( transform, ratio, Vector3.up ); + } + + /** + * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space + * + * @method placeLocal + * @param {Transform} transform:Transform the transform of the object you wish to place along the path + * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) + * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up + * @example + * ltPath.placeLocal( transform, 0.6f, Vector3.left ); + */ + public void placeLocal( Transform transform, float ratio, Vector3 worldUp ){ + transform.localPosition = point( ratio ); + ratio += 0.001f; + if(ratio<=1.0f) + transform.LookAt( transform.parent.TransformPoint( point( ratio ) ), worldUp ); + } + + public void gizmoDraw(float t = -1.0f) { + if(lengthRatio!=null && lengthRatio.Length>0){ + Vector3 prevPt = point(0); + + for (int i = 1; i <= 120; i++) { + float pm = (float) i / 120f; + Vector3 currPt = point(pm); + Gizmos.DrawLine(currPt, prevPt); + prevPt = currPt; + } + } + } + + public Vector3 Velocity(float t) { + t = map( t ); + + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return 1.5f * (-a + 3f * b - 3f * c + d) * (u * u) + + (2f * a -5f * b + 4f * c - d) * u + + .5f * c - .5f * a; + } +} + +public enum TweenAction{ + MOVE_X, + MOVE_Y, + MOVE_Z, + MOVE_LOCAL_X, + MOVE_LOCAL_Y, + MOVE_LOCAL_Z, + MOVE_CURVED, + MOVE_CURVED_LOCAL, + MOVE_SPLINE, + MOVE_SPLINE_LOCAL, + SCALE_X, + SCALE_Y, + SCALE_Z, + ROTATE_X, + ROTATE_Y, + ROTATE_Z, + ROTATE_AROUND, + ALPHA, + ALPHA_VERTEX, + CALLBACK, + MOVE, + MOVE_LOCAL, + ROTATE, + ROTATE_LOCAL, + SCALE, + VALUE3, + GUI_MOVE, + GUI_MOVE_MARGIN, + GUI_SCALE, + GUI_ALPHA, + GUI_ROTATE, + DELAYED_SOUND +} + +/** +* LeanTween is an efficient tweening engine for Unity3d

+* Index of All Methods | Optional Paramaters that can be passed

+* Optional Parameters are passed at the end of every method
+*
+* Example:
+* LeanTween.moveX( gameObject, 1f, 1f).setEase( LeanTweenType.easeInQuad ).setDelay(1f);
+*
+* You can pass the optional parameters in any order, and chain on as many as you wish.
+* You can also pass parameters at a later time by saving a reference to what is returned.
+*
+* Example:
+* LTDescr d = LeanTween.moveX(gameObject, 1f, 1f);
+*   ...later set some parameters
+* d.setOnComplete( onCompleteFunc ).setEase( LeanTweenType.easeInOutBack );
+* +* @class LeanTween +*/ + +public class LeanTween: MonoBehaviour { + +public static bool throwErrors = true; + +private static LTDescr[] tweens; +private static int tweenMaxSearch = 0; +private static int maxTweens = 400; +private static int frameRendered= -1; +private static GameObject _tweenEmpty; +private static float dtEstimated; +private static float previousRealTime; +private static float dt; +private static float dtActual; +private static LTDescr tween; +private static int i; +private static int j; +private static AnimationCurve punch = new AnimationCurve( new Keyframe(0.0f, 0.0f ), new Keyframe(0.112586f, 0.9976035f ), new Keyframe(0.3120486f, -0.1720615f ), new Keyframe(0.4316337f, 0.07030682f ), new Keyframe(0.5524869f, -0.03141804f ), new Keyframe(0.6549395f, 0.003909959f ), new Keyframe(0.770987f, -0.009817753f ), new Keyframe(0.8838775f, 0.001939224f ), new Keyframe(1.0f, 0.0f ) ); +private static AnimationCurve shake = new AnimationCurve( new Keyframe(0f, 0f), new Keyframe(0.25f, 1f), new Keyframe(0.75f, -1f), new Keyframe(1f, 0f) ) ; + +public static void init(){ + init(maxTweens); +} + +/** +* This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400). This must be called before any use of LeanTween is made for it to be effective. +* +* @method LeanTween.init +* @param {integer} maxSimultaneousTweens:int The maximum number of tweens you will use, make sure you don't go over this limit, otherwise the code will throw an error +* @example +* LeanTween.init( 800 ); +*/ +public static void init(int maxSimultaneousTweens){ + if(tweens==null){ + maxTweens = maxSimultaneousTweens; + tweens = new LTDescr[maxTweens]; + _tweenEmpty = new GameObject(); + _tweenEmpty.name = "~LeanTween"; + _tweenEmpty.AddComponent(typeof(LeanTween)); + _tweenEmpty.isStatic = true; + #if !UNITY_EDITOR + _tweenEmpty.hideFlags = HideFlags.HideAndDontSave; + #endif + DontDestroyOnLoad( _tweenEmpty ); + for(int i = 0; i < maxTweens; i++){ + tweens[i] = new LTDescr(); + } + } +} + +public static void reset(){ + tweens = null; +} + +public void Update(){ + LeanTween.update(); +} + +public void OnLevelWasLoaded( int lvl ){ + // Debug.Log("reseting gui"); + LTGUI.reset(); +} + +private static Transform trans; +private static float timeTotal; +private static TweenAction tweenAction; +private static float ratioPassed; +private static float from; +private static float to; +private static float val; +private static Vector3 newVect; +private static bool isTweenFinished; +private static GameObject target; +private static GameObject customTarget; + +public static void update() { + if(frameRendered != Time.frameCount){ // make sure update is only called once per frame + init(); + + dtEstimated = Time.realtimeSinceStartup - previousRealTime; + if(dtEstimated>0.2f) // a catch put in, when at the start sometimes this number can grow unrealistically large + dtEstimated = 0.2f; + previousRealTime = Time.realtimeSinceStartup; + dtActual = Time.deltaTime*Time.timeScale; + // if(tweenMaxSearch>1500) + // Debug.Log("tweenMaxSearch:"+tweenMaxSearch +" maxTweens:"+maxTweens); + for( int i = 0; i < tweenMaxSearch && i < maxTweens; i++){ + + //Debug.Log("tweens["+i+"].toggle:"+tweens[i].toggle); + if(tweens[i].toggle){ + tween = tweens[i]; + trans = tween.trans; + timeTotal = tween.time; + tweenAction = tween.type; + + dt = dtActual; + if( tween.useEstimatedTime ){ + dt = dtEstimated; + timeTotal = tween.time; + }else if( tween.useFrames ){ + dt = 1; + }else if(tween.direction==0f){ + dt = 0f; + } + + if(trans==null){ + removeTween(i); + continue; + } + //Debug.Log("i:"+i+" tween:"+tween+" dt:"+dt); + + // Check for tween finished + isTweenFinished = false; + if(tween.delay<=0){ + if((tween.passed + dt > timeTotal && tween.direction > 0.0f )){ + isTweenFinished = true; + tween.passed = tween.time; // Set to the exact end time so that it can finish tween exactly on the end value + }else if(tween.direction<0.0f && tween.passed - dt < 0.0f){ + isTweenFinished = true; + tween.passed = Mathf.Epsilon; + } + } + + if(!tween.hasInitiliazed && ((tween.passed==0.0 && tween.delay==0.0) || tween.passed>0.0) ){ + tween.hasInitiliazed = true; + + // Set time based on current timeScale + if( !tween.useEstimatedTime ){ + tween.time = tween.time*Time.timeScale; + } + + // Initialize From Values + switch(tweenAction){ + case TweenAction.MOVE: + tween.from = trans.position; break; + case TweenAction.MOVE_X: + tween.from.x = trans.position.x; break; + case TweenAction.MOVE_Y: + tween.from.x = trans.position.y; break; + case TweenAction.MOVE_Z: + tween.from.x = trans.position.z; break; + case TweenAction.MOVE_LOCAL_X: + tweens[i].from.x = trans.localPosition.x; break; + case TweenAction.MOVE_LOCAL_Y: + tweens[i].from.x = trans.localPosition.y; break; + case TweenAction.MOVE_LOCAL_Z: + tweens[i].from.x = trans.localPosition.z; break; + case TweenAction.SCALE_X: + tween.from.x = trans.localScale.x; break; + case TweenAction.SCALE_Y: + tween.from.x = trans.localScale.y; break; + case TweenAction.SCALE_Z: + tween.from.x = trans.localScale.z; break; + case TweenAction.ALPHA: + #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 + tween.from.x = trans.gameObject.renderer.material.color.a; + break; + #else + SpriteRenderer ren = trans.gameObject.GetComponent(); + tween.from.x = (ren!=null) ? ren.color.a : trans.gameObject.GetComponent().material.color.a; + break; + #endif + case TweenAction.MOVE_LOCAL: + tween.from = trans.localPosition; break; + case TweenAction.MOVE_CURVED: + case TweenAction.MOVE_CURVED_LOCAL: + case TweenAction.MOVE_SPLINE: + case TweenAction.MOVE_SPLINE_LOCAL: + tween.from.x = 0; break; + case TweenAction.ROTATE: + tween.from = trans.eulerAngles; + tween.to = new Vector3(LeanTween.closestRot( tween.from.x, tween.to.x), LeanTween.closestRot( tween.from.y, tween.to.y), LeanTween.closestRot( tween.from.z, tween.to.z)); + break; + case TweenAction.ROTATE_X: + tween.from.x = trans.eulerAngles.x; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_Y: + tween.from.x = trans.eulerAngles.y; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_Z: + tween.from.x = trans.eulerAngles.z; + tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x); + break; + case TweenAction.ROTATE_AROUND: + tween.lastVal = 0.0f; // optional["last"] + tween.origRotation = trans.eulerAngles; // optional["origRotation" + break; + case TweenAction.ROTATE_LOCAL: + tween.from = trans.localEulerAngles; + tween.to = new Vector3(LeanTween.closestRot( tween.from.x, tween.to.x), LeanTween.closestRot( tween.from.y, tween.to.y), LeanTween.closestRot( tween.from.z, tween.to.z)); + break; + case TweenAction.SCALE: + tween.from = trans.localScale; break; + case TweenAction.GUI_MOVE: + tween.from = new Vector3(tween.ltRect.rect.x, tween.ltRect.rect.y, 0); break; + case TweenAction.GUI_MOVE_MARGIN: + tween.from = new Vector2(tween.ltRect.margin.x, tween.ltRect.margin.y); break; + case TweenAction.GUI_SCALE: + tween.from = new Vector3(tween.ltRect.rect.width, tween.ltRect.rect.height, 0); break; + case TweenAction.GUI_ALPHA: + tween.from.x = tween.ltRect.alpha; break; + case TweenAction.GUI_ROTATE: + if(tween.ltRect.rotateEnabled==false){ + tween.ltRect.rotateEnabled = true; + tween.ltRect.resetForRotation(); + } + + tween.from.x = tween.ltRect.rotation; break; + case TweenAction.ALPHA_VERTEX: + tween.from.x = trans.GetComponent().mesh.colors32[0].a; + break; + } + tween.diff = tween.to - tween.from; + } + if(tween.delay<=0){ + // Move Values + if(timeTotal<=0f){ + //Debug.LogError("time total is zero Time.timeScale:"+Time.timeScale+" useEstimatedTime:"+tween.useEstimatedTime); + ratioPassed = 0f; + }else{ + ratioPassed = tween.passed / timeTotal; + } + + if(ratioPassed>1.0f){ + ratioPassed = 1.0f; + }else if(ratioPassed<0f){ + ratioPassed = 0f; + } + // Debug.Log("action:"+tweenAction+" ratioPassed:"+ratioPassed + " timeTotal:" + timeTotal + " tween.passed:"+ tween.passed +" dt:"+dt); + + if(tweenAction>=TweenAction.MOVE_X && tweenAction<=TweenAction.CALLBACK){ + if(tween.animationCurve!=null){ + val = tweenOnCurve(tween, ratioPassed); + }else { + switch( tween.tweenType ){ + case LeanTweenType.linear: + val = tween.from.x + tween.diff.x * ratioPassed; break; + case LeanTweenType.easeOutQuad: + val = easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInQuad: + val = easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInOutQuad: + val = easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break; + case LeanTweenType.easeInCubic: + val = easeInCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutCubic: + val = easeOutCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutCubic: + val = easeInOutCubic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInQuart: + val = easeInQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutQuart: + val = easeOutQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutQuart: + val = easeInOutQuart(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInQuint: + val = easeInQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutQuint: + val = easeOutQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutQuint: + val = easeInOutQuint(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInSine: + val = easeInSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutSine: + val = easeOutSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutSine: + val = easeInOutSine(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInExpo: + val = easeInExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutExpo: + val = easeOutExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutExpo: + val = easeInOutExpo(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInCirc: + val = easeInCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutCirc: + val = easeOutCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutCirc: + val = easeInOutCirc(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInBounce: + val = easeInBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutBounce: + val = easeOutBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutBounce: + val = easeInOutBounce(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInBack: + val = easeInBack(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutBack: + val = easeOutBack(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutBack: + val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInElastic: + val = easeInElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeOutElastic: + val = easeOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.easeInOutElastic: + val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed); break; + case LeanTweenType.punch: + case LeanTweenType.easeShake: + if(tween.tweenType==LeanTweenType.punch){ + tween.animationCurve = LeanTween.punch; + }else if(tween.tweenType==LeanTweenType.easeShake){ + tween.animationCurve = LeanTween.shake; + } + tween.to.x = tween.from.x + tween.to.x; + tween.diff.x = tween.to.x - tween.from.x; + val = tweenOnCurve(tween, ratioPassed); break; + case LeanTweenType.easeSpring: + val = spring(tween.from.x, tween.to.x, ratioPassed); break; + default: + { + val = tween.from.x + tween.diff.x * ratioPassed; break; + } + } + + } + + //Debug.Log("from:"+from+" to:"+to+" val:"+val+" ratioPassed:"+ratioPassed); + if(tweenAction==TweenAction.MOVE_X){ + trans.position=new Vector3( val,trans.position.y,trans.position.z); + }else if(tweenAction==TweenAction.MOVE_Y){ + trans.position =new Vector3( trans.position.x,val,trans.position.z); + }else if(tweenAction==TweenAction.MOVE_Z){ + trans.position=new Vector3( trans.position.x,trans.position.y,val); + }if(tweenAction==TweenAction.MOVE_LOCAL_X){ + trans.localPosition=new Vector3( val,trans.localPosition.y,trans.localPosition.z); + }else if(tweenAction==TweenAction.MOVE_LOCAL_Y){ + trans.localPosition=new Vector3( trans.localPosition.x,val,trans.localPosition.z); + }else if(tweenAction==TweenAction.MOVE_LOCAL_Z){ + trans.localPosition=new Vector3( trans.localPosition.x,trans.localPosition.y,val); + }else if(tweenAction==TweenAction.MOVE_CURVED){ + if(tween.path.orientToPath){ + tween.path.place( trans, val ); + }else{ + trans.position = tween.path.point( val ); + } + // Debug.Log("val:"+val+" trans.position:"+trans.position + " 0:"+ tween.curves[0] +" 1:"+tween.curves[1] +" 2:"+tween.curves[2] +" 3:"+tween.curves[3]); + }else if((TweenAction)tweenAction==TweenAction.MOVE_CURVED_LOCAL){ + if(tween.path.orientToPath){ + tween.path.placeLocal( trans, val ); + }else{ + trans.localPosition = tween.path.point( val ); + } + // Debug.Log("val:"+val+" trans.position:"+trans.position); + }else if((TweenAction)tweenAction==TweenAction.MOVE_SPLINE){ + if(tween.spline.orientToPath){ + tween.spline.place( trans, val ); + }else{ + trans.position = tween.spline.point( val ); + } + }else if((TweenAction)tweenAction==TweenAction.MOVE_SPLINE_LOCAL){ + if(tween.spline.orientToPath){ + tween.spline.placeLocal( trans, val ); + }else{ + trans.localPosition = tween.spline.point( val ); + } + }else if(tweenAction==TweenAction.SCALE_X){ + trans.localScale=new Vector3(val, trans.localScale.y,trans.localScale.z); + }else if(tweenAction==TweenAction.SCALE_Y){ + trans.localScale=new Vector3( trans.localScale.x,val,trans.localScale.z); + }else if(tweenAction==TweenAction.SCALE_Z){ + trans.localScale=new Vector3(trans.localScale.x,trans.localScale.y,val); + }else if(tweenAction==TweenAction.ROTATE_X){ + trans.eulerAngles=new Vector3(val, trans.eulerAngles.y,trans.eulerAngles.z); + }else if(tweenAction==TweenAction.ROTATE_Y){ + trans.eulerAngles=new Vector3(trans.eulerAngles.x,val,trans.eulerAngles.z); + }else if(tweenAction==TweenAction.ROTATE_Z){ + trans.eulerAngles=new Vector3(trans.eulerAngles.x,trans.eulerAngles.y,val); + }else if(tweenAction==TweenAction.ROTATE_AROUND){ + + float move = val - tween.lastVal; + // Debug.Log("move:"+move+" val:"+val + " timeTotal:"+timeTotal + " from:"+tween.from+ " diff:"+tween.diff); + if(isTweenFinished){ + trans.eulerAngles = tween.origRotation; + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, tween.to.x); + }else{ + /*trans.rotation = tween.origRotation; + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, val); + tween.lastVal = val;*/ + + trans.RotateAround((Vector3)trans.TransformPoint( tween.point ), tween.axis, move); + tween.lastVal = val; + + //trans.rotation = * Quaternion.AngleAxis(val, tween.axis); + } + + }else if(tweenAction==TweenAction.ALPHA){ + #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 + + foreach(Material mat in trans.gameObject.renderer.materials){ + mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val); + } + + #else + + SpriteRenderer ren = trans.gameObject.GetComponent(); + if(ren!=null){ + ren.color = new Color( ren.color.r, ren.color.g, ren.color.b, val); + }else{ + foreach(Material mat in trans.gameObject.GetComponent().materials){ + mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val); + } + } + + #endif + }else if(tweenAction==TweenAction.ALPHA_VERTEX){ + Mesh mesh = trans.GetComponent().mesh; + Vector3[] vertices = mesh.vertices; + Color32[] colors = new Color32[vertices.Length]; + Color32 c = mesh.colors32[0]; + c = new Color( c.r, c.g, c.b, val); + for (int k= 0; k < vertices.Length; k++) { + colors[k] = c; + } + mesh.colors32 = colors; + } + + }else if(tweenAction>=TweenAction.MOVE){ + // + + if(tween.animationCurve!=null){ + newVect = tweenOnCurveVector(tween, ratioPassed); + }else{ + if(tween.tweenType == LeanTweenType.linear){ + newVect = new Vector3( tween.from.x + tween.diff.x * ratioPassed, tween.from.y + tween.diff.y * ratioPassed, tween.from.z + tween.diff.z * ratioPassed); + }else if(tween.tweenType >= LeanTweenType.linear){ + switch(tween.tweenType){ + case LeanTweenType.easeOutQuad: + newVect = new Vector3(easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInQuad: + newVect = new Vector3(easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuad: + newVect = new Vector3(easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed), easeInOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed), easeInOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed)); break; + case LeanTweenType.easeInCubic: + newVect = new Vector3(easeInCubic(tween.from.x, tween.to.x, ratioPassed), easeInCubic(tween.from.y, tween.to.y, ratioPassed), easeInCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutCubic: + newVect = new Vector3(easeOutCubic(tween.from.x, tween.to.x, ratioPassed), easeOutCubic(tween.from.y, tween.to.y, ratioPassed), easeOutCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutCubic: + newVect = new Vector3(easeInOutCubic(tween.from.x, tween.to.x, ratioPassed), easeInOutCubic(tween.from.y, tween.to.y, ratioPassed), easeInOutCubic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInQuart: + newVect = new Vector3(easeInQuart(tween.from.x, tween.to.x, ratioPassed), easeInQuart(tween.from.y, tween.to.y, ratioPassed), easeInQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutQuart: + newVect = new Vector3(easeOutQuart(tween.from.x, tween.to.x, ratioPassed), easeOutQuart(tween.from.y, tween.to.y, ratioPassed), easeOutQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuart: + newVect = new Vector3(easeInOutQuart(tween.from.x, tween.to.x, ratioPassed), easeInOutQuart(tween.from.y, tween.to.y, ratioPassed), easeInOutQuart(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInQuint: + newVect = new Vector3(easeInQuint(tween.from.x, tween.to.x, ratioPassed), easeInQuint(tween.from.y, tween.to.y, ratioPassed), easeInQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutQuint: + newVect = new Vector3(easeOutQuint(tween.from.x, tween.to.x, ratioPassed), easeOutQuint(tween.from.y, tween.to.y, ratioPassed), easeOutQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutQuint: + newVect = new Vector3(easeInOutQuint(tween.from.x, tween.to.x, ratioPassed), easeInOutQuint(tween.from.y, tween.to.y, ratioPassed), easeInOutQuint(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInSine: + newVect = new Vector3(easeInSine(tween.from.x, tween.to.x, ratioPassed), easeInSine(tween.from.y, tween.to.y, ratioPassed), easeInSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutSine: + newVect = new Vector3(easeOutSine(tween.from.x, tween.to.x, ratioPassed), easeOutSine(tween.from.y, tween.to.y, ratioPassed), easeOutSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutSine: + newVect = new Vector3(easeInOutSine(tween.from.x, tween.to.x, ratioPassed), easeInOutSine(tween.from.y, tween.to.y, ratioPassed), easeInOutSine(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInExpo: + newVect = new Vector3(easeInExpo(tween.from.x, tween.to.x, ratioPassed), easeInExpo(tween.from.y, tween.to.y, ratioPassed), easeInExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutExpo: + newVect = new Vector3(easeOutExpo(tween.from.x, tween.to.x, ratioPassed), easeOutExpo(tween.from.y, tween.to.y, ratioPassed), easeOutExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutExpo: + newVect = new Vector3(easeInOutExpo(tween.from.x, tween.to.x, ratioPassed), easeInOutExpo(tween.from.y, tween.to.y, ratioPassed), easeInOutExpo(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInCirc: + newVect = new Vector3(easeInCirc(tween.from.x, tween.to.x, ratioPassed), easeInCirc(tween.from.y, tween.to.y, ratioPassed), easeInCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutCirc: + newVect = new Vector3(easeOutCirc(tween.from.x, tween.to.x, ratioPassed), easeOutCirc(tween.from.y, tween.to.y, ratioPassed), easeOutCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutCirc: + newVect = new Vector3(easeInOutCirc(tween.from.x, tween.to.x, ratioPassed), easeInOutCirc(tween.from.y, tween.to.y, ratioPassed), easeInOutCirc(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInBounce: + newVect = new Vector3(easeInBounce(tween.from.x, tween.to.x, ratioPassed), easeInBounce(tween.from.y, tween.to.y, ratioPassed), easeInBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutBounce: + newVect = new Vector3(easeOutBounce(tween.from.x, tween.to.x, ratioPassed), easeOutBounce(tween.from.y, tween.to.y, ratioPassed), easeOutBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutBounce: + newVect = new Vector3(easeInOutBounce(tween.from.x, tween.to.x, ratioPassed), easeInOutBounce(tween.from.y, tween.to.y, ratioPassed), easeInOutBounce(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInBack: + newVect = new Vector3(easeInBack(tween.from.x, tween.to.x, ratioPassed), easeInBack(tween.from.y, tween.to.y, ratioPassed), easeInBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutBack: + newVect = new Vector3(easeOutBack(tween.from.x, tween.to.x, ratioPassed), easeOutBack(tween.from.y, tween.to.y, ratioPassed), easeOutBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutBack: + newVect = new Vector3(easeInOutBack(tween.from.x, tween.to.x, ratioPassed), easeInOutBack(tween.from.y, tween.to.y, ratioPassed), easeInOutBack(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInElastic: + newVect = new Vector3(easeInElastic(tween.from.x, tween.to.x, ratioPassed), easeInElastic(tween.from.y, tween.to.y, ratioPassed), easeInElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeOutElastic: + newVect = new Vector3(easeOutElastic(tween.from.x, tween.to.x, ratioPassed), easeOutElastic(tween.from.y, tween.to.y, ratioPassed), easeOutElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.easeInOutElastic: + newVect = new Vector3(easeInOutElastic(tween.from.x, tween.to.x, ratioPassed), easeInOutElastic(tween.from.y, tween.to.y, ratioPassed), easeInOutElastic(tween.from.z, tween.to.z, ratioPassed)); break; + case LeanTweenType.punch: + case LeanTweenType.easeShake: + if(tween.tweenType==LeanTweenType.punch){ + tween.animationCurve = LeanTween.punch; + }else if(tween.tweenType==LeanTweenType.easeShake){ + tween.animationCurve = LeanTween.shake; + } + tween.to = tween.from + tween.to; + tween.diff = tween.to - tween.from; + if(tweenAction==TweenAction.ROTATE || tweenAction==TweenAction.ROTATE_LOCAL){ + tween.to = new Vector3(closestRot(tween.from.x, tween.to.x), closestRot(tween.from.y, tween.to.y), closestRot(tween.from.z, tween.to.z)); + } + newVect = tweenOnCurveVector(tween, ratioPassed); break; + case LeanTweenType.easeSpring: + newVect = new Vector3(spring(tween.from.x, tween.to.x, ratioPassed), spring(tween.from.y, tween.to.y, ratioPassed), spring(tween.from.z, tween.to.z, ratioPassed)); break; + + } + }else{ + newVect = new Vector3( tween.from.x + tween.diff.x * ratioPassed, tween.from.y + tween.diff.y * ratioPassed, tween.from.z + tween.diff.z * ratioPassed); + } + } + + if(tweenAction==TweenAction.MOVE){ + trans.position = newVect; + }else if(tweenAction==TweenAction.MOVE_LOCAL){ + trans.localPosition = newVect; + }else if(tweenAction==TweenAction.ROTATE){ + /*if(tween.hasPhysics){ + trans.gameObject.rigidbody.MoveRotation(Quaternion.Euler( newVect )); + }else{*/ + trans.eulerAngles = newVect; + // } + }else if(tweenAction==TweenAction.ROTATE_LOCAL){ + trans.localEulerAngles = newVect; + }else if(tweenAction==TweenAction.SCALE){ + trans.localScale = newVect; + }else if(tweenAction==TweenAction.GUI_MOVE){ + tween.ltRect.rect = new Rect( newVect.x, newVect.y, tween.ltRect.rect.width, tween.ltRect.rect.height); + }else if(tweenAction==TweenAction.GUI_MOVE_MARGIN){ + tween.ltRect.margin = new Vector2(newVect.x, newVect.y); + }else if(tweenAction==TweenAction.GUI_SCALE){ + tween.ltRect.rect = new Rect( tween.ltRect.rect.x, tween.ltRect.rect.y, newVect.x, newVect.y); + }else if(tweenAction==TweenAction.GUI_ALPHA){ + tween.ltRect.alpha = newVect.x; + }else if(tweenAction==TweenAction.GUI_ROTATE){ + tween.ltRect.rotation = newVect.x; + } + } + //Debug.Log("tween.delay:"+tween.delay + " tween.passed:"+tween.passed + " tweenAction:"+tweenAction + " to:"+newVect+" axis:"+tween.axis); + + if(tween.onUpdateFloat!=null){ + tween.onUpdateFloat(val); + }else if(tween.onUpdateFloatObject!=null){ + tween.onUpdateFloatObject(val, tween.onUpdateParam); + }else if(tween.onUpdateVector3Object!=null){ + tween.onUpdateVector3Object(newVect, tween.onUpdateParam); + }else if(tween.onUpdateVector3!=null){ + tween.onUpdateVector3(newVect); + } + #if !UNITY_METRO + else if(tween.optional!=null){ // LeanTween 1.x legacy stuff + + var onUpdate = tween.optional["onUpdate"]; + if(onUpdate!=null){ + Hashtable updateParam = (Hashtable)tween.optional["onUpdateParam"]; + if((TweenAction)tweenAction==TweenAction.VALUE3){ + if(onUpdate.GetType() == typeof(string)){ + string onUpdateS = onUpdate as string; + customTarget = tween.optional["onUpdateTarget"]!=null ? tween.optional["onUpdateTarget"] as GameObject : trans.gameObject; + customTarget.BroadcastMessage( onUpdateS, newVect ); + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(newVect, updateParam); + }else{ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(newVect); + } + }else{ + if(onUpdate.GetType() == typeof(string)){ + string onUpdateS = onUpdate as string; + if (tween.optional["onUpdateTarget"]!=null){ + customTarget = tween.optional["onUpdateTarget"] as GameObject; + customTarget.BroadcastMessage( onUpdateS, val ); + }else{ + trans.gameObject.BroadcastMessage( onUpdateS, val ); + } + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(val, updateParam); + }else if(onUpdate.GetType() == typeof(System.Action)){ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA( newVect ); + }else{ + System.Action onUpdateA = (System.Action)onUpdate; + onUpdateA(val); + } + } + } + } + #endif + } + + if(isTweenFinished){ + // Debug.Log("finished tween:"+i+" tween:"+tween); + if(tweenAction==TweenAction.GUI_ROTATE) + tween.ltRect.rotateFinished = true; + + if(tween.loopType==LeanTweenType.once || tween.loopCount==1){ + if(tweenAction==TweenAction.DELAYED_SOUND){ + AudioSource.PlayClipAtPoint((AudioClip)tween.onCompleteParam, tween.to, tween.from.x); + } + if(tween.onComplete!=null){ + removeTween(i); + tween.onComplete(); + + }else if(tween.onCompleteObject!=null){ + removeTween(i); + tween.onCompleteObject(tween.onCompleteParam); + } + + #if !UNITY_METRO + else if(tween.optional!=null){ + System.Action callback=null; + System.Action callbackWithParam = null; + string callbackS=string.Empty; + object callbackParam=null; + if(tween.optional!=null && tween.trans){ + if(tween.optional["onComplete"]!=null){ + callbackParam = tween.optional["onCompleteParam"]; + if(tween.optional["onComplete"].GetType()==typeof(string)){ + callbackS = tween.optional["onComplete"] as string; + }else{ + if(callbackParam!=null){ + callbackWithParam = (System.Action)tween.optional["onComplete"]; + }else{ + callback = (System.Action)tween.optional["onComplete"]; + if(callback==null) + Debug.LogWarning("callback was not converted"); + } + } + } + } + removeTween(i); + if(callbackWithParam!=null){ + callbackWithParam( callbackParam ); + }else if(callback!=null){ + callback(); + }else if(callbackS!=string.Empty){ + if (tween.optional["onCompleteTarget"]!=null){ + customTarget = tween.optional["onCompleteTarget"] as GameObject; + if(callbackParam!=null) customTarget.BroadcastMessage ( callbackS, callbackParam ); + else customTarget.BroadcastMessage( callbackS ); + }else{ + if(callbackParam!=null) trans.gameObject.BroadcastMessage ( callbackS, callbackParam ); + else trans.gameObject.BroadcastMessage( callbackS ); + } + } + } + #endif + else{ + removeTween(i); + } + }else{ + if(tween.loopCount<0 && tween.type==TweenAction.CALLBACK){ + if(tween.onComplete!=null){ + tween.onComplete(); + }else if(tween.onCompleteObject!=null){ + tween.onCompleteObject(tween.onCompleteParam); + } + } + if(tween.loopCount>=1){ + tween.loopCount--; + } + if(tween.loopType==LeanTweenType.clamp){ + tween.passed = Mathf.Epsilon; + // tween.delay = 0.0; + }else if(tween.loopType==LeanTweenType.pingPong){ + tween.direction = 0.0f-(tween.direction); + } + } + }else if(tween.delay<=0){ + tween.passed += dt*tween.direction; + }else{ + tween.delay -= dt; + // Debug.Log("dt:"+dt+" tween:"+i+" tween:"+tween); + if(tween.delay<0){ + tween.passed = 0.0f;//-tween.delay + tween.delay = 0.0f; + } + } + } + } + + frameRendered = Time.frameCount; + } +} + +// This method is only used internally! Do not call this from your scripts. To cancel a tween use LeanTween.cancel +public static void removeTween( int i ){ + if(tweens[i].toggle){ + tweens[i].toggle = false; + if(tweens[i].destroyOnComplete){ + //Debug.Log("destroying tween.type:"+tween.type); + if(tweens[i].ltRect!=null){ + // Debug.Log("destroy i:"+i+" id:"+tweens[i].ltRect.id); + LTGUI.destroy( tweens[i].ltRect.id ); + }else{ // check if equal to tweenEmpty + + } + } + //tweens[i].optional = null; + startSearch = i; + //Debug.Log("start search reset:"+startSearch + " i:"+i+" tweenMaxSearch:"+tweenMaxSearch); + if(i+1>=tweenMaxSearch){ + //Debug.Log("reset to zero"); + startSearch = 0; + tweenMaxSearch--; + } + } +} + +public static Vector3[] add(Vector3[] a, Vector3 b){ + Vector3[] c = new Vector3[ a.Length ]; + for(i=0; i +* LeanTween.cancel( gameObject ); +*/ +public static void cancel( GameObject gameObject ){ + init(); + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans) + removeTween(i); + } +} + +/** +* Cancel a specific tween with the provided id +* +* @method LeanTween.cancel +* @param {GameObject} gameObject:GameObject gameObject whose tweens you want to cancel +* @param {float} id:float unique id that represents that tween +*/ +public static void cancel( GameObject gameObject, int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" counter:"+backCounter + " setCounter:"+ tweens[backId].counter + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].trans==null || (tweens[backId].trans.gameObject == gameObject && tweens[backId].counter==backCounter)) + removeTween((int)backId); + } +} + +/** +* Cancel a specific tween with the provided id +* +* @method LeanTween.cancel +* @param {LTRect} ltRect:LTRect LTRect object whose tweens you want to cancel +* @param {float} id:float unique id that represents that tween +*/ +public static void cancel( LTRect ltRect, int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].ltRect == ltRect && tweens[backId].counter==backCounter) + removeTween((int)backId); + } +} + +private static void cancel( int uniqueId ){ + if(uniqueId>=0){ + init(); + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + // Debug.Log("uniqueId:"+uniqueId+ " id:"+backId +" action:"+(TweenAction)backType + " tweens[id].type:"+tweens[backId].type); + if(tweens[backId].hasInitiliazed && tweens[backId].counter==backCounter) + removeTween((int)backId); + } +} + +// Deprecated +public static LTDescr description( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + + if(tweens[backId]!=null && tweens[backId].uniqueId == uniqueId && tweens[backId].counter==backCounter) + return tweens[backId]; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].uniqueId == uniqueId && tweens[i].counter==backCounter) + return tweens[i]; + } + return null; +} + +// Deprecated use pause( id ) +public static void pause( GameObject gameObject, int uniqueId ){ + pause( uniqueId ); +} + +public static void pause( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter){ + tweens[backId].pause(); + } +} + +/** +* Pause all tweens for a GameObject +* +* @method LeanTween.pause +* @param {GameObject} gameObject:GameObject GameObject whose tweens you want to pause +*/ +public static void pause( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans){ + tweens[i].pause(); + } + } +} + +// Deprecated +public static void resume( GameObject gameObject, int uniqueId ){ + resume( uniqueId ); +} + +/** +* Resume a specific tween +* +* @method LeanTween.resume +* @param {int} id:int Id of the tween you want to resume ex: int id = LeanTween.MoveX(gameObject, 5, 1.0).id; +*/ +public static void resume( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter){ + tweens[backId].resume(); + } +} + +/** +* Resume all the tweens on a GameObject +* +* @method LeanTween.resume +* @param {GameObject} gameObject:GameObject GameObject whose tweens you want to resume +*/ +public static void resume( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].trans==trans) + tweens[i].resume(); + } +} + +/** +* Test whether or not a tween is active on a GameObject +* +* @method LeanTween.isTweening +* @param {GameObject} gameObject:GameObject GameObject that you want to test if it is tweening +*/ +public static bool isTweening( GameObject gameObject ){ + Transform trans = gameObject.transform; + for(int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].toggle && tweens[i].trans==trans) + return true; + } + return false; +} + +/** +* Test whether or not a tween is active or not +* +* @method LeanTween.isTweening +* @param {GameObject} id:int id of the tween that you want to test if it is tweening +*   Example:
+*   int id = LeanTween.moveX(gameObject, 1f, 3f).id;
+*   if(LeanTween.isTweening( id ))
+*      Debug.Log("I am tweening!");
+*/ +public static bool isTweening( int uniqueId ){ + int backId = uniqueId & 0xFFFF; + int backCounter = uniqueId >> 16; + if(tweens[backId].counter==backCounter && tweens[backId].toggle){ + return true; + } + return false; +} + +/** +* Test whether or not a tween is active on a LTRect +* +* @method LeanTween.isTweening +* @param {LTRect} ltRect:LTRect LTRect that you want to test if it is tweening +*/ +public static bool isTweening( LTRect ltRect ){ + for( int i = 0; i < tweenMaxSearch; i++){ + if(tweens[i].toggle && tweens[i].ltRect==ltRect) + return true; + } + return false; +} + +public static void drawBezierPath(Vector3 a, Vector3 b, Vector3 c, Vector3 d){ + Vector3 last = a; + Vector3 p; + Vector3 aa = (-a + 3*(b-c) + d); + Vector3 bb = 3*(a+c) - 6*b; + Vector3 cc = 3*(b-a); + float t; + for(float k = 1.0f; k <= 30.0f; k++){ + t = k / 30.0f; + p = ((aa* t + (bb))* t + cc)* t + a; + Gizmos.DrawLine(last, p); + last = p; + } +} + +public static object logError( string error ){ + if(throwErrors) Debug.LogError(error); else Debug.Log(error); + return null; +} + +// LeanTween 2.0 Methods + +public static LTDescr options(LTDescr seed){ Debug.LogError("error this function is no longer used"); return null; } +public static LTDescr options(){ + init(); + + for(j=0, i = startSearch; j < maxTweens; i++){ + if(i>=maxTweens-1) + i = 0; + if(tweens[i].toggle==false){ + if(i+1>tweenMaxSearch) + tweenMaxSearch = i+1; + startSearch = i + 1; + break; + } + + j++; + if(j>=maxTweens) + return logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );") as LTDescr; + } + tween = tweens[i]; + tween.reset(); + tween.setId( (uint)i ); + + return tween; +} + +public static GameObject tweenEmpty{ + get{ + init(maxTweens); + return _tweenEmpty; + } +} + +public static int startSearch = 0; +public static LTDescr descr; + +private static LTDescr pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, LTDescr tween ){ + init(maxTweens); + if(gameObject==null) + return null; + tween.trans = gameObject.transform; + tween.to = to; + tween.time = time; + tween.type = tweenAction; + //tween.hasPhysics = gameObject.rigidbody!=null; + + return tween; +} + +/** +* Fade a gameobject's material to a certain alpha value. The material's shader needs to support alpha. Owl labs has some excellent efficient shaders. +* +* @method LeanTween.alpha +* @param {GameObject} gameObject:GameObject Gameobject that you wish to fade +* @param {float} to:float the final alpha value (0-1) +* @param {float} time:float The time with which to fade the object +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* LeanTween.alpha(gameObject, 1f, 1f) .setDelay(1f); +*/ +public static LTDescr alpha(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ALPHA, options() ); +} + +/** +* Fade a GUI Object +* +* @method LeanTween.alpha +* @param {LTRect} ltRect:LTRect LTRect that you wish to fade +* @param {float} to:float the final alpha value (0-1) +* @param {float} time:float The time with which to fade the object +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* LeanTween.alpha(ltRect, 1f, 1f) .setEase(LeanTweenType.easeInCirc); +*/ +public static LTDescr alpha(LTRect ltRect, float to, float time){ + ltRect.alphaEnabled = true; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ALPHA, options().setRect( ltRect ) ); +} + +/** +* This works by tweening the vertex colors directly.
+
+Vertex-based coloring is useful because you avoid making a copy of your +object's material for each instance that needs a different color.
+
+A shader that supports vertex colors is required for it to work +(for example the shaders in Mobile/Particles/) +* +* @method LeanTween.alphaVertex +* @param {GameObject} gameObject:GameObject Gameobject that you wish to alpha +* @param {float} to:float The alpha value you wish to tween to +* @param {float} time:float The time with which to delay before calling the function +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr alphaVertex(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0f,0f), time, TweenAction.ALPHA_VERTEX, options() ); +} + +public static LTDescr delayedCall( float delayTime, Action callback){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( float delayTime, Action callback){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( GameObject gameObject, float delayTime, Action callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr delayedCall( GameObject gameObject, float delayTime, Action callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete(callback) ); +} + +public static LTDescr destroyAfter( LTRect rect, float delayTime){ + return pushNewTween( tweenEmpty, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setRect( rect ).setDestroyOnComplete(true) ); +} + +/*public static LTDescr delayedCall(GameObject gameObject, float delayTime, string callback){ + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, options().setOnComplete( callback ) ); +}*/ + +/** +* Move a GameObject to a certain location +* +* @method LeanTween.move +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {Vector3} vec:Vector3 to The final positin with which to move to +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example LeanTween.move(gameObject, new Vector3(0f,-3f,5f), 2.0f) .setEase( LeanTween.easeOutQuad ); +*/ +public static LTDescr move(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE, options() ); +} +public static LTDescr move(GameObject gameObject, Vector2 to, float time){ + return pushNewTween( gameObject, new Vector3(to.x, to.y, gameObject.transform.position.z), time, TweenAction.MOVE, options() ); +} + + +/** +* Move a GameObject along a set of bezier curves +* +* @method LeanTween.move +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,... +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.move(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);;
+*/ +public static LTDescr move(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + if(descr.path==null) + descr.path = new LTBezierPath( to ); + else + descr.path.setPoints( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED, descr ); +} + +/** +* Move a GameObject through a set of points +* +* @method LeanTween.moveSpline +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.moveSpline(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveSpline(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + descr.spline = new LTSpline( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_SPLINE, descr ); +} + +/** +* Move a GameObject through a set of points, in local space +* +* @method LeanTween.moveSplineLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.moveSpline(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}, 1.5f). setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveSplineLocal(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + descr.spline = new LTSpline( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_SPLINE_LOCAL, descr ); +} + +/** +* Move a GUI Element to a certain location +* +* @method LeanTween.move (GUI) +* @param {LTRect} ltRect:LTRect ltRect LTRect object that you wish to move +* @param {Vector2} vec:Vector2 to The final position with which to move to (pixel coordinates) +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr move(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE, options().setRect( ltRect ) ); +} + +public static LTDescr moveMargin(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE_MARGIN, options().setRect( ltRect ) ); +} + +/** +* Move a GameObject along the x-axis +* +* @method LeanTween.moveX +* @param {GameObject} gameObject:GameObject gameObject Gameobject that you wish to move +* @param {float} to:float to The final position with which to move to +* @param {float} time:float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_X, options() ); +} + +/** +* Move a GameObject along the y-axis +* +* @method LeanTween.moveY +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {float} float to The final position with which to move to +* @param {float} float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Y, options() ); +} + +/** +* Move a GameObject along the z-axis +* +* @method LeanTween.moveZ +* @param {GameObject} GameObject gameObject Gameobject that you wish to move +* @param {float} float to The final position with which to move to +* @param {float} float time The time to complete the move in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Z, options() ); +} + +/** +* Move a GameObject to a certain location relative to the parent transform. +* +* @method LeanTween.moveLocal +* @param {GameObject} GameObject gameObject Gameobject that you wish to rotate +* @param {Vector3} Vector3 to The final positin with which to move to +* @param {float} float time The time to complete the tween in +* @param {Hashtable} Hashtable optional Hashtable where you can pass optional items. +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr moveLocal(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE_LOCAL, options() ); +} + +/** +* Move a GameObject along a set of bezier curves, in local space +* +* @method LeanTween.moveLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to move +* @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,... +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Javascript:
+* LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0).setEase(LeanTween.easeOutQuad).setOrientToPath(true);

+* C#:
+* LeanTween.move(gameObject, new Vector3{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}).setEase(LeanTween.easeOutQuad).setOrientToPath(true);
+*/ +public static LTDescr moveLocal(GameObject gameObject, Vector3[] to, float time){ + descr = options(); + if(descr.path==null) + descr.path = new LTBezierPath( to ); + else + descr.path.setPoints( to ); + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED_LOCAL, descr ); +} + +public static LTDescr moveLocalX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_X, options() ); +} + +public static LTDescr moveLocalY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Y, options() ); +} + +public static LTDescr moveLocalZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Z, options() ); +} + +/** +* Rotate a GameObject, to values are in passed in degrees +* +* @method LeanTween.rotate +* @param {GameObject} GameObject gameObject Gameobject that you wish to rotate +* @param {Vector3} Vector3 to The final rotation with which to rotate to +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example LeanTween.rotate(cube, new Vector3(180f,30f,0f), 1.5f); +*/ + +public static LTDescr rotate(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE, options() ); +} + +/** +* Rotate a GUI element (using an LTRect object), to a value that is in degrees +* +* @method LeanTween.rotate +* @param {LTRect} ltRect:LTRect LTRect that you wish to rotate +* @param {float} to:float The final rotation with which to rotate to +* @param {float} time:float The time to complete the tween in +* @param {Array} optional:Array Object Array where you can pass optional items. +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* if(GUI.Button(buttonRect.rect, "Rotate"))
+* LeanTween.rotate( buttonRect4, 150.0f, 1.0f).setEase(LeanTween.easeOutElastic);
+* GUI.matrix = Matrix4x4.identity;
+*/ +public static LTDescr rotate(LTRect ltRect, float to, float time){ + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ROTATE, options().setRect( ltRect ) ); +} + +/** +* Rotate a GameObject in the objects local space (on the transforms localEulerAngles object) +* +* @method LeanTween.rotateLocal +* @param {GameObject} gameObject:GameObject Gameobject that you wish to rotate +* @param {Vector3} to:Vector3 The final rotation with which to rotate to +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateLocal(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE_LOCAL, options() ); +} + +/** +* Rotate a GameObject only on the X axis +* +* @method LeanTween.rotateX +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final x-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_X, options() ); +} + +/** +* Rotate a GameObject only on the Y axis +* +* @method LeanTween.rotateY +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final y-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Y, options() ); +} + +/** +* Rotate a GameObject only on the Z axis +* +* @method LeanTween.rotateZ +* @param {GameObject} GameObject Gameobject that you wish to rotate +* @param {float} to:float The final z-axis rotation with which to rotate +* @param {float} time:float The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr rotateZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Z, options() ); +} + +/** +* Rotate a GameObject around a certain Axis (the best method to use when you want to rotate beyond 180 degrees) +* +* @method LeanTween.rotateAround +* @param {GameObject} gameObject:GameObject Gameobject that you wish to rotate +* @param {Vector3} vec:Vector3 axis in which to rotate around ex: Vector3.up +* @param {float} degrees:float the degrees in which to rotate +* @param {float} time:float time The time to complete the rotation in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example:
+* LeanTween.rotateAround ( gameObject, Vector3.left, 90f, 1f ); +*/ +public static LTDescr rotateAround(GameObject gameObject, Vector3 axis, float add, float time){ + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, options().setAxis(axis) ); +} + +/** +* Scale a GameObject to a certain size +* +* @method LeanTween.scale +* @param {GameObject} gameObject:GameObject gameObject Gameobject that you wish to scale +* @param {Vector3} vec:Vector3 to The size with which to tween to +* @param {float} time:float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scale(GameObject gameObject, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.SCALE, options() ); +} + +/** +* Scale a GUI Element to a certain width and height +* +* @method LeanTween.scale (GUI) +* @param {LTRect} LTRect ltRect LTRect object that you wish to move +* @param {Vector2} Vector2 to The final width and height to scale to (pixel based) +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example Javascript:
+* var bRect:LTRect = new LTRect( 0, 0, 100, 50 );
+* LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 ).setEase(LeanTweenType.easeOutBounce);
+* function OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*
+* Example C#:
+* LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );
+* LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f ).setEase(LeanTweenType.easeOutBounce);
+* void OnGUI(){
+*   if(GUI.Button(bRect.rect, "Scale")){ }
+* }
+*/ +public static LTDescr scale(LTRect ltRect, Vector2 to, float time){ + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_SCALE, options().setRect( ltRect ) ); +} + +/** +* Scale a GameObject to a certain size along the x-axis only +* +* @method LeanTween.scaleX +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleX(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_X, options() ); +} + +/** +* Scale a GameObject to a certain size along the y-axis only +* +* @method LeanTween.scaleY +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleY(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Y, options() ); +} + +/** +* Scale a GameObject to a certain size along the z-axis only +* +* @method LeanTween.scaleZ +* @param {GameObject} gameObject:GameObject Gameobject that you wish to scale +* @param {float} scaleTo:float the size with which to scale to +* @param {float} time:float the time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr scaleZ(GameObject gameObject, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Z, options()); +} + +/** +* Tween any particular value, it does not need to be tied to any particular type or GameObject +* +* @method LeanTween.value (float) +* @param {GameObject} GameObject gameObject GameObject with which to tie the tweening with. This is only used when you need to cancel this tween, it does not actually perform any operations on this gameObject +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( float val ){ } +* @param {float} float from The original value to start the tween from +* @param {float} float to The value to end the tween on +* @param {float} float time The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +* @example +* Example Javascript:
+* LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
+* function updateValueExampleCallback( val:float ){
+*   Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
+* }
+*
+* Example C#:
+* LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
+* void updateValueExampleCallback( float val ){
+*   Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
+* }
+*/ + +public static LTDescr value(GameObject gameObject, Action callOnUpdate, float from, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, options().setTo( new Vector3(to,0,0) ).setFrom( new Vector3(from,0,0) ).setOnUpdate(callOnUpdate) ); +} + +/** +* Tween any particular value (Vector3), this could be used to tween an arbitrary value like a material color +* +* @method LeanTween.value (Vector3) +* @param {GameObject} gameObject:GameObject Gameobject that you wish to attach the tween to +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val ){ } +* @param {float} from:Vector3 The original value to start the tween from +* @param {Vector3} to:Vector3 The final Vector3 with which to tween to +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr value(GameObject gameObject, Action callOnUpdate, Vector3 from, Vector3 to, float time){ + return pushNewTween( gameObject, to, time, TweenAction.VALUE3, options().setTo( to ).setFrom( from ).setOnUpdateVector3(callOnUpdate) ); +} + +/** +* Tween any particular value (float) +* +* @method LeanTween.value (float,object) +* @param {GameObject} gameObject:GameObject Gameobject that you wish to attach the tween to +* @param {Action} callOnUpdate:Action The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val, object obj ){ } +* @param {float} from:Vector3 The original value to start the tween from +* @param {Vector3} to:Vector3 The final Vector3 with which to tween to +* @param {float} time:float The time to complete the tween in +* @return {LTDescr} LTDescr an object that distinguishes the tween +*/ +public static LTDescr value(GameObject gameObject, Action callOnUpdate, float from, float to, float time){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, options().setTo( new Vector3(to,0,0) ).setFrom( new Vector3(from,0,0) ).setOnUpdateObject(callOnUpdate) ); +} + +public static LTDescr delayedSound( AudioClip audio, Vector3 pos, float volume ){ + return pushNewTween( tweenEmpty, pos, 0f, TweenAction.DELAYED_SOUND, options().setTo( pos ).setFrom( new Vector3(volume,0,0) ).setAudio( audio ) ); +} + +#if !UNITY_METRO +// LeanTween 1.x Methods + +public static Hashtable h( object[] arr ){ + if(arr.Length%2==1){ + logError("LeanTween - You have attempted to create a Hashtable with an odd number of values."); + return null; + } + Hashtable hash = new Hashtable(); + for(i = 0; i < arr.Length; i += 2){ + hash.Add(arr[i] as string, arr[i+1]); + } + + return hash; +} + +private static int idFromUnique( int uniqueId ){ + return uniqueId & 0xFFFF; +} + +private static int pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, Hashtable optional ){ + init(maxTweens); + if(gameObject==null) + return -1; + + j = 0; + for(i = startSearch; j < maxTweens; i++){ + if(i>=maxTweens-1) + i = 0; + if(tweens[i].toggle==false){ + if(i+1>tweenMaxSearch) + tweenMaxSearch = i+1; + startSearch = i + 1; + break; + } + + j++; + if(j>=maxTweens){ + logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );"); + return -1; + } + } + tween = tweens[i]; + tween.toggle = true; + tween.reset(); + tween.trans = gameObject.transform; + tween.to = to; + tween.time = time; + tween.type = tweenAction; + tween.optional = optional; + tween.setId( (uint)i ); + //tween.hasPhysics = gameObject.rigidbody!=null; + + if(optional!=null){ + var ease = optional["ease"]; + //LeanTweenType ease; + var optionsNotUsed = 0; + if(ease!=null) { + tween.tweenType = LeanTweenType.linear; + if( ease.GetType() ==typeof( LeanTweenType) ){ + tween.tweenType = (LeanTweenType)ease;// Enum.Parse(typeof(LeanTweenType), optional["ease"].ToString()); + } else if(ease.GetType() == typeof(AnimationCurve)){ + tween.animationCurve = optional["ease"] as AnimationCurve; + } else{ + string func = optional["ease"].ToString(); + if(func.Equals("easeOutQuad")){ + tween.tweenType = LeanTweenType.easeOutQuad; + }else if(func.Equals("easeInQuad")){ + tween.tweenType = LeanTweenType.easeInQuad; + }else if(func.Equals("easeInOutQuad")){ + tween.tweenType = LeanTweenType.easeInOutQuad; + } + } + optionsNotUsed++; + } + if(optional["rect"]!=null){ + tween.ltRect = (LTRect)optional["rect"]; + optionsNotUsed++; + } + if(optional["path"]!=null){ + tween.path = (LTBezierPath)optional["path"]; + optionsNotUsed++; + } + if(optional["delay"]!=null){ + tween.delay = (float)optional["delay"]; + optionsNotUsed++; + } + if(optional["useEstimatedTime"]!=null){ + tween.useEstimatedTime =(bool) optional["useEstimatedTime"]; + optionsNotUsed++; + } + if(optional["useFrames"]!=null){ + tween.useFrames =(bool) optional["useFrames"]; + optionsNotUsed++; + } + if(optional["loopType"]!=null){ + tween.loopType = (LeanTweenType)optional["loopType"]; + optionsNotUsed++; + } + if(optional["repeat"]!=null){ + tween.loopCount = (int)optional["repeat"]; + if(tween.loopType==LeanTweenType.once) + tween.loopType = LeanTweenType.clamp; + optionsNotUsed++; + } + if(optional["point"]!=null){ + tween.point = (Vector3)optional["point"]; + optionsNotUsed++; + } + if(optional["axis"]!=null){ + tween.axis = (Vector3)optional["axis"]; + optionsNotUsed++; + } + if(optional.Count <= optionsNotUsed) + tween.optional = null; // nothing else is used with the extra piece, so set to null + }else{ + tween.optional = null; + } + //Debug.Log("pushing new tween["+i+"]:"+tweens[i]); + + return tweens[i].uniqueId; +} + +public static int value(string callOnUpdate, float from, float to, float time, Hashtable optional){ + return value( tweenEmpty, callOnUpdate, from, to, time, optional ); +} + +public static int value(GameObject gameObject, string callOnUpdate, float from, float to, float time){ + return value(gameObject, callOnUpdate, from, to, time, new Hashtable()); +} +public static int value(GameObject gameObject, string callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject, Action callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} +public static int value(GameObject gameObject, Action callOnUpdate, float from, float to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject,string callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject,Action callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject,Action callOnUpdate, float from, float to, float time, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.CALLBACK, optional ) ); + tweens[id].from = new Vector3(from,0,0); + return id; +} + +public static int value(GameObject gameObject, String callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, String callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["onUpdate"] = callOnUpdate; + int id = idFromUnique( pushNewTween( gameObject, to, time, TweenAction.VALUE3, optional ) ); + tweens[id].from = from; + return id; +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} +public static int value(GameObject gameObject, System.Action callOnUpdate, Vector3 from, Vector3 to, float time, object[] optional){ + return value(gameObject, callOnUpdate, from, to, time, h(optional)); +} + +public static int rotate(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE, optional ); +} +public static int rotate(GameObject gameObject, Vector3 to, float time, object[] optional){ + return rotate( gameObject, to, time, h( optional ) ); +} + + +public static int rotate(LTRect ltRect, float to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ROTATE, optional ); +} + +public static int rotate(LTRect ltRect, float to, float time, object[] optional){ + return rotate( ltRect, to, time, h(optional) ); +} + +public static int rotateX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_X, optional ); +} + +public static int rotateX(GameObject gameObject, float to, float time, object[] optional){ + return rotateX( gameObject, to, time, h(optional) ); +} + +public static int rotateY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Y, optional ); +} +public static int rotateY(GameObject gameObject, float to, float time, object[] optional){ + return rotateY( gameObject, to, time, h(optional) ); +} + +public static int rotateZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ROTATE_Z, optional ); +} + +public static int rotateZ(GameObject gameObject, float to, float time, object[] optional){ + return rotateZ( gameObject, to, time, h(optional) ); +} + +public static int rotateLocal(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.ROTATE_LOCAL, optional ); +} +public static int rotateLocal(GameObject gameObject, Vector3 to, float time, object[] optional){ + return rotateLocal( gameObject, to, time, h(optional) ); +} + +/*public static int rotateAround(GameObject gameObject, Vector3 point, Vector3 axis, float add, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["axis"] = axis; + if(optional["point"]!=null) + optional["point"] = Vector3.zero; + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, optional ); +}*/ + +public static int rotateAround(GameObject gameObject, Vector3 axis, float add, float time, Hashtable optional){ + if(optional==null || optional.Count==0) + optional = new Hashtable(); + + optional["axis"] = axis; + if(optional["point"]==null) + optional["point"] = Vector3.zero; + + return pushNewTween( gameObject, new Vector3(add,0f,0f), time, TweenAction.ROTATE_AROUND, optional ); +} + +public static int rotateAround(GameObject gameObject, Vector3 axis, float add, float time, object[] optional){ + return rotateAround(gameObject, axis, add, time, h(optional)); +} + +public static int moveX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_X, optional ); +} +public static int moveX(GameObject gameObject, float to, float time, object[] optional){ + return moveX( gameObject, to, time, h(optional) ); +} + +public static int moveY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Y, optional ); +} +public static int moveY(GameObject gameObject, float to, float time, object[] optional){ + return moveY( gameObject, to, time, h(optional) ); +} + +public static int moveZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_Z, optional ); +} +public static int moveZ(GameObject gameObject, float to, float time, object[] optional){ + return moveZ( gameObject, to, time, h(optional) ); +} + +public static int move(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE, optional ); +} + +public static int move(GameObject gameObject, Vector3 to, float time, object[] optional){ + return move( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int move(GameObject gameObject, Vector3[] to, float time, Hashtable optional){ + if(to.Length<4){ + string errorMsg = "LeanTween - When passing values for a vector path, you must pass four or more values!"; + if(throwErrors) Debug.LogError(errorMsg); else Debug.Log(errorMsg); + return -1; + } + if(to.Length%4!=0){ + string errorMsg2 = "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..."; + if(throwErrors) Debug.LogError(errorMsg2); else Debug.Log(errorMsg2); + return -1; + } + + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + LTBezierPath ltPath = new LTBezierPath( to ); + if(optional["orientToPath"]!=null) + ltPath.orientToPath = true; + optional["path"] = ltPath; + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED, optional ); +} +public static int move(GameObject gameObject, Vector3[] to, float time, object[] optional){ + return move( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int move(LTRect ltRect, Vector2 to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_MOVE, optional ); +} +public static int move(LTRect ltRect, Vector3 to, float time, object[] optional){ + return move( ltRect, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocal(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.MOVE_LOCAL, optional ); +} +public static int moveLocal(GameObject gameObject, Vector3 to, float time, object[] optional){ + return moveLocal( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocal(GameObject gameObject, Vector3[] to, float time, Hashtable optional){ + if(to.Length<4){ + string errorMsg = "LeanTween - When passing values for a vector path, you must pass four or more values!"; + if(throwErrors) Debug.LogError(errorMsg); else Debug.Log(errorMsg); + return -1; + } + if(to.Length%4!=0){ + string errorMsg2 = "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..."; + if(throwErrors) Debug.LogError(errorMsg2); else Debug.Log(errorMsg2); + return -1; + } + + init(); + if( optional == null ) + optional = new Hashtable(); + + LTBezierPath ltPath = new LTBezierPath( to ); + if(optional["orientToPath"]!=null) + ltPath.orientToPath = true; + optional["path"] = ltPath; + + return pushNewTween( gameObject, new Vector3(1.0f,0.0f,0.0f), time, TweenAction.MOVE_CURVED_LOCAL, optional ); +} +public static int moveLocal(GameObject gameObject, Vector3[] to, float time,object[] optional){ + return moveLocal( gameObject, to, time, LeanTween.h( optional ) ); +} + +public static int moveLocalX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_X, optional ); +} +public static int moveLocalX(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalX( gameObject, to, time, h(optional) ); +} + +public static int moveLocalY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Y, optional ); +} +public static int moveLocalY(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalY( gameObject, to, time, h(optional) ); +} + +public static int moveLocalZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.MOVE_LOCAL_Z, optional ); +} +public static int moveLocalZ(GameObject gameObject, float to, float time, object[] optional){ + return moveLocalZ( gameObject, to, time, h(optional) ); +} + +public static int scale(GameObject gameObject, Vector3 to, float time, Hashtable optional){ + return pushNewTween( gameObject, to, time, TweenAction.SCALE, optional ); +} +public static int scale(GameObject gameObject, Vector3 to, float time, object[] optional){ + return scale( gameObject, to, time, h(optional) ); +} + +public static int scale(LTRect ltRect,Vector2 to, float time, Hashtable optional) +{ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, to, time, TweenAction.GUI_SCALE, optional ); +} +public static int scale(LTRect ltRect, Vector2 to, float time, object[] optional){ + return scale( ltRect, to, time, h(optional) ); +} + +public static int alpha(LTRect ltRect, float to, float time, Hashtable optional){ + init(); + if( optional==null || optional.Count == 0 ) + optional = new Hashtable(); + + ltRect.alphaEnabled = true; + optional["rect"] = ltRect; + return pushNewTween( tweenEmpty, new Vector3(to,0f,0f), time, TweenAction.GUI_ALPHA, optional ); +} +public static int alpha(LTRect ltRect, float to, float time, object[] optional){ + return alpha( ltRect, to, time, h(optional) ); +} + +public static int scaleX(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_X, optional ); +} +public static int scaleX(GameObject gameObject, float to, float time, object[] optional){ + return scaleX( gameObject, to, time, h(optional) ); +} + +public static int scaleY(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Y, optional ); +} +public static int scaleY(GameObject gameObject, float to, float time, object[] optional){ + return scaleY( gameObject, to, time, h(optional) ); +} + +public static int scaleZ(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.SCALE_Z, optional ); +} +public static int scaleZ(GameObject gameObject, float to, float time, object[] optional){ + return scaleZ( gameObject, to, time, h(optional) ); +} + +public static int delayedCall( float delayTime, string callback, Hashtable optional ){ + init(); + return delayedCall( tweenEmpty, delayTime, callback, optional ); +} +public static int delayedCall( float delayTime, Action callback, object[] optional){ + init(); + return delayedCall( tweenEmpty, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, string callback, object[] optional){ + return delayedCall( gameObject, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, object[] optional){ + return delayedCall( gameObject, delayTime, callback, h(optional) ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, string callback, Hashtable optional){ + if(optional==null || optional.Count == 0) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, Hashtable optional){ + if(optional==null) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int delayedCall( GameObject gameObject, float delayTime, Action callback, Hashtable optional){ + if(optional==null) + optional = new Hashtable(); + optional["onComplete"] = callback; + + return pushNewTween( gameObject, Vector3.zero, delayTime, TweenAction.CALLBACK, optional ); +} + +public static int alpha(GameObject gameObject, float to, float time, Hashtable optional){ + return pushNewTween( gameObject, new Vector3(to,0,0), time, TweenAction.ALPHA, optional ); +} +public static int alpha(GameObject gameObject, float to, float time, object[] optional){ + return alpha(gameObject, to, time, h(optional)); +} +#endif + +// Tweening Functions - Thanks to Robert Penner and GFX47 + +private static float tweenOnCurve( LTDescr tweenDescr, float ratioPassed ){ + // Debug.Log("single ratio:"+ratioPassed+" tweenDescr.animationCurve.Evaluate(ratioPassed):"+tweenDescr.animationCurve.Evaluate(ratioPassed)); + return tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed); +} + +private static Vector3 tweenOnCurveVector( LTDescr tweenDescr, float ratioPassed ){ + return new Vector3(tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed), + tweenDescr.from.y + (tweenDescr.diff.y) * tweenDescr.animationCurve.Evaluate(ratioPassed), + tweenDescr.from.z + (tweenDescr.diff.z) * tweenDescr.animationCurve.Evaluate(ratioPassed) ); +} + +private static float easeOutQuadOpt( float start, float diff, float ratioPassed ){ + return -diff * ratioPassed * (ratioPassed - 2) + start; +} + +private static float easeInQuadOpt( float start, float diff, float ratioPassed ){ + return diff * ratioPassed * ratioPassed + start; +} + +private static float easeInOutQuadOpt( float start, float diff, float ratioPassed ){ + ratioPassed /= .5f; + if (ratioPassed < 1) return diff / 2 * ratioPassed * ratioPassed + start; + ratioPassed--; + return -diff / 2 * (ratioPassed * (ratioPassed - 2) - 1) + start; +} + +private static float linear(float start, float end, float val){ + return Mathf.Lerp(start, end, val); +} + +private static float clerp(float start, float end, float val){ + float min = 0.0f; + float max = 360.0f; + float half = Mathf.Abs((max - min) / 2.0f); + float retval = 0.0f; + float diff = 0.0f; + if ((end - start) < -half){ + diff = ((max - start) + end) * val; + retval = start + diff; + }else if ((end - start) > half){ + diff = -((max - end) + start) * val; + retval = start + diff; + }else retval = start + (end - start) * val; + return retval; +} + +private static float spring(float start, float end, float val){ + val = Mathf.Clamp01(val); + val = (Mathf.Sin(val * Mathf.PI * (0.2f + 2.5f * val * val * val)) * Mathf.Pow(1f - val, 2.2f) + val) * (1f + (1.2f * (1f - val))); + return start + (end - start) * val; +} + +private static float easeInQuad(float start, float end, float val){ + end -= start; + return end * val * val + start; +} + +private static float easeOutQuad(float start, float end, float val){ + end -= start; + return -end * val * (val - 2) + start; +} + +private static float easeInOutQuad(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val + start; + val--; + return -end / 2 * (val * (val - 2) - 1) + start; +} + +private static float easeInCubic(float start, float end, float val){ + end -= start; + return end * val * val * val + start; +} + +private static float easeOutCubic(float start, float end, float val){ + val--; + end -= start; + return end * (val * val * val + 1) + start; +} + +private static float easeInOutCubic(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val + start; + val -= 2; + return end / 2 * (val * val * val + 2) + start; +} + +private static float easeInQuart(float start, float end, float val){ + end -= start; + return end * val * val * val * val + start; +} + +private static float easeOutQuart(float start, float end, float val){ + val--; + end -= start; + return -end * (val * val * val * val - 1) + start; +} + +private static float easeInOutQuart(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val * val + start; + val -= 2; + return -end / 2 * (val * val * val * val - 2) + start; +} + +private static float easeInQuint(float start, float end, float val){ + end -= start; + return end * val * val * val * val * val + start; +} + +private static float easeOutQuint(float start, float end, float val){ + val--; + end -= start; + return end * (val * val * val * val * val + 1) + start; +} + +private static float easeInOutQuint(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * val * val * val * val * val + start; + val -= 2; + return end / 2 * (val * val * val * val * val + 2) + start; +} + +private static float easeInSine(float start, float end, float val){ + end -= start; + return -end * Mathf.Cos(val / 1 * (Mathf.PI / 2)) + end + start; +} + +private static float easeOutSine(float start, float end, float val){ + end -= start; + return end * Mathf.Sin(val / 1 * (Mathf.PI / 2)) + start; +} + +private static float easeInOutSine(float start, float end, float val){ + end -= start; + return -end / 2 * (Mathf.Cos(Mathf.PI * val / 1) - 1) + start; +} + +private static float easeInExpo(float start, float end, float val){ + end -= start; + return end * Mathf.Pow(2, 10 * (val / 1 - 1)) + start; +} + +private static float easeOutExpo(float start, float end, float val){ + end -= start; + return end * (-Mathf.Pow(2, -10 * val / 1) + 1) + start; +} + +private static float easeInOutExpo(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return end / 2 * Mathf.Pow(2, 10 * (val - 1)) + start; + val--; + return end / 2 * (-Mathf.Pow(2, -10 * val) + 2) + start; +} + +private static float easeInCirc(float start, float end, float val){ + end -= start; + return -end * (Mathf.Sqrt(1 - val * val) - 1) + start; +} + +private static float easeOutCirc(float start, float end, float val){ + val--; + end -= start; + return end * Mathf.Sqrt(1 - val * val) + start; +} + +private static float easeInOutCirc(float start, float end, float val){ + val /= .5f; + end -= start; + if (val < 1) return -end / 2 * (Mathf.Sqrt(1 - val * val) - 1) + start; + val -= 2; + return end / 2 * (Mathf.Sqrt(1 - val * val) + 1) + start; +} + +/* GFX47 MOD START */ +private static float easeInBounce(float start, float end, float val){ + end -= start; + float d = 1f; + return end - easeOutBounce(0, end, d-val) + start; +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +//public static function bounce(float start, float end, float val){ +private static float easeOutBounce(float start, float end, float val){ + val /= 1f; + end -= start; + if (val < (1 / 2.75f)){ + return end * (7.5625f * val * val) + start; + }else if (val < (2 / 2.75f)){ + val -= (1.5f / 2.75f); + return end * (7.5625f * (val) * val + .75f) + start; + }else if (val < (2.5 / 2.75)){ + val -= (2.25f / 2.75f); + return end * (7.5625f * (val) * val + .9375f) + start; + }else{ + val -= (2.625f / 2.75f); + return end * (7.5625f * (val) * val + .984375f) + start; + } +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +private static float easeInOutBounce(float start, float end, float val){ + end -= start; + float d= 1f; + if (val < d/2) return easeInBounce(0, end, val*2) * 0.5f + start; + else return easeOutBounce(0, end, val*2-d) * 0.5f + end*0.5f + start; +} +/* GFX47 MOD END */ + +private static float easeInBack(float start, float end, float val){ + end -= start; + val /= 1; + float s= 1.70158f; + return end * (val) * val * ((s + 1) * val - s) + start; +} + +private static float easeOutBack(float start, float end, float val){ + float s= 1.70158f; + end -= start; + val = (val / 1) - 1; + return end * ((val) * val * ((s + 1) * val + s) + 1) + start; +} + +private static float easeInOutBack(float start, float end, float val){ + float s= 1.70158f; + end -= start; + val /= .5f; + if ((val) < 1){ + s *= (1.525f); + return end / 2 * (val * val * (((s) + 1) * val - s)) + start; + } + val -= 2; + s *= (1.525f); + return end / 2 * ((val) * val * (((s) + 1) * val + s) + 2) + start; +} + +/* GFX47 MOD START */ +private static float easeInElastic(float start, float end, float val){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s= 0; + float a = 0; + + if (val == 0) return start; + val = val/d; + if (val == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + val = val-1; + return -(a * Mathf.Pow(2, 10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p)) + start; +} +/* GFX47 MOD END */ + +/* GFX47 MOD START */ +//public static function elastic(float start, float end, float val){ +private static float easeOutElastic(float start, float end, float val){ +/* GFX47 MOD END */ + //Thank you to rafael.marteleto for fixing this as a port over from Pedro's UnityTween + end -= start; + + float d = 1f; + float p= d * .3f; + float s= 0; + float a= 0; + + if (val == 0) return start; + + val = val / d; + if (val == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return (a * Mathf.Pow(2, -10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p) + end + start); +} + +/* GFX47 MOD START */ +private static float easeInOutElastic(float start, float end, float val) +{ + end -= start; + + float d = 1f; + float p= d * .3f; + float s= 0; + float a = 0; + + if (val == 0) return start; + + val = val / (d/2); + if (val == 2) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + if (val < 1){ + val = val-1; + return -0.5f * (a * Mathf.Pow(2, 10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p)) + start; + } + val = val-1; + return a * Mathf.Pow(2, -10 * val) * Mathf.Sin((val * d - s) * (2 * Mathf.PI) / p) * 0.5f + end + start; +} + +// LeanTween Listening/Dispatch + +private static System.Action[] eventListeners; +private static GameObject[] goListeners; +private static int eventsMaxSearch = 0; +public static int EVENTS_MAX = 10; +public static int LISTENERS_MAX = 10; + +public static void addListener( int eventId, System.Action callback ){ + addListener(tweenEmpty, eventId, callback); +} + +/** +* Add a listener method to be called when the appropriate LeanTween.dispatchEvent is called +* @method LeanTween.addListener +* @param {GameObject} caller:GameObject the gameObject the listener is attached to +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {System.Action} callback:System.Action the method to call when the event has been dispatched +* @example +* LeanTween.addListener(gameObject, (int)MyEvents.JUMP, jumpUp);
+*
+* void jumpUp( LTEvent e ){ Debug.Log("jump!"); }
+*/ +public static void addListener( GameObject caller, int eventId, System.Action callback ){ + if(eventListeners==null){ + eventListeners = new System.Action[ EVENTS_MAX * LISTENERS_MAX ]; + goListeners = new GameObject[ EVENTS_MAX * LISTENERS_MAX ]; + } + // Debug.Log("searching for an empty space for:"+caller + " eventid:"+event); + for(i = 0; i < LISTENERS_MAX; i++){ + int point = eventId*LISTENERS_MAX + i; + if(goListeners[ point ]==null || eventListeners[ point ]==null){ + eventListeners[ point ] = callback; + goListeners[ point ] = caller; + if(i>=eventsMaxSearch) + eventsMaxSearch = i+1; + // Debug.Log("adding event for:"+caller.name); + + return; + } + if(goListeners[ point ] == caller && System.Object.ReferenceEquals( eventListeners[ point ], callback)){ + // Debug.Log("This event is already being listened for."); + return; + } + } + Debug.LogError("You ran out of areas to add listeners, consider increasing LISTENERS_MAX, ex: LeanTween.LISTENERS_MAX = "+(LISTENERS_MAX*2)); +} + +public static bool removeListener( int eventId, System.Action callback ){ + return removeListener( tweenEmpty, eventId, callback); +} + +/** +* Remove an event listener you have added +* @method LeanTween.removeListener +* @param {GameObject} caller:GameObject the gameObject the listener is attached to +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {System.Action} callback:System.Action the method that was specified to call when the event has been dispatched +* @example +* LeanTween.removeListener(gameObject, (int)MyEvents.JUMP, jumpUp);
+*
+* void jumpUp( LTEvent e ){ }
+*/ +public static bool removeListener( GameObject caller, int eventId, System.Action callback ){ + for(i = 0; i < eventsMaxSearch; i++){ + int point = eventId*LISTENERS_MAX + i; + if(goListeners[ point ] == caller && System.Object.ReferenceEquals( eventListeners[ point ], callback) ){ + eventListeners[ point ] = null; + goListeners[ point ] = null; + return true; + } + } + return false; +} + +/** +* Tell the added listeners that you are dispatching the event +* @method LeanTween.dispatchEvent +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @example +* LeanTween.dispatchEvent( (int)MyEvents.JUMP );
+*/ +public static void dispatchEvent( int eventId ){ + dispatchEvent( eventId, null); +} + +/** +* Tell the added listeners that you are dispatching the event +* @method LeanTween.dispatchEvent +* @param {int} eventId:int a unique int that describes the event (best to use an enum) +* @param {object} data:object Pass data to the listener, access it from the listener with *.data on the LTEvent object +* @example +* LeanTween.dispatchEvent( (int)MyEvents.JUMP, transform );
+*
+* void jumpUp( LTEvent e ){
+*   Transform tran = (Transform)e.data;
+* }
+*/ +public static void dispatchEvent( int eventId, object data ){ + for(int k = 0; k < eventsMaxSearch; k++){ + int point = eventId*LISTENERS_MAX + k; + if(eventListeners[ point ]!=null){ + if(goListeners[point]){ + eventListeners[ point ]( new LTEvent(eventId, data) ); + }else{ + eventListeners[ point ] = null; + } + } + } +} + +} + +/** +* Object that describes the event to an event listener +* @class LTEvent +* @constructor +* @param {object} data:object Data that has been passed from the dispatchEvent method +*/ +public class LTEvent{ + public int id; + public object data; + + public LTEvent(int id, object data){ + this.id = id; + this.data = data; + } +} + +public class LTGUI{ + public static int RECT_LEVELS = 5; + public static int RECTS_PER_LEVEL = 10; + public static int BUTTONS_MAX = 24; + + private static LTRect[] levels; + private static int[] levelDepths; + private static Rect[] buttons; + private static int[] buttonLevels; + private static int[] buttonLastFrame; + private static LTRect r; + private static Color color = Color.white; + private static bool isGUIEnabled = false; + private static int global_counter = 0; + + public enum Element_Type{ + Texture, + Label + } + + public static void init(){ + if(levels==null){ + levels = new LTRect[RECT_LEVELS*RECTS_PER_LEVEL]; + levelDepths = new int[RECT_LEVELS]; + } + } + + public static void initRectCheck(){ + if(buttons==null){ + buttons = new Rect[BUTTONS_MAX]; + buttonLevels = new int[BUTTONS_MAX]; + buttonLastFrame = new int[BUTTONS_MAX]; + for(int i = 0; i < buttonLevels.Length; i++){ + buttonLevels[i] = -1; + } + } + } + + public static void reset(){ + if(isGUIEnabled){ + isGUIEnabled = false; + for(int i = 0; i < levels.Length; i++){ + levels[i] = null; + } + + for(int i = 0; i < levelDepths.Length; i++){ + levelDepths[i] = 0; + } + } + } + + public static void update( int updateLevel ){ + if(isGUIEnabled){ + init(); + if(levelDepths[updateLevel]>0){ + color = GUI.color; + int baseI = updateLevel*RECTS_PER_LEVEL; + int maxLoop = baseI + levelDepths[updateLevel];// RECTS_PER_LEVEL;//; + + for(int i = baseI; i < maxLoop; i++){ + r = levels[i]; + // Debug.Log("r:"+r+" i:"+i); + if(r!=null /*&& checkOnScreen(r.rect)*/){ + //Debug.Log("label:"+r.labelStr+" textColor:"+r.style.normal.textColor); + if(r.useColor) + GUI.color = r.color; + if(r.type == Element_Type.Label){ + if(r.style!=null) + GUI.skin.label = r.style; + if(r.useSimpleScale){ + GUI.Label( new Rect((r.rect.x + r.margin.x + r.relativeRect.x)*r.relativeRect.width, (r.rect.y + r.margin.y + r.relativeRect.y)*r.relativeRect.height, r.rect.width*r.relativeRect.width, r.rect.height*r.relativeRect.height), r.labelStr ); + }else{ + GUI.Label( new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, r.rect.width, r.rect.height), r.labelStr ); + } + }else if(r.type == Element_Type.Texture && r.texture!=null){ + Vector2 size = r.useSimpleScale ? new Vector2(0f, r.rect.height*r.relativeRect.height) : new Vector2(r.rect.width, r.rect.height); + if(r.sizeByHeight){ + size.x = (float)r.texture.width/(float)r.texture.height * size.y; + } + if(r.useSimpleScale){ + GUI.DrawTexture( new Rect((r.rect.x + r.margin.x + r.relativeRect.x)*r.relativeRect.width, (r.rect.y + r.margin.y + r.relativeRect.y)*r.relativeRect.height, size.x, size.y), r.texture ); + }else{ + GUI.DrawTexture( new Rect(r.rect.x + r.margin.x, r.rect.y + r.margin.y, size.x, size.y), r.texture ); + } + } + } + } + GUI.color = color; + } + } + } + + public static bool checkOnScreen(Rect rect){ + bool offLeft = rect.x + rect.width < 0f; + bool offRight = rect.x > Screen.width; + bool offBottom = rect.y > Screen.height; + bool offTop = rect.y + rect.height < 0f; + + return !(offLeft || offRight || offBottom || offTop); + } + + public static void destroy( int id ){ + int backId = id & 0xFFFF; + int backCounter = id >> 16; + if(id>=0 && levels[backId]!=null && levels[backId].hasInitiliazed && levels[backId].counter==backCounter) + levels[backId] = null; + } + + public static LTRect label( Rect rect, string label, int depth){ + return LTGUI.label(new LTRect(rect), label, depth); + } + + public static LTRect label( LTRect rect, string label, int depth){ + rect.type = Element_Type.Label; + rect.labelStr = label; + return element(rect, depth); + } + + public static LTRect texture( Rect rect, Texture texture, int depth){ + return LTGUI.texture( new LTRect(rect), texture, depth); + } + + public static LTRect texture( LTRect rect, Texture texture, int depth){ + rect.type = Element_Type.Texture; + rect.texture = texture; + return element(rect, depth); + } + + public static LTRect element( LTRect rect, int depth){ + isGUIEnabled = true; + init(); + int maxLoop = depth*RECTS_PER_LEVEL + RECTS_PER_LEVEL; + int k = 0; + if(rect!=null){ + destroy(rect.id); + } + if(rect.type==LTGUI.Element_Type.Label && rect.style!=null){ + if(rect.style.normal.textColor.a<=0f){ + Debug.LogWarning("Your GUI normal color has an alpha of zero, and will not be rendered."); + } + } + if(rect.relativeRect.width==float.PositiveInfinity){ + rect.relativeRect = new Rect(0f,0f,Screen.width,Screen.height); + } + for(int i = depth*RECTS_PER_LEVEL; i < maxLoop; i++){ + r = levels[i]; + if(r==null){ + r = rect; + r.rotateEnabled = true; + r.alphaEnabled = true; + r.setId( i, global_counter ); + levels[i] = r; + // Debug.Log("k:"+k+ " maxDepth:"+levelDepths[depth]); + if(k>=levelDepths[depth]){ + levelDepths[depth] = k + 1; + } + global_counter++; + return r; + } + k++; + } + + Debug.LogError("You ran out of GUI Element spaces"); + + return null; + } + + public static bool hasNoOverlap( Rect rect, int depth ){ + initRectCheck(); + bool hasNoOverlap = true; + bool wasAddedToList = false; + for(int i = 0; i < buttonLevels.Length; i++){ + // Debug.Log("buttonLastFrame["+i+"]:"+buttonLastFrame[i]); + //Debug.Log("buttonLevels["+i+"]:"+buttonLevels[i]); + if(buttonLevels[i]>=0){ + //Debug.Log("buttonLastFrame["+i+"]:"+buttonLastFrame[i]+" Time.frameCount:"+Time.frameCount); + if( buttonLastFrame[i] + 1 < Time.frameCount ){ // It has to have been visible within the current, or + buttonLevels[i] = -1; + // Debug.Log("resetting i:"+i); + }else{ + //if(buttonLevels[i]>=0) + // Debug.Log("buttonLevels["+i+"]:"+buttonLevels[i]); + if(buttonLevels[i]>depth){ + /*if(firstTouch().x > 0){ + Debug.Log("buttons["+i+"]:"+buttons[i] + " firstTouch:"); + Debug.Log(firstTouch()); + Debug.Log(buttonLevels[i]); + }*/ + if(pressedWithinRect( buttons[i] )){ + hasNoOverlap = false; // there is an overlapping button that is higher + } + } + } + } + + if(wasAddedToList==false && buttonLevels[i]<0){ + wasAddedToList = true; + buttonLevels[i] = depth; + buttons[i] = rect; + buttonLastFrame[i] = Time.frameCount; + } + } + + return hasNoOverlap; + } + + public static bool pressedWithinRect( Rect rect ){ + Vector2 vec2 = firstTouch(); + if(vec2.x<0f) + return false; + float vecY = Screen.height-vec2.y; + return (vec2.x > rect.x && vec2.x < rect.x + rect.width && vecY > rect.y && vecY < rect.y + rect.height); + } + + public static bool checkWithinRect(Vector2 vec2, Rect rect){ + vec2.y = Screen.height-vec2.y; + return (vec2.x > rect.x && vec2.x < rect.x + rect.width && vec2.y > rect.y && vec2.y < rect.y + rect.height); + } + + public static Vector2 firstTouch(){ + if(Input.touchCount>0){ + return Input.touches[0].position; + }else if(Input.GetMouseButton(0)){ + return Input.mousePosition; + } + + return new Vector2(Mathf.NegativeInfinity,Mathf.NegativeInfinity); + } + +} diff --git a/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs.meta b/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs.meta new file mode 100644 index 0000000..13d23f8 --- /dev/null +++ b/UnityTests.Unity5/Assets/LeanTween/Plugins/LeanTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c2f4b27196f84954b44753aaac214bb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins.meta b/UnityTests.Unity5/Assets/Plugins.meta new file mode 100644 index 0000000..2b41241 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c3dc57e0651866248b11147918501490 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit.meta b/UnityTests.Unity5/Assets/Plugins/GoKit.meta new file mode 100644 index 0000000..b67bec1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8c5cefa129e0c4945acf6eb49a983eae +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs new file mode 100644 index 0000000..b5bbf23 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs @@ -0,0 +1,406 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class Go : MonoBehaviour +{ + // defaults used for all tweens/properties that are not explicitly set + public static GoEaseType defaultEaseType = GoEaseType.Linear; + public static GoLoopType defaultLoopType = GoLoopType.RestartFromBeginning; + public static GoUpdateType defaultUpdateType = GoUpdateType.Update; + + // defines what we should do in the event that a TweenProperty is added and an already existing tween has the same + // property and target + public static GoDuplicatePropertyRuleType duplicatePropertyRule = GoDuplicatePropertyRuleType.None; + public static GoLogLevel logLevel = GoLogLevel.Warn; + + // validates that the target object still exists each tick of the tween. NOTE: it is recommended + // that you just properly remove your tweens before destroying any objects even though this might destroy them for you + public static bool validateTargetObjectsEachTick = true; + + // Used to stop instances being created while the application is quitting + private static bool _applicationIsQuitting = false; + + private static List _tweens = new List(); // contains Tweens, TweenChains and TweenFlows + private bool _timeScaleIndependentUpdateIsRunning; + + // only one Go can exist + static Go _instance = null; + public static Go instance + { + get + { + // Don't allow new instances to be created when the application is quitting to avoid the GOKit object never being destroyed. + // These dangling instances can't be found with FindObjectOfType and so you'd get multiple instances in a scene. + if( !_instance && !_applicationIsQuitting ) + { + // check if there is a GO instance already available in the scene graph + _instance = FindObjectOfType( typeof( Go ) ) as Go; + + // possible Unity bug with FindObjectOfType workaround + //_instance = FindObjectOfType( typeof( Go ) ) ?? GameObject.Find( "GoKit" ).GetComponent() as Go; + + // nope, create a new one + if( !_instance ) + { + var obj = new GameObject( "GoKit" ); + _instance = obj.AddComponent(); + DontDestroyOnLoad( obj ); + } + } + + return _instance; + } + } + + + /// + /// loops through all the Tweens and updates any that are of updateType. If any Tweens are complete + /// (the update call will return true) they are removed. + /// + private void handleUpdateOfType( GoUpdateType updateType, float deltaTime ) + { + // loop backwards so we can remove completed tweens + for( var i = _tweens.Count - 1; i >= 0; --i ) + { + var t = _tweens[i]; + + if( t.state == GoTweenState.Destroyed ) + { + // destroy method has been called + removeTween( t ); + } + else + { + // only process tweens with our update type that are running + if( t.updateType == updateType && t.state == GoTweenState.Running && t.update( deltaTime * t.timeScale ) ) + { + // tween is complete if we get here. if destroyed or set to auto remove kill it + if( t.state == GoTweenState.Destroyed || t.autoRemoveOnComplete ) + { + removeTween( t ); + t.destroy(); + } + } + } + } + } + + + #region Monobehaviour + + private void Update() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.Update, Time.deltaTime ); + } + + + private void LateUpdate() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.LateUpdate, Time.deltaTime ); + } + + + private void FixedUpdate() + { + if( _tweens.Count == 0 ) + return; + + handleUpdateOfType( GoUpdateType.FixedUpdate, Time.deltaTime ); + } + + + private void OnApplicationQuit() + { + _instance = null; + Destroy( gameObject ); + _applicationIsQuitting = true; + } + + #endregion + + + /// + /// this only runs as needed and handles time scale independent Tweens + /// + private IEnumerator timeScaleIndependentUpdate() + { + _timeScaleIndependentUpdateIsRunning = true; + var time = Time.realtimeSinceStartup; + + while( _tweens.Count > 0 ) + { + var elapsed = Time.realtimeSinceStartup - time; + time = Time.realtimeSinceStartup; + + // update tweens + handleUpdateOfType( GoUpdateType.TimeScaleIndependentUpdate, elapsed ); + + yield return null; + } + + _timeScaleIndependentUpdateIsRunning = false; + } + + + /// + /// checks for duplicate properties. if one is found and the DuplicatePropertyRuleType is set to + /// DontAddCurrentProperty it will return true indicating that the tween should not be added. + /// this only checks tweens that are not part of an AbstractTweenCollection + /// + private static bool handleDuplicatePropertiesInTween( GoTween tween ) + { + // first fetch all the current tweens with the same target object as this one + var allTweensWithTarget = tweensWithTarget( tween.target ); + + // store a list of all the properties in the tween + var allProperties = tween.allTweenProperties(); + + // TODO: perhaps only perform the check on running Tweens? + + // loop through all the tweens with the same target + foreach( var tweenWithTarget in allTweensWithTarget ) + { + // loop through all the properties in the tween and see if there are any dupes + foreach( var tweenProp in allProperties ) + { + warn( "found duplicate TweenProperty {0} in tween {1}", tweenProp, tween ); + + // check for a matched property + if( tweenWithTarget.containsTweenProperty( tweenProp ) ) + { + // handle the different duplicate property rules + if( duplicatePropertyRule == GoDuplicatePropertyRuleType.DontAddCurrentProperty ) + { + return true; + } + else if( duplicatePropertyRule == GoDuplicatePropertyRuleType.RemoveRunningProperty ) + { + // TODO: perhaps check if the Tween has any properties left and remove it if it doesnt? + tweenWithTarget.removeTweenProperty( tweenProp ); + } + + return false; + } + } + } + + return false; + } + + + #region Logging + + /// + /// logging should only occur in the editor so we use a conditional + /// + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + private static void log( object format, params object[] paramList ) + { + if( format is string ) + Debug.Log( string.Format( format as string, paramList ) ); + else + Debug.Log( format ); + } + + + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + public static void warn( object format, params object[] paramList ) + { + if( logLevel == GoLogLevel.None || logLevel == GoLogLevel.Info ) + return; + + if( format is string ) + Debug.LogWarning( string.Format( format as string, paramList ) ); + else + Debug.LogWarning( format ); + } + + + [System.Diagnostics.Conditional( "UNITY_EDITOR" )] + public static void error( object format, params object[] paramList ) + { + if( logLevel == GoLogLevel.None || logLevel == GoLogLevel.Info || logLevel == GoLogLevel.Warn ) + return; + + if( format is string ) + Debug.LogError( string.Format( format as string, paramList ) ); + else + Debug.LogError( format ); + } + + #endregion + + + #region public API + + /// + /// helper function that creates a "to" Tween and adds it to the pool + /// + public static GoTween to( object target, float duration, GoTweenConfig config ) + { + config.setIsTo(); + var tween = new GoTween( target, duration, config ); + addTween( tween ); + + return tween; + } + + + /// + /// helper function that creates a "from" Tween and adds it to the pool + /// + public static GoTween from( object target, float duration, GoTweenConfig config ) + { + config.setIsFrom(); + var tween = new GoTween( target, duration, config ); + addTween( tween ); + + return tween; + } + + + /// + /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens + /// + public static void addTween( AbstractGoTween tween ) + { + // early out for invalid items + if( !tween.isValid() ) + return; + + // dont add the same tween twice + if( _tweens.Contains( tween ) ) + return; + + // check for dupes and handle them before adding the tween. we only need to check for Tweens + if( duplicatePropertyRule != GoDuplicatePropertyRuleType.None && tween is GoTween ) + { + // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween + if( handleDuplicatePropertiesInTween( tween as GoTween ) ) + return; + + // if we became invalid after handling dupes dont add the tween + if( !tween.isValid() ) + return; + } + + _tweens.Add( tween ); + + // enable ourself if we are not enabled + if( !instance.enabled ) // purposely using the static instace property just once for initialization + _instance.enabled = true; + + // if the Tween isn't paused and it is a "from" tween jump directly to the start position + if( tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused ) + tween.update( 0 ); + + // should we start up the time scale independent update? + if( !_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate ) + _instance.StartCoroutine( _instance.timeScaleIndependentUpdate() ); + +#if UNITY_EDITOR + _instance.gameObject.name = string.Format( "GoKit ({0} tweens)", _tweens.Count ); +#endif + } + + + /// + /// removes the Tween returning true if it was removed or false if it was not found + /// + public static bool removeTween( AbstractGoTween tween ) + { + if( _tweens.Contains( tween ) ) + { + _tweens.Remove( tween ); + +#if UNITY_EDITOR + if( _instance != null && _tweens != null ) + _instance.gameObject.name = string.Format( "GoKit ({0} tweens)", _tweens.Count ); +#endif + + if( _instance != null && _tweens.Count == 0 ) + { + // disable ourself if we have no more tweens + _instance.enabled = false; + } + + return true; + } + + return false; + } + + + /// + /// returns a list of all Tweens, TweenChains and TweenFlows with the given id + /// + public static List tweensWithId( int id ) + { + List list = null; + + foreach( var tween in _tweens ) + { + if( tween.id == id ) + { + if( list == null ) + list = new List(); + list.Add( tween ); + } + } + + return list; + } + + + /// + /// returns a list of all Tweens with the given target. TweenChains and TweenFlows can optionally + /// be traversed and matching Tweens returned as well. + /// + public static List tweensWithTarget( object target, bool traverseCollections = false ) + { + List list = new List(); + + foreach( var item in _tweens ) + { + // we always check Tweens so handle them first + var tween = item as GoTween; + if( tween != null && tween.target == target ) + list.Add( tween ); + + // optionally check TweenChains and TweenFlows. if tween is null we have a collection + if( traverseCollections && tween == null ) + { + var tweenCollection = item as AbstractGoTweenCollection; + if( tweenCollection != null ) + { + var tweensInCollection = tweenCollection.tweensWithTarget( target ); + if( tweensInCollection.Count > 0 ) + list.AddRange( tweensInCollection ); + } + } + } + + return list; + } + + + /// + /// kills all tweens with the given target by calling the destroy method on each one + /// + public static void killAllTweensWithTarget( object target ) + { + foreach( var tween in tweensWithTarget( target, true ) ) + tween.destroy(); + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs.meta new file mode 100644 index 0000000..16082f3 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/Go.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aabcf1780fb4540bbb12fde714c3f88a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs new file mode 100644 index 0000000..8302a6b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// place this script on any GameObject to enable route editing. note that it is not required at runtime! it is +/// only required to be in your scene while editing a path +/// +public class GoDummyPath : MonoBehaviour +{ + public string pathName = string.Empty; + public Color pathColor = Color.magenta; // color of the path if visible in the editor + public List nodes = new List() { Vector3.zero, Vector3.zero }; + public bool useStandardHandles = false; + public bool forceStraightLinePath = false; + public int pathResolution = 50; + + + public void OnDrawGizmos() + { + // the editor will draw paths when force straight line is on + if( !forceStraightLinePath ) + { + var spline = new GoSpline( nodes ); + Gizmos.color = pathColor; + spline.drawGizmos( pathResolution ); + } + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs.meta new file mode 100644 index 0000000..60af7e7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoDummyPath.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25af92ea012eb4667a9c36cc4a72a725 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs new file mode 100644 index 0000000..c456d14 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs @@ -0,0 +1,341 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTween : AbstractGoTween +{ + // Tween specific properties + public object target { get; private set; } // the target of the tweens + public float delay { get; private set; } // delay before starting the actual animations + private float _elapsedDelay; // total time delayed + private bool _delayComplete; // once we complete the delay this gets set so we can reverse and play properly for the future + public bool isFrom { get; private set; } // a value of true will make this a "from" tween + + private List _tweenPropertyList = new List(); + private string targetTypeString; + + /// + /// sets the ease type for all Tweens. this will overwrite the ease types for each Tween! + /// + private GoEaseType _easeType; + public GoEaseType easeType + { + get + { + return _easeType; + } + set + { + _easeType = value; + + // change ease type of all existing tweens. + foreach( var tween in _tweenPropertyList ) + tween.setEaseType( value ); + } + } + + + /// + /// initializes a new instance and sets up the details according to the config parameter + /// + public GoTween( object target, float duration, GoTweenConfig config, Action onComplete = null ) + { + // default to removing on complete + autoRemoveOnComplete = true; + + // allow events by default + allowEvents = true; + + // setup callback bools + _didInit = false; + _didBegin = false; + + // flag the onIterationStart event to fire. + // as long as goTo is not called on this tween, the onIterationStart event will fire + // as soon as the delay, if any, is completed. + _fireIterationStart = true; + + this.target = target; + this.targetTypeString = target.GetType().ToString(); + this.duration = duration; + + // copy the TweenConfig info over + id = config.id; + delay = config.delay; + loopType = config.loopType; + iterations = config.iterations; + _easeType = config.easeType; + updateType = config.propertyUpdateType; + isFrom = config.isFrom; + timeScale = config.timeScale; + + _onInit = config.onInitHandler; + _onBegin = config.onBeginHandler; + _onIterationStart = config.onIterationStartHandler; + _onUpdate = config.onUpdateHandler; + _onIterationEnd = config.onIterationEndHandler; + _onComplete = config.onCompleteHandler; + + if( config.isPaused ) + state = GoTweenState.Paused; + + // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be + // set and maintain clean code (Actions always try to be the last param of a method) + if( onComplete != null ) + _onComplete = onComplete; + + // add all our properties + for( var i = 0; i < config.tweenProperties.Count; ++i ) + { + var tweenProp = config.tweenProperties[i]; + + // if the tween property is initialized already it means it is being reused so we need to clone it + if( tweenProp.isInitialized ) + tweenProp = tweenProp.clone(); + + addTweenProperty( tweenProp ); + } + + // calculate total duration + if( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = iterations * duration; + } + + /// + /// tick method. if it returns true it indicates the tween is complete + /// + public override bool update( float deltaTime ) + { + // properties are prepared only once on the first update of the tween. + if ( !_didInit ) + onInit(); + + // should we validate the target? + if( Go.validateTargetObjectsEachTick ) + { + // This might seem to be overkill, but on the case of Transforms that + // have been destroyed, target == null will return false, whereas + // target.Equals(null) will return true. Otherwise we don't really + // get the benefits of the nanny. + if( target == null || target.Equals(null) ) + { + // if the target doesn't pass validation + Debug.LogWarning( "target validation failed. destroying the tween to avoid errors. Target type: " + this.targetTypeString ); + autoRemoveOnComplete = true; + return true; + } + } + + // we only fire the begin callback once per run. + if ( !_didBegin ) + onBegin(); + + // handle delay and return if we are still delaying + if( !_delayComplete && _elapsedDelay < delay ) + { + // if we have a timeScale set we need to remove its influence so that delays are always in seconds + if( timeScale != 0 ) + _elapsedDelay += deltaTime / timeScale; + + // are we done delaying? + if( _elapsedDelay >= delay ) + _delayComplete = true; + + return false; + } + + // loops only start once the delay has completed. + if ( _fireIterationStart ) + onIterationStart(); + + // base will calculate the proper elapsedTime, iterations, etc. + base.update( deltaTime ); + + // if we are looping back on a PingPong loop + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + //Debug.Log(string.Format("{0} : {1} -- {2}", _elapsedTime, convertedElapsedTime, _isLoopingBackOnPingPong ? "Y" : "N")); + + // update all properties + for( var i = 0; i < _tweenPropertyList.Count; ++i ) + _tweenPropertyList[i].tick( convertedElapsedTime ); + + onUpdate(); + + if ( _fireIterationEnd ) + onIterationEnd(); + + if( state == GoTweenState.Complete ) + { + onComplete(); + + return true; // true if complete + } + + return false; // false if not complete + } + + + /// + /// we are valid if we have a target and at least one TweenProperty + /// + public override bool isValid() + { + return target != null; + } + + + /// + /// adds the tween property if it passes validation and initializes the property + /// + public void addTweenProperty( AbstractTweenProperty tweenProp ) + { + // make sure the target is valid for this tween before adding + if( tweenProp.validateTarget( target ) ) + { + // ensure we dont add two tweens of the same property so they dont fight + if( _tweenPropertyList.Contains( tweenProp ) ) + { + Debug.Log( "not adding tween property because one already exists: " + tweenProp ); + return; + } + + _tweenPropertyList.Add( tweenProp ); + tweenProp.init( this ); + } + else + { + Debug.Log( "tween failed to validate target: " + tweenProp ); + } + } + + + public override bool removeTweenProperty( AbstractTweenProperty property ) + { + if( _tweenPropertyList.Contains( property ) ) + { + _tweenPropertyList.Remove( property ); + return true; + } + + return false; + } + + + public override bool containsTweenProperty( AbstractTweenProperty property ) + { + return _tweenPropertyList.Contains( property ); + } + + + public void clearTweenProperties() + { + _tweenPropertyList.Clear(); + } + + + public override List allTweenProperties() + { + return _tweenPropertyList; + } + + + #region AbstractTween overrides + + /// + /// called only once the first update of a tween. + /// + protected override void onInit() + { + base.onInit(); + + for ( var i = 0; i < _tweenPropertyList.Count; ++i ) + _tweenPropertyList[i].prepareForUse(); + } + + /// + /// removes the tween and cleans up its state + /// + public override void destroy() + { + base.destroy(); + + _tweenPropertyList.Clear(); + target = null; + } + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it will be force updated to the time specified. + /// + public override void goTo( float time , bool skipDelay = true ) + { + // handle delay, which is specific to Tweens + if( skipDelay ) + { + _elapsedDelay = delay; + } + else + { + _elapsedDelay = Mathf.Min( time, delay ); + time -= _elapsedDelay; + } + + _delayComplete = _elapsedDelay >= delay; + + time = Mathf.Clamp( time, 0f, totalDuration ); + + // provide an early out for calling goto on the same time multiple times. + if ( time == _totalElapsedTime ) + return; + + // if we are doing a goTo at the "start" of the timeline, based on the isReversed variable, + // allow the onBegin and onIterationStart callback to fire again. + // we only allow the onIterationStart event callback to fire at the start of the timeline, + // as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we + // go to the start. + if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + else + { + _didBegin = true; + _fireIterationStart = false; + } + + // since we're doing a goTo, we want to stop this tween from remembering that it iterated. + // this could cause issues if you caused the tween to complete an iteration and then goTo somewhere + // else while still paused. + _didIterateThisFrame = false; + + // force a time and completedIterations before we update + _totalElapsedTime = time; + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + update( 0 ); + } + + + /// + /// completes the tween. sets the object to it's final position as if the tween completed normally. + /// takes into effect if the tween was playing forward or reversed. + /// + public override void complete() + { + if( iterations < 0 ) + return; + + // set delayComplete so we get one last update in before we die (base will set the elapsed time for us) + _delayComplete = true; + + base.complete(); + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs.meta new file mode 100644 index 0000000..ace9b8c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5e29433d2fb8417c9b59ce3453f2ca3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs new file mode 100644 index 0000000..d9b9595 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs @@ -0,0 +1,147 @@ +using UnityEngine; +using System.Collections; + + +public class GoTweenChain : AbstractGoTweenCollection +{ + public GoTweenChain() : this(new GoTweenCollectionConfig()) {} + public GoTweenChain(GoTweenCollectionConfig config) : base(config) {} + + #region internal Chain management + + private void append( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenChain is not permitted" ); + return; + } + + if ( item.tween != null ) + { + if ( item.tween.isReversed != isReversed ) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween(item.tween); + + // ensure that the item is marked to play. + item.tween.play(); + } + + _tweenFlows.Add( item ); + + // update the duration and total duration + duration += item.duration; + + if( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + + private void prepend( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenChain is not permitted" ); + return; + } + + if ( item.tween != null ) + { + if ( item.tween.isReversed != isReversed ) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween( item.tween ); + + // ensure that the item is marked to play. + item.tween.play(); + } + + // fix all the start times on our previous chains + foreach( var flowItem in _tweenFlows ) + flowItem.startTime += item.duration; + + _tweenFlows.Insert( 0, item ); + + // update the duration and total duration + duration += item.duration; + + if ( iterations < 0 ) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + #endregion + + + #region Chain management + + /// + /// appends a Tween at the end of the current flow + /// + public GoTweenChain append( AbstractGoTween tween ) + { + var item = new TweenFlowItem( duration, tween ); + append( item ); + + return this; + } + + + /// + /// appends a delay to the end of the current flow + /// + public GoTweenChain appendDelay( float delay ) + { + var item = new TweenFlowItem( duration, delay ); + append( item ); + + return this; + } + + + /// + /// adds a Tween to the front of the flow + /// + public GoTweenChain prepend( AbstractGoTween tween ) + { + var item = new TweenFlowItem( 0, tween ); + prepend( item ); + + return this; + } + + + /// + /// adds a delay to the front of the flow + /// + public GoTweenChain prependDelay( float delay ) + { + var item = new TweenFlowItem( 0, delay ); + prepend( item ); + + return this; + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs.meta new file mode 100644 index 0000000..d8cc75a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenChain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4985888b83c04c04b428c6b4d0e9e13 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs new file mode 100644 index 0000000..c3fbf93 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs @@ -0,0 +1,122 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTweenCollectionConfig +{ + public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id + public int iterations = 1; // number of times to iterate. -1 will loop indefinitely + public GoLoopType loopType = Go.defaultLoopType; + public GoUpdateType propertyUpdateType = Go.defaultUpdateType; + + public Action onInitHandler; + public Action onBeginHandler; + public Action onIterationStartHandler; + public Action onUpdateHandler; + public Action onIterationEndHandler; + public Action onCompleteHandler; + + + /// + /// sets the number of iterations. setting to -1 will loop infinitely + /// + public GoTweenCollectionConfig setIterations( int iterations ) + { + this.iterations = iterations; + return this; + } + + + /// + /// sets the number of iterations and the loop type. setting to -1 will loop infinitely + /// + public GoTweenCollectionConfig setIterations( int iterations, GoLoopType loopType ) + { + this.iterations = iterations; + this.loopType = loopType; + return this; + } + + + /// + /// sets the update type for the Tween + /// + public GoTweenCollectionConfig setUpdateType( GoUpdateType setUpdateType ) + { + this.propertyUpdateType = setUpdateType; + return this; + } + + + /// + /// sets the onInit handler for the Tween + /// + public GoTweenCollectionConfig onInit( Action onInit ) + { + onInitHandler = onInit; + return this; + } + + + /// + /// sets the onBegin handler for the Tween + /// + public GoTweenCollectionConfig onBegin( Action onBegin ) + { + onBeginHandler = onBegin; + return this; + } + + + /// + /// sets the onIterationStart handler for the Tween + /// + public GoTweenCollectionConfig onIterationStart( Action onIterationStart ) + { + onIterationStartHandler = onIterationStart; + return this; + } + + + /// + /// sets the onUpdate handler for the Tween + /// + public GoTweenCollectionConfig onUpdate( Action onUpdate ) + { + onUpdateHandler = onUpdate; + return this; + } + + + /// + /// sets the onIterationEnd handler for the Tween + /// + public GoTweenCollectionConfig onIterationEnd( Action onIterationEnd ) + { + onIterationEndHandler = onIterationEnd; + return this; + } + + + /// + /// sets the onComplete handler for the Tween + /// + public GoTweenCollectionConfig onComplete( Action onComplete ) + { + onCompleteHandler = onComplete; + return this; + } + + + /// + /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class + /// + public GoTweenCollectionConfig setId( int id ) + { + this.id = id; + return this; + } + +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta new file mode 100644 index 0000000..3e6701f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenCollectionConfig.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04126d38111de41799edaa161b80b0b4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs new file mode 100644 index 0000000..d0b87c5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs @@ -0,0 +1,533 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +public class GoTweenConfig +{ + private List _tweenProperties = new List(); + public List tweenProperties { get { return _tweenProperties; } } + + public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id + public float delay; // how long should we delay before starting the Tween + public int iterations = 1; // number of times to iterate. -1 will loop indefinitely + public int timeScale = 1; + public GoLoopType loopType = Go.defaultLoopType; + public GoEaseType easeType = Go.defaultEaseType; + public bool isPaused; + public GoUpdateType propertyUpdateType = Go.defaultUpdateType; + public bool isFrom; + + public Action onInitHandler; + public Action onBeginHandler; + public Action onIterationStartHandler; + public Action onUpdateHandler; + public Action onIterationEndHandler; + public Action onCompleteHandler; + + + #region TweenProperty adders + + /// + /// position tween + /// + public GoTweenConfig position( Vector3 endValue, bool isRelative = false ) + { + var prop = new PositionTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// localPosition tween + /// + public GoTweenConfig localPosition( Vector3 endValue, bool isRelative = false ) + { + var prop = new PositionTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// position path tween + /// + public GoTweenConfig positionPath( GoSpline path, bool isRelative = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null ) + { + var prop = new PositionPathTweenProperty( path, isRelative, false, lookAtType, lookTarget ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// uniform scale tween (x, y and z scale to the same value) + /// + public GoTweenConfig scale( float endValue, bool isRelative = false ) + { + return this.scale( new Vector3( endValue, endValue, endValue ), isRelative ); + } + + + /// + /// scale tween + /// + public GoTweenConfig scale( Vector3 endValue, bool isRelative = false ) + { + var prop = new ScaleTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// scale through a series of Vector3s + /// + public GoTweenConfig scalePath( GoSpline path, bool isRelative = false ) + { + var prop = new ScalePathTweenProperty( path, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// eulerAngle tween + /// + public GoTweenConfig eulerAngles( Vector3 endValue, bool isRelative = false ) + { + var prop = new EulerAnglesTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// local eulerAngle tween + /// + public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false ) + { + var prop = new EulerAnglesTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// rotation tween + /// + public GoTweenConfig rotation( Vector3 endValue, bool isRelative = false ) + { + var prop = new RotationTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// localRotation tween + /// + public GoTweenConfig localRotation( Vector3 endValue, bool isRelative = false ) + { + var prop = new RotationTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// rotation tween as Quaternion + /// + public GoTweenConfig rotation( Quaternion endValue, bool isRelative = false ) + { + var prop = new RotationQuaternionTweenProperty( endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + /// + /// localRotation tween as Quaternion + /// + public GoTweenConfig localRotation( Quaternion endValue, bool isRelative = false ) + { + var prop = new RotationQuaternionTweenProperty( endValue, isRelative, true ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// material color tween + /// + public GoTweenConfig materialColor( Color endValue, string colorName = "_Color", bool isRelative = false ) + { + var prop = new MaterialColorTweenProperty( endValue, colorName, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// shake tween + /// + public GoTweenConfig shake( Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false ) + { + var prop = new ShakeTweenProperty( shakeMagnitude, shakeType, frameMod, useLocalProperties ); + _tweenProperties.Add( prop ); + + return this; + } + + + #region generic properties + + /// + /// generic vector2 tween + /// + public GoTweenConfig vector2Prop( string propertyName, Vector2 endValue, bool isRelative = false ) + { + var prop = new Vector2TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3 tween + /// + public GoTweenConfig vector3Prop( string propertyName, Vector3 endValue, bool isRelative = false ) + { + var prop = new Vector3TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector4 tween + /// + public GoTweenConfig vector4Prop( string propertyName, Vector4 endValue, bool isRelative = false ) + { + var prop = new Vector4TweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3 path tween + /// + public GoTweenConfig vector3PathProp( string propertyName, GoSpline path, bool isRelative = false ) + { + var prop = new Vector3PathTweenProperty( propertyName, path, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.x tween + /// + public GoTweenConfig vector3XProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3XTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.y tween + /// + public GoTweenConfig vector3YProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3YTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic vector3.z tween + /// + public GoTweenConfig vector3ZProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new Vector3ZTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic color tween + /// + public GoTweenConfig colorProp( string propertyName, Color endValue, bool isRelative = false ) + { + var prop = new ColorTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic integer tween + /// + public GoTweenConfig intProp( string propertyName, int endValue, bool isRelative = false ) + { + var prop = new IntTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + + /// + /// generic float tween + /// + public GoTweenConfig floatProp( string propertyName, float endValue, bool isRelative = false ) + { + var prop = new FloatTweenProperty( propertyName, endValue, isRelative ); + _tweenProperties.Add( prop ); + + return this; + } + + #endregion + + #endregion + + + /// + /// adds a TweenProperty to the list + /// + public GoTweenConfig addTweenProperty( AbstractTweenProperty tweenProp ) + { + _tweenProperties.Add( tweenProp ); + + return this; + } + + + /// + /// clears out all the TweenProperties + /// + public GoTweenConfig clearProperties() + { + _tweenProperties.Clear(); + + return this; + } + + /// + /// clears out all the TweenProperties + /// + public GoTweenConfig clearEvents() + { + onInitHandler = null; + onBeginHandler = null; + onIterationStartHandler = null; + onUpdateHandler = null; + onIterationEndHandler = null; + onCompleteHandler = null; + + return this; + } + + /// + /// sets the delay for the tween + /// + public GoTweenConfig setDelay( float seconds ) + { + delay = seconds; + + return this; + } + + + /// + /// sets the number of iterations. setting to -1 will loop infinitely + /// + public GoTweenConfig setIterations( int iterations ) + { + this.iterations = iterations; + + return this; + } + + + /// + /// sets the number of iterations and the loop type. setting to -1 will loop infinitely + /// + public GoTweenConfig setIterations( int iterations, GoLoopType loopType ) + { + this.iterations = iterations; + this.loopType = loopType; + + return this; + } + + + /// + /// sets the timeScale to be used by the Tween + /// + public GoTweenConfig setTimeScale( int timeScale ) + { + this.timeScale = timeScale; + + return this; + } + + + /// + /// sets the ease type for the Tween + /// + public GoTweenConfig setEaseType( GoEaseType easeType ) + { + this.easeType = easeType; + + return this; + } + + + /// + /// sets whether the Tween should start paused + /// + public GoTweenConfig startPaused() + { + isPaused = true; + + return this; + } + + + /// + /// sets the update type for the Tween + /// + public GoTweenConfig setUpdateType( GoUpdateType setUpdateType ) + { + propertyUpdateType = setUpdateType; + + return this; + } + + + /// + /// sets if this Tween should be a "from" Tween. From Tweens use the current property as the endValue and + /// the endValue as the start value + /// + public GoTweenConfig setIsFrom() + { + isFrom = true; + + return this; + } + + /// + /// sets if this Tween should be a "to" Tween. + /// + public GoTweenConfig setIsTo() + { + isFrom = false; + + return this; + } + + + /// + /// sets the onInit handler for the Tween + /// + public GoTweenConfig onInit( Action onInit ) + { + onInitHandler = onInit; + return this; + } + + + /// + /// sets the onBegin handler for the Tween + /// + public GoTweenConfig onBegin( Action onBegin ) + { + onBeginHandler = onBegin; + + return this; + } + + + /// + /// sets the onIterationStart handler for the Tween + /// + public GoTweenConfig onIterationStart( Action onIterationStart ) + { + onIterationStartHandler = onIterationStart; + + return this; + } + + + /// + /// sets the onUpdate handler for the Tween + /// + public GoTweenConfig onUpdate( Action onUpdate ) + { + onUpdateHandler = onUpdate; + + return this; + } + + + /// + /// sets the onIterationEnd handler for the Tween + /// + public GoTweenConfig onIterationEnd( Action onIterationEnd ) + { + onIterationEndHandler = onIterationEnd; + + return this; + } + + + /// + /// sets the onComplete handler for the Tween + /// + public GoTweenConfig onComplete( Action onComplete ) + { + onCompleteHandler = onComplete; + + return this; + } + + + /// + /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class + /// + public GoTweenConfig setId( int id ) + { + this.id = id; + + return this; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs.meta new file mode 100644 index 0000000..64d0104 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenConfig.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 110c83c73e3544e7785938ec38e5361e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs new file mode 100644 index 0000000..c6c946c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs @@ -0,0 +1,83 @@ +using UnityEngine; +using System.Collections; + + +/// +/// TweenFlows are used for creating a chain of Tweens via the append/prepend methods. You can also get timeline +/// like control by inserting Tweens and setting them to start at a specific time. Note that TweenFlows do not +/// honor the delays set within regular Tweens. Use the append/prependDelay method to add any required delays +/// +public class GoTweenFlow : AbstractGoTweenCollection +{ + public GoTweenFlow() : this( new GoTweenCollectionConfig() ) {} + + public GoTweenFlow( GoTweenCollectionConfig config ) : base( config ) {} + + + #region internal Flow management + + /// + /// the item being added already has a start time so no extra parameter is needed + /// + private void insert( TweenFlowItem item ) + { + // early out for invalid items + if( item.tween != null && !item.tween.isValid() ) + return; + + if( float.IsInfinity( item.duration ) ) + { + Debug.LogError( "adding a Tween with infinite iterations to a TweenFlow is not permitted" ); + return; + } + + if( item.tween != null ) + { + if (item.tween.isReversed != isReversed) + { + Debug.LogError( "adding a Tween that doesn't match the isReversed property of the TweenFlow is not permitted." ); + return; + } + + // ensure the tween isnt already live + Go.removeTween(item.tween); + + // ensure that the item is marked to play. + item.tween.play(); + } + + // add the item then sort based on startTimes + _tweenFlows.Add( item ); + _tweenFlows.Sort( ( x, y ) => + { + return x.startTime.CompareTo( y.startTime ); + } ); + + duration = Mathf.Max( item.startTime + item.duration, duration ); + + if (iterations < 0) + totalDuration = float.PositiveInfinity; + else + totalDuration = duration * iterations; + } + + #endregion + + + #region Flow management + + /// + /// inserts a Tween and sets it to start at the given startTime + /// + public GoTweenFlow insert( float startTime, AbstractGoTween tween ) + { + var item = new TweenFlowItem( startTime, tween ); + insert( item ); + + return this; + } + + #endregion + + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs.meta new file mode 100644 index 0000000..78b498f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/GoTweenFlow.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc32096ae2bba43da839e42c553f294c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/base.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/base.meta new file mode 100644 index 0000000..ebbc1e1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/base.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0a0650221f37549c4988877fdaa5e4bb +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs new file mode 100644 index 0000000..2e03474 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs @@ -0,0 +1,445 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + + +/// +/// base class shared by the Tween and TweenChain classes to allow a seemless API when controlling +/// either of them +/// +public abstract class AbstractGoTween +{ + public int id = 0; // optional id used for identifying this tween + public GoTweenState state { get; protected set; } // current state of the tween + public float duration { get; protected set; } // duration for a single loop + public float totalDuration { get; protected set; } // duration for all loops of this tween + public float timeScale { get; set; } // time scale to be used by this tween + + public GoUpdateType updateType { get; protected set; } + public GoLoopType loopType { get; protected set; } + public int iterations { get; protected set; } // set to -1 for infinite + + public bool autoRemoveOnComplete { get; set; } // should we automatically remove ourself from the Go's list of tweens when done? + public bool isReversed { get; protected set; } // have we been reversed? this is different than a PingPong loop's backwards section + public bool allowEvents { get; set; } // allow the user to surpress events. + protected bool _didInit; // flag to ensure event only gets fired once + protected bool _didBegin; // flag to ensure event only gets fired once + protected bool _fireIterationStart; + protected bool _fireIterationEnd; + + // internal state for update logic + protected float _elapsedTime; // elapsed time for the current loop iteration + protected float _totalElapsedTime; // total elapsed time of the entire tween + public float totalElapsedTime { get { return _totalElapsedTime; } } + + protected bool _isLoopingBackOnPingPong; + public bool isLoopingBackOnPingPong { get { return _isLoopingBackOnPingPong; } } + + protected bool _didIterateLastFrame; + protected bool _didIterateThisFrame; + protected int _deltaIterations; // change in completed iterations this frame. + protected int _completedIterations; + public int completedIterations { get { return _completedIterations; } } + + // action event handlers + protected Action _onInit; // executes before initial setup. + protected Action _onBegin; // executes when a tween starts. + protected Action _onIterationStart; // executes whenever a tween starts an iteration. + protected Action _onUpdate; // execute whenever a tween updates. + protected Action _onIterationEnd; // executes whenever a tween ends an iteration. + protected Action _onComplete; // exectures whenever a tween completes + + public void setOnInitHandler( Action onInit ) + { + _onInit = onInit; + } + + public void setOnBeginHandler( Action onBegin ) + { + _onBegin = onBegin; + } + + public void setonIterationStartHandler( Action onIterationStart ) + { + _onIterationStart = onIterationStart; + } + + public void setOnUpdateHandler( Action onUpdate ) + { + _onUpdate = onUpdate; + } + + public void setonIterationEndHandler( Action onIterationEnd ) + { + _onIterationEnd = onIterationEnd; + } + + public void setOnCompleteHandler( Action onComplete ) + { + _onComplete = onComplete; + } + + /// + /// called once per tween when it is first updated + /// + protected virtual void onInit() + { + if( !allowEvents ) + return; + + if( _onInit != null ) + _onInit( this ); + + _didInit = true; + } + + /// + /// called whenever the tween is updated and the playhead is at the start (or end, depending on isReversed) of the tween. + /// + protected virtual void onBegin() + { + if( !allowEvents ) + return; + + if( isReversed && _totalElapsedTime != totalDuration ) + return; + else if( !isReversed && _totalElapsedTime != 0f ) + return; + + if( _onBegin != null ) + _onBegin( this ); + + _didBegin = true; + } + + + /// + /// called once per iteration at the start of the iteration. + /// + protected virtual void onIterationStart() + { + if( !allowEvents ) + return; + + if( _onIterationStart != null ) + _onIterationStart( this ); + } + + /// + /// called once per update, after the update has occured. + /// + protected virtual void onUpdate() + { + if( !allowEvents ) + return; + + if( _onUpdate != null ) + _onUpdate( this ); + } + + /// + /// called once per iteration at the end of the iteration. + /// + protected virtual void onIterationEnd() + { + if( !allowEvents ) + return; + + if( _onIterationEnd != null ) + _onIterationEnd( this ); + } + + + /// + /// called when the tween completes playing. + /// + protected virtual void onComplete() + { + if( !allowEvents ) + return; + + if( _onComplete != null ) + _onComplete( this ); + } + + + /// + /// tick method. if it returns true it indicates the tween is complete. + /// note: at it's base, AbstractGoTween does not fire events, it is up to the implementer to + /// do so. see GoTween and AbstractGoTweenCollection for examples. + /// + public virtual bool update( float deltaTime ) + { + // increment or decrement the total elapsed time then clamp from 0 to totalDuration + if( isReversed ) + _totalElapsedTime -= deltaTime; + else + _totalElapsedTime += deltaTime; + + _totalElapsedTime = Mathf.Clamp( _totalElapsedTime, 0, totalDuration ); + + _didIterateLastFrame = _didIterateThisFrame || ( !isReversed && _totalElapsedTime == 0 ) || ( isReversed && _totalElapsedTime == totalDuration ); + + // we flip between ceil and floor based on the direction, because we want the iteration change + // to happen when "duration" seconds has elapsed, not immediately, as was the case if you + // were doing a floor and were going in reverse. + if( isReversed ) + _deltaIterations = Mathf.CeilToInt( _totalElapsedTime / duration ) - _completedIterations; + else + _deltaIterations = Mathf.FloorToInt( _totalElapsedTime / duration ) - _completedIterations; + + // we iterated this frame if we have done a goTo() to an iteration point, or we've passed over + // an iteration threshold. + _didIterateThisFrame = !_didIterateLastFrame && ( _deltaIterations != 0f || _totalElapsedTime % duration == 0f ); + + _completedIterations += _deltaIterations; + + // set the elapsedTime, given what we know. + if( _didIterateLastFrame ) + { + _elapsedTime = isReversed ? duration : 0f; + } + else if( _didIterateThisFrame ) + { + // if we iterated this frame, we force the _elapsedTime to the end of the timeline. + _elapsedTime = isReversed ? 0f : duration; + } + else + { + _elapsedTime = _totalElapsedTime % duration; + + // if you do a goTo(x) where x is a multiple of duration, we assume that you want + // to be at the end of your duration, as this sets you up to have an automatic OnIterationStart fire + // the next updated frame. the only caveat is when you do a goTo(0) when playing forwards, + // or a goTo(totalDuration) when playing in reverse. we assume that at that point, you want to be + // at the start of your tween. + if( _elapsedTime == 0f && ( ( isReversed && _totalElapsedTime == totalDuration ) || ( !isReversed && _totalElapsedTime > 0f ) ) ) + { + _elapsedTime = duration; + } + } + + // we can only be looping back on a PingPong if our loopType is PingPong and we are on an odd numbered iteration + _isLoopingBackOnPingPong = false; + if( loopType == GoLoopType.PingPong ) + { + // due to the way that we count iterations, and force a tween to remain at the end + // of it's timeline for one frame after passing the duration threshold, + // we need to make sure that _isLoopingBackOnPingPong references the current + // iteration, and not the next one. + if( isReversed ) + { + _isLoopingBackOnPingPong = _completedIterations % 2 == 0; + + if( _elapsedTime == 0f ) + _isLoopingBackOnPingPong = !_isLoopingBackOnPingPong; + } + else + { + _isLoopingBackOnPingPong = _completedIterations % 2 != 0; + + if( _elapsedTime == duration ) + _isLoopingBackOnPingPong = !_isLoopingBackOnPingPong; + } + } + + // set a flag whether to fire the onIterationEnd event or not. + _fireIterationStart = _didIterateThisFrame || ( !isReversed && _elapsedTime == duration ) || ( isReversed && _elapsedTime == 0f ); + _fireIterationEnd = _didIterateThisFrame; + + // check for completion + if( ( !isReversed && iterations >= 0 && _completedIterations >= iterations ) || ( isReversed && _totalElapsedTime <= 0 ) ) + state = GoTweenState.Complete; + + if( state == GoTweenState.Complete ) + { + // these variables need to be reset here. if a tween were to complete, + // and then get played again: + // * The onIterationStart event would get fired + // * tweens would flip their elapsedTime between 0 and totalDuration + + _fireIterationStart = false; + _didIterateThisFrame = false; + + return true; // true if complete + } + + return false; // false if not complete + } + + + /// + /// subclasses should return true if they are a valid and ready to be added to the list of running tweens + /// or false if not ready. + /// technically, this should be marked as internal + /// + public abstract bool isValid(); + + + /// + /// attempts to remove the tween property returning true if successful + /// technically, this should be marked as internal + /// + public abstract bool removeTweenProperty( AbstractTweenProperty property ); + + + /// + /// returns true if the tween contains the same type (or propertyName) property in its property list + /// technically, this should be marked as internal + /// + public abstract bool containsTweenProperty( AbstractTweenProperty property ); + + + /// + /// returns a list of all the TweenProperties contained in the tween and all its children (if it is + /// a TweenChain or a TweenFlow) + /// technically, this should be marked as internal + /// + public abstract List allTweenProperties(); + + + /// + /// removes the Tween from action and cleans up its state + /// + public virtual void destroy() + { + state = GoTweenState.Destroyed; + } + + + /// + /// pauses playback + /// + public virtual void pause() + { + state = GoTweenState.Paused; + } + + + /// + /// resumes playback + /// + public virtual void play() + { + state = GoTweenState.Running; + } + + + /// + /// plays the tween forward. if it is already playing forward has no effect + /// + public void playForward() + { + if( isReversed ) + reverse(); + + play(); + } + + + /// + /// plays the tween backwards. if it is already playing backwards has no effect + /// + public void playBackwards() + { + if( !isReversed ) + reverse(); + + play(); + } + + + /// + /// resets the tween to the beginning, taking isReversed into account. + /// + protected virtual void reset( bool skipDelay = true ) + { + goTo( isReversed ? totalDuration : 0, skipDelay ); + + _fireIterationStart = true; + } + + + /// + /// rewinds the tween to the beginning (or end, depending on isReversed) and pauses playback. + /// + public virtual void rewind( bool skipDelay = true ) + { + reset( skipDelay ); + pause(); + } + + + /// + /// rewinds the tween to the beginning (or end, depending on isReversed) and starts playback, + /// optionally skipping delay (only relevant for Tweens). + /// + public void restart( bool skipDelay = true ) + { + reset( skipDelay ); + play(); + } + + + /// + /// reverses playback. if going forward it will be going backward after this and vice versa. + /// + public virtual void reverse() + { + isReversed = !isReversed; + + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + // if we are at the "start" of the timeline, based on isReversed, + // allow the onBegin/onIterationStart callbacks to fire again. + if( ( isReversed && _totalElapsedTime == totalDuration ) || ( !isReversed && _totalElapsedTime == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + } + + + /// + /// completes the tween. sets the playhead to it's final position as if the tween completed normally. + /// takes into account if the tween was playing forward or reversed. + /// + public virtual void complete() + { + if( iterations < 0 ) + return; + + // set full elapsed time and let the next iteration finish it off + goTo( isReversed ? 0 : totalDuration, true ); + } + + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it can optionally be force updated to the time specified. delays are not taken into effect. + /// (must be implemented by inherited classes.) + /// + public abstract void goTo( float time, bool skipDelay = true ); + + /// + /// goes to the time and starts playback skipping any delays + /// + public void goToAndPlay( float time, bool skipDelay = true ) + { + goTo( time, skipDelay ); + play(); + } + + + /// + /// waits for either completion or destruction. call in a Coroutine and yield on the return + /// + public IEnumerator waitForCompletion() + { + while( state != GoTweenState.Complete && state != GoTweenState.Destroyed ) + yield return null; + + yield break; + } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta new file mode 100644 index 0000000..e13d51e --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d8eb47665d5434148a4bd7391644861a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs new file mode 100644 index 0000000..39e93a0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs @@ -0,0 +1,500 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// base class for TweenChains and TweenFlows +/// +public class AbstractGoTweenCollection : AbstractGoTween +{ + protected List _tweenFlows = new List(); + + + /// + /// data class that wraps an AbstractTween and its start time for the timeline + /// + protected class TweenFlowItem + { + public float startTime; + public float endTime { get { return startTime + duration; } } + public float duration; + public AbstractGoTween tween; + + + public TweenFlowItem( float startTime, AbstractGoTween tween ) + { + this.tween = tween; + this.startTime = startTime; + this.duration = tween.totalDuration; + } + + + public TweenFlowItem( float startTime, float duration ) + { + this.duration = duration; + this.startTime = startTime; + } + } + + + public AbstractGoTweenCollection( GoTweenCollectionConfig config ) + { + // allow events by default + allowEvents = true; + + // setup callback bools + _didInit = false; + _didBegin = false; + + // flag the onIterationStart event to fire. + // as long as goTo is not called on this tween, the onIterationStart event will fire + _fireIterationStart = true; + + // copy the TweenConfig info over + id = config.id; + loopType = config.loopType; + iterations = config.iterations; + updateType = config.propertyUpdateType; + timeScale = 1; + state = GoTweenState.Paused; + + _onInit = config.onInitHandler; + _onBegin = config.onBeginHandler; + _onIterationStart = config.onIterationStartHandler; + _onUpdate = config.onUpdateHandler; + _onIterationEnd = config.onIterationEndHandler; + _onComplete = config.onCompleteHandler; + + Go.addTween( this ); + } + + + #region AbstractTween overrides + + /// + /// returns a list of all Tweens with the given target in the collection + /// technically, this should be marked as internal + /// + public List tweensWithTarget( object target ) + { + List list = new List(); + + foreach( var flowItem in _tweenFlows ) + { + // skip TweenFlowItems with no target + if( flowItem.tween == null ) + continue; + + // check Tweens first + var tween = flowItem.tween as GoTween; + if( tween != null && tween.target == target ) + list.Add( tween ); + + // check for TweenCollections + if( tween == null ) + { + var tweenCollection = flowItem.tween as AbstractGoTweenCollection; + if( tweenCollection != null ) + { + var tweensInCollection = tweenCollection.tweensWithTarget( target ); + if( tweensInCollection.Count > 0 ) + list.AddRange( tweensInCollection ); + } + } + } + + return list; + } + + + public override bool removeTweenProperty( AbstractTweenProperty property ) + { + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + if( flowItem.tween.removeTweenProperty( property ) ) + return true; + } + + return false; + } + + + public override bool containsTweenProperty( AbstractTweenProperty property ) + { + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + if( flowItem.tween.containsTweenProperty( property ) ) + return true; + } + + return false; + } + + + public override List allTweenProperties() + { + var propList = new List(); + + foreach( var flowItem in _tweenFlows ) + { + // skip delay items which have no tween + if( flowItem.tween == null ) + continue; + + propList.AddRange( flowItem.tween.allTweenProperties() ); + } + + return propList; + } + + + /// + /// we are always considered valid because our constructor adds us to Go and we start paused + /// + public override bool isValid() + { + return true; + } + + /// + /// resumes playback + /// + public override void play() + { + base.play(); + + foreach( var flowItem in _tweenFlows ) + { + if( flowItem.tween != null ) + flowItem.tween.play(); + } + } + + /// + /// pauses playback + /// + public override void pause() + { + base.pause(); + + foreach( var flowItem in _tweenFlows ) + { + if( flowItem.tween != null ) + flowItem.tween.pause(); + } + } + + /// + /// tick method. if it returns true it indicates the tween is complete + /// + public override bool update( float deltaTime ) + { + if ( !_didInit ) + onInit(); + + if ( !_didBegin ) + onBegin(); + + if ( _fireIterationStart ) + onIterationStart(); + + // update the timeline and state. + base.update( deltaTime ); + + // get the proper elapsedTime if we're doing a PingPong + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + // used for iterating over flowItems below. + TweenFlowItem flowItem = null; + + // if we iterated last frame and this flow restarts from the beginning, we now need to reset all + // of the flowItem tweens to either the beginning or the end of their respective timelines + // we also want to do this in the _opposite_ way that we would normally iterate on them + // as the start value of a later flowItem may alter a property of an earlier flowItem. + if ( _didIterateLastFrame && loopType == GoLoopType.RestartFromBeginning ) + { + if ( isReversed || _isLoopingBackOnPingPong ) + { + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + var cacheAllow = flowItem.tween.allowEvents; + flowItem.tween.allowEvents = false; + flowItem.tween.restart(); + flowItem.tween.allowEvents = cacheAllow; + } + } + else + { + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + var cacheAllow = flowItem.tween.allowEvents; + flowItem.tween.allowEvents = false; + flowItem.tween.restart(); + flowItem.tween.allowEvents = cacheAllow; + } + } + } + else + { + if ( ( isReversed && !_isLoopingBackOnPingPong ) || ( !isReversed && _isLoopingBackOnPingPong ) ) + { + // if we are moving the tween in reverse, we should be iterating over the flowItems in reverse + // to help properties behave a bit better. + for ( var i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + // if there's been an iteration this frame and we're not done yet, we want to make sure + // this tween is set to play in the right direction, and isn't set to complete/paused. + if ( _didIterateLastFrame && state != GoTweenState.Complete ) + { + if ( !flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.play(); + } + + if ( flowItem.tween.state == GoTweenState.Running && flowItem.endTime >= convertedElapsedTime ) + { + var convertedDeltaTime = Mathf.Abs( convertedElapsedTime - flowItem.startTime - flowItem.tween.totalElapsedTime ); + flowItem.tween.update( convertedDeltaTime ); + } + } + } + else + { + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem.tween == null ) + continue; + + // if there's been an iteration this frame and we're not done yet, we want to make sure + // this tween is set to play in the right direction, and isn't set to complete/paused. + if ( _didIterateLastFrame && state != GoTweenState.Complete ) + { + if ( flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.play(); + } + + if ( flowItem.tween.state == GoTweenState.Running && flowItem.startTime <= convertedElapsedTime ) + { + var convertedDeltaTime = convertedElapsedTime - flowItem.startTime - flowItem.tween.totalElapsedTime; + flowItem.tween.update( convertedDeltaTime ); + } + } + } + } + + onUpdate(); + + if ( _fireIterationEnd ) + onIterationEnd(); + + if ( state == GoTweenState.Complete ) + { + onComplete(); + + return true; // true if complete + } + + return false; // false if not complete + } + + /// + /// reverses playback. if going forward it will be going backward after this and vice versa. + /// + public override void reverse() + { + base.reverse(); + + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + foreach ( var flowItem in _tweenFlows ) + { + if ( flowItem.tween == null ) + continue; + + if ( isReversed != flowItem.tween.isReversed ) + flowItem.tween.reverse(); + + flowItem.tween.pause(); + + // we selectively mark tweens for play if they will be played immediately or in the future. + // update() will filter out more tweens that should not be played yet. + if ( isReversed || _isLoopingBackOnPingPong ) + { + if ( flowItem.startTime <= convertedElapsedTime ) + flowItem.tween.play(); + } + else + { + if ( flowItem.endTime >= convertedElapsedTime ) + flowItem.tween.play(); + } + } + } + + /// + /// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is + /// not playing it will be force updated to the time specified. + /// + public override void goTo( float time, bool skipDelay = true ) + { + time = Mathf.Clamp( time, 0f, totalDuration ); + + // provide an early out for calling goTo on the same time multiple times. + if ( time == _totalElapsedTime ) + return; + + // we don't simply call base.goTo because that would force an update within AbstractGoTweenCollection, + // which forces an update on all the tweenFlowItems without putting them in the right position. + // it's also possible that people will move around a tween via the goTo method, so we want to + // try to make that as efficient as possible. + + // if we are doing a goTo at the "start" of the timeline, based on the isReversed variable, + // allow the onBegin and onIterationStart callback to fire again. + // we only allow the onIterationStart event callback to fire at the start of the timeline, + // as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we + // go to the start. + if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) ) + { + _didBegin = false; + _fireIterationStart = true; + } + else + { + _didBegin = true; + _fireIterationStart = false; + } + + // since we're doing a goTo, we want to stop this tween from remembering that it iterated. + // this could cause issues if you caused the tween to complete an iteration and then goTo somewhere + // else while still paused. + _didIterateThisFrame = false; + + // force a time and completedIterations before we update + _totalElapsedTime = time; + _completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration ); + + // we don't want to use the Collection update function, because we don't have all of our + // child tweenFlowItems setup properly. this will properly setup our iterations, + // totalElapsedTime, and other useful information. + base.update( 0 ); + + var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime; + + // we always want to process items in the future of this tween from last to first. + // and items that have already occured from first to last. + TweenFlowItem flowItem = null; + if ( isReversed || _isLoopingBackOnPingPong ) + { + // flowItems in the future of the timeline + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.endTime >= convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + + // flowItems in the past & current part of the timeline + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.endTime < convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + } + else + { + // flowItems in the future of the timeline + for ( int i = _tweenFlows.Count - 1; i >= 0; --i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.startTime <= convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + + // flowItems in the past & current part of the timeline + for ( int i = 0; i < _tweenFlows.Count; ++i ) + { + flowItem = _tweenFlows[i]; + + if ( flowItem == null ) + continue; + + if ( flowItem.startTime > convertedElapsedTime ) + break; + + changeTimeForFlowItem( flowItem, convertedElapsedTime ); + } + } + } + + private void changeTimeForFlowItem( TweenFlowItem flowItem, float time ) + { + if ( flowItem == null || flowItem.tween == null ) + return; + + if ( flowItem.tween.isReversed != ( isReversed || _isLoopingBackOnPingPong ) ) + flowItem.tween.reverse(); + + var convertedTime = Mathf.Clamp( time - flowItem.startTime, 0f, flowItem.endTime ); + + if ( flowItem.startTime <= time && flowItem.endTime >= time ) + { + flowItem.tween.goToAndPlay( convertedTime ); + } + else + { + flowItem.tween.goTo( convertedTime ); + flowItem.tween.pause(); + } + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta new file mode 100644 index 0000000..498d505 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/base/AbstractGoTweenCollection.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c011ef2561dca4c2492fdbf1b78d96a8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing.meta new file mode 100644 index 0000000..7f25095 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 34b16834b4ced4d9a9b03c6d00303ad5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs new file mode 100644 index 0000000..1b32a97 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs @@ -0,0 +1,25 @@ +public static class GoEaseBack +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * ( ( 1.70158f + 1 ) * t - 1.70158f ) + b; + } + + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * ( ( 1.70158f + 1 ) * t + 1.70158f ) + 1 ) + b; + } + + + public static float EaseInOut( float t, float b, float c, float d ) + { + float s = 1.70158f; + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * ( t * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t - s ) ) + b; + } + return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t + s ) + 2 ) + b; + } +} + diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta new file mode 100644 index 0000000..dda0af8 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBack.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e44fd25dcb7704da0a39cfe042b81293 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs new file mode 100644 index 0000000..c74f515 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs @@ -0,0 +1,35 @@ +public static class GoEaseBounce +{ + public static float EaseOut( float t, float b, float c, float d ) + { + if( ( t /= d ) < ( 1 / 2.75 ) ) + { + return c * ( 7.5625f * t * t ) + b; + } + else if( t < ( 2 / 2.75 ) ) + { + return c * ( 7.5625f * ( t -= ( 1.5f / 2.75f ) ) * t + .75f ) + b; + } + else if( t < ( 2.5 / 2.75 ) ) + { + return c * ( 7.5625f * ( t -= ( 2.25f / 2.75f ) ) * t + .9375f ) + b; + } + else + { + return c * ( 7.5625f * ( t -= ( 2.625f / 2.75f ) ) * t + .984375f ) + b; + } + } + + public static float EaseIn( float t, float b, float c, float d ) + { + return c - EaseOut( d - t, 0, c, d ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t < d / 2 ) + return EaseIn( t * 2, 0, c, d ) * 0.5f + b; + else + return EaseOut( t * 2 - d, 0, c, d ) * .5f + c * 0.5f + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta new file mode 100644 index 0000000..330e0a0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseBounce.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95777a3e9f3304c5f87d79f0035e7cce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs new file mode 100644 index 0000000..9c05c92 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs @@ -0,0 +1,24 @@ +using System; + + +public static class GoEaseCircular +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return -c * ( (float)Math.Sqrt( 1 - ( t /= d ) * t ) - 1 ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * (float)Math.Sqrt( 1 - ( t = t / d - 1 ) * t ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return -c / 2 * ( (float)Math.Sqrt( 1 - t * t ) - 1 ) + b; + } + return c / 2 * ( (float)Math.Sqrt( 1 - ( t -= 2 ) * t ) + 1 ) + b; + } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta new file mode 100644 index 0000000..3d9ddf8 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCircular.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b7f811e7d59a41bf99d08c646d1725b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs new file mode 100644 index 0000000..3c8df0a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs @@ -0,0 +1,21 @@ +public static class GoEaseCubic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * t + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t + b; + } + return c / 2 * ( ( t -= 2 ) * t * t + 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta new file mode 100644 index 0000000..d778eab --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseCubic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7210f854113854752bdff44a9b562d42 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs new file mode 100644 index 0000000..a252b41 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs @@ -0,0 +1,68 @@ +using System; +using UnityEngine; + + +public class GoEaseElastic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d ) == 1 ) + { + return b + c; + } + float p = d * .3f; + float s = p / 4; + return -(float)( c * Math.Pow( 2, 10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d ) == 1 ) + { + return b + c; + } + float p = d * .3f; + float s = p / 4; + return (float)( c * Math.Pow( 2, -10 * t ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b ); + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( ( t /= d / 2 ) == 2 ) + { + return b + c; + } + float p = d * ( .3f * 1.5f ); + float a = c; + float s = p / 4; + if( t < 1 ) + { + return -.5f * (float)( a * Math.Pow( 2, 10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; + } + return (float)( a * Math.Pow( 2, -10 * ( t -= 1 ) ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b ); + } + + public static float Punch( float t, float b, float c, float d ) + { + if( t == 0 ) + return 0; + + if( ( t /= d ) == 1 ) + return 0; + + const float p = 0.3f; + return ( c * Mathf.Pow( 2, -10 * t ) * Mathf.Sin( t * ( 2 * Mathf.PI ) / p ) ); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta new file mode 100644 index 0000000..cf0540c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseElastic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c183f70ddaf54b6caa706e2d7a15837 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs new file mode 100644 index 0000000..eaeecd2 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs @@ -0,0 +1,32 @@ +using System; + + +public static class GoEaseExponential +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return ( t == 0 ) ? b : c * (float)Math.Pow( 2, 10 * ( t / d - 1 ) ) + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return ( t == d ) ? b + c : c * (float)( -Math.Pow( 2, -10 * t / d ) + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( t == 0 ) + { + return b; + } + if( t == d ) + { + return b + c; + } + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * (float)Math.Pow( 2, 10 * ( t - 1 ) ) + b; + } + return c / 2 * (float)( -Math.Pow( 2, -10 * --t ) + 2 ) + b; + } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta new file mode 100644 index 0000000..d62fa06 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseExponential.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9db2ed7f90d404641b604f6db1368fcc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs new file mode 100644 index 0000000..a61643d --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs @@ -0,0 +1,10 @@ +using UnityEngine; + + +public static class GoEaseLinear +{ + public static float EaseNone( float t, float b, float c, float d ) + { + return c * t / d + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta new file mode 100644 index 0000000..9d1c67c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseLinear.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2f840d866998449683cf9b8a34c0b8f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs new file mode 100644 index 0000000..f15e825 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuadratic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return -c * ( t /= d ) * ( t - 2 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t + b; + } + return -c / 2 * ( ( --t ) * ( t - 2 ) - 1 ) + b; + } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta new file mode 100644 index 0000000..816a532 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuadratic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94e247c3236114f678e9ffffa07bfe09 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs new file mode 100644 index 0000000..a9631b6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuartic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return -c * ( ( t = t / d - 1 ) * t * t * t - 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t * t + b; + } + return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta new file mode 100644 index 0000000..293cc52 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuartic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 178a095287feb40b3b2fb42327529cf3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs new file mode 100644 index 0000000..8275a6c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs @@ -0,0 +1,21 @@ +public static class GoEaseQuintic +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return c * ( t /= d ) * t * t * t * t + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + if( ( t /= d / 2 ) < 1 ) + { + return c / 2 * t * t * t * t * t + b; + } + return c / 2 * ( ( t -= 2 ) * t * t * t * t + 2 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta new file mode 100644 index 0000000..dd6b826 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseQuintic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ec4a9f5d98bf04114b5a015db1308a60 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs new file mode 100644 index 0000000..0d93276 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs @@ -0,0 +1,21 @@ +using System; +using UnityEngine; + + +public static class GoEaseSinusoidal +{ + public static float EaseIn( float t, float b, float c, float d ) + { + return -c * (float)Math.Cos( t / d * ( Math.PI / 2 ) ) + c + b; + } + + public static float EaseOut( float t, float b, float c, float d ) + { + return c * (float)Math.Sin( t / d * ( Math.PI / 2 ) ) + b; + } + + public static float EaseInOut( float t, float b, float c, float d ) + { + return -c / 2 * ( (float)Math.Cos( Math.PI * t / d ) - 1 ) + b; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta new file mode 100644 index 0000000..65ae0e5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/GoEaseSinusoidal.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fa97311d39f04b93b833ca28fac10ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt new file mode 100644 index 0000000..4b171ff --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt @@ -0,0 +1,33 @@ +/* +Microsoft Public License (Ms-PL) + +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. + +1. Definitions + +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. + +A "contribution" is the original software, or any additions or changes to the software. + +A "contributor" is any person that distributes its contribution under this license. + +"Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights + +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations + +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. + +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. +*/ \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta new file mode 100644 index 0000000..cf14134 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/easing/easeEquationsLicense.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 098d0b0599d2b4fcc8c8f24379e8bf90 +TextScriptImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums.meta new file mode 100644 index 0000000..fcfe59c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3fdf9641baedb40338ca9a110aa99706 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs new file mode 100644 index 0000000..2a23635 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + + + +/// +/// defines what should be done in the event that a TweenProperty is being added to Go when an existing TweenProperty +/// of the same type with the same target object is already present +/// +public enum GoDuplicatePropertyRuleType +{ + None, // dont bother checking or doing anything + RemoveRunningProperty, // removes the property from the Tween that was already running + DontAddCurrentProperty // leaves the original property intact and doesnt add the current property +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta new file mode 100644 index 0000000..ad0ddca --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoDuplicatePropertyRuleType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7107639cda4a541a79a05bd60caf35c8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs new file mode 100644 index 0000000..85ece37 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs @@ -0,0 +1,50 @@ +using UnityEngine; +using System.Collections; + + + +public enum GoEaseType +{ + Linear, + + SineIn, + SineOut, + SineInOut, + + QuadIn, + QuadOut, + QuadInOut, + + CubicIn, + CubicOut, + CubicInOut, + + QuartIn, + QuartOut, + QuartInOut, + + QuintIn, + QuintOut, + QuintInOut, + + ExpoIn, + ExpoOut, + ExpoInOut, + + CircIn, + CircOut, + CircInOut, + + ElasticIn, + ElasticOut, + ElasticInOut, + Punch, + + BackIn, + BackOut, + BackInOut, + + BounceIn, + BounceOut, + BounceInOut +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta new file mode 100644 index 0000000..7af1d29 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoEaseType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e53d7306407a34ceaa133d772fa1ec3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs new file mode 100644 index 0000000..f85f14f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoLogLevel +{ + None, + Info, + Warn, + Error +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta new file mode 100644 index 0000000..12dac08 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLogLevel.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95f2b1a5decae452784d0c332801c1d1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs new file mode 100644 index 0000000..d6ac54a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using System.Collections; + + +/// +/// used by paths to identify what the object being tweened should look at +/// +public enum GoLookAtType +{ + None, + NextPathNode, + TargetTransform +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta new file mode 100644 index 0000000..8f47701 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLookAtType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08691283d482e4054b037fc5d4030e48 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs new file mode 100644 index 0000000..ceaddd9 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using System.Collections; + + + +public enum GoLoopType +{ + RestartFromBeginning, + PingPong +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta new file mode 100644 index 0000000..4919875 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoLoopType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8820e9c24b06041b8ab4157ec84b5f86 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs new file mode 100644 index 0000000..b9abc80 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +[System.Flags] +public enum GoShakeType +{ + Position = ( 1 << 0 ), + Scale = ( 1 << 1 ), + Eulers = ( 1 << 2 ) +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta new file mode 100644 index 0000000..ae54040 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoShakeType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83c69d81ac63f4b789dd05ab1f326517 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs new file mode 100644 index 0000000..89651d2 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoSplineType +{ + StraightLine, // 2 points + QuadraticBezier, // 3 points + CubicBezier, // 4 points + CatmullRom // 5+ points +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta new file mode 100644 index 0000000..ba9152f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoSplineType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3b24cf23dec3f4db7869ebfde6112be9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs new file mode 100644 index 0000000..3accbb7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoTweenState +{ + Running, + Paused, + Complete, + Destroyed +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta new file mode 100644 index 0000000..d863321 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoTweenState.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de15fdc9763ed4873b7021c616d7952d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs new file mode 100644 index 0000000..ffb1100 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections; + + +public enum GoUpdateType +{ + Update, + LateUpdate, + FixedUpdate, + TimeScaleIndependentUpdate +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta new file mode 100644 index 0000000..b0b6fc0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/enums/GoUpdateType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 634c22f604be24212ae1f75ddec523f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/extensions.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions.meta new file mode 100644 index 0000000..86f5f2c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cb14c988d1865428599a6a5bc46a79e5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs new file mode 100644 index 0000000..b384fd7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs @@ -0,0 +1,124 @@ +using UnityEngine; +using System.Collections; + + +public static class GoKitTweenExtensions +{ + #region Transform extensions + + // to tweens + public static GoTween rotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) ); + } + + + public static GoTween localRotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) ); + } + + + public static GoTween eulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) ); + } + + + public static GoTween localEulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) ); + } + + + public static GoTween positionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().position( endValue, isRelative ) ); + } + + + public static GoTween localPositionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) ); + } + + + public static GoTween scaleTo( this Transform self, float duration, float endValue, bool isRelative = false ) + { + return self.scaleTo( duration, new Vector3( endValue, endValue, endValue ), isRelative ); + } + + + public static GoTween scaleTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.to( self, duration, new GoTweenConfig().scale( endValue, isRelative ) ); + } + + + public static GoTween shake( this Transform self, float duration, Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false ) + { + return Go.to( self, duration, new GoTweenConfig().shake( shakeMagnitude, shakeType, frameMod, useLocalProperties ) ); + } + + + // from tweens + public static GoTween rotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) ); + } + + + public static GoTween localRotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) ); + } + + + public static GoTween eulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) ); + } + + + public static GoTween localEulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) ); + } + + + public static GoTween positionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().position( endValue, isRelative ) ); + } + + + public static GoTween localPositionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) ); + } + + + public static GoTween scaleFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false ) + { + return Go.from( self, duration, new GoTweenConfig().scale( endValue, isRelative ) ); + } + + #endregion + + + #region Material extensions + + public static GoTween colorTo( this Material self, float duration, Color endValue, string colorName = "_Color" ) + { + return Go.to( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) ); + } + + + public static GoTween colorFrom( this Material self, float duration, Color endValue, string colorName = "_Color" ) + { + return Go.from( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) ); + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta new file mode 100644 index 0000000..047f239 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/extensions/GoKitTweenExtensions.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21ffa6d37448541bead4c009180436bd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties.meta new file mode 100644 index 0000000..9fcc64e --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4204282772fc1408da934f8775d6da4f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs new file mode 100644 index 0000000..47d6e98 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs @@ -0,0 +1,236 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Reflection; + + +public static class GoTweenUtils +{ + /// + /// fetches the actual function for the given ease type + /// + public static Func easeFunctionForType( GoEaseType easeType ) + { + switch( easeType ) + { + case GoEaseType.Linear: + return GoEaseLinear.EaseNone; + + case GoEaseType.BackIn: + return GoEaseBack.EaseIn; + case GoEaseType.BackOut: + return GoEaseBack.EaseOut; + case GoEaseType.BackInOut: + return GoEaseBack.EaseInOut; + + case GoEaseType.BounceIn: + return GoEaseBounce.EaseIn; + case GoEaseType.BounceOut: + return GoEaseBounce.EaseOut; + case GoEaseType.BounceInOut: + return GoEaseBounce.EaseInOut; + + case GoEaseType.CircIn: + return GoEaseCircular.EaseIn; + case GoEaseType.CircOut: + return GoEaseCircular.EaseOut; + case GoEaseType.CircInOut: + return GoEaseCircular.EaseInOut; + + case GoEaseType.CubicIn: + return GoEaseCubic.EaseIn; + case GoEaseType.CubicOut: + return GoEaseCubic.EaseOut; + case GoEaseType.CubicInOut: + return GoEaseCubic.EaseInOut; + + case GoEaseType.ElasticIn: + return GoEaseElastic.EaseIn; + case GoEaseType.ElasticOut: + return GoEaseElastic.EaseOut; + case GoEaseType.ElasticInOut: + return GoEaseElastic.EaseInOut; + case GoEaseType.Punch: + return GoEaseElastic.Punch; + + case GoEaseType.ExpoIn: + return GoEaseExponential.EaseIn; + case GoEaseType.ExpoOut: + return GoEaseExponential.EaseOut; + case GoEaseType.ExpoInOut: + return GoEaseExponential.EaseInOut; + + case GoEaseType.QuadIn: + return GoEaseQuadratic.EaseIn; + case GoEaseType.QuadOut: + return GoEaseQuadratic.EaseOut; + case GoEaseType.QuadInOut: + return GoEaseQuadratic.EaseInOut; + + case GoEaseType.QuartIn: + return GoEaseQuartic.EaseIn; + case GoEaseType.QuartOut: + return GoEaseQuartic.EaseOut; + case GoEaseType.QuartInOut: + return GoEaseQuartic.EaseInOut; + + case GoEaseType.QuintIn: + return GoEaseQuintic.EaseIn; + case GoEaseType.QuintOut: + return GoEaseQuintic.EaseOut; + case GoEaseType.QuintInOut: + return GoEaseQuintic.EaseInOut; + + case GoEaseType.SineIn: + return GoEaseSinusoidal.EaseIn; + case GoEaseType.SineOut: + return GoEaseSinusoidal.EaseOut; + case GoEaseType.SineInOut: + return GoEaseSinusoidal.EaseInOut; + } + + return GoEaseLinear.EaseNone; + } + + + /// + /// either returns a super fast Delegate to set the given property or null if it couldn't be found + /// via reflection + /// + public static T setterForProperty( System.Object targetObject, string propertyName ) + { + // first get the property +#if NETFX_CORE + var propInfo = targetObject.GetType().GetRuntimeProperty( propertyName ); +#else + var propInfo = targetObject.GetType().GetProperty( propertyName ); +#endif + + if( propInfo == null ) + { + Debug.Log( "could not find property with name: " + propertyName ); + return default( T ); + } + +#if NETFX_CORE + // Windows Phone/Store new API + return (T)(object)propInfo.SetMethod.CreateDelegate( typeof( T ), targetObject ); +#else + return (T)(object)Delegate.CreateDelegate( typeof( T ), targetObject, propInfo.GetSetMethod() ); +#endif + } + + + /// + /// either returns a super fast Delegate to get the given property or null if it couldn't be found + /// via reflection + /// + public static T getterForProperty( System.Object targetObject, string propertyName ) + { + // first get the property +#if NETFX_CORE + var propInfo = targetObject.GetType().GetRuntimeProperty( propertyName ); +#else + var propInfo = targetObject.GetType().GetProperty( propertyName ); +#endif + + if( propInfo == null ) + { + Debug.Log( "could not find property with name: " + propertyName ); + return default( T ); + } + +#if NETFX_CORE + // Windows Phone/Store new API + return (T)(object)propInfo.GetMethod.CreateDelegate( typeof( T ), targetObject ); +#else + return (T)(object)Delegate.CreateDelegate( typeof( T ), targetObject, propInfo.GetGetMethod() ); +#endif + } + + + #region math functions + + /// + /// note for all lerps: normally a lerp would be something like the following: + /// val1 + ( val2 - val1 ) * t + /// or in more familiar terms: + /// start + ( end - start ) * t + /// + /// when lerping relatively, the formula simplifies to: + /// start + end * t + /// + /// for all the unclamped lerps in this class the diff value is precalculated and cached. that means these arent like normal + /// lerps where you pass in the start and end values. the "diff" paramter in each method should be either the cached + /// ( end - start ) for non-relative tweens or just end for relative tweens (that are not "from" tweens) + /// + + + /// + /// unclamped lerp from c1 to c2. diff should be c2 - c1 (or just c2 for relative lerps) + /// + public static Color unclampedColorLerp( Color c1, Color diff, float value ) + { + return new Color + ( + c1.r + diff.r * value, + c1.g + diff.g * value, + c1.b + diff.b * value, + c1.a + diff.a * value + ); + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector2 unclampedVector2Lerp( Vector2 v1, Vector2 diff, float value ) + { + return new Vector2 + ( + v1.x + diff.x * value, + v1.y + diff.y * value + ); + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector3 unclampedVector3Lerp( Vector3 v1, Vector3 diff, float value ) + { + return new Vector3 + ( + v1.x + diff.x * value, + v1.y + diff.y * value, + v1.z + diff.z * value + ); + + /* + return new Vector3 + ( + v1.x + ( v2.x - v1.x ) * value, + v1.y + ( v2.y - v1.y ) * value, + v1.z + ( v2.z - v1.z ) * value + ); + */ + } + + + /// + /// unclamped lerp from v1 to v2. diff should be v2 - v1 (or just v2 for relative lerps) + /// + public static Vector4 unclampedVector4Lerp( Vector4 v1, Vector4 diff, float value ) + { + return new Vector4 + ( + v1.x + diff.x * value, + v1.y + diff.y * value, + v1.z + diff.z * value, + v1.w + diff.w * value + ); + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta new file mode 100644 index 0000000..ed58ca4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/GoTweenUtils.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a79611b258ffd496990f232247eefc3a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts.meta new file mode 100644 index 0000000..18ec7f9 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b015a50b4ac6b4515bd5116d6da7ff5d +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs new file mode 100644 index 0000000..8f0df3f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for any color tweens (MaterialColor and ColorTween) +/// +public abstract class AbstractColorTweenProperty : AbstractTweenProperty +{ + protected Material _target; + + protected Color _originalEndValue; + protected Color _startValue; + protected Color _endValue; + protected Color _diffValue; + + + public AbstractColorTweenProperty( Color endValue, bool isRelative ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return ( target is Material || target is GameObject || target is Transform || target is Renderer ); + } + + + public override void init( GoTween owner ) + { + // setup our target before initting + if( owner.target is Material ) + _target = (Material)owner.target; + else if( owner.target is GameObject ) + _target = ((GameObject)owner.target).GetComponent().material; + else if( owner.target is Transform ) + _target = ((Transform)owner.target).GetComponent().material; + else if( owner.target is Renderer ) + _target = ((Renderer)owner.target).material; + + base.init( owner ); + } + + + public override void prepareForUse() + { + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta new file mode 100644 index 0000000..be55103 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06d1e7d9b36ea4b9fb70c40298d959ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs new file mode 100644 index 0000000..0b5639a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for generic Quaternion props +/// +public abstract class AbstractQuaternionTweenProperty : AbstractTweenProperty +{ + protected Transform _target; + + protected Quaternion _originalEndValue; + protected Quaternion _startValue; + protected Quaternion _endValue; + + public AbstractQuaternionTweenProperty() + {} + + + public AbstractQuaternionTweenProperty( Quaternion endValue, bool isRelative = false ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + if (_isRelative && !_ownerTween.isFrom) + _endValue = _startValue * _endValue; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta new file mode 100644 index 0000000..970a921 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractQuaternionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91d9cba1487704697be079449afdefbb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs new file mode 100644 index 0000000..ce1f3fe --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs @@ -0,0 +1,112 @@ +using UnityEngine; +using System; +using System.Collections; + + +public abstract class AbstractTweenProperty +{ + protected bool _isInitialized; + public bool isInitialized { get { return _isInitialized; } } + + protected bool _isRelative; + protected GoTween _ownerTween; + + protected Func _easeFunction; + + + + public AbstractTweenProperty( bool isRelative = false ) + { + _isRelative = isRelative; + } + + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + /// + /// checks to see if a TweenProperty matches another. checks propertyNames of IGenericPropertys first then + /// resorts to direct type checking + /// + public override bool Equals( object obj ) + { + // null check first + if( obj == null ) + return false; + + // handle IGenericProperty comparisons which just have the property name checked + if( this is IGenericProperty && obj is IGenericProperty ) + return ((IGenericProperty)this).propertyName == ((IGenericProperty)obj).propertyName; + + // check for the same types + if( obj.GetType() == this.GetType() ) + return true; + + return base.Equals( obj ); + } + + + /// + /// called by a Tween just after this property is validated and added to the Tweens property list + /// + public virtual void init( GoTween owner ) + { + _isInitialized = true; + _ownerTween = owner; + + // if we dont have an easeFunction use the owners type + if( _easeFunction == null ) + setEaseType( owner.easeType ); + } + + + /// + /// clones the instance + /// + public AbstractTweenProperty clone() + { + var clone = MemberwiseClone() as AbstractTweenProperty; + clone._ownerTween = null; + clone._isInitialized = false; + clone._easeFunction = null; + + return clone; + } + + + /// + /// sets the ease type for this tween property + /// technically, this should be an internal method + /// + public void setEaseType( GoEaseType easeType ) + { + _easeFunction = GoTweenUtils.easeFunctionForType( easeType ); + } + + + /// + /// each TweenProperty should override this to ensure the object is the correct type + /// + public virtual bool validateTarget( object target ) + { + return true; + } + + + /// + /// subclasses should get the eased time then set the new value on the object + /// + public abstract void tick( float totalElapsedTime ); + + + /// + /// called when a Tween is initially started. + /// subclasses should strongly type the start/end/target and handle isFrom with + /// regard to setting the proper start/end values + /// + public abstract void prepareForUse(); + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta new file mode 100644 index 0000000..961823f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf8a9f19ff8c84f3d9b75558baec7117 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs new file mode 100644 index 0000000..9910255 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs @@ -0,0 +1,49 @@ +using UnityEngine; +using System.Collections; + + +/// +/// base class for position, scale, eulers and the generic Vector3 props +/// +public abstract class AbstractVector3TweenProperty : AbstractTweenProperty +{ + protected Transform _target; + + protected Vector3 _originalEndValue; + protected Vector3 _startValue; + protected Vector3 _endValue; + protected Vector3 _diffValue; + + + public AbstractVector3TweenProperty() + {} + + + public AbstractVector3TweenProperty( Vector3 endValue, bool isRelative = false ) : base( isRelative ) + { + _originalEndValue = endValue; + } + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public void resetWithNewEndValue( Vector3 endValue ) + { + _originalEndValue = endValue; + prepareForUse(); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta new file mode 100644 index 0000000..8c7cf0a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/abstracts/AbstractVector3TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f73ba6304fca4593ac3756c9c01864e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes.meta new file mode 100644 index 0000000..c475535 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 568b4e56e499a47b6b1edebd41563940 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs new file mode 100644 index 0000000..2190267 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class ColorTweenProperty : AbstractColorTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + + public ColorTweenProperty( string propertyName, Color endValue, bool isRelative = false ) : base( endValue, isRelative ) + { + this.propertyName = propertyName; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var newColor = GoTweenUtils.unclampedColorLerp( _startValue, _diffValue, easedTime ); + + _setter( newColor ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta new file mode 100644 index 0000000..54df139 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/ColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8feba848df2ec4a0cb2b5c4b11d09fde +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs new file mode 100644 index 0000000..aff23cd --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs @@ -0,0 +1,66 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class FloatTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected float _originalEndValue; + protected float _startValue; + protected float _endValue; + protected float _diffValue; + + + public FloatTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // setup the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedValue = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + _setter( easedValue ); + } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta new file mode 100644 index 0000000..60e05fe --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/FloatTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69fddc80fa08840df95aeb0cc5631b3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs new file mode 100644 index 0000000..5877656 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using System.Collections; + + +/// +/// interface that simply defines that a generic property tween must have a propertyName. this has the side effect +/// of letting us easily compare generic property tweens vs stongly typed tweens +/// +public interface IGenericProperty +{ + string propertyName { get; } +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta new file mode 100644 index 0000000..80ed0c2 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IGenericProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21e55e5f9ed3e437ba9c943917440083 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs new file mode 100644 index 0000000..d5086d4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs @@ -0,0 +1,68 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class IntTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + + private Action _setter; + + protected int _originalEndValue; + protected int _startValue; + protected int _endValue; + protected int _diffValue; + + + public IntTweenProperty( string propertyName, int endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedValue = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + _setter( (int)Math.Round( easedValue ) ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta new file mode 100644 index 0000000..3792d14 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/IntTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 26ecf98b31f464c3eab865287ed4f9b2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs new file mode 100644 index 0000000..083449e --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector2TweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected Vector2 _originalEndValue; + protected Vector2 _startValue; + protected Vector2 _endValue; + protected Vector2 _diffValue; + + + public Vector2TweenProperty( string propertyName, Vector2 endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector2Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta new file mode 100644 index 0000000..69e15cc --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector2TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22a05f02b0d2d4c579d00c2db33555b1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs new file mode 100644 index 0000000..78d039b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3PathTweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + + private Action _setter; + private GoSpline _path; + private Vector3 _startValue; + + + public Vector3PathTweenProperty( string propertyName, GoSpline path, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _path = path; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // if this is a from tween first reverse the path then build it. we unreverse in case we were copied + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + { + _startValue = _path.getLastNode(); + } + else + { + // retrieve the getter only when needed + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + _startValue = getter(); + } + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta new file mode 100644 index 0000000..1a4153b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3PathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bf2fb33fe8d04ad2a177ab6038c1965 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs new file mode 100644 index 0000000..bd79c8b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3TweenProperty : AbstractVector3TweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + + public Vector3TweenProperty( string propertyName, Vector3 endValue, bool isRelative = false ) : base( endValue, isRelative ) + { + this.propertyName = propertyName; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta new file mode 100644 index 0000000..709bdae --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ccd327e369c14fac909ab0b6d1d0da5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs new file mode 100644 index 0000000..477bef6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs @@ -0,0 +1,71 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3XTweenProperty : AbstractVector3TweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + protected Action _setter; + protected Func _getter; + + protected new float _originalEndValue; + protected new float _startValue; + protected new float _endValue; + protected new float _diffValue; + + + public Vector3XTweenProperty( string propertyName, float endValue, bool isRelative = false ) + { + this.propertyName = propertyName; + _isRelative = isRelative; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().x; + } + else + { + _startValue = _getter().x; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.x = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta new file mode 100644 index 0000000..6b2acb5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3XTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e4e4541e602d4fbcba6aa19d256cf94 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs new file mode 100644 index 0000000..3096140 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3YTweenProperty : Vector3XTweenProperty +{ + public Vector3YTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( propertyName, endValue, isRelative ) + {} + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().y; + } + else + { + _startValue = _getter().y; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.y = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta new file mode 100644 index 0000000..e4d798f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3YTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 576b35d4282a84f26b445f338480bd4d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs new file mode 100644 index 0000000..50eff0c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector3ZTweenProperty : Vector3XTweenProperty +{ + public Vector3ZTweenProperty( string propertyName, float endValue, bool isRelative = false ) : base( propertyName, endValue, isRelative ) + {} + + + public override void prepareForUse() + { + // retrieve the getter + _getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _getter().z; + } + else + { + _startValue = _getter().z; + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var currentValue = _getter(); + currentValue.z = _easeFunction( totalElapsedTime, _startValue, _diffValue, _ownerTween.duration ); + + _setter( currentValue ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta new file mode 100644 index 0000000..334ca96 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector3ZTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31797a4f425d143babbdfd3ab73f8189 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs new file mode 100644 index 0000000..bac5b0d --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class Vector4TweenProperty : AbstractTweenProperty, IGenericProperty +{ + public string propertyName { get; private set; } + private Action _setter; + + protected Vector4 _originalEndValue; + protected Vector4 _startValue; + protected Vector4 _endValue; + protected Vector4 _diffValue; + + + public Vector4TweenProperty( string propertyName, Vector4 endValue, bool isRelative = false ) : base( isRelative ) + { + this.propertyName = propertyName; + _originalEndValue = endValue; + } + + + /// + /// validation checks to make sure the target has a valid property with an accessible setter + /// + public override bool validateTarget( object target ) + { + // cache the setter + _setter = GoTweenUtils.setterForProperty>( target, propertyName ); + return _setter != null; + } + + + public override void prepareForUse() + { + // retrieve the getter + var getter = GoTweenUtils.getterForProperty>( _ownerTween.target, propertyName ); + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _endValue = _startValue; + _endValue = getter(); + } + else + { + _startValue = getter(); + } + + // prep the diff value + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _endValue; + else + _diffValue = _endValue - _startValue; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector4Lerp( _startValue, _diffValue, easedTime ); + + _setter( vec ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta new file mode 100644 index 0000000..546b274 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/genericTypes/Vector4TweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cb950a7d0cdd24204ac8d2be1336b0ea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing.meta new file mode 100644 index 0000000..b0abd80 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8c076f7b25e9c4c27b52cc7847d14056 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs new file mode 100644 index 0000000..18617ac --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs @@ -0,0 +1,123 @@ +using UnityEngine; +using System.Collections; + + +/// +/// based on the idea by Mike Talbot here http://whydoidoit.com/2012/04/01/smoothed-vector3-quaternions-and-floats-in-unity/ +/// +/// lerps or slerps a Quaternion over time. usage is like so: +/// +/// mySmoothedQuat = target.rotation; // creates the GoSmoothedQuaternion +/// mySmoothedQuat.smoothValue = someNewQuaternion; // update the smoothValue whenever you would normally set the value on your object +/// target.rotation = mySmoothedQuat.smoothValue; // use the smoothValue property in an Update method to lerp/slerp it +/// +/// +public struct GoSmoothedQuaternion +{ + public GoSmoothingType smoothingType; + public float duration; + + private Quaternion _currentValue; + private Quaternion _target; + private Quaternion _start; + private float _startTime; + + + public GoSmoothedQuaternion( Quaternion quat ) + { + _currentValue = quat; + _start = quat; + _target = quat; + _startTime = Time.time; + + // set sensible defaults + duration = 0.2f; + smoothingType = GoSmoothingType.Lerp; + } + + + public Quaternion smoothValue + { + get + { + // how far along are we? + var t = ( Time.time - _startTime ) / duration; + + switch( smoothingType ) + { + case GoSmoothingType.Lerp: + _currentValue = Quaternion.Lerp( _start, _target, t ); + break; + case GoSmoothingType.Slerp: + _currentValue = Quaternion.Slerp( _start, _target, t ); + break; + } + + return _currentValue; + } + set + { + _start = smoothValue; + _startTime = Time.time; + _target = value; + } + } + + + public float x + { + get + { + return _currentValue.x; + } + set + { + smoothValue = new Quaternion( value, _target.y, _target.z, _target.w ); + } + } + + public float y + { + get + { + return _currentValue.y; + } + set + { + smoothValue = new Quaternion( _target.x, value, _target.y, _target.w ); + } + } + + public float z + { + get + { + return _currentValue.z; + } + set + { + smoothValue = new Quaternion( _target.x, _target.y, value, _target.w ); + } + + } + + public float w + { + get + { + return _currentValue.w; + } + set + { + + smoothValue = new Quaternion( _target.x, _target.y, _target.z, value ); + } + } + + + public static implicit operator GoSmoothedQuaternion( Quaternion q ) + { + return new GoSmoothedQuaternion( q ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta new file mode 100644 index 0000000..3df77a4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedQuaternion.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 806c433a2491044ec8c3f50375392041 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs new file mode 100644 index 0000000..32bfc79 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs @@ -0,0 +1,101 @@ +using UnityEngine; +using System.Collections; + + + +public struct GoSmoothedVector3 +{ + public GoSmoothingType smoothingType; + public float duration; + + private Vector3 _currentValue; + private Vector3 _target; + private Vector3 _start; + private float _startTime; + + + public GoSmoothedVector3( Vector3 vector ) + { + _currentValue = vector; + _start = vector; + _target = vector; + _startTime = Time.time; + + // set sensible defaults + duration = 0.2f; + smoothingType = GoSmoothingType.Lerp; + } + + + public Vector3 smoothValue + { + get + { + // how far along are we? + var t = ( Time.time - _startTime ) / duration; + + switch( smoothingType ) + { + case GoSmoothingType.Lerp: + _currentValue = Vector3.Lerp( _start, _target, t ); + break; + case GoSmoothingType.Slerp: + _currentValue = Vector3.Slerp( _start, _target, t ); + break; + } + + return _currentValue; + } + private set + { + _start = smoothValue; + _startTime = Time.time; + _target = value; + } + } + + + public float x + { + get + { + return _currentValue.x; + } + set + { + smoothValue = new Vector3( value, _target.y, _target.z ); + } + } + + public float y + { + get + { + return _currentValue.y; + } + set + { + smoothValue = new Vector3( _target.x, value, _target.y ); + } + } + + public float z + { + get + { + return _currentValue.z; + } + set + { + smoothValue = new Vector3( _target.x, _target.y, value ); + } + + } + + + public static implicit operator GoSmoothedVector3( Vector3 v ) + { + return new GoSmoothedVector3( v ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta new file mode 100644 index 0000000..fd93a4a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothedVector3.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b796c056272a04cfea12f664f35c98e5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs new file mode 100644 index 0000000..6e7a779 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs @@ -0,0 +1,9 @@ +using UnityEngine; +using System.Collections; + + +public enum GoSmoothingType +{ + Lerp, + Slerp +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta new file mode 100644 index 0000000..5ef58f7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/smoothing/GoSmoothingType.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b85c904ec09ed418abbdc697bdd916fc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes.meta new file mode 100644 index 0000000..f011a2a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5ad9b033696fb463ea98ab0fb95a3deb +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs new file mode 100644 index 0000000..966f7d8 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using System.Collections; + + +public class EulerAnglesTweenProperty : AbstractVector3TweenProperty +{ + private bool _useLocalEulers; + public bool useLocalEulers { get { return _useLocalEulers; } } + + public EulerAnglesTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalEulers = false ) : base( endValue, isRelative ) + { + _useLocalEulers = useLocalEulers; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalEulers == ((EulerAnglesTweenProperty)obj)._useLocalEulers; + + // if we get here, we need to see if the other object is a rotation tween of the same kind + var otherAsRotation = obj as RotationTweenProperty; + if( otherAsRotation != null ) + return this._useLocalEulers == otherAsRotation.useLocalRotation; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // swap the start and end if this is a from tween + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalEulers ) + _endValue = _target.localEulerAngles; + else + _endValue = _target.eulerAngles; + } + else + { + if( _useLocalEulers ) + _startValue = _target.localEulerAngles; + else + _startValue = _target.eulerAngles; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalEulers ) + _target.localEulerAngles = vec; + else + _target.eulerAngles = vec; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta new file mode 100644 index 0000000..96240d6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/EulerAnglesTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5bbfcb772b13641e1afec2d91d2940f7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs new file mode 100644 index 0000000..d9f3427 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs @@ -0,0 +1,63 @@ +using UnityEngine; +using System.Collections; + + +public class MaterialColorTweenProperty : AbstractColorTweenProperty +{ + private string _materialColorName; + + + public MaterialColorTweenProperty( Color endValue, string colorName = "_Color", bool isRelative = false ) : base( endValue, isRelative ) + { + _materialColorName = colorName; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare our material names + if( base.Equals( obj ) ) + return this._materialColorName == ((MaterialColorTweenProperty)obj)._materialColorName; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _target.GetColor( _materialColorName ); + } + else + { + _startValue = _target.GetColor( _materialColorName ); + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var color = GoTweenUtils.unclampedColorLerp( _startValue, _diffValue, easedTime ); + + _target.SetColor( _materialColorName, color ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta new file mode 100644 index 0000000..fd33d2a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/MaterialColorTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74b57762d8d034ccc9b9f37bb8c70019 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs new file mode 100644 index 0000000..fd4f425 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs @@ -0,0 +1,131 @@ +using UnityEngine; +using System.Collections; + + +/// +/// tweens position along a path at constant speed between nodes. isRelative makes the path movement +/// relative to the start position of the object. a "from" tween will reverse the path and make the start +/// position be the last node in the path. +/// +public class PositionPathTweenProperty : AbstractTweenProperty +{ + protected bool _useLocalPosition; + public bool useLocalPosition { get { return _useLocalPosition; } } + + protected Transform _target; + protected Vector3 _startValue; + + private GoSpline _path; + private GoLookAtType _lookAtType = GoLookAtType.None; + private Transform _lookTarget; + private GoSmoothedQuaternion _smoothedRotation; + + + public PositionPathTweenProperty( GoSpline path, bool isRelative = false, bool useLocalPosition = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null ) : base( isRelative ) + { + _path = path; + _useLocalPosition = useLocalPosition; + _lookAtType = lookAtType; + _lookTarget = lookTarget; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalPosition == ((PositionPathTweenProperty)obj)._useLocalPosition; + + // if we get here, we need to see if the other object is a position tween of the same kind + var otherAsPosition = obj as PositionTweenProperty; + if( otherAsPosition != null ) + return this._useLocalPosition == otherAsPosition.useLocalPosition; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + // if this is a from tween first reverse the path then build it + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + { + _startValue = _path.getLastNode(); + } + else + { + if( _useLocalPosition ) + _startValue = _target.localPosition; + else + _startValue = _target.position; + } + + // validate the lookTarget if we are set to look at it + if( _lookAtType == GoLookAtType.TargetTransform ) + { + if( _lookTarget == null ) + _lookAtType = GoLookAtType.None; + } + + // prep our smoothed rotation + _smoothedRotation = _target.rotation; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + + // handle look types + switch( _lookAtType ) + { + case GoLookAtType.NextPathNode: + { + _smoothedRotation.smoothValue = vec.Equals( _target.position ) ? Quaternion.identity : Quaternion.LookRotation( vec - _target.position ); + _target.rotation = _smoothedRotation.smoothValue; + //var lookAtNode = ( _ownerTween.isReversed || _ownerTween.isLoopoingBackOnPingPong ) ? _path.getPreviousNode() : _path.getNextNode(); + //_target.LookAt( lookAtNode, Vector3.up ); + break; + } + case GoLookAtType.TargetTransform: + { + _target.LookAt( _lookTarget, Vector3.up ); + break; + } + } + + + // assign the position + if( _useLocalPosition ) + _target.localPosition = vec; + else + _target.position = vec; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta new file mode 100644 index 0000000..a23bbef --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionPathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c9f58caa7cd847519c748a7132b4e9c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs new file mode 100644 index 0000000..ae458f1 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs @@ -0,0 +1,92 @@ +using UnityEngine; +using System.Collections; + + +public class PositionTweenProperty : AbstractVector3TweenProperty +{ + protected bool _useLocalPosition; + public bool useLocalPosition { get { return _useLocalPosition; } } + + public PositionTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalPosition = false ) : base( endValue, isRelative ) + { + _useLocalPosition = useLocalPosition; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalPosition == ((PositionTweenProperty)obj)._useLocalPosition; + + // if we get here, we need to see if the other object is a position path tween of the same kind + var otherAsPositionPath = obj as PositionPathTweenProperty; + if( otherAsPositionPath != null ) + return this._useLocalPosition == otherAsPositionPath.useLocalPosition; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + if( _useLocalPosition ) + { + if (_isRelative) + _startValue = _target.localPosition + _endValue; + else + _startValue = _endValue; + + _endValue = _target.localPosition; + } + else + { + if (_isRelative) + _startValue = _target.position + _endValue; + else + _startValue = _endValue; + + _endValue = _target.position; + } + } + else + { + if( _useLocalPosition ) + _startValue = _target.localPosition; + else + _startValue = _target.position; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalPosition ) + _target.localPosition = vec; + else + _target.position = vec; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta new file mode 100644 index 0000000..73cb0b2 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/PositionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f372333393a1a4501a09d64bc262d2e4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs new file mode 100644 index 0000000..606d3cb --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs @@ -0,0 +1,76 @@ +using UnityEngine; +using System.Collections; + + +public class RotationQuaternionTweenProperty : AbstractQuaternionTweenProperty +{ + private bool _useLocalRotation; + public bool useLocalRotation { get { return _useLocalRotation; } } + + + public RotationQuaternionTweenProperty( Quaternion endValue, bool isRelative = false, bool useLocalRotation = false ) : base( endValue, isRelative ) + { + _useLocalRotation = useLocalRotation; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalRotation == ((RotationQuaternionTweenProperty)obj)._useLocalRotation; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalRotation ) + _endValue = _target.localRotation; + else + _endValue = _target.rotation; + } + else + { + if( _useLocalRotation ) + _startValue = _target.localRotation; + else + _startValue = _target.rotation; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + Quaternion newOrientation = Quaternion.Slerp (_startValue, _endValue, easedTime); + + if( _useLocalRotation ) + _target.localRotation = newOrientation; + else + _target.rotation = newOrientation; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta new file mode 100644 index 0000000..1a306eb --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationQuaternionTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5a476a934239a4681b4241f6cce8aa62 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs new file mode 100644 index 0000000..b858a0b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs @@ -0,0 +1,85 @@ +using UnityEngine; +using System.Collections; + + +public class RotationTweenProperty : AbstractVector3TweenProperty +{ + private bool _useLocalRotation; + public bool useLocalRotation { get { return _useLocalRotation; } } + + + public RotationTweenProperty( Vector3 endValue, bool isRelative = false, bool useLocalRotation = false ) : base( endValue, isRelative ) + { + _useLocalRotation = useLocalRotation; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare if we are both using local values + if( base.Equals( obj ) ) + return this._useLocalRotation == ((RotationTweenProperty)obj)._useLocalRotation; + + // if we get here, we need to see if the other object is a eulerAngles tween of the same kind + var otherAsEuler = obj as EulerAnglesTweenProperty; + if( otherAsEuler != null ) + return this._useLocalRotation == otherAsEuler.useLocalEulers; + + return false; + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + + if( _useLocalRotation ) + _endValue = _target.localRotation.eulerAngles; + else + _endValue = _target.rotation.eulerAngles; + } + else + { + if( _useLocalRotation ) + _startValue = _target.localRotation.eulerAngles; + else + _startValue = _target.rotation.eulerAngles; + } + + // handle rotation carefully: when not relative, we always want to go the shortest possible distance to the new angle + if( _isRelative && !_ownerTween.isFrom ) + _diffValue = _startValue + _endValue; + else + _diffValue = new Vector3( Mathf.DeltaAngle( _startValue.x, _endValue.x ), Mathf.DeltaAngle( _startValue.y, _endValue.y ), Mathf.DeltaAngle( _startValue.z, _endValue.z ) ); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + + if( _useLocalRotation ) + _target.localRotation = Quaternion.Euler( vec ); + else + _target.rotation = Quaternion.Euler( vec ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta new file mode 100644 index 0000000..2402d96 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/RotationTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e783a8e5c400d4037be1e46fe3c33ee0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs new file mode 100644 index 0000000..dbc3a58 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs @@ -0,0 +1,77 @@ +using UnityEngine; +using System.Collections; + + +/// +/// tweens scale along a path at constant speed between nodes. isRelative makes the path scale +/// relative to the start scale of the object. a "from" tween will reverse the path and make the start +/// scale be the last node in the path. +/// +public class ScalePathTweenProperty : AbstractTweenProperty +{ + protected Transform _target; + protected Vector3 _startValue; + + private GoSpline _path; + + + public ScalePathTweenProperty( GoSpline path, bool isRelative = false ) : base( isRelative ) + { + _path = path; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // if base already determined that we are equal no need to check further + if( base.Equals( obj ) ) + return true; + + // we can be equal if the other object is a ScaleTweenProperty + return obj.GetType() == typeof( ScaleTweenProperty ); + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + // if this is a from tween first reverse the path then build it + if( _ownerTween.isFrom ) + _path.reverseNodes(); + else + _path.unreverseNodes(); + + _path.buildPath(); + + // a from tween means the start value is the last node + if( _ownerTween.isFrom ) + _startValue = _path.getLastNode(); + else + _startValue = _target.localScale; + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + var vec = _path.getPointOnPath( easedTime ); + + // if we are relative, add the vec to our startValue + if( _isRelative ) + vec += _startValue; + + _target.localScale = vec; + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta new file mode 100644 index 0000000..abdd126 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScalePathTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed2a9c26628f648cd812a55c3cc09572 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs new file mode 100644 index 0000000..ee6fe66 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System.Collections; + + +public class ScaleTweenProperty : AbstractVector3TweenProperty +{ + public ScaleTweenProperty( Vector3 endValue, bool isRelative = false ) : base( endValue, isRelative ) + {} + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // if base already determined that we are equal no need to check further + if( base.Equals( obj ) ) + return true; + + // we can be equal if the other object is a ScalePathTweenProperty + return obj.GetType() == typeof( ScalePathTweenProperty ); + } + + #endregion + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + + _endValue = _originalEndValue; + + // if this is a from tween we need to swap the start and end values + if( _ownerTween.isFrom ) + { + _startValue = _endValue; + _endValue = _target.localScale; + } + else + { + _startValue = _target.localScale; + } + + base.prepareForUse(); + } + + + public override void tick( float totalElapsedTime ) + { + var easedTime = _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + _target.localScale = GoTweenUtils.unclampedVector3Lerp( _startValue, _diffValue, easedTime ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta new file mode 100644 index 0000000..2e7d42f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ScaleTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af4196a114d624232b278034ec06ce24 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs new file mode 100644 index 0000000..ed25968 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs @@ -0,0 +1,135 @@ +using UnityEngine; +using System.Collections; + + +public class ShakeTweenProperty : AbstractTweenProperty +{ + private Transform _target; + private Vector3 _shakeMagnitude; + + private Vector3 _originalEndValue; + private Vector3 _startPosition; + private Vector3 _startScale; + private Vector3 _startEulers; + + private GoShakeType _shakeType; + private int _frameCount; + private int _frameMod; + private bool _useLocalProperties; + public bool useLocalProperties { get { return _useLocalProperties; } } + + + /// + /// you can shake any combination of position, scale and eulers by passing in a bitmask of the types you want to shake. frameMod + /// allows you to specify what frame count the shakes should occur on. for example, a frameMod of 3 would mean that only when + /// frameCount % 3 == 0 will the shake occur + /// + public ShakeTweenProperty( Vector3 shakeMagnitude, GoShakeType shakeType, int frameMod = 1, bool useLocalProperties = false ) : base( true ) + { + _shakeMagnitude = shakeMagnitude; + _shakeType = shakeType; + _frameMod = frameMod; + _useLocalProperties = useLocalProperties; + } + + + #region Object overrides + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + + public override bool Equals( object obj ) + { + // start with a base check and then compare our material names + if( base.Equals( obj ) ) + return this._shakeType == ((ShakeTweenProperty)obj)._shakeType; + + return false; + } + + #endregion + + + public override bool validateTarget( object target ) + { + return target is Transform; + } + + + public override void prepareForUse() + { + _target = _ownerTween.target as Transform; + _frameCount = 0; + + // store off any properties we will be shaking + if( ( _shakeType & GoShakeType.Position ) != 0 ) + { + if( _useLocalProperties ) + _startPosition = _target.localPosition; + else + _startPosition = _target.position; + } + + if( ( _shakeType & GoShakeType.Eulers ) != 0 ) + { + if( _useLocalProperties ) + _startEulers = _target.eulerAngles; + else + _startEulers = _target.eulerAngles; + } + + if( ( _shakeType & GoShakeType.Scale ) != 0 ) + _startScale = _target.localScale; + } + + + private Vector3 randomDiminishingTarget( float falloffValue ) + { + return new Vector3 + ( + Random.Range( -_shakeMagnitude.x, _shakeMagnitude.x ) * falloffValue, + Random.Range( -_shakeMagnitude.y, _shakeMagnitude.y ) * falloffValue, + Random.Range( -_shakeMagnitude.z, _shakeMagnitude.z ) * falloffValue + ); + } + + + public override void tick( float totalElapsedTime ) + { + // should we skip any frames? + if( _frameMod > 1 && ++_frameCount % _frameMod != 0 ) + return; + + // we want 1 minus the eased time so that we go from 1 - 0 for a shake + var easedTime = 1 - _easeFunction( totalElapsedTime, 0, 1, _ownerTween.duration ); + + + // shake any properties required + if( ( _shakeType & GoShakeType.Position ) != 0 ) + { + var val = _startPosition + randomDiminishingTarget( easedTime ); + if( _useLocalProperties ) + _target.localPosition = val; + else + _target.position = val; + } + + if( ( _shakeType & GoShakeType.Eulers ) != 0 ) + { + var val = _startEulers + randomDiminishingTarget( easedTime ); + if( _useLocalProperties ) + _target.localEulerAngles = val; + else + _target.eulerAngles = val; + } + + if( ( _shakeType & GoShakeType.Scale ) != 0 ) + { + _target.localScale = _startScale + randomDiminishingTarget( easedTime ); + } + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta new file mode 100644 index 0000000..fb16eaa --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/specificTypes/ShakeTweenProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cf366ef096364042b041e422af86bbc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines.meta new file mode 100644 index 0000000..b0a20f8 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 82ff7a332193a46a0aed718a4d6af4ba +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs new file mode 100644 index 0000000..055e0eb --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs @@ -0,0 +1,105 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public abstract class AbstractGoSplineSolver +{ + protected List _nodes; + public List nodes { get { return _nodes; } } + protected float _pathLength; + + // how many subdivisions should we divide each segment into? higher values take longer to build and lookup but + // result in closer to actual constant velocity + protected int totalSubdivisionsPerNodeForLookupTable = 5; + protected Dictionary _segmentTimeForDistance; // holds data in the form [time:distance] as a lookup table + + + + // the default implementation breaks the spline down into segments and approximates distance by adding up + // the length of each segment + public virtual void buildPath() + { + var totalSudivisions = _nodes.Count * totalSubdivisionsPerNodeForLookupTable; + _pathLength = 0; + float timePerSlice = 1f / totalSudivisions; + + // we dont care about the first node for distances because they are always t:0 and len:0 + _segmentTimeForDistance = new Dictionary( totalSudivisions ); + + + var lastPoint = getPoint( 0 ); + + // skip the first node and wrap 1 extra node + for( var i = 1; i < totalSudivisions + 1; i++ ) + { + // what is the current time along the path? + float currentTime = timePerSlice * i; + + var currentPoint = getPoint( currentTime ); + _pathLength += Vector3.Distance( currentPoint, lastPoint ); + lastPoint = currentPoint; + + _segmentTimeForDistance.Add( currentTime, _pathLength ); + } + } + + + public abstract void closePath(); + + + // gets the raw point not taking into account constant speed. used for drawing gizmos + public abstract Vector3 getPoint( float t ); + + + // gets the point taking in to account constant speed. the default implementation approximates the length of the spline + // by walking it and calculating the distance between each node + public virtual Vector3 getPointOnPath( float t ) + { + // we know exactly how far along the path we want to be from the passed in t + var targetDistance = _pathLength * t; + + // store the previous and next nodes in our lookup table + var previousNodeTime = 0f; + var previousNodeLength = 0f; + var nextNodeTime = 0f; + var nextNodeLength = 0f; + + // loop through all the values in our lookup table and find the two nodes our targetDistance falls between + foreach( var item in _segmentTimeForDistance ) + { + // have we passed our targetDistance yet? + if( item.Value >= targetDistance ) + { + nextNodeTime = item.Key; + nextNodeLength = item.Value; + + if( previousNodeTime > 0 ) + previousNodeLength = _segmentTimeForDistance[previousNodeTime]; + + break; + } + previousNodeTime = item.Key; + } + + // translate the values from the lookup table estimating the arc length between our known nodes from the lookup table + var segmentTime = nextNodeTime - previousNodeTime; + var segmentLength = nextNodeLength - previousNodeLength; + var distanceIntoSegment = targetDistance - previousNodeLength; + + t = previousNodeTime + ( distanceIntoSegment / segmentLength ) * segmentTime; + + return getPoint( t ); + } + + + public void reverseNodes() + { + _nodes.Reverse(); + } + + + public virtual void drawGizmos() + {} + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta new file mode 100644 index 0000000..a3d749f --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/AbstractGoSplineSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f87ecb9f470844d2abef8dbbd08a0102 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs new file mode 100644 index 0000000..b165a2a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs @@ -0,0 +1,240 @@ +// spline equation courtesy Andeeee's CRSpline (http://forum.unity3d.com/threads/32954-Waypoints-and-constant-variable-speed-problems?p=213942&viewfull=1#post213942) + +using UnityEngine; +using System.IO; +using System.Collections; +using System.Collections.Generic; + + +public class GoSpline +{ + public int currentSegment { get; private set; } + public bool isClosed { get; private set; } + public GoSplineType splineType { get; private set; } + + // used by the visual path editor + public List nodes { get { return _solver.nodes; } } + + private bool _isReversed; // internal flag that lets us know if our nodes are reversed or not + private AbstractGoSplineSolver _solver; + + + // default constructor + public GoSpline( List nodes, bool useStraightLines = false ) + { + // determine spline type and solver based on number of nodes + if( useStraightLines || nodes.Count == 2 ) + { + splineType = GoSplineType.StraightLine; + _solver = new GoSplineStraightLineSolver( nodes ); + } + else if( nodes.Count == 3 ) + { + splineType = GoSplineType.QuadraticBezier; + _solver = new GoSplineQuadraticBezierSolver( nodes ); + } + else if( nodes.Count == 4 ) + { + splineType = GoSplineType.CubicBezier; + _solver = new GoSplineCubicBezierSolver( nodes ); + } + else + { + splineType = GoSplineType.CatmullRom; + _solver = new GoSplineCatmullRomSolver( nodes ); + } + } + + + public GoSpline( Vector3[] nodes, bool useStraightLines = false ) : this( new List( nodes ), useStraightLines ) + {} + + + public GoSpline( string pathAssetName, bool useStraightLines = false ) : this( nodeListFromAsset( pathAssetName ), useStraightLines ) + {} + + + /// + /// helper to get a node list from an asset created with the visual editor + /// + private static List nodeListFromAsset( string pathAssetName ) + { + if( Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer ) + { + Debug.LogError( "The Web Player does not support loading files from disk." ); + return null; + } + + + var path = string.Empty; + if( !pathAssetName.EndsWith( ".asset" ) ) + pathAssetName += ".asset"; + + + if( Application.platform == RuntimePlatform.Android ) + { + path = Path.Combine( "jar:file://" + Application.dataPath + "!/assets/", pathAssetName ); + + WWW loadAsset = new WWW( path ); + while( !loadAsset.isDone ) { } // maybe make a safety check here + + return bytesToVector3List( loadAsset.bytes ); + } + else if( Application.platform == RuntimePlatform.IPhonePlayer ) + { + // at runtime on iOS, we load from the dataPath + path = Path.Combine( Path.Combine( Application.dataPath, "Raw" ), pathAssetName ); + } + else + { + // in the editor we default to looking in the StreamingAssets folder + path = Path.Combine( Path.Combine( Application.dataPath, "StreamingAssets" ), pathAssetName ); + } + +#if UNITY_WEBPLAYER || NETFX_CORE + // it isnt possible to get here but the compiler needs it to be here anyway + return null; +#else + var bytes = File.ReadAllBytes( path ); + return bytesToVector3List( bytes ); +#endif + } + + + /// + /// helper to get a node list from an asset created with the visual editor + /// + public static List bytesToVector3List( byte[] bytes ) + { + var vecs = new List(); + for( var i = 0; i < bytes.Length; i += 12 ) + { + var newVec = new Vector3( System.BitConverter.ToSingle( bytes, i ), System.BitConverter.ToSingle( bytes, i + 4 ), System.BitConverter.ToSingle( bytes, i + 8 ) ); + vecs.Add( newVec ); + } + + return vecs; + } + + + /// + /// gets the last node. used to setup relative tweens + /// + public Vector3 getLastNode() + { + return _solver.nodes[_solver.nodes.Count]; + } + + + /// + /// responsible for calculating total length, segmentStartLocations and segmentDistances + /// + public void buildPath() + { + _solver.buildPath(); + } + + + /// + /// directly gets the point for the current spline type with no lookup table to adjust for constant speed + /// + private Vector3 getPoint( float t ) + { + return _solver.getPoint( t ); + } + + + /// + /// returns the point that corresponds to the given t where t >= 0 and t <= 1 making sure that the + /// path is traversed at a constant speed. + /// + public Vector3 getPointOnPath( float t ) + { + // if the path is closed, we will allow t to wrap. if is not we need to clamp t + if( t < 0 || t > 1 ) + { + if( isClosed ) + { + if( t < 0 ) + t += 1; + else + t -= 1; + } + else + { + t = Mathf.Clamp01( t ); + } + } + + return _solver.getPointOnPath( t ); + } + + + /// + /// closes the path adding a new node at the end that is equal to the start node if it isn't already equal + /// + public void closePath() + { + // dont let this get closed twice! + if( isClosed ) + return; + + isClosed = true; + _solver.closePath(); + } + + + /// + /// reverses the order of the nodes + /// + public void reverseNodes() + { + if( !_isReversed ) + { + _solver.reverseNodes(); + _isReversed = true; + } + } + + + /// + /// unreverses the order of the nodes if they were reversed + /// + public void unreverseNodes() + { + if( _isReversed ) + { + _solver.reverseNodes(); + _isReversed = false; + } + } + + + public void drawGizmos( float resolution ) + { + _solver.drawGizmos(); + + var previousPoint = _solver.getPoint( 0 ); + + resolution *= _solver.nodes.Count; + for( var i = 1; i <= resolution; i++ ) + { + var t = (float)i / resolution; + var currentPoint = _solver.getPoint( t ); + Gizmos.DrawLine( currentPoint, previousPoint ); + previousPoint = currentPoint; + } + } + + + /// + /// helper for drawing gizmos in the editor + /// + public static void drawGizmos( Vector3[] path, float resolution = 50 ) + { + // horribly inefficient but it only runs in the editor + var spline = new GoSpline( path ); + spline.drawGizmos( resolution ); + } + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta new file mode 100644 index 0000000..c1e5956 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSpline.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4ed66155442f6467bae99f410e969cc3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs new file mode 100644 index 0000000..d846b06 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs @@ -0,0 +1,87 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class GoSplineCatmullRomSolver : AbstractGoSplineSolver +{ + public GoSplineCatmullRomSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + // closing a Catmull-Rom spline: http://cl.ly/GOZv + public override void closePath() + { + // first, remove the control points + _nodes.RemoveAt( 0 ); + _nodes.RemoveAt( _nodes.Count - 1 ); + + // if the first and last node are not the same add one + if( _nodes[0] != _nodes[_nodes.Count - 1] ) + _nodes.Add( _nodes[0] ); + + + // figure out the distances from node 0 to the first node and the second to last node (remember above + // we made the last node equal to the first so node 0 and _nodes.Count - 1 are identical) + var distanceToFirstNode = Vector3.Distance( _nodes[0], _nodes[1] ); + var distanceToLastNode = Vector3.Distance( _nodes[0], _nodes[_nodes.Count - 2] ); + + + // handle the first node. we want to use the distance to the LAST (opposite segment) node to figure out where this control point should be + var distanceToFirstTarget = distanceToLastNode / Vector3.Distance( _nodes[1], _nodes[0] ); + var lastControlNode = ( _nodes[0] + ( _nodes[1] - _nodes[0] ) * distanceToFirstTarget ); + + + // handle the last node. for this one, we want the distance to the first node for the control point but it should + // be along the vector to the last node + var distanceToLastTarget = distanceToFirstNode / Vector3.Distance( _nodes[_nodes.Count - 2], _nodes[0] ); + var firstControlNode = ( _nodes[0] + ( _nodes[_nodes.Count - 2] - _nodes[0] ) * distanceToLastTarget ); + + _nodes.Insert( 0, firstControlNode ); + _nodes.Add( lastControlNode ); + } + + + public override Vector3 getPoint( float t ) + { + int numSections = _nodes.Count - 3; + int currentNode = Mathf.Min( Mathf.FloorToInt( t * (float)numSections ), numSections - 1 ); + float u = t * (float)numSections - (float)currentNode; + + Vector3 a = _nodes[currentNode]; + Vector3 b = _nodes[currentNode + 1]; + Vector3 c = _nodes[currentNode + 2]; + Vector3 d = _nodes[currentNode + 3]; + + return .5f * + ( + ( -a + 3f * b - 3f * c + d ) * ( u * u * u ) + + ( 2f * a - 5f * b + 4f * c - d ) * ( u * u ) + + ( -a + c ) * u + + 2f * b + ); + } + + + public override void drawGizmos() + { + if( _nodes.Count < 2 ) + return; + + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = new Color( 1, 1, 1, 0.3f ); + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[_nodes.Count - 1], _nodes[_nodes.Count - 2] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta new file mode 100644 index 0000000..729a658 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCatmullRomSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d4e3d83fc59fd47d3a469ac52b3955ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs new file mode 100644 index 0000000..c36505c --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// nodes should be in the order start, end, control1, control2 +/// +public class GoSplineCubicBezierSolver : AbstractGoSplineSolver +{ + public GoSplineCubicBezierSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + public override void closePath() + { + + } + + + public override Vector3 getPoint( float t ) + { + float d = 1f - t; + return d * d * d * _nodes[0] + 3f * d * d * t * _nodes[1] + 3f * d * t * t * _nodes[2] + t * t * t * _nodes[3]; + } + + + public override void drawGizmos() + { + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = Color.red; + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[2], _nodes[3] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta new file mode 100644 index 0000000..5638344 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineCubicBezierSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0465a564e2fcd462eb4b5b4bdfd1532c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs new file mode 100644 index 0000000..152ab7b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +/// +/// nodes should be in the order start, control, end +/// +public class GoSplineQuadraticBezierSolver : AbstractGoSplineSolver +{ + public GoSplineQuadraticBezierSolver( List nodes ) + { + _nodes = nodes; + } + + + // http://www.gamedev.net/topic/551455-length-of-a-generalized-quadratic-bezier-curve-in-3d/ + protected float quadBezierLength( Vector3 startPoint, Vector3 controlPoint, Vector3 endPoint ) + { + // ASSERT: all inputs are distinct points. + var A = new Vector3[2]; + A[0] = controlPoint - startPoint; + A[1] = startPoint - 2f * controlPoint + endPoint; + + float length; + + if( A[1] != Vector3.zero ) + { + // Coefficients of f(t) = c*t^2 + b*t + a. + float c = 4.0f * Vector3.Dot( A[1], A[1] ); // A[1].Dot(A[1]); // c > 0 to be in this block of code + float b = 8.0f * Vector3.Dot( A[0], A[1] ); // A[0].Dot(A[1]); + float a = 4.0f * Vector3.Dot( A[0], A[0] ); // A[0].Dot(A[0]); // a > 0 by assumption + float q = 4.0f * a * c - b * b; // = 16*|Cross(A0,A1)| >= 0 + + float twoCpB = 2.0f * c + b; + float sumCBA = c + b + a; + float mult0 = 0.25f / c; + float mult1 = q / ( 8.0f * Mathf.Pow( c, 1.5f ) ); + length = mult0 * ( twoCpB * Mathf.Sqrt( sumCBA ) - b * Mathf.Sqrt( a ) ) + + mult1 * ( Mathf.Log( 2.0f * Mathf.Sqrt( c * sumCBA ) + twoCpB ) - Mathf.Log( 2.0f * Mathf.Sqrt( c * a ) + b ) ); + } + else + { + length = 2.0f * A[0].magnitude; + } + + return length; + } + + + #region AbstractGoSplineSolver + + public override void closePath() + { + + } + + + public override Vector3 getPoint( float t ) + { + float d = 1f - t; + return d * d * _nodes[0] + 2f * d * t * _nodes[1] + t * t * _nodes[2]; + } + + + public override void drawGizmos() + { + // draw the control points + var originalColor = Gizmos.color; + Gizmos.color = Color.red; + + Gizmos.DrawLine( _nodes[0], _nodes[1] ); + Gizmos.DrawLine( _nodes[1], _nodes[2] ); + + Gizmos.color = originalColor; + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta new file mode 100644 index 0000000..1cc45a0 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineQuadraticBezierSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 474c1029fc1d848998185b77129ed5c0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs new file mode 100644 index 0000000..3729ad6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs @@ -0,0 +1,100 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class GoSplineStraightLineSolver : AbstractGoSplineSolver +{ + private Dictionary _segmentStartLocations; + private Dictionary _segmentDistances; + private int _currentSegment; + + + public GoSplineStraightLineSolver( List nodes ) + { + _nodes = nodes; + } + + + #region AbstractGoSplineSolver + + public override void buildPath() + { + // we need at least 3 nodes (more than 1 segment) to bother with building + if( _nodes.Count < 3 ) + return; + + // we dont care about the first node for distances because they are always t:0 and len:0 and we dont need the first or last for locations + _segmentStartLocations = new Dictionary( _nodes.Count - 2 ); + _segmentDistances = new Dictionary( _nodes.Count - 1 ); + + for( var i = 0; i < _nodes.Count - 1; i++ ) + { + // calculate the distance to the next node + var distance = Vector3.Distance( _nodes[i], _nodes[i + 1] ); + _segmentDistances.Add( i, distance ); + _pathLength += distance; + } + + + // now that we have the total length we can loop back through and calculate the segmentStartLocations + var accruedRouteLength = 0f; + for( var i = 0; i < _segmentDistances.Count - 1; i++ ) + { + accruedRouteLength += _segmentDistances[i]; + _segmentStartLocations.Add( i + 1, accruedRouteLength / _pathLength ); + } + } + + + public override void closePath() + { + // add a node to close the route if necessary + if( _nodes[0] != _nodes[_nodes.Count - 1] ) + _nodes.Add( _nodes[0] ); + } + + + public override Vector3 getPoint( float t ) + { + return getPointOnPath( t ); + } + + + public override Vector3 getPointOnPath( float t ) + { + // we need at least 3 nodes (more than 1 segment) to bother using the look up tables. else we just lerp directly from + // node 1 to node 2 + if( _nodes.Count < 3 ) + return Vector3.Lerp( _nodes[0], _nodes[1], t ); + + + // which segment are we on? + _currentSegment = 0; + foreach( var info in _segmentStartLocations ) + { + if( info.Value < t ) + { + _currentSegment = info.Key; + continue; + } + + break; + } + + // now we need to know the total distance travelled in all previous segments so we can subtract it from the total + // travelled to get exactly how far along the current segment we are + var totalDistanceTravelled = t * _pathLength; + var i = _currentSegment - 1; // we want all the previous segment lengths + while( i >= 0 ) + { + totalDistanceTravelled -= _segmentDistances[i]; + --i; + } + + return Vector3.Lerp( _nodes[_currentSegment], _nodes[_currentSegment + 1], totalDistanceTravelled / _segmentDistances[_currentSegment] ); + } + + #endregion + +} diff --git a/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta new file mode 100644 index 0000000..81185e5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/GoKit/properties/splines/GoSplineStraightLineSolver.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 86af7ded131634ccfa3962417a095e05 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/Pixelplacement.meta b/UnityTests.Unity5/Assets/Plugins/Pixelplacement.meta new file mode 100644 index 0000000..75cdbd6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/Pixelplacement.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8a34e0eeedd2b4bb7a52529c26d5fd03 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween.meta b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween.meta new file mode 100644 index 0000000..dd0e45b --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 62c61d3ebfdbc4210b98849503e254dc +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs new file mode 100644 index 0000000..52006df --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs @@ -0,0 +1,7503 @@ +// Copyright (c) 2011 Bob Berkebile (pixelplacment) +// Please direct any bugs/comments/suggestions to http://pixelplacement.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* +TERMS OF USE - EASING EQUATIONS +Open source under the BSD License. +Copyright (c)2001 Robert Penner +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#region Namespaces +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +#endregion + +/// +/// Version: 2.0.46 +/// Author: Bob Berkebile (http://pixelplacement.com) +/// Support: http://itween.pixelplacement.com +/// +public class iTween : MonoBehaviour{ + + #region Variables + + //repository of all living iTweens: + public static List tweens = new List(); + + //camera fade object: + private static GameObject cameraFade; + + //status members (made public for visual troubleshooting in the inspector): + public string id, type, method; + public iTween.EaseType easeType; + public float time, delay; + public LoopType loopType; + public bool isRunning,isPaused; + /* GFX47 MOD START */ + public string _name; + /* GFX47 MOD END */ + + //private members: + private float runningTime, percentage; + private float delayStarted; //probably not neccesary that this be protected but it shuts Unity's compiler up about this being "never used" + private bool kinematic, isLocal, loop, reverse, wasPaused, physics; + private Hashtable tweenArguments; + private Space space; + private delegate float EasingFunction(float start, float end, float Value); + private delegate void ApplyTween(); + private EasingFunction ease; + private ApplyTween apply; + private AudioSource audioSource; + private Vector3[] vector3s; + private Vector2[] vector2s; + private Color[,] colors; + private float[] floats; + private Rect[] rects; + private CRSpline path; + private Vector3 preUpdate; + private Vector3 postUpdate; + private NamedValueColor namedcolorvalue; + + private float lastRealTime; // Added by PressPlay + private bool useRealTime; // Added by PressPlay + + private Transform thisTransform; + + + /// + /// The type of easing to use based on Robert Penner's open source easing equations (http://www.robertpenner.com/easing_terms_of_use.html). + /// + public enum EaseType{ + easeInQuad, + easeOutQuad, + easeInOutQuad, + easeInCubic, + easeOutCubic, + easeInOutCubic, + easeInQuart, + easeOutQuart, + easeInOutQuart, + easeInQuint, + easeOutQuint, + easeInOutQuint, + easeInSine, + easeOutSine, + easeInOutSine, + easeInExpo, + easeOutExpo, + easeInOutExpo, + easeInCirc, + easeOutCirc, + easeInOutCirc, + linear, + spring, + /* GFX47 MOD START */ + //bounce, + easeInBounce, + easeOutBounce, + easeInOutBounce, + /* GFX47 MOD END */ + easeInBack, + easeOutBack, + easeInOutBack, + /* GFX47 MOD START */ + //elastic, + easeInElastic, + easeOutElastic, + easeInOutElastic, + /* GFX47 MOD END */ + punch + } + + /// + /// The type of loop (if any) to use. + /// + public enum LoopType{ + /// + /// Do not loop. + /// + none, + /// + /// Rewind and replay. + /// + loop, + /// + /// Ping pong the animation back and forth. + /// + pingPong + } + + /// + /// Many shaders use more than one color. Use can have iTween's Color methods operate on them by name. + /// + public enum NamedValueColor{ + /// + /// The main color of a material. Used by default and not required for Color methods to work in iTween. + /// + _Color, + /// + /// The specular color of a material (used in specular/glossy/vertexlit shaders). + /// + _SpecColor, + /// + /// The emissive color of a material (used in vertexlit shaders). + /// + _Emission, + /// + /// The reflection color of the material (used in reflective shaders). + /// + _ReflectColor + } + + #endregion + + #region Defaults + + /// + /// A collection of baseline presets that iTween needs and utilizes if certain parameters are not provided. + /// + public static class Defaults{ + //general defaults: + public static float time = 1f; + public static float delay = 0f; + public static NamedValueColor namedColorValue = NamedValueColor._Color; + public static LoopType loopType = LoopType.none; + public static EaseType easeType = iTween.EaseType.easeOutExpo; + public static float lookSpeed = 3f; + public static bool isLocal = false; + public static Space space = Space.Self; + public static bool orientToPath = false; + public static Color color = Color.white; + //update defaults: + public static float updateTimePercentage = .05f; + public static float updateTime = 1f*updateTimePercentage; + //cameraFade defaults: + public static int cameraFadeDepth = 999999; + //path look ahead amount: + public static float lookAhead = .05f; + public static bool useRealTime = false; // Added by PressPlay + //look direction: + public static Vector3 up = Vector3.up; + } + + #endregion + + #region #1 Static Registers + + /// + /// Sets up a GameObject to avoid hiccups when an initial iTween is added. It's advisable to run this on every object you intend to run iTween on in its Start or Awake. + /// + /// + /// A to be the target to be initialized for iTween. + /// + public static void Init(GameObject target){ + MoveBy(target,Vector3.zero,0); + } + + /// + /// Instantly changes the amount(transparency) of a camera fade and then returns it back over time with MINIMUM customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void CameraFadeFrom(float amount, float time){ + if(cameraFade){ + CameraFadeFrom(Hash("amount",amount,"time",time)); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Instantly changes the amount(transparency) of a camera fade and then returns it back over time with FULL customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void CameraFadeFrom(Hashtable args){ + //establish iTween: + if(cameraFade){ + ColorFrom(cameraFade,args); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Changes the amount(transparency) of a camera fade over time with MINIMUM customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void CameraFadeTo(float amount, float time){ + if(cameraFade){ + CameraFadeTo(Hash("amount",amount,"time",time)); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Changes the amount(transparency) of a camera fade over time with FULL customization options. + /// + /// + /// A or for how transparent the Texture2D that the camera fade uses is. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void CameraFadeTo(Hashtable args){ + /* + CameraFadeAdd(Defaults.cameraFadeDepth); + + //rescale cameraFade just in case screen size has changed to ensure it takes up the full screen: + cameraFade.guiTexture.pixelInset=new Rect(0,0,Screen.width,Screen.height); + */ + + if(cameraFade){ + //establish iTween: + ColorTo(cameraFade,args); + }else{ + Debug.LogError("iTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); + } + } + + /// + /// Returns a value to an 'oncallback' method interpolated between the supplied 'from' and 'to' values for application as desired. Requires an 'onupdate' callback that accepts the same type as the supplied 'from' and 'to' properties. + /// + /// + /// A or or or or or for the starting value. + /// + /// + /// A or or or or or for the ending value. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed (only works with Vector2, Vector3, and Floats) + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ValueTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to")) { + Debug.LogError("iTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!"); + return; + }else{ + //establish iTween: + args["type"]="value"; + + if (args["from"].GetType() == typeof(Vector2)) { + args["method"]="vector2"; + }else if (args["from"].GetType() == typeof(Vector3)) { + args["method"]="vector3"; + }else if (args["from"].GetType() == typeof(Rect)) { + args["method"]="rect"; + }else if (args["from"].GetType() == typeof(Single)) { + args["method"]="float"; + }else if (args["from"].GetType() == typeof(Color)) { + args["method"]="color"; + }else{ + Debug.LogError("iTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!"); + return; + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + Launch(target,args); + } + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeFrom(GameObject target, float alpha, float time){ + FadeFrom(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeFrom(GameObject target, Hashtable args){ + ColorFrom(target,args); + } + + /// + /// Changes a GameObject's alpha value over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeTo(GameObject target, float alpha, float time){ + FadeTo(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeTo(GameObject target, Hashtable args){ + ColorTo(target,args); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorFrom(GameObject target, Color color, float time){ + ColorFrom(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with FULL customization options. If a GUIText or GUITexture component is attached, it will become the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorFrom(GameObject target, Hashtable args){ + Color fromColor = new Color(); + Color tempColor = new Color(); + + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorFrom(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //set tempColor and base fromColor: + if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().color; + }else if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().material.color; + }else if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().material.color; + }else if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().color; + } + + //set augmented fromColor: + if(args.Contains("color")){ + fromColor=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + fromColor.r=(float)args["r"]; + } + if (args.Contains("g")) { + fromColor.g=(float)args["g"]; + } + if (args.Contains("b")) { + fromColor.b=(float)args["b"]; + } + if (args.Contains("a")) { + fromColor.a=(float)args["a"]; + } + } + + //alpha or amount? + if(args.Contains("amount")){ + fromColor.a=(float)args["amount"]; + args.Remove("amount"); + }else if(args.Contains("alpha")){ + fromColor.a=(float)args["alpha"]; + args.Remove("alpha"); + } + + //apply fromColor: + if(target.GetComponent()){ + target.GetComponent().color=fromColor; + }else if(target.GetComponent()){ + target.GetComponent().material.color=fromColor; + }else if(target.GetComponent()){ + target.GetComponent().material.color=fromColor; + }else if(target.GetComponent()){ + target.GetComponent().color=fromColor; + } + + //set new color arg: + args["color"]=tempColor; + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's color values over time with MINIMUM customization options. If a GUIText or GUITexture component is attached, they will become the target of the animation. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorTo(GameObject target, Color color, float time){ + ColorTo(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values over time with FULL customization options. If a GUIText or GUITexture component is attached, they will become the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorTo(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioFrom(GameObject target, float volume, float pitch, float time){ + AudioFrom(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioFrom(GameObject target, Hashtable args){ + Vector2 tempAudioProperties; + Vector2 fromAudioProperties; + AudioSource tempAudioSource; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempAudioSource: + if(args.Contains("audiosource")){ + tempAudioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + tempAudioSource=target.GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioFrom requires an AudioSource."); + return; + } + } + + //set tempAudioProperties: + tempAudioProperties.x=fromAudioProperties.x=tempAudioSource.volume; + tempAudioProperties.y=fromAudioProperties.y=tempAudioSource.pitch; + + //set augmented fromAudioProperties: + if(args.Contains("volume")){ + fromAudioProperties.x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + fromAudioProperties.y=(float)args["pitch"]; + } + + //apply fromAudioProperties: + tempAudioSource.volume=fromAudioProperties.x; + tempAudioSource.pitch=fromAudioProperties.y; + + //set new volume and pitch args: + args["volume"]=tempAudioProperties.x; + args["pitch"]=tempAudioProperties.y; + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Fades volume and pitch of an AudioSource with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioTo(GameObject target, float volume, float pitch, float time){ + AudioTo(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Fades volume and pitch of an AudioSource with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with MINIMUM customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be utilized. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for the time in seconds the action will wait before beginning. + /// + public static void Stab(GameObject target, AudioClip audioclip, float delay){ + Stab(target,Hash("audioclip",audioclip,"delay",delay)); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with FULL customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for which AudioSource to use + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the action will wait before beginning. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void Stab(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="stab"; + Launch(target,args); + } + + /// + /// Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookFrom(GameObject target, Vector3 looktarget, float time){ + LookFrom(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Instantly rotates a GameObject to look at a supplied Transform or Vector3 then returns it to it's starting rotation over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 tempRestriction; + + //clean args: + args = iTween.CleanArgs(args); + + //set look: + tempRotation=target.transform.eulerAngles; + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + + //axis restriction: + if(args.Contains("axis")){ + tempRestriction=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + tempRestriction.y=tempRotation.y; + tempRestriction.z=tempRotation.z; + break; + case "y": + tempRestriction.x=tempRotation.x; + tempRestriction.z=tempRotation.z; + break; + case "z": + tempRestriction.x=tempRotation.x; + tempRestriction.y=tempRotation.y; + break; + } + target.transform.eulerAngles=tempRestriction; + } + + //set new rotation: + args["rotation"] = tempRotation; + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to look at the supplied Vector3 over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookTo(GameObject target, Vector3 looktarget, float time){ + LookTo(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Rotates a GameObject to look at a supplied Transform or Vector3 over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["looktarget"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + } + } + + //establish iTween + args["type"]="look"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveTo(GameObject target, Vector3 position, float time){ + MoveTo(target,Hash("position",position,"time",time)); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["position"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveFrom(GameObject target, Vector3 position, float time){ + MoveFrom(target,Hash("position",position,"time",time)); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveFrom(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + bool tempIsLocal; + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + if(args.Contains("path")){ + Vector3[] fromPath; + Vector3[] suppliedPath; + if(args["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])args["path"]; + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])args["path"]; + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + if(suppliedPath[suppliedPath.Length-1] != target.transform.position){ + fromPath= new Vector3[suppliedPath.Length+1]; + Array.Copy(suppliedPath,fromPath,suppliedPath.Length); + if(tempIsLocal){ + fromPath[fromPath.Length-1] = target.transform.localPosition; + target.transform.localPosition=fromPath[0]; + }else{ + fromPath[fromPath.Length-1] = target.transform.position; + target.transform.position=fromPath[0]; + } + args["path"]=fromPath; + }else{ + if(tempIsLocal){ + target.transform.localPosition=suppliedPath[0]; + }else{ + target.transform.position=suppliedPath[0]; + } + args["path"]=suppliedPath; + } + }else{ + Vector3 tempPosition; + Vector3 fromPosition; + + //set tempPosition and base fromPosition: + if(tempIsLocal){ + tempPosition=fromPosition=target.transform.localPosition; + }else{ + tempPosition=fromPosition=target.transform.position; + } + + //set augmented fromPosition: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + fromPosition=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + fromPosition=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + fromPosition.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromPosition.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromPosition.z=(float)args["z"]; + } + } + + //apply fromPosition: + if(tempIsLocal){ + target.transform.localPosition = fromPosition; + }else{ + target.transform.position = fromPosition; + } + + //set new position arg: + args["position"]=tempPosition; + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Translates a GameObject's position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveAdd(GameObject target, Vector3 amount, float time){ + MoveAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Translates a GameObject's position over time with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Adds the supplied coordinates to a GameObject's postion with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveBy(GameObject target, Vector3 amount, float time){ + MoveBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds the supplied coordinates to a GameObject's position with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Changes a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleTo(GameObject target, Vector3 scale, float time){ + ScaleTo(target,Hash("scale",scale,"time",time)); + } + + /// + /// Changes a GameObject's scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["scale"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleFrom(GameObject target, Vector3 scale, float time){ + ScaleFrom(target,Hash("scale",scale,"time",time)); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleFrom(GameObject target, Hashtable args){ + Vector3 tempScale; + Vector3 fromScale; + + //clean args: + args = iTween.CleanArgs(args); + + //set base fromScale: + tempScale=fromScale=target.transform.localScale; + + //set augmented fromScale: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + fromScale=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + fromScale=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + fromScale.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromScale.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromScale.z=(float)args["z"]; + } + } + + //apply fromScale: + target.transform.localScale = fromScale; + + //set new scale arg: + args["scale"]=tempScale; + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be added to the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleAdd(GameObject target, Vector3 amount, float time){ + ScaleAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be added to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be multiplied by the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleBy(GameObject target, Vector3 amount, float time){ + ScaleBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateTo(GameObject target, Vector3 rotation, float time){ + RotateTo(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["rotation"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate from. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateFrom(GameObject target, Vector3 rotation, float time){ + RotateFrom(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 fromRotation; + bool tempIsLocal; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + //set tempRotation and base fromRotation: + if(tempIsLocal){ + tempRotation=fromRotation=target.transform.localEulerAngles; + }else{ + tempRotation=fromRotation=target.transform.eulerAngles; + } + + //set augmented fromRotation: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + fromRotation=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + fromRotation=(Vector3)args["rotation"]; + } + }else{ + if (args.Contains("x")) { + fromRotation.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromRotation.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromRotation.z=(float)args["z"]; + } + } + + //apply fromRotation: + if(tempIsLocal){ + target.transform.localEulerAngles = fromRotation; + }else{ + target.transform.eulerAngles = fromRotation; + } + + //set new rotation arg: + args["rotation"]=tempRotation; + + //establish iTween: + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateAdd(GameObject target, Vector3 amount, float time){ + RotateAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with FULL customization options. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="rotate"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateBy(GameObject target, Vector3 amount, float time){ + RotateBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="rotate"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakePosition(GameObject target, Vector3 amount, float time){ + ShakePosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakePosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="position"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeScale(GameObject target, Vector3 amount, float time){ + ShakeScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="scale"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeRotation(GameObject target, Vector3 amount, float time){ + ShakeRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="rotation"; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchPosition(GameObject target, Vector3 amount, float time){ + PunchPosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchPosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="position"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchRotation(GameObject target, Vector3 amount, float time){ + PunchRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="rotation"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchScale(GameObject target, Vector3 amount, float time){ + PunchScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="scale"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + #endregion + + #region #2 Generate Method Targets + + //call correct set target method and set tween application delegate: + void GenerateTargets(){ + switch (type) { + case "value": + switch (method) { + case "float": + GenerateFloatTargets(); + apply = new ApplyTween(ApplyFloatTargets); + break; + case "vector2": + GenerateVector2Targets(); + apply = new ApplyTween(ApplyVector2Targets); + break; + case "vector3": + GenerateVector3Targets(); + apply = new ApplyTween(ApplyVector3Targets); + break; + case "color": + GenerateColorTargets(); + apply = new ApplyTween(ApplyColorTargets); + break; + case "rect": + GenerateRectTargets(); + apply = new ApplyTween(ApplyRectTargets); + break; + } + break; + case "color": + switch (method) { + case "to": + GenerateColorToTargets(); + apply = new ApplyTween(ApplyColorToTargets); + break; + } + break; + case "audio": + switch (method) { + case "to": + GenerateAudioToTargets(); + apply = new ApplyTween(ApplyAudioToTargets); + break; + } + break; + case "move": + switch (method) { + case "to": + //using a path? + if(tweenArguments.Contains("path")){ + GenerateMoveToPathTargets(); + apply = new ApplyTween(ApplyMoveToPathTargets); + }else{ //not using a path? + GenerateMoveToTargets(); + apply = new ApplyTween(ApplyMoveToTargets); + } + break; + case "by": + case "add": + GenerateMoveByTargets(); + apply = new ApplyTween(ApplyMoveByTargets); + break; + } + break; + case "scale": + switch (method){ + case "to": + GenerateScaleToTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "by": + GenerateScaleByTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "add": + GenerateScaleAddTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + } + break; + case "rotate": + switch (method) { + case "to": + GenerateRotateToTargets(); + apply = new ApplyTween(ApplyRotateToTargets); + break; + case "add": + GenerateRotateAddTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + case "by": + GenerateRotateByTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + } + break; + case "shake": + switch (method) { + case "position": + GenerateShakePositionTargets(); + apply = new ApplyTween(ApplyShakePositionTargets); + break; + case "scale": + GenerateShakeScaleTargets(); + apply = new ApplyTween(ApplyShakeScaleTargets); + break; + case "rotation": + GenerateShakeRotationTargets(); + apply = new ApplyTween(ApplyShakeRotationTargets); + break; + } + break; + case "punch": + switch (method) { + case "position": + GeneratePunchPositionTargets(); + apply = new ApplyTween(ApplyPunchPositionTargets); + break; + case "rotation": + GeneratePunchRotationTargets(); + apply = new ApplyTween(ApplyPunchRotationTargets); + break; + case "scale": + GeneratePunchScaleTargets(); + apply = new ApplyTween(ApplyPunchScaleTargets); + break; + } + break; + case "look": + switch (method) { + case "to": + GenerateLookToTargets(); + apply = new ApplyTween(ApplyLookToTargets); + break; + } + break; + case "stab": + GenerateStabTargets(); + apply = new ApplyTween(ApplyStabTargets); + break; + } + } + + #endregion + + #region #3 Generate Specific Targets + + void GenerateRectTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + rects=new Rect[3]; + + //from and to values: + rects[0]=(Rect)tweenArguments["from"]; + rects[1]=(Rect)tweenArguments["to"]; + } + + void GenerateColorTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + colors=new Color[1,3]; + + //from and to values: + colors[0,0]=(Color)tweenArguments["from"]; + colors[0,1]=(Color)tweenArguments["to"]; + } + + void GenerateVector3Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from and to values: + vector3s[0]=(Vector3)tweenArguments["from"]; + vector3s[1]=(Vector3)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateVector2Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //from and to values: + vector2s[0]=(Vector2)tweenArguments["from"]; + vector2s[1]=(Vector2)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + Vector3 fromV3 = new Vector3(vector2s[0].x,vector2s[0].y,0); + Vector3 toV3 = new Vector3(vector2s[1].x,vector2s[1].y,0); + float distance = Math.Abs(Vector3.Distance(fromV3,toV3)); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateFloatTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + floats=new float[3]; + + //from and to values: + floats[0]=(float)tweenArguments["from"]; + floats[1]=(float)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(floats[0] - floats[1]); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateColorToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + //colors = new Color[3]; + + //from and init to values: + if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = GetComponent().color; + }else if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = GetComponent().material.color; + }else if(GetComponent()){ + colors = new Color[GetComponent().materials.Length,3]; + for (int i = 0; i < GetComponent().materials.Length; i++) { + colors[i,0]=GetComponent().materials[i].GetColor(namedcolorvalue.ToString()); + colors[i,1]=GetComponent().materials[i].GetColor(namedcolorvalue.ToString()); + } + //colors[0] = colors[1] = renderer.material.color; + }else if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = GetComponent().color; + }else{ + colors = new Color[1,3]; //empty placeholder incase the GO is perhaps an empty holder or something similar + } + + //to values: + if (tweenArguments.Contains("color")) { + //colors[1]=(Color)tweenArguments["color"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1]=(Color)tweenArguments["color"]; + } + }else{ + if (tweenArguments.Contains("r")) { + //colors[1].r=(float)tweenArguments["r"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].r=(float)tweenArguments["r"]; + } + } + if (tweenArguments.Contains("g")) { + //colors[1].g=(float)tweenArguments["g"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].g=(float)tweenArguments["g"]; + } + } + if (tweenArguments.Contains("b")) { + //colors[1].b=(float)tweenArguments["b"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].b=(float)tweenArguments["b"]; + } + } + if (tweenArguments.Contains("a")) { + //colors[1].a=(float)tweenArguments["a"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["a"]; + } + } + } + + //alpha or amount? + if(tweenArguments.Contains("amount")){ + //colors[1].a=(float)tweenArguments["amount"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["amount"]; + } + }else if(tweenArguments.Contains("alpha")){ + //colors[1].a=(float)tweenArguments["alpha"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["alpha"]; + } + } + } + + void GenerateAudioToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioTo requires an AudioSource."); + Dispose(); + } + } + + //from values and default to values: + vector2s[0]=vector2s[1]=new Vector2(audioSource.volume,audioSource.pitch); + + //to values: + if (tweenArguments.Contains("volume")) { + vector2s[1].x=(float)tweenArguments["volume"]; + } + if (tweenArguments.Contains("pitch")) { + vector2s[1].y=(float)tweenArguments["pitch"]; + } + } + + void GenerateStabTargets(){ + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=GetComponent(); + }else{ + //add and populate AudioSource if one doesn't exist: + gameObject.AddComponent(); + audioSource=GetComponent(); + audioSource.playOnAwake=false; + + } + } + + //populate audioSource's clip: + audioSource.clip=(AudioClip)tweenArguments["audioclip"]; + + //set audio's pitch and volume if requested: + if(tweenArguments.Contains("pitch")){ + audioSource.pitch=(float)tweenArguments["pitch"]; + } + if(tweenArguments.Contains("volume")){ + audioSource.volume=(float)tweenArguments["volume"]; + } + + //set run time based on length of clip after pitch is augmented + time=audioSource.clip.length/audioSource.pitch; + } + + void GenerateLookToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + + //set look: + if(tweenArguments.Contains("looktarget")){ + if (tweenArguments["looktarget"].GetType() == typeof(Transform)) { + //transform.LookAt((Transform)tweenArguments["looktarget"]); + thisTransform.LookAt((Transform)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + }else if(tweenArguments["looktarget"].GetType() == typeof(Vector3)){ + //transform.LookAt((Vector3)tweenArguments["looktarget"]); + thisTransform.LookAt((Vector3)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookTo needs a 'looktarget' property!"); + Dispose(); + } + + //to values: + vector3s[1]=thisTransform.eulerAngles; + thisTransform.eulerAngles=vector3s[0]; + + //axis restriction: + if(tweenArguments.Contains("axis")){ + switch((string)tweenArguments["axis"]){ + case "x": + vector3s[1].y=vector3s[0].y; + vector3s[1].z=vector3s[0].z; + break; + case "y": + vector3s[1].x=vector3s[0].x; + vector3s[1].z=vector3s[0].z; + break; + case "z": + vector3s[1].x=vector3s[0].x; + vector3s[1].y=vector3s[0].y; + break; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToPathTargets(){ + Vector3[] suppliedPath; + + //create and store path points: + if(tweenArguments["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + + //do we need to plot a path to get to the beginning of the supplied path? + bool plotStart; + int offset; + if(thisTransform.position != suppliedPath[0]){ + if(!tweenArguments.Contains("movetopath") || (bool)tweenArguments["movetopath"]==true){ + plotStart=true; + offset=3; + }else{ + plotStart=false; + offset=2; + } + }else{ + plotStart=false; + offset=2; + } + + //build calculated path: + vector3s = new Vector3[suppliedPath.Length+offset]; + if(plotStart){ + vector3s[1]=thisTransform.position; + offset=2; + }else{ + offset=1; + } + + //populate calculate path; + Array.Copy(suppliedPath,0,vector3s,offset,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + //create Catmull-Rom path: + path = new CRSpline(vector3s); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = PathLength(vector3s); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localPosition; + }else{ + vector3s[0]=vector3s[1]=thisTransform.position; + } + + //to values: + if (tweenArguments.Contains("position")) { + if (tweenArguments["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["position"]; + vector3s[1]=trans.position; + }else if(tweenArguments["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["position"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in, [5] for dial in location: + vector3s=new Vector3[6]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.position; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=vector3s[0] + (Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=vector3s[0].x + (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=vector3s[0].y +(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=vector3s[0].z + (float)tweenArguments["z"]; + } + } + + //calculation for dial in: + thisTransform.Translate(vector3s[1],space); + vector3s[5] = thisTransform.position; + thisTransform.position=vector3s[0]; + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("scale")) { + if (tweenArguments["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["scale"]; + vector3s[1]=trans.localScale; + }else if(tweenArguments["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["scale"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=Vector3.Scale(vector3s[1],(Vector3)tweenArguments["amount"]); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x*=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y*=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z*=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localEulerAngles; + }else{ + vector3s[0]=vector3s[1]=thisTransform.eulerAngles; + } + + //to values: + if (tweenArguments.Contains("rotation")) { + if (tweenArguments["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(tweenArguments["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["rotation"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[5]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=Vector3.Scale((Vector3)tweenArguments["amount"],new Vector3(360,360,360)); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=360 * (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=360 * (float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=360 * (float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateShakePositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[4]; + + //grab starting rotation: + vector3s[3] = thisTransform.eulerAngles; + + //root: + vector3s[0]=thisTransform.position; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeScaleTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.localScale; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeRotationTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.eulerAngles; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchPositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[5]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=thisTransform.position; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchRotationTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchScaleTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.localScale; + vector3s[1]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + #endregion + + #region #4 Apply Targets + + void ApplyRectTargets(){ + //calculate: + rects[2].x = ease(rects[0].x,rects[1].x,percentage); + rects[2].y = ease(rects[0].y,rects[1].y,percentage); + rects[2].width = ease(rects[0].width,rects[1].width,percentage); + rects[2].height = ease(rects[0].height,rects[1].height,percentage); + + //apply: + tweenArguments["onupdateparams"]=rects[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=rects[1]; + } + } + + void ApplyColorTargets(){ + //calculate: + colors[0,2].r = ease(colors[0,0].r,colors[0,1].r,percentage); + colors[0,2].g = ease(colors[0,0].g,colors[0,1].g,percentage); + colors[0,2].b = ease(colors[0,0].b,colors[0,1].b,percentage); + colors[0,2].a = ease(colors[0,0].a,colors[0,1].a,percentage); + + //apply: + tweenArguments["onupdateparams"]=colors[0,2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=colors[0,1]; + } + } + + void ApplyVector3Targets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector3s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector3s[1]; + } + } + + void ApplyVector2Targets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector2s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector2s[1]; + } + } + + void ApplyFloatTargets(){ + //calculate: + floats[2] = ease(floats[0],floats[1],percentage); + + //apply: + tweenArguments["onupdateparams"]=floats[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=floats[1]; + } + } + + void ApplyColorToTargets(){ + //calculate: + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,2].r = ease(colors[i,0].r,colors[i,1].r,percentage); + colors[i,2].g = ease(colors[i,0].g,colors[i,1].g,percentage); + colors[i,2].b = ease(colors[i,0].b,colors[i,1].b,percentage); + colors[i,2].a = ease(colors[i,0].a,colors[i,1].a,percentage); + } + /* + colors[2].r = ease(colors[0].r,colors[1].r,percentage); + colors[2].g = ease(colors[0].g,colors[1].g,percentage); + colors[2].b = ease(colors[0].b,colors[1].b,percentage); + colors[2].a = ease(colors[0].a,colors[1].a,percentage); + */ + + //apply: + if(GetComponent()){ + //guiTexture.color=colors[2]; + GetComponent().color=colors[0,2]; + }else if(GetComponent()){ + //guiText.material.color=colors[2]; + GetComponent().material.color=colors[0,2]; + }else if(GetComponent()){ + //renderer.material.color=colors[2]; + for (int i = 0; i < colors.GetLength(0); i++) { + GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,2]); + } + }else if(GetComponent()){ + //light.color=colors[2]; + GetComponent().color=colors[0,2]; + } + + //dial in: + if(percentage==1){ + if(GetComponent()){ + //guiTexture.color=colors[1]; + GetComponent().color=colors[0,1]; + }else if(GetComponent()){ + //guiText.material.color=colors[1]; + GetComponent().material.color=colors[0,1]; + }else if(GetComponent()){ + //renderer.material.color=colors[1]; + for (int i = 0; i < colors.GetLength(0); i++) { + GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,1]); + } + }else if(GetComponent()){ + //light.color=colors[1]; + GetComponent().color=colors[0,1]; + } + } + } + + void ApplyAudioToTargets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + audioSource.volume=vector2s[2].x; + audioSource.pitch=vector2s[2].y; + + //dial in: + if(percentage==1){ + audioSource.volume=vector2s[1].x; + audioSource.pitch=vector2s[1].y; + } + } + + void ApplyStabTargets(){ + //unnecessary but here just in case + } + + void ApplyMoveToPathTargets(){ + preUpdate = thisTransform.position; + float t = ease(0,1,percentage); + float lookAheadAmount; + + //clamp easing equation results as "back" will fail since overshoots aren't handled in the Catmull-Rom interpolation: + if(isLocal){ + thisTransform.localPosition=path.Interp(Mathf.Clamp(t,0,1)); + }else{ + thisTransform.position=path.Interp(Mathf.Clamp(t,0,1)); + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + + //plot a point slightly ahead in the interpolation by pushing the percentage forward using the default lookahead value: + float tLook; + if(tweenArguments.Contains("lookahead")){ + lookAheadAmount = (float)tweenArguments["lookahead"]; + }else{ + lookAheadAmount = Defaults.lookAhead; + } + //tLook = ease(0,1,percentage+lookAheadAmount); + tLook = ease(0,1, Mathf.Min(1f, percentage+lookAheadAmount)); + + //locate new leading point with a clamp as stated above: + //Vector3 lookDistance = path.Interp(Mathf.Clamp(tLook,0,1)) - transform.position; + tweenArguments["looktarget"] = path.Interp(Mathf.Clamp(tLook,0,1)); + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyMoveToTargets(){ + //record current: + preUpdate=thisTransform.position; + + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localPosition=vector3s[2]; + }else{ + thisTransform.position=vector3s[2]; + } + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localPosition=vector3s[1]; + }else{ + thisTransform.position=vector3s[1]; + } + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyMoveByTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + /* + //dial in: + if(percentage==1){ + transform.position=vector3s[5]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyScaleToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.localScale=vector3s[2]; + + //dial in: + if(percentage==1){ + thisTransform.localScale=vector3s[1]; + } + } + + void ApplyLookToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + } + + void ApplyRotateToTargets(){ + preUpdate=thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[1]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[1]); + }; + } + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyRotateAddTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyShakePositionTargets(){ + //preUpdate = transform.position; + if (isLocal) { + preUpdate = thisTransform.localPosition; + }else{ + preUpdate = thisTransform.position; + } + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[3]; + } + + //impact: + if (percentage==0) { + thisTransform.Translate(vector3s[1],space); + } + + //transform.position=vector3s[0]; + //reset: + if (isLocal) { + thisTransform.localPosition=vector3s[0]; + }else{ + thisTransform.position=vector3s[0]; + } + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + //transform.Translate(vector3s[2],space); + if (isLocal) { + thisTransform.localPosition+=vector3s[2]; + }else{ + thisTransform.position+=vector3s[2]; + } + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyShakeScaleTargets(){ + //impact: + if (percentage==0) { + thisTransform.localScale=vector3s[1]; + } + + //reset: + thisTransform.localScale=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.localScale+=vector3s[2]; + } + + void ApplyShakeRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //impact: + if (percentage==0) { + thisTransform.Rotate(vector3s[1],space); + } + + //reset: + thisTransform.eulerAngles=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.Rotate(vector3s[2],space); + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchPositionTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //dial in: + /* + if(percentage==1){ + transform.position=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyPunchRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.eulerAngles=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchScaleTargets(){ + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.localScale=vector3s[0]+vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.localScale=vector3s[0]; + } + */ + } + + #endregion + + #region #5 Tween Steps + + IEnumerator TweenDelay(){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + if(wasPaused){ + wasPaused=false; + TweenStart(); + } + } + + void TweenStart(){ + CallBack("onstart"); + + if(!loop){//only if this is not a loop + ConflictCheck(); + GenerateTargets(); + } + + //run stab: + if(type == "stab"){ + audioSource.PlayOneShot(audioSource.clip); + } + + //toggle isKinematic for iTweens that may interfere with physics: + if (type == "move" || type=="scale" || type=="rotate" || type=="punch" || type=="shake" || type=="curve" || type=="look") { + EnableKinematic(); + } + + isRunning = true; + } + + IEnumerator TweenRestart(){ + if(delay > 0){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + } + loop=true; + TweenStart(); + } + + void TweenUpdate(){ + apply(); + CallBack("onupdate"); + UpdatePercentage(); + } + + void TweenComplete(){ + isRunning=false; + + //dial in percentage to 1 or 0 for final run: + if(percentage>.5f){ + percentage=1f; + }else{ + percentage=0; + } + + //apply dial in and final run: + apply(); + if(type == "value"){ + CallBack("onupdate"); //CallBack run for ValueTo since it only calculates and applies in the update callback + } + + //loop or dispose? + if(loopType==LoopType.none){ + Dispose(); + }else{ + TweenLoop(); + } + + CallBack("oncomplete"); + } + + void TweenLoop(){ + DisableKinematic(); //give physics control again + switch(loopType){ + case LoopType.loop: + //rewind: + percentage=0; + runningTime=0; + apply(); + + //replay: + StartCoroutine("TweenRestart"); + break; + case LoopType.pingPong: + reverse = !reverse; + runningTime=0; + + //replay: + StartCoroutine("TweenRestart"); + break; + } + } + + #endregion + + #region #6 Update Callable + + /// + /// Returns a Rect that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed){ + Rect diff = new Rect(FloatUpdate(currentValue.x, targetValue.x, speed), FloatUpdate(currentValue.y, targetValue.y, speed), FloatUpdate(currentValue.width, targetValue.width, speed), FloatUpdate(currentValue.height, targetValue.height, speed)); + return (diff); + } + + /// + /// Returns a Vector3 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed){ + Vector3 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a Vector2 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed){ + Vector2 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a float that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static float FloatUpdate(float currentValue, float targetValue, float speed){ + float diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, Hashtable args){ + args["a"]=args["alpha"]; + ColorUpdate(target,args); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, float alpha, float time){ + FadeUpdate(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Color[] colors = new Color[4]; + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + ColorUpdate(child.gameObject,args); + } + } + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().color; + }else if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().material.color; + }else if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().material.color; + }else if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().color; + } + + //to values: + if (args.Contains("color")) { + colors[1]=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + colors[1].r=(float)args["r"]; + } + if (args.Contains("g")) { + colors[1].g=(float)args["g"]; + } + if (args.Contains("b")) { + colors[1].b=(float)args["b"]; + } + if (args.Contains("a")) { + colors[1].a=(float)args["a"]; + } + } + + //calculate: + colors[3].r=Mathf.SmoothDamp(colors[0].r,colors[1].r,ref colors[2].r,time); + colors[3].g=Mathf.SmoothDamp(colors[0].g,colors[1].g,ref colors[2].g,time); + colors[3].b=Mathf.SmoothDamp(colors[0].b,colors[1].b,ref colors[2].b,time); + colors[3].a=Mathf.SmoothDamp(colors[0].a,colors[1].a,ref colors[2].a,time); + + //apply: + if(target.GetComponent()){ + target.GetComponent().color=colors[3]; + }else if(target.GetComponent()){ + target.GetComponent().material.color=colors[3]; + }else if(target.GetComponent()){ + target.GetComponent().material.color=colors[3]; + }else if(target.GetComponent()){ + target.GetComponent().color=colors[3]; + } + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Color color, float time){ + ColorUpdate(target,Hash("color",color,"time",time)); + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + AudioSource audioSource; + float time; + Vector2[] vector2s = new Vector2[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set audioSource: + if(args.Contains("audiosource")){ + audioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + audioSource=target.GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioUpdate requires an AudioSource."); + return; + } + } + + //from values: + vector2s[0] = vector2s[1] = new Vector2(audioSource.volume,audioSource.pitch); + + //set to: + if(args.Contains("volume")){ + vector2s[1].x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + vector2s[1].y=(float)args["pitch"]; + } + + //calculate: + vector2s[3].x=Mathf.SmoothDampAngle(vector2s[0].x,vector2s[1].x,ref vector2s[2].x,time); + vector2s[3].y=Mathf.SmoothDampAngle(vector2s[0].y,vector2s[1].y,ref vector2s[2].y,time); + + //apply: + audioSource.volume=vector2s[3].x; + audioSource.pitch=vector2s[3].y; + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target level of volume. + /// + /// + /// A for the target pitch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, float volume, float pitch, float time){ + AudioUpdate(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + bool isLocal; + float time; + Vector3[] vector3s = new Vector3[4]; + Vector3 preUpdate = target.transform.eulerAngles; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //from values: + if(isLocal){ + vector3s[0] = target.transform.localEulerAngles; + }else{ + vector3s[0] = target.transform.eulerAngles; + } + + //set to: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["rotation"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + if(isLocal){ + target.transform.localEulerAngles=vector3s[3]; + }else{ + target.transform.eulerAngles=vector3s[3]; + } + + //need physics? + if(target.GetComponent() != null){ + Vector3 postUpdate=target.transform.eulerAngles; + target.transform.eulerAngles=preUpdate; + target.GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Vector3 rotation, float time){ + RotateUpdate(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + vector3s[0] = vector3s[1] = target.transform.localScale; + + //to values: + if (args.Contains("scale")) { + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + vector3s[1]=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.localScale=vector3s[3]; + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Vector3 scale, float time){ + ScaleUpdate(target,Hash("scale",scale,"time",time)); + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + public static void MoveUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + bool isLocal; + Vector3 preUpdate = target.transform.position; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //init values: + if(isLocal){ + vector3s[0] = vector3s[1] = target.transform.localPosition; + }else{ + vector3s[0] = vector3s[1] = target.transform.position; + } + + //to values: + if (args.Contains("position")) { + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + vector3s[1]=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //handle orient to path: + if(args.Contains("orienttopath") && (bool)args["orienttopath"]){ + args["looktarget"] = vector3s[3]; + } + + //look applications: + if(args.Contains("looktarget")){ + iTween.LookUpdate(target,args); + } + + //apply: + if(isLocal){ + target.transform.localPosition = vector3s[3]; + }else{ + target.transform.position=vector3s[3]; + } + + //need physics? + if(target.GetComponent() != null){ + Vector3 postUpdate=target.transform.position; + target.transform.position=preUpdate; + target.GetComponent().MovePosition(postUpdate); + } + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a point in space the GameObject will animate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveUpdate(GameObject target, Vector3 position, float time){ + MoveUpdate(target,Hash("position",position,"time",time)); + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[5]; + + //set smooth time: + if(args.Contains("looktime")){ + time=(float)args["looktime"]; + time*=Defaults.updateTimePercentage; + }else if(args.Contains("time")){ + time=(float)args["time"]*.15f; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //from values: + vector3s[0] = target.transform.eulerAngles; + + //set look: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookUpdate needs a 'looktarget' property!"); + return; + } + + //to values and reset look: + vector3s[1]=target.transform.eulerAngles; + target.transform.eulerAngles=vector3s[0]; + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.eulerAngles=vector3s[3]; + + //axis restriction: + if(args.Contains("axis")){ + vector3s[4]=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + vector3s[4].y=vector3s[0].y; + vector3s[4].z=vector3s[0].z; + break; + case "y": + vector3s[4].x=vector3s[0].x; + vector3s[4].z=vector3s[0].z; + break; + case "z": + vector3s[4].x=vector3s[0].x; + vector3s[4].y=vector3s[0].y; + break; + } + + //apply axis restriction: + target.transform.eulerAngles=vector3s[4]; + } + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a target the GameObject will look at. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Vector3 looktarget, float time){ + LookUpdate(target,Hash("looktarget",looktarget,"time",time)); + } + + #endregion + + #region #7 External Utilities + + /// + /// Returns the length of a curved path drawn through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static float PathLength(Transform[] path){ + Vector3[] suppliedPath = new Vector3[path.Length]; + float pathLength = 0; + + //create and store path points: + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + Vector3[] vector3s = PathControlPointGenerator(suppliedPath); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + /// + /// Returns the length of a curved path drawn through the provided array of Vector3s. + /// + /// + /// The length. + /// + /// + /// A + /// + public static float PathLength(Vector3[] path){ + float pathLength = 0; + + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + /// + /// Creates and returns a full-screen Texture2D for use with CameraFade. + /// + /// + /// Texture2D + /// + /// + /// Color + /// + public static Texture2D CameraTexture(Color color){ + Texture2D texture = new Texture2D(Screen.width,Screen.height,TextureFormat.ARGB32, false); + Color[] colors = new Color[Screen.width*Screen.height]; + for (int i = 0; i < colors.Length; i++) { + colors[i]=color; + } + texture.SetPixels(colors); + texture.Apply(); + return(texture); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Vector3[] path, float percent){ + target.transform.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Vector3[] path, float percent){ + target.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.transform.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + return(Interp(PathControlPointGenerator(suppliedPath),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawLine(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"handles"); + } + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Vector3[] path, float percent){ + return(Interp(PathControlPointGenerator(path),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawPath(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"handles"); + } + } + + /// + /// Changes a camera fade's texture. + /// + /// + /// A + /// + public static void CameraFadeDepth(int depth){ + if(cameraFade){ + cameraFade.transform.position=new Vector3(cameraFade.transform.position.x,cameraFade.transform.position.y,depth); + } + } + + /// + /// Removes and destroyes a camera fade. + /// + public static void CameraFadeDestroy(){ + if(cameraFade){ + Destroy(cameraFade); + } + } + + /// + /// Changes a camera fade's texture. + /// + /// + /// A + /// + public static void CameraFadeSwap(Texture2D texture){ + if(cameraFade){ + cameraFade.GetComponent().texture=texture; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the supplied depth that can be used to simulate a camera fade. + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(Texture2D texture, int depth){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,depth); + cameraFade.AddComponent(); + cameraFade.GetComponent().texture=texture; + cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the default depth that can be used to simulate a camera fade. + /// + /// + /// A + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(Texture2D texture){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); + cameraFade.AddComponent(); + cameraFade.GetComponent().texture=texture; + cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + /// + /// Creates a GameObject (if it doesn't exist) at the default depth filled with black that can be used to simulate a camera fade. + /// + /// + /// A for a reference to the CameraFade. + /// + public static GameObject CameraFadeAdd(){ + if(cameraFade){ + return null; + }else{ + //establish colorFade object: + cameraFade = new GameObject("iTween Camera Fade"); + cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); + cameraFade.AddComponent(); + cameraFade.GetComponent().texture=CameraTexture(Color.black); + cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); + return cameraFade; + } + } + + + //################################# + //# RESUME UTILITIES AND OVERLOADS # + //################################# + + /// + /// Resume all iTweens on a GameObject. + /// + public static void Resume(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.enabled=true; + } + } + + /// + /// Resume all iTweens on a GameObject including its children. + /// + public static void Resume(GameObject target, bool includechildren){ + Resume(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,true); + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,type,true); + } + } + } + + /// + /// Resume all iTweens in scene. + /// + public static void Resume(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Resume(target); + } + } + + /// + /// Resume all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(string type){ + ArrayList resumeArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + resumeArray.Insert(resumeArray.Count,target); + } + + for (int i = 0; i < resumeArray.Count; i++) { + Resume((GameObject)resumeArray[i],type); + } + } + + //################################# + //# PAUSE UTILITIES AND OVERLOADS # + //################################# + + /// + /// Pause all iTweens on a GameObject. + /// + public static void Pause(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + + /// + /// Pause all iTweens on a GameObject including its children. + /// + public static void Pause(GameObject target, bool includechildren){ + Pause(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,true); + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,type,true); + } + } + } + + /// + /// Pause all iTweens in scene. + /// + public static void Pause(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Pause(target); + } + } + + /// + /// Pause all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(string type){ + ArrayList pauseArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + pauseArray.Insert(pauseArray.Count,target); + } + + for (int i = 0; i < pauseArray.Count; i++) { + Pause((GameObject)pauseArray[i],type); + } + } + + //################################# + //# COUNT UTILITIES AND OVERLOADS # + //################################# + + /// + /// Count all iTweens in current scene. + /// + public static int Count(){ + return(tweens.Count); + } + + /// + /// Count all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(string type){ + int tweenCount = 0; + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + string targetType = (string)currentTween["type"]+(string)currentTween["method"]; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + + return(tweenCount); + } + + /// + /// Count all iTweens on a GameObject. + /// + public static int Count(GameObject target){ + Component[] tweens = target.GetComponents(); + return(tweens.Length); + } + + /// + /// Count all iTweens on a GameObject of a particular type. + /// + /// + /// A name of the type of iTween you would like to count. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(GameObject target, string type){ + int tweenCount = 0; + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + return(tweenCount); + } + + //################################ + //# STOP UTILITIES AND OVERLOADS # + //################################ + + /// + /// Stop and destroy all Tweens in current scene. + /// + public static void Stop(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Stop(target); + } + tweens.Clear(); + } + + /// + /// Stop and destroy all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(string type){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + Stop((GameObject)stopArray[i],type); + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens in current scene of a particular name. + /// + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(string name){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + StopByName((GameObject)stopArray[i],name); + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject. + /// + public static void Stop(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.Dispose(); + } + } + + /// + /// Stop and destroy all iTweens on a GameObject including its children. + /// + public static void Stop(GameObject target, bool includechildren){ + Stop(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,true); + } + } + } + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,type,true); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name including its children. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + //Stop(child.gameObject,type,true); + StopByName(child.gameObject,name,true); + } + } + } + /* GFX47 MOD END */ + + /// + /// Universal interface to help in the creation of Hashtables. Especially useful for C# users. + /// + /// + /// A of alternating name value pairs. For example "time",1,"delay",2... + /// + /// + /// A + /// + public static Hashtable Hash(params object[] args){ + Hashtable hashTable = new Hashtable(args.Length/2); + if (args.Length %2 != 0) { + Debug.LogError("Tween Error: Hash requires an even number of arguments!"); + return null; + }else{ + int i = 0; + while(i < args.Length - 1) { + hashTable.Add(args[i], args[i+1]); + i += 2; + } + return hashTable; + } + } + + #endregion + + #region Component Segments + + private iTween(Hashtable h) { + tweenArguments = h; + } + + void Awake(){ + thisTransform = transform; + + RetrieveArgs(); + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + IEnumerator Start(){ + if(delay > 0){ + yield return StartCoroutine("TweenDelay"); + } + TweenStart(); + } + + //non-physics + void Update(){ + if(isRunning && !physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + //physics + void FixedUpdate(){ + if(isRunning && physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + void LateUpdate(){ + //look applications: + if(tweenArguments.Contains("looktarget") && isRunning){ + if(type =="move" || type =="shake" || type=="punch"){ + LookUpdate(gameObject,tweenArguments); + } + } + } + + void OnEnable(){ + if(isRunning){ + EnableKinematic(); + } + + //resume delay: + if(isPaused){ + isPaused=false; + if(delay > 0){ + wasPaused=true; + ResumeDelay(); + } + } + } + + void OnDisable(){ + DisableKinematic(); + } + + #endregion + + #region Internal Helpers + + private static void DrawLineHelper(Vector3[] line, Color color, string method){ + Gizmos.color=color; + for (int i = 0; i < line.Length-1; i++) { + if(method == "gizmos"){ + Gizmos.DrawLine(line[i], line[i+1]);; + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(line[i], line[i+1]); + } + } + } + + private static void DrawPathHelper(Vector3[] path, Color color, string method){ + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + Gizmos.color=color; + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + if(method == "gizmos"){ + Gizmos.DrawLine(currPt, prevPt); + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(currPt, prevPt); + } + prevPt = currPt; + } + } + + private static Vector3[] PathControlPointGenerator(Vector3[] path){ + Vector3[] suppliedPath; + Vector3[] vector3s; + + //create and store path points: + suppliedPath = path; + + //populate calculate path; + int offset = 2; + vector3s = new Vector3[suppliedPath.Length+offset]; + Array.Copy(suppliedPath,0,vector3s,1,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + return(vector3s); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private static Vector3 Interp(Vector3[] pts, float t){ + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private class CRSpline { + public Vector3[] pts; + + public CRSpline(params Vector3[] pts) { + this.pts = new Vector3[pts.Length]; + Array.Copy(pts, this.pts, pts.Length); + } + + + public Vector3 Interp(float t) { + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + return .5f*((-a+3f*b-3f*c+d)*(u*u*u)+(2f*a-5f*b+4f*c-d)*(u*u)+(-a+c)*u+2f*b); + } + } + + //catalog new tween and add component phase of iTween: + static void Launch(GameObject target, Hashtable args){ + if(!args.Contains("id")){ + args["id"] = GenerateID(); + } + if(!args.Contains("target")){ + args["target"] = target; + + } + + tweens.Insert (0, args); + target.AddComponent(); + } + + //cast any accidentally supplied doubles and ints as floats as iTween only uses floats internally and unify parameter case: + static Hashtable CleanArgs(Hashtable args){ + Hashtable argsCopy = new Hashtable(args.Count); + Hashtable argsCaseUnified = new Hashtable(args.Count); + + foreach (DictionaryEntry item in args) { + argsCopy.Add(item.Key, item.Value); + } + + foreach (DictionaryEntry item in argsCopy) { + if(item.Value.GetType() == typeof(System.Int32)){ + int original = (int)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + if(item.Value.GetType() == typeof(System.Double)){ + double original = (double)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + } + + //unify parameter case: + foreach (DictionaryEntry item in args) { + argsCaseUnified.Add(item.Key.ToString().ToLower(), item.Value); + } + + //swap back case unification: + args = argsCaseUnified; + + return args; + } + + //random ID generator: + static string GenerateID(){ +// int strlen = 15; +// char[] chars = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8'}; +// int num_chars = chars.Length - 1; +// string randomChar = ""; +// for (int i = 0; i < strlen; i++) { +// randomChar += chars[(int)Mathf.Floor(UnityEngine.Random.Range(0,num_chars))]; +// } + return System.Guid.NewGuid().ToString(); + } + + //grab and set generic, neccesary iTween arguments: + void RetrieveArgs(){ + foreach (Hashtable item in tweens) { + if((GameObject)item["target"] == gameObject){ + tweenArguments=item; + break; + } + } + + id=(string)tweenArguments["id"]; + type=(string)tweenArguments["type"]; + /* GFX47 MOD START */ + _name=(string)tweenArguments["name"]; + /* GFX47 MOD END */ + method=(string)tweenArguments["method"]; + + if(tweenArguments.Contains("time")){ + time=(float)tweenArguments["time"]; + }else{ + time=Defaults.time; + } + + //do we need to use physics, is there a rigidbody? + if(GetComponent() != null){ + physics=true; + } + + if(tweenArguments.Contains("delay")){ + delay=(float)tweenArguments["delay"]; + }else{ + delay=Defaults.delay; + } + + if(tweenArguments.Contains("namedcolorvalue")){ + //allows namedcolorvalue to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["namedcolorvalue"].GetType() == typeof(NamedValueColor)){ + namedcolorvalue=(NamedValueColor)tweenArguments["namedcolorvalue"]; + }else{ + try { + namedcolorvalue=(NamedValueColor)Enum.Parse(typeof(NamedValueColor),(string)tweenArguments["namedcolorvalue"],true); + } catch { + Debug.LogWarning("iTween: Unsupported namedcolorvalue supplied! Default will be used."); + namedcolorvalue = iTween.NamedValueColor._Color; + } + } + }else{ + namedcolorvalue=Defaults.namedColorValue; + } + + if(tweenArguments.Contains("looptype")){ + //allows loopType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["looptype"].GetType() == typeof(LoopType)){ + loopType=(LoopType)tweenArguments["looptype"]; + }else{ + try { + loopType=(LoopType)Enum.Parse(typeof(LoopType),(string)tweenArguments["looptype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported loopType supplied! Default will be used."); + loopType = iTween.LoopType.none; + } + } + }else{ + loopType = iTween.LoopType.none; + } + + if(tweenArguments.Contains("easetype")){ + //allows easeType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["easetype"].GetType() == typeof(EaseType)){ + easeType=(EaseType)tweenArguments["easetype"]; + }else{ + try { + easeType=(EaseType)Enum.Parse(typeof(EaseType),(string)tweenArguments["easetype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported easeType supplied! Default will be used."); + easeType=Defaults.easeType; + } + } + }else{ + easeType=Defaults.easeType; + } + + if(tweenArguments.Contains("space")){ + //allows space to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["space"].GetType() == typeof(Space)){ + space=(Space)tweenArguments["space"]; + }else{ + try { + space=(Space)Enum.Parse(typeof(Space),(string)tweenArguments["space"],true); + } catch { + Debug.LogWarning("iTween: Unsupported space supplied! Default will be used."); + space = Defaults.space; + } + } + }else{ + space = Defaults.space; + } + + if(tweenArguments.Contains("islocal")){ + isLocal = (bool)tweenArguments["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + // Added by PressPlay + if (tweenArguments.Contains("ignoretimescale")) + { + useRealTime = (bool)tweenArguments["ignoretimescale"]; + } + else + { + useRealTime = Defaults.useRealTime; + } + + //instantiates a cached ease equation reference: + GetEasingFunction(); + } + + //instantiates a cached ease equation refrence: + void GetEasingFunction(){ + switch (easeType){ + case EaseType.easeInQuad: + ease = new EasingFunction(easeInQuad); + break; + case EaseType.easeOutQuad: + ease = new EasingFunction(easeOutQuad); + break; + case EaseType.easeInOutQuad: + ease = new EasingFunction(easeInOutQuad); + break; + case EaseType.easeInCubic: + ease = new EasingFunction(easeInCubic); + break; + case EaseType.easeOutCubic: + ease = new EasingFunction(easeOutCubic); + break; + case EaseType.easeInOutCubic: + ease = new EasingFunction(easeInOutCubic); + break; + case EaseType.easeInQuart: + ease = new EasingFunction(easeInQuart); + break; + case EaseType.easeOutQuart: + ease = new EasingFunction(easeOutQuart); + break; + case EaseType.easeInOutQuart: + ease = new EasingFunction(easeInOutQuart); + break; + case EaseType.easeInQuint: + ease = new EasingFunction(easeInQuint); + break; + case EaseType.easeOutQuint: + ease = new EasingFunction(easeOutQuint); + break; + case EaseType.easeInOutQuint: + ease = new EasingFunction(easeInOutQuint); + break; + case EaseType.easeInSine: + ease = new EasingFunction(easeInSine); + break; + case EaseType.easeOutSine: + ease = new EasingFunction(easeOutSine); + break; + case EaseType.easeInOutSine: + ease = new EasingFunction(easeInOutSine); + break; + case EaseType.easeInExpo: + ease = new EasingFunction(easeInExpo); + break; + case EaseType.easeOutExpo: + ease = new EasingFunction(easeOutExpo); + break; + case EaseType.easeInOutExpo: + ease = new EasingFunction(easeInOutExpo); + break; + case EaseType.easeInCirc: + ease = new EasingFunction(easeInCirc); + break; + case EaseType.easeOutCirc: + ease = new EasingFunction(easeOutCirc); + break; + case EaseType.easeInOutCirc: + ease = new EasingFunction(easeInOutCirc); + break; + case EaseType.linear: + ease = new EasingFunction(linear); + break; + case EaseType.spring: + ease = new EasingFunction(spring); + break; + /* GFX47 MOD START */ + /*case EaseType.bounce: + ease = new EasingFunction(bounce); + break;*/ + case EaseType.easeInBounce: + ease = new EasingFunction(easeInBounce); + break; + case EaseType.easeOutBounce: + ease = new EasingFunction(easeOutBounce); + break; + case EaseType.easeInOutBounce: + ease = new EasingFunction(easeInOutBounce); + break; + /* GFX47 MOD END */ + case EaseType.easeInBack: + ease = new EasingFunction(easeInBack); + break; + case EaseType.easeOutBack: + ease = new EasingFunction(easeOutBack); + break; + case EaseType.easeInOutBack: + ease = new EasingFunction(easeInOutBack); + break; + /* GFX47 MOD START */ + /*case EaseType.elastic: + ease = new EasingFunction(elastic); + break;*/ + case EaseType.easeInElastic: + ease = new EasingFunction(easeInElastic); + break; + case EaseType.easeOutElastic: + ease = new EasingFunction(easeOutElastic); + break; + case EaseType.easeInOutElastic: + ease = new EasingFunction(easeInOutElastic); + break; + /* GFX47 MOD END */ + } + } + + //calculate percentage of tween based on time: + void UpdatePercentage(){ + + // Added by PressPlay + if (useRealTime) + { + runningTime += (Time.realtimeSinceStartup - lastRealTime); + } + else + { + runningTime += Time.deltaTime; + } + + if(reverse){ + percentage = 1 - runningTime/time; + }else{ + percentage = runningTime/time; + } + + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + void CallBack(string callbackType){ + if (tweenArguments.Contains(callbackType) && !tweenArguments.Contains("ischild")) { + //establish target: + GameObject target; + if (tweenArguments.Contains(callbackType+"target")) { + target=(GameObject)tweenArguments[callbackType+"target"]; + }else{ + target=gameObject; + } + + //throw an error if a string wasn't passed for callback: + if (tweenArguments[callbackType].GetType() == typeof(System.String)) { + target.SendMessage((string)tweenArguments[callbackType],(object)tweenArguments[callbackType+"params"],SendMessageOptions.DontRequireReceiver); + }else{ + Debug.LogError("iTween Error: Callback method references must be passed as a String!"); + Destroy (this); + } + } + } + + void Dispose(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable tweenEntry = tweens[i]; + if ((string)tweenEntry["id"] == id){ + tweens.RemoveAt(i); + break; + } + } + Destroy(this); + } + + void ConflictCheck(){//if a new iTween is about to run and is of the same type as an in progress iTween this will destroy the previous if the new one is NOT identical in every way or it will destroy the new iTween if they are: + Component[] tweens = GetComponents(); + foreach (iTween item in tweens) { + if(item.type == "value"){ + return; + }else if(item.isRunning && item.type==type){ + //cancel out if this is a shake or punch variant: + if (item.method != method) { + return; + } + + //step 1: check for length first since it's the fastest: + if(item.tweenArguments.Count != tweenArguments.Count){ + item.Dispose(); + return; + } + + //step 2: side-by-side check to figure out if this is an identical tween scenario to handle Update usages of iTween: + foreach (DictionaryEntry currentProp in tweenArguments) { + if(!item.tweenArguments.Contains(currentProp.Key)){ + item.Dispose(); + return; + }else{ + if(!item.tweenArguments[currentProp.Key].Equals(tweenArguments[currentProp.Key]) && (string)currentProp.Key != "id"){//if we aren't comparing ids and something isn't exactly the same replace the running iTween: + item.Dispose(); + return; + } + } + } + + //step 3: prevent a new iTween addition if it is identical to the currently running iTween + Dispose(); + //Destroy(this); + } + } + } + + void EnableKinematic(){ + /* + if(gameObject.GetComponent(typeof(Rigidbody))){ + if(!rigidbody.isKinematic){ + kinematic=true; + rigidbody.isKinematic=true; + } + } + */ + } + + void DisableKinematic(){ + /* + if(kinematic && rigidbody.isKinematic==true){ + kinematic=false; + rigidbody.isKinematic=false; + } + */ + } + + void ResumeDelay(){ + StartCoroutine("TweenDelay"); + } + + #endregion + + #region Easing Curves + + private float linear(float start, float end, float value){ + return Mathf.Lerp(start, end, value); + } + + private float clerp(float start, float end, float value){ + float min = 0.0f; + float max = 360.0f; + float half = Mathf.Abs((max - min) * 0.5f); + float retval = 0.0f; + float diff = 0.0f; + if ((end - start) < -half){ + diff = ((max - start) + end) * value; + retval = start + diff; + }else if ((end - start) > half){ + diff = -((max - end) + start) * value; + retval = start + diff; + }else retval = start + (end - start) * value; + return retval; + } + + private float spring(float start, float end, float value){ + value = Mathf.Clamp01(value); + value = (Mathf.Sin(value * Mathf.PI * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + (1.2f * (1f - value))); + return start + (end - start) * value; + } + + private float easeInQuad(float start, float end, float value){ + end -= start; + return end * value * value + start; + } + + private float easeOutQuad(float start, float end, float value){ + end -= start; + return -end * value * (value - 2) + start; + } + + private float easeInOutQuad(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value + start; + value--; + return -end * 0.5f * (value * (value - 2) - 1) + start; + } + + private float easeInCubic(float start, float end, float value){ + end -= start; + return end * value * value * value + start; + } + + private float easeOutCubic(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value + 1) + start; + } + + private float easeInOutCubic(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value + 2) + start; + } + + private float easeInQuart(float start, float end, float value){ + end -= start; + return end * value * value * value * value + start; + } + + private float easeOutQuart(float start, float end, float value){ + value--; + end -= start; + return -end * (value * value * value * value - 1) + start; + } + + private float easeInOutQuart(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value + start; + value -= 2; + return -end * 0.5f * (value * value * value * value - 2) + start; + } + + private float easeInQuint(float start, float end, float value){ + end -= start; + return end * value * value * value * value * value + start; + } + + private float easeOutQuint(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value * value * value + 1) + start; + } + + private float easeInOutQuint(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value * value * value + 2) + start; + } + + private float easeInSine(float start, float end, float value){ + end -= start; + return -end * Mathf.Cos(value * (Mathf.PI * 0.5f)) + end + start; + } + + private float easeOutSine(float start, float end, float value){ + end -= start; + return end * Mathf.Sin(value * (Mathf.PI * 0.5f)) + start; + } + + private float easeInOutSine(float start, float end, float value){ + end -= start; + return -end * 0.5f * (Mathf.Cos(Mathf.PI * value) - 1) + start; + } + + private float easeInExpo(float start, float end, float value){ + end -= start; + return end * Mathf.Pow(2, 10 * (value - 1)) + start; + } + + private float easeOutExpo(float start, float end, float value){ + end -= start; + return end * (-Mathf.Pow(2, -10 * value ) + 1) + start; + } + + private float easeInOutExpo(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * Mathf.Pow(2, 10 * (value - 1)) + start; + value--; + return end * 0.5f * (-Mathf.Pow(2, -10 * value) + 2) + start; + } + + private float easeInCirc(float start, float end, float value){ + end -= start; + return -end * (Mathf.Sqrt(1 - value * value) - 1) + start; + } + + private float easeOutCirc(float start, float end, float value){ + value--; + end -= start; + return end * Mathf.Sqrt(1 - value * value) + start; + } + + private float easeInOutCirc(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return -end * 0.5f * (Mathf.Sqrt(1 - value * value) - 1) + start; + value -= 2; + return end * 0.5f * (Mathf.Sqrt(1 - value * value) + 1) + start; + } + + /* GFX47 MOD START */ + private float easeInBounce(float start, float end, float value){ + end -= start; + float d = 1f; + return end - easeOutBounce(0, end, d-value) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float bounce(float start, float end, float value){ + private float easeOutBounce(float start, float end, float value){ + value /= 1f; + end -= start; + if (value < (1 / 2.75f)){ + return end * (7.5625f * value * value) + start; + }else if (value < (2 / 2.75f)){ + value -= (1.5f / 2.75f); + return end * (7.5625f * (value) * value + .75f) + start; + }else if (value < (2.5 / 2.75)){ + value -= (2.25f / 2.75f); + return end * (7.5625f * (value) * value + .9375f) + start; + }else{ + value -= (2.625f / 2.75f); + return end * (7.5625f * (value) * value + .984375f) + start; + } + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + private float easeInOutBounce(float start, float end, float value){ + end -= start; + float d = 1f; + if (value < d* 0.5f) return easeInBounce(0, end, value*2) * 0.5f + start; + else return easeOutBounce(0, end, value*2-d) * 0.5f + end*0.5f + start; + } + /* GFX47 MOD END */ + + private float easeInBack(float start, float end, float value){ + end -= start; + value /= 1; + float s = 1.70158f; + return end * (value) * value * ((s + 1) * value - s) + start; + } + + private float easeOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value = (value) - 1; + return end * ((value) * value * ((s + 1) * value + s) + 1) + start; + } + + private float easeInOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value /= .5f; + if ((value) < 1){ + s *= (1.525f); + return end * 0.5f * (value * value * (((s) + 1) * value - s)) + start; + } + value -= 2; + s *= (1.525f); + return end * 0.5f * ((value) * value * (((s) + 1) * value + s) + 2) + start; + } + + private float punch(float amplitude, float value){ + float s = 9; + if (value == 0){ + return 0; + } + else if (value == 1){ + return 0; + } + float period = 1 * 0.3f; + s = period / (2 * Mathf.PI) * Mathf.Asin(0); + return (amplitude * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * 1 - s) * (2 * Mathf.PI) / period)); + } + + /* GFX47 MOD START */ + private float easeInElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return -(a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float elastic(float start, float end, float value){ + private float easeOutElastic(float start, float end, float value){ + /* GFX47 MOD END */ + //Thank you to rafael.marteleto for fixing this as a port over from Pedro's UnityTween + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p * 0.25f; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return (a * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) + end + start); + } + + /* GFX47 MOD START */ + private float easeInOutElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d*0.5f) == 2) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + if (value < 1) return -0.5f * (a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + return a * Mathf.Pow(2, -10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) * 0.5f + end + start; + } + /* GFX47 MOD END */ + + #endregion + + #region Deprecated and Renamed + /* + public static void audioFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioFrom() has been renamed to AudioFrom().");} + public static void audioTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioTo() has been renamed to AudioTo().");} + public static void colorFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorFrom() has been renamed to ColorFrom().");} + public static void colorTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorTo() has been renamed to ColorTo().");} + public static void fadeFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeFrom() has been renamed to FadeFrom().");} + public static void fadeTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeTo() has been renamed to FadeTo().");} + public static void lookFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFrom() has been renamed to LookFrom().");} + public static void lookFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFromWorld() has been deprecated. Please investigate LookFrom().");} + public static void lookTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookTo() has been renamed to LookTo().");} + public static void lookToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdate() has been renamed to LookUpdate().");} + public static void lookToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdateWorld() has been deprecated. Please investigate LookUpdate().");} + public static void moveAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAdd() has been renamed to MoveAdd().");} + public static void moveAddWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveBy() has been renamed to MoveBy().");} + public static void moveByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFrom() has been renamed to MoveFrom().");} + public static void moveFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFromWorld() has been deprecated. Please investigate MoveFrom().");} + public static void moveTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveTo() has been renamed to MoveTo().");} + public static void moveToBezier(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezier() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToBezierWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezierWorld() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdate() has been renamed to MoveUpdate().");} + public static void moveToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdateWorld() has been deprecated. Please investigate MoveUpdate().");} + public static void moveToWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToWorld() has been deprecated. Please investigate MoveTo().");} + public static void punchPosition(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchPosition().");} + public static void punchPositionWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPositionWorld() has been deprecated. Please investigate PunchPosition().");} + public static void punchRotation(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchRotation().");} + public static void punchRotationWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchRotationWorld() has been deprecated. Please investigate PunchRotation().");} + public static void punchScale(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchScale() has been renamed to PunchScale().");} + public static void rotateAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateAdd() has been renamed to RotateAdd().");} + public static void rotateBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateBy() has been renamed to RotateBy().");} + public static void rotateByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateByWorld() has been deprecated. Please investigate RotateBy().");} + public static void rotateFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateFrom() has been renamed to RotateFrom().");} + public static void rotateTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateTo() has been renamed to RotateTo().");} + public static void scaleAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleAdd() has been renamed to ScaleAdd().");} + public static void scaleBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleBy() has been renamed to ScaleBy().");} + public static void scaleFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleFrom() has been renamed to ScaleFrom().");} + public static void scaleTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleTo() has been renamed to ScaleTo().");} + public static void shake(GameObject target, Hashtable args){Debug.LogError("iTween Error: scale() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void shakeWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: shakeWorld() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void stab(GameObject target, Hashtable args){Debug.LogError("iTween Error: stab() has been renamed to Stab().");} + public static void stop(GameObject target, Hashtable args){Debug.LogError("iTween Error: stop() has been renamed to Stop().");} + public static void stopType(GameObject target, Hashtable args){Debug.LogError("iTween Error: stopType() has been deprecated. Please investigate Stop().");} + public static void tweenCount(GameObject target, Hashtable args){Debug.LogError("iTween Error: tweenCount() has been deprecated. Please investigate Count().");} + */ + #endregion +} diff --git a/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta new file mode 100644 index 0000000..591fd5a --- /dev/null +++ b/UnityTests.Unity5/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 521257714fc9e437a9163df2d37f2ea2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/Resources.meta b/UnityTests.Unity5/Assets/Resources.meta new file mode 100644 index 0000000..ff8703e --- /dev/null +++ b/UnityTests.Unity5/Assets/Resources.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c4ba43af0a1577c44aed9e8ee47cbb81 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset new file mode 100644 index 0000000..91ffb0a Binary files /dev/null and b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset differ diff --git a/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset.meta b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset.meta new file mode 100644 index 0000000..5b7f13d --- /dev/null +++ b/UnityTests.Unity5/Assets/Resources/DOTweenSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce117ac50a01981468b64937132115fa +timeCreated: 1426159620 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/SampleClass.cs b/UnityTests.Unity5/Assets/SampleClass.cs new file mode 100644 index 0000000..120088a --- /dev/null +++ b/UnityTests.Unity5/Assets/SampleClass.cs @@ -0,0 +1,9 @@ +public class SampleClass +{ + public float floatVal; + + public SampleClass(float floatVal) + { + this.floatVal = floatVal; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/SampleClass.cs.meta b/UnityTests.Unity5/Assets/SampleClass.cs.meta new file mode 100644 index 0000000..535e7a2 --- /dev/null +++ b/UnityTests.Unity5/Assets/SampleClass.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5374fed20b767e240973bc047e1c7312 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/SampleCube.prefab b/UnityTests.Unity5/Assets/SampleCube.prefab new file mode 100644 index 0000000..ba31488 Binary files /dev/null and b/UnityTests.Unity5/Assets/SampleCube.prefab differ diff --git a/UnityTests.Unity5/Assets/SampleCube.prefab.meta b/UnityTests.Unity5/Assets/SampleCube.prefab.meta new file mode 100644 index 0000000..f39382d --- /dev/null +++ b/UnityTests.Unity5/Assets/SampleCube.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 569696ae7d0444f4cbcb038d5f6e9ab8 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/SampleMAT.mat b/UnityTests.Unity5/Assets/SampleMAT.mat new file mode 100644 index 0000000..17639ec Binary files /dev/null and b/UnityTests.Unity5/Assets/SampleMAT.mat differ diff --git a/UnityTests.Unity5/Assets/SampleMAT.mat.meta b/UnityTests.Unity5/Assets/SampleMAT.mat.meta new file mode 100644 index 0000000..4ebc617 --- /dev/null +++ b/UnityTests.Unity5/Assets/SampleMAT.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c58c23a68cd685a48a251f4b8c174b49 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets.meta b/UnityTests.Unity5/Assets/Standard Assets.meta new file mode 100644 index 0000000..72aa307 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9b6c3265fe95ef14eb69adc565411c57 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets.meta new file mode 100644 index 0000000..4e16ce4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7e6f84bf81c8d4de280f1133cff7e601 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta new file mode 100644 index 0000000..8ad03b6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: f2af333648c334319bd43c214449ab50 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd new file mode 100644 index 0000000..3ef205f Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta new file mode 100644 index 0000000..fa248b4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 2c528fec5d95e4ac28cf46399b887662 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd new file mode 100644 index 0000000..524c925 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta new file mode 100644 index 0000000..25f7643 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Grass/Grass2.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: d6cdc79ec19714fcd980ca3f6ac01a0a +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta new file mode 100644 index 0000000..4a01de4 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cba4562cece794697b418ce8e7c04b3c +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd new file mode 100644 index 0000000..6e22b60 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta new file mode 100644 index 0000000..3efa40d --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Cliff (Layered Rock).psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 18214e9d6af6248559d501391856f1c7 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd new file mode 100644 index 0000000..b53f25f Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta new file mode 100644 index 0000000..7ae4c98 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/GoodDirt.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: bfd675cc0db1d4656b75dc6d6ba91142 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd new file mode 100644 index 0000000..ac22ca8 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta new file mode 100644 index 0000000..9beda07 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill).psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: c6e0767b1f8c34890ac245217f4b9731 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd new file mode 100644 index 0000000..38269a0 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta new file mode 100644 index 0000000..47ceaf7 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Terrain Textures/Grass&Rock.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 440eb36db91ca410f800ff3cfe43572f +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta new file mode 100644 index 0000000..a682933 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ac865f55780124eeabc4a99d6d0b0115 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta new file mode 100644 index 0000000..9a85322 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5710a1f47af2947699139509aae39149 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta new file mode 100644 index 0000000..e2aefe5 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 527393b10fb66418bbaa072e104f5a30 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat new file mode 100644 index 0000000..51941d4 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta new file mode 100644 index 0000000..21100c6 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbark.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5bdb6135a74b444d8cebd065dbf9d08 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat new file mode 100644 index 0000000..b2ee33d Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta new file mode 100644 index 0000000..50c8c92 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Materials/palmbranch.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3186f38ca67e7441e8299da2e169f9f9 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx new file mode 100644 index 0000000..7e890f6 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta new file mode 100644 index 0000000..8b2b582 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/Palm.fbx.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 4c85abd0a4d974473b97e81d10a3a6bc +ModelImporter: + serializedVersion: 16 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: polySurface1 + 11100000: //RootNode + materials: + importMaterials: 1 + materialName: 3 + materialSearch: 1 + animations: + legacyGenerateAnimations: 0 + bakeSimulation: 0 + optimizeGameObjects: 0 + motionNodeName: + animationCompression: 1 + animationRotationError: .5 + animationPositionError: .5 + animationScaleError: .5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + tangentSpace: + normalSmoothAngle: 60 + splitTangentsAcrossUV: 0 + normalImportMode: 0 + tangentImportMode: 1 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: .5 + foreArmTwist: .5 + upperLegTwist: .5 + legTwist: .5 + armStretch: .0500000007 + legStretch: .0500000007 + feetSpacing: 0 + rootMotionBoneName: + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 1 + additionalBone: 1 + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd new file mode 100644 index 0000000..7d219ec Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta new file mode 100644 index 0000000..179de37 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBark.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: f7d5f039a8e7848e889e1546d37dc39e +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 1 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd new file mode 100644 index 0000000..efb1392 Binary files /dev/null and b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd differ diff --git a/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta new file mode 100644 index 0000000..8290942 --- /dev/null +++ b/UnityTests.Unity5/Assets/Standard Assets/Terrain Assets/Trees Ambient-Occlusion/Palm/PalmBranch.psd.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 54e03e659ab274dd9b12c0538a9c4983 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 2 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/UnityVS.meta b/UnityTests.Unity5/Assets/UnityVS.meta new file mode 100644 index 0000000..00d3372 --- /dev/null +++ b/UnityTests.Unity5/Assets/UnityVS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 02fe78e962405814a83b8ba6c9471d32 +folderAsset: yes +timeCreated: 1426681054 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor.meta b/UnityTests.Unity5/Assets/UnityVS/Editor.meta new file mode 100644 index 0000000..b6befcd --- /dev/null +++ b/UnityTests.Unity5/Assets/UnityVS/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6e71a3e2fb5854e43823a9da25b68e21 +folderAsset: yes +timeCreated: 1426681054 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll new file mode 100644 index 0000000..8f28fd7 Binary files /dev/null and b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll differ diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll.meta b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll.meta new file mode 100644 index 0000000..b6baca6 --- /dev/null +++ b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 38d405c119fcc7c4e83d4a478a40ff2f diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll new file mode 100644 index 0000000..3df910d Binary files /dev/null and b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll differ diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll.meta b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll.meta new file mode 100644 index 0000000..1d07397 --- /dev/null +++ b/UnityTests.Unity5/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4ad02dc83da735c4e8d945332b9202f6 diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll b/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll new file mode 100644 index 0000000..a5205cd Binary files /dev/null and b/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll differ diff --git a/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll.meta b/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll.meta new file mode 100644 index 0000000..a3a6d5a --- /dev/null +++ b/UnityTests.Unity5/Assets/UnityVS/Editor/UnityVS.VersionSpecific.dll.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 42c12149efdc035458bffa42058b9a04 +timeCreated: 1426681070 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests PRO.meta b/UnityTests.Unity5/Assets/_Tests PRO.meta new file mode 100644 index 0000000..1c7c6c5 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d39176b1d2f7d0748abbfe614c1c2496 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity b/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity new file mode 100644 index 0000000..ad19d97 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity.meta new file mode 100644 index 0000000..3e5ab85 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/AnimationEditor.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fb89465d399dca42868a23e46c09e39 +timeCreated: 1426174764 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs b/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs new file mode 100644 index 0000000..01df174 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs @@ -0,0 +1,115 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Paths : BrainBase +{ + public Ease ease = Ease.Linear; + public AxisConstraint lockPosition; + public AxisConstraint lockRotation0, lockRotation1; + public LoopType loopType = LoopType.Yoyo; + public PathMode pathMode; + public int pathResolution = 10; + public bool closePaths; + public Vector3 forward = Vector3.forward; + public Color[] pathsColors = new Color[2]; + public Transform[] targets; + + Tween controller; + + void Start() + { + return; + + Vector3[] path = new[] { + new Vector3(0,1,0), + new Vector3(1,2,0), + new Vector3(2,1,0), + new Vector3(2,0,0) + }; + + TweenParams tp = new TweenParams() + .SetEase(ease) + .SetLoops(-1, loopType); + + AxisConstraint lockRotation = lockRotation0 | lockRotation1; + + // Relative VS non relative + controller = targets[0].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(0.1f, forward) + .SetAs(tp) + .SetRelative() + .Pause(); + targets[1].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[1]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(targets[2], forward) + .SetAs(tp) + .Pause(); + + // Linear VS curved + targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(new Vector3(3, 0, 0), forward) + .SetAs(tp) + .SetRelative() + .Pause(); + targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(0.1f, forward) + .SetAs(tp) + .SetRelative() + .Pause(); + + // Linear VS curved no lookAt + targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetAs(tp) + .SetRelative() + .Pause(); + targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetAs(tp) + .SetRelative() + .Pause(); + + // Linear VS curved top-down + path = new[] { + new Vector3(0,0,1), + new Vector3(1,0,2), + new Vector3(2,0,1), + new Vector3(2,0,0) + }; + targets[6].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(0.1f, forward) + .SetAs(tp) + .SetRelative() + .Pause(); + targets[7].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1]) + .SetOptions(closePaths, lockPosition, lockRotation) + .SetLookAt(0.1f, forward) + .SetAs(tp) + .SetRelative() + .Pause(); + + // Log lengths + controller.ForceInit(); + Debug.Log("Controller path length: " + controller.PathLength()); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + DGUtils.GUIScrubber(controller); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Goto 1.5")) DOTween.GotoAll(1.5f); + if (GUILayout.Button("Kill")) DOTween.KillAll(); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs.meta b/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs.meta new file mode 100644 index 0000000..926fecf --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9121962a6609ba743a789347a38b036f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity b/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity new file mode 100644 index 0000000..bc63c77 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity.meta new file mode 100644 index 0000000..32a8baa --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c5bfd946971ae7e48b678c8b96e7ff3d +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs new file mode 100644 index 0000000..6043f97 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs @@ -0,0 +1,94 @@ +using Holoville.HOTween; +using Holoville.HOTween.Plugins; +using System.Collections; +using UnityEngine; + +public class Paths_HOTween : MonoBehaviour +{ + public Axis lockPosition; + public Axis lockRotation0, lockRotation1; + public bool is2DPath, is2DSideScroller; + public Transform[] targets; + + void Start() + { + HOTween.showPathGizmos = true; + + Vector3[] path = new[] { + Vector3.zero, + new Vector3(0,1,0), + new Vector3(1,2,0), + new Vector3(2,1,0), + new Vector3(2,0,0) + }; + + Axis lockRotation = lockRotation0 | lockRotation1; + + PlugVector3Path plugPath = new PlugVector3Path(path, true).ClosePath().OrientToPath(0.1f, lockRotation).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[0], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + plugPath = new PlugVector3Path(path).ClosePath().LookAt(targets[2]).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[1], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + + // Linear VS curved + plugPath = new PlugVector3Path(path, true, PathType.Curved).ClosePath().LookAt(Vector3.zero).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[2], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + plugPath = new PlugVector3Path(path, true, PathType.Linear).ClosePath().OrientToPath(0.1f, lockRotation).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[3], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + + // Linear VS curved top-down + path = new[] { + Vector3.zero, + new Vector3(0,0,1), + new Vector3(1,0,2), + new Vector3(2,0,1), + new Vector3(2,0,0) + }; + plugPath = new PlugVector3Path(path, true, PathType.Curved).ClosePath().OrientToPath(0.1f, lockRotation).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[4], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + plugPath = new PlugVector3Path(path, true, PathType.Linear).ClosePath().OrientToPath(0.1f, lockRotation).LockPosition(lockPosition); + if (is2DPath) plugPath.Is2D(is2DSideScroller); + HOTween.To(targets[5], 3, new TweenParms() + .Prop("position", plugPath) + .Ease(EaseType.Linear) + .Loops(-1) + ).Pause(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play")) HOTween.Play(); + if (GUILayout.Button("Pause")) HOTween.Pause(); + if (GUILayout.Button("Kill")) HOTween.Kill(); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs.meta b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs.meta new file mode 100644 index 0000000..fb1394b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a13a5a033ebd06458bd685af5583116 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity new file mode 100644 index 0000000..bbed7a2 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity.meta new file mode 100644 index 0000000..bf791fb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/Paths_HOTween.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9f573f93773af8d4a87aa96af4be4072 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs new file mode 100644 index 0000000..b7704ee --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs @@ -0,0 +1,39 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class ShapeTweens : BrainBase +{ + public float duration = 1; + public int loops = 1; + public LoopType loopType = LoopType.Yoyo; + public Ease ease = Ease.Linear; + public SpiralMode spiralMode; + public float frequency = 4; + public float speed = 1; + public float depth = 0; + public Vector3 direction = Vector3.up; + public bool snapping; + public Transform[] targets; + + void Start() + { + targets[0].DOSpiral(duration, direction, spiralMode, speed, frequency, depth, snapping) + .SetEase(ease) + .SetLoops(loops, loopType) + .SetAutoKill(false) + .Pause(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs.meta b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs.meta new file mode 100644 index 0000000..58a9720 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e8ed40e1bb084f44ae3ecb0632a1aba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity new file mode 100644 index 0000000..66f56ef Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity.meta new file mode 100644 index 0000000..42fd1d2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/ShapeTweens.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5c2314ff1b46d99408662536edca1d98 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity new file mode 100644 index 0000000..1894f96 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity.meta new file mode 100644 index 0000000..a65d764 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9664d49472fc31a40b3149198d903aa5 +timeCreated: 1426535291 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity new file mode 100644 index 0000000..2bcdca0 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity.meta new file mode 100644 index 0000000..8bc8081 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenAnimation.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61ed382d1a0663444ab0f79297419be2 +timeCreated: 1426588047 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity new file mode 100644 index 0000000..66cdad0 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity.meta b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity.meta new file mode 100644 index 0000000..68e9e06 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests PRO/_4video_DOTweenPath.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a4da94159cf411e4f9d57797268dee0f +timeCreated: 1426590721 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests.meta b/UnityTests.Unity5/Assets/_Tests.meta new file mode 100644 index 0000000..7d6c7d7 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ce8e63e0e1a0163489d2afcce127d357 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Basics.cs b/UnityTests.Unity5/Assets/_Tests/Basics.cs new file mode 100644 index 0000000..dcd1bc9 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Basics.cs @@ -0,0 +1,246 @@ +using DG.Tweening; +using DG.Tweening.Plugins; +using UnityEngine; + +public class Basics : BrainBase +{ + public bool tweenLightAndCam = true; + public int loops = 100000; + public LoopType loopType = LoopType.Yoyo; + public Ease ease = Ease.OutQuad; + public AnimationCurve easeCurve; + public Vector3 toRotation = new Vector3(0, 180, 0); + public Color toCamColor, toLightColor, toSpriteColor; + public Transform[] targets; + public Light mainLight; + public SpriteRenderer spriteRenderer; + public GameObject specularSphere; + public Transform targetToDoLookAt, targetToDoLookFrom; + public GUITexture guiTexAlpha, guiTexColor; + public GUIText txtInfo, txtFloat, txtInt, txtUint, txtVector2, txtVector4, txtRect, txtRectOffset, txtString0, txtString1, txtString2; + public GameObject txtBackwards; + + int intId = 4; + string stringId = "hello"; + Tween[] tweens; + + int intToTween; + uint uintToTween; + float floatToTween; + Vector2 vector2toTween; + Vector4 vector4toTween; + Rect rectToTween; + RectOffset rectOffsetToTween; + string stringToTween0 = "Short text", stringToTween1 = "Long text to show how it gets completely replaced", stringToTween2 = "Relative text... "; + + void Start() + { + DOTween.logBehaviour = LogBehaviour.ErrorsOnly; + + txtInfo.text = txtInfo.text.Replace("#N", loops.ToString("N0")); + + // Set RectOffset since it can't be set before + rectOffsetToTween = new RectOffset(0, 0, 0, 0); + + TweenParams tp = new TweenParams(); + tp.SetLoops(loops, loopType).SetAutoKill(false); + if (ease == Ease.INTERNAL_Custom) tp.SetEase(easeCurve); + else tp.SetEase(ease); + + // Transform tweens + tweens = new Tween[targets.Length - 1]; + for (int i = 0; i < targets.Length; ++i) + { + Transform t = targets[i]; + switch (i) { + case 0: + tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetRelative().SetUpdate(true).SetAutoKill(true); + break; + case 1: + // Red cube (rotation) + tweens[i] = DOTween.To(()=> t.rotation, x=> t.rotation = x, toRotation, 1.5f).SetAs(tp).SetRelative(); + break; + case 2: + tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetOptions(true).SetRelative().SetAutoKill(true); + break; + case 3: + // Vector3Array (not stored) + Vector3[] path = new[] { + new Vector3(1,0,0), new Vector3(0,1,0), new Vector3(1,0,0), new Vector3(0,-1,0) + }; + float[] durations = new[] { 0.5f, 0.5f, 0.5f, 0.5f }; + DOTween.ToArray(() => t.position, x => t.position = x, path, durations) + .SetAs(tp).SetRelative().Pause(); + continue; + } + Tween tween = tweens[i]; + tween.OnStart(()=> Debug.Log("OnStart: " + t.name)) + .OnPlay(()=> Debug.Log("OnPlay: " + t.name)) + .OnPause(()=> Debug.Log("OnPause: " + t.name)) + .OnComplete(()=> Debug.Log("OnComplete: " + t.name)) + .Pause(); + switch (i) { + case 0: + tween.SetId(intId); + // tween.OnStart(()=>tweens[2].Kill()); + break; + case 1: + tween.SetId(stringId); + break; + case 2: + tween.SetId(this); + break; + } + } + // Additional tweens ////////////////////////// + // Float + DOTween.To(()=> floatToTween, x=> floatToTween = x, 100, 1.5f).SetAs(tp).Pause(); + // Int + DOTween.To(()=> intToTween, x=> intToTween = x, 100, 1.5f).SetAs(tp).Pause(); + // Uint + DOTween.To(()=> uintToTween, x=> uintToTween = x, 50, 1.5f).SetAs(tp).Pause(); + // Vector2 + DOTween.To(()=> vector2toTween, x=> vector2toTween = x, new Vector2(50,100), 1.5f).SetAs(tp).Pause(); + // Vector4 + DOTween.To(()=> vector4toTween, x=> vector4toTween = x, new Vector4(50,100,150,200), 1.5f).SetAs(tp).Pause(); + // Rect + DOTween.To(()=> rectToTween, x=> rectToTween = x, new Rect(10, 20, 50, 100), 1.5f).SetAs(tp).Pause(); + // RectOffset + DOTween.To(()=> rectOffsetToTween, x=> rectOffsetToTween = x, new RectOffset(10, 20, 50, 100), 1.5f).SetAs(tp).Pause(); + // Color + DOTween.To(()=> guiTexColor.color, x=> guiTexColor.color = x, Color.green, 1.5f).SetAs(tp).Pause(); + // Alpha + DOTween.ToAlpha(()=> guiTexAlpha.color, x=> guiTexAlpha.color = x, 0f, 1.5f).SetAs(tp).Pause(); + // String + DOTween.To(()=> stringToTween0, x=> stringToTween0 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause(); + // String + DOTween.To(()=> stringToTween1, x=> stringToTween1 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause(); + // String (relative) + DOTween.To(()=> stringToTween2, x=> stringToTween2 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).SetRelative().Pause(); + if (tweenLightAndCam) { + // Camera + Camera.main.DOColor(toCamColor, 1.5f).SetAs(tp).Pause(); + // Light + mainLight.DOColor(toLightColor, 1.5f).SetAs(tp).Pause(); + mainLight.DOIntensity(4, 1.5f).SetAs(tp).Pause(); + } + // SpriteRenderer + spriteRenderer.DOColor(toSpriteColor, 1.5f).SetAs(tp).Pause(); + // Specular material tween + specularSphere.GetComponent().material.DOColor(Color.green, "_SpecColor", 1.5f).SetAs(tp).Pause(); + // Rotate towards + targetToDoLookAt.DOLookAt(specularSphere.transform.position, 1.5f).SetAs(tp).Pause(); + targetToDoLookFrom.DOLookAt(specularSphere.transform.position, 1.5f).From().SetAs(tp).Pause(); + } + + void LateUpdate() + { + txtFloat.text = "float: " + floatToTween; + txtInt.text = "int: " + intToTween; + txtUint.text = "uint: " + uintToTween; + txtVector2.text = "Vector2: " + vector2toTween; + txtVector4.text = "Vector4: " + vector4toTween; + txtRect.text = "Rect: " + rectToTween; + txtRectOffset.text = "RectOffset: " + rectOffsetToTween; + txtString0.text = "String 0: " + stringToTween0; + txtString1.text = "String 1: " + stringToTween1; + txtString2.text = "String 2: " + stringToTween2; + + bool isBackwards = tweens[1] != null && tweens[1].IsBackwards(); + if (isBackwards && !txtBackwards.activeSelf || !isBackwards && txtBackwards.activeSelf) { + txtBackwards.SetActive(!txtBackwards.activeSelf); + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play All")) Debug.Log("Played tweens: " + DOTween.PlayAll()); + if (GUILayout.Button("Pause All")) Debug.Log("Paused tweens: " + DOTween.PauseAll()); + if (GUILayout.Button("Kill All")) Debug.Log("Killed tweens: " + DOTween.KillAll()); + if (GUILayout.Button("Complete+Kill All")) Debug.Log("Killed tweens: " + DOTween.KillAll(true)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Rewind All")) Debug.Log("Rewinded tweens: " + DOTween.RewindAll()); + if (GUILayout.Button("Restart All")) Debug.Log("Restarted tweens: " + DOTween.RestartAll()); + if (GUILayout.Button("Complete All")) Debug.Log("Completed tweens: " + DOTween.CompleteAll()); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("PlayForward All")) Debug.Log("PlayForwarded tweens: " + DOTween.PlayForwardAll()); + if (GUILayout.Button("PlayBackwards All")) Debug.Log("PlayBackwarded tweens: " + DOTween.PlayBackwardsAll()); + if (GUILayout.Button("Flip All")) Debug.Log("Flipped tweens: " + DOTween.FlipAll()); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto 1.5 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(1.5f)); + if (GUILayout.Button("Goto 3 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(3)); + if (GUILayout.Button("Goto 4.5 All")) Debug.Log("Goto-ed tweens: " + DOTween.GotoAll(4.5f)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play by Id")) Debug.Log("Played tweens: " + DOTween.Play(intId)); + if (GUILayout.Button("Play by StringId")) Debug.Log("Played tweens: " + DOTween.Play(stringId)); + if (GUILayout.Button("Play by UnityObjectId")) Debug.Log("Played tweens: " + DOTween.Play(this)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Pause by Id")) Debug.Log("Paused tweens: " + DOTween.Pause(intId)); + if (GUILayout.Button("Pause by StringId")) Debug.Log("Paused tweens: " + DOTween.Pause(stringId)); + if (GUILayout.Button("Pause by UnityObjectId")) Debug.Log("PlaPausedyed tweens: " + DOTween.Pause(this)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Kill by Id")) Debug.Log("Killed tweens: " + DOTween.Kill(intId)); + if (GUILayout.Button("Complete+Kill by Id")) Debug.Log("Killed tweens: " + DOTween.Kill(intId, true)); + if (GUILayout.Button("Kill by StringId")) Debug.Log("Killed tweens: " + DOTween.Kill(stringId)); + if (GUILayout.Button("Kill by UnityObjectId")) Debug.Log("Killed tweens: " + DOTween.Kill(this)); + if (GUILayout.Button("Clear")) { + Debug.Log(":::::::::::: CLEAR"); + DOTween.Clear(); + } + if (GUILayout.Button("Clear & Reload")) { + Debug.Log(":::::::::::: CLEAR AND RELOAD"); + int level = Application.loadedLevel; + DOTween.Clear(); + Application.LoadLevel(level); + } + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + if (GUILayout.Button("Direct Kill")) t.Kill(); + } + GUILayout.EndHorizontal(); + + GUILayout.Space(5); + + GUILayout.Label("Global DOTween Timescale"); + GUILayout.BeginHorizontal(); + DOTween.timeScale = GUILayout.HorizontalSlider(DOTween.timeScale, 0.0f, 20.0f); + if (GUILayout.Button("Reset", GUILayout.Width(80))) DOTween.timeScale = 1; + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + for (int i = 0; i < tweens.Length; ++i) GUILayout.Label("Single Timescale"); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + t.timeScale = GUILayout.HorizontalSlider(t.timeScale, 0.0f, 20.0f, GUILayout.Width(60)); + if (GUILayout.Button("Reset", GUILayout.Width(80))) t.timeScale = 1; + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + foreach (Tween t in tweens) { + GUILayout.Label("Elapsed: " + t.Elapsed(false) + + "\nFullElapsed: " + t.Elapsed() + + "\nElapsed %: " + t.ElapsedPercentage(false) + + "\nFullElapsed %: " + t.ElapsedPercentage() + + "\nCompleted Loops: " + t.CompletedLoops() + ); + } + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Basics.cs.meta b/UnityTests.Unity5/Assets/_Tests/Basics.cs.meta new file mode 100644 index 0000000..d491b9d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Basics.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a621cf8dd34803b4aa9f54590cd19c4d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Basics.unity b/UnityTests.Unity5/Assets/_Tests/Basics.unity new file mode 100644 index 0000000..77538d2 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Basics.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Basics.unity.meta b/UnityTests.Unity5/Assets/_Tests/Basics.unity.meta new file mode 100644 index 0000000..ef35012 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Basics.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fcbe7ea1e13cc024c822bc5ed6e7e751 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs.meta new file mode 100644 index 0000000..9c66c44 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 857866c1bf6ef0b4f906c2f07a781b5f +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs new file mode 100644 index 0000000..0be7203 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class AddTweenIndexOutOfRange : BrainBase +{ + public GameObject prefab; + public Transform container; + public int totObjs = 300; + + Transform[] ts; + + void Start() + { + ts = new Transform[totObjs]; + for (int i = 0; i < totObjs; ++i) { + GameObject go = Instantiate(prefab) as GameObject; + go.transform.position = RandomV3(); + go.transform.parent = container; + ts[i] = go.transform; + } + } + + void OnGUI() + { + if (GUILayout.Button("Tween")) CreateTweens(); + if (GUILayout.Button("Kill All & Create Tweens")) { + DOTween.KillAll(); + CreateTweens(); + } + if (GUILayout.Button("Kill All & Create Tweens Combo")) { + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + DOTween.KillAll(); + CreateTweens(); + } + if (GUILayout.Button("Kill All")) DOTween.KillAll(); + } + + void CreateTweens() + { + foreach (Transform trans in ts) trans.DOMove(RandomV3(), 2).SetLoops(-1, LoopType.Yoyo); + } + + Vector3 RandomV3() + { + const float range = 7; + return new Vector3(Random.Range(-range,range), Random.Range(-range,range), Random.Range(-range,range)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta new file mode 100644 index 0000000..16ae95c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8158f403c14d8ce42bc9e62a26d0b911 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity new file mode 100644 index 0000000..61a1782 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta new file mode 100644 index 0000000..085625d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AddTweenIndexOutOfRange.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 696584990385c1741970de5d0e4a3aec +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs new file mode 100644 index 0000000..bb14352 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs @@ -0,0 +1,20 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class AppendLookAt : MonoBehaviour +{ + public Transform target, lookAtTarget, moveToTarget; + + void Start() + { + DOTween.Sequence() + .Append(target.DOMove(moveToTarget.position,3,false)) + .Append(target.DOLookAt(lookAtTarget.position,3)); + + // DOTween.Sequence() + // .Append(target.DORotate(new Vector3(0, 180, 0), 1).SetRelative()) + // .Append(target.DOMoveX(-3, 1).SetRelative()) + // .Append(target.DORotate(new Vector3(0, 45, 0), 1).SetRelative()); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs.meta new file mode 100644 index 0000000..1e2146e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6778be44d281eda4d8fef812dfdebc18 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity new file mode 100644 index 0000000..141d453 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity.meta new file mode 100644 index 0000000..22f0795 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/AppendLookAt.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 147f778e86d76aa42b4bb2c2c9749ec9 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs new file mode 100644 index 0000000..663f403 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class ElasticDragAndRelease : MonoBehaviour +{ + public Transform target; + Vector3 orPos; + + void Start() + { + orPos = target.position; + } + + public void OnClick() + { + StartCoroutine(TweenCoroutine()); + } + + IEnumerator TweenCoroutine() + { + float range = 2; + Vector3 rnd = new Vector3(Random.Range(-range, range), Random.Range(-range, range), target.position.z); + target.position = orPos + rnd; + + yield return new WaitForSeconds(1); + + target.DOMove(orPos, 0.6f).SetEase(Ease.OutElastic, 4, 0); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta new file mode 100644 index 0000000..a28e0b2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3cfc6eb13ec575448bb58d1358e883b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity new file mode 100644 index 0000000..698a982 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta new file mode 100644 index 0000000..c527c14 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ElasticDragAndRelease.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8a65a6b7b38cedf48855da0e69f45f6d +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs new file mode 100644 index 0000000..0f696ef --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs @@ -0,0 +1,17 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class KillVSKillTarget : MonoBehaviour +{ + public Transform[] targets; + + void Start() + { + targets[0].DOMoveX(2, 2).SetRelative().SetId(1); + targets[1].DOMoveY(2, 2).SetRelative(); + DOTween.Kill(targets[0]); + // DOTween.Kill(1); + // DOTween.Kill(null); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta new file mode 100644 index 0000000..0d2b13b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b70fff205e943c04786cfabc9a30e7f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity new file mode 100644 index 0000000..b06f9af Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta new file mode 100644 index 0000000..17d469b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/KillVSKillTarget.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3c9eec1da265e14478c514b4bf542423 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs new file mode 100644 index 0000000..ba143e9 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs @@ -0,0 +1,25 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class MultipleAxisRotation : MonoBehaviour +{ + public Transform target; + + void Update() + { + if (Input.GetKeyDown(KeyCode.LeftArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.RightArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(0, -90, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.UpArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd); + } else if (Input.GetKeyDown(KeyCode.DownArrow)) { + DOTween.CompleteAll(); + target.DORotate(new Vector3(-90, 0, 0), 1, RotateMode.LocalAxisAdd); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta new file mode 100644 index 0000000..2eabb12 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotation.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7afc1b695ba06204abc91b0d911ae17e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity new file mode 100644 index 0000000..ee7f844 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta new file mode 100644 index 0000000..5168c08 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/MultipleAxisRotations.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 84109798bbec4c649965f4e489436325 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs new file mode 100644 index 0000000..aac5efb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs @@ -0,0 +1,19 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class OnCompleteCreateNewTween : BrainBase +{ + public Transform target; + + void Start() + { + MakeTween(); + } + + void MakeTween() + { + target.position = Vector3.zero; + target.DOMoveX(3, 0.1f).SetRelative().OnComplete(MakeTween); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta new file mode 100644 index 0000000..5de8ed2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 244f01ea47e9ad246ad446f8abbbafb3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity new file mode 100644 index 0000000..56f4247 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta new file mode 100644 index 0000000..f072634 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/OnCompleteCreateNewTween.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2fbd785dc6b7ab6488ed3f24ad941696 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs new file mode 100644 index 0000000..7615a53 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs @@ -0,0 +1,22 @@ +using DG.Tweening; +using UnityEngine; + +public class PersistentComponent : BrainBase +{ + public Transform target; + + void OnDestroy() + { + Debug.Log("OnDestroy > Create tween"); + target.DOMoveX(3, 1); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Init")) DOTween.Init(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs.meta new file mode 100644 index 0000000..fb1de77 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdedd283199aaf34fa0a6bbabef2462b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity new file mode 100644 index 0000000..d7bcc01 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity.meta new file mode 100644 index 0000000..875adc4 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/PersistentComponent.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c89f9107ee8671b4aa4249f7522cfff3 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs new file mode 100644 index 0000000..afd5d41 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs @@ -0,0 +1,25 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class ReloadWithTimeScale0 : BrainBase +{ + public Transform target; + public bool independentUpdate; + + void Start() + { + Time.timeScale = 1; + target.DOMoveX(4, 2).SetRelative().SetUpdate(independentUpdate); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Set TimeScale to 0")) Time.timeScale = 0; + if (GUILayout.Button("Set TimeScale to 1")) Time.timeScale = 1; + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta new file mode 100644 index 0000000..41c55ca --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e379a3bcdd72854bab4fc01615e376b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity new file mode 100644 index 0000000..02c8a7a Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta new file mode 100644 index 0000000..f440971 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/ReloadWithTimeScale0.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 735c78eb1e9d4654c9d7059a76dc74fd +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs new file mode 100644 index 0000000..dc25694 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class SequenceKillAndComplete : BrainBase +{ + public Transform target; + + Sequence sequence; + + IEnumerator Start() + { + sequence = DOTween.Sequence(); + sequence.Append(target.DOMoveX(3, 3).SetRelative()); + sequence.Join(target.DOMoveY(3, 3).SetRelative()); + + yield return new WaitForSeconds(1.5f); + + sequence.Kill(true); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta new file mode 100644 index 0000000..ccf637d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0fe1b1e1a0a7d344da6735c628e05d5b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity new file mode 100644 index 0000000..fb746ce Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta new file mode 100644 index 0000000..8bf0788 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/SequenceKillAndComplete.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 27f5b9d0bf456cd448c751c9108a2c5f +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs new file mode 100644 index 0000000..4dc64f3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs @@ -0,0 +1,34 @@ +using DG.Tweening; +using UnityEngine; +using UnityEngine.UI; +using System.Collections; + +public class Temp : BrainBase +{ + public Image img; + Sequence _seq; + + void Start() + { + Debug.Log("START"); + _seq = DOTween.Sequence().SetId("SEQ"); + _seq.Append(img.DOFade(1, 0.5f)); + _seq.AppendInterval(3f); + _seq.Append(img.DOFade(0, 0.5f)); + _seq.AppendCallback(BalloonComplete); + // _seq.OnComplete(BalloonComplete); + } + + void BalloonComplete() + { + Debug.Log("Complete"); + _seq.Rewind(); + Debug.Log("Rewind called"); + } + + public void Goforit() + { + Debug.Log("GO"); + _seq.Restart(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs.meta new file mode 100644 index 0000000..4ac802a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10b78de0ac241344fae8dae397a30133 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity new file mode 100644 index 0000000..5df237e Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity.meta new file mode 100644 index 0000000..e6c74ce --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/Temp.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a49b8d05a761ad94194b140cf5b3e5d5 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs new file mode 100644 index 0000000..0177d0f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs @@ -0,0 +1,7 @@ +using UnityEngine; +using System.Collections; + +public class TempMonoBehaviour : MonoBehaviour +{ + public float fval = 0; +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta new file mode 100644 index 0000000..71737d2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TempMonoBehaviour.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 72e758936dff21a40b1eec97be3ab362 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs new file mode 100644 index 0000000..df83d7d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class TweenCreationInCoroutine : BrainBase +{ + public Transform[] targets; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + for (int i = 0; i < targets.Length; ++i) { + // Doesnt work + Transform t = targets[i]; + // DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 2, 0), 1).SetRelative(); + t.DOMove(new Vector3(0, 2, 0), 1).SetRelative(); + } + // CreateTweens(); + } + + void CreateTweens() + { + // Works + for (int i = 0; i < targets.Length; ++i) { + Transform t = targets[i]; + DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 2, 0), 1).SetRelative(); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta new file mode 100644 index 0000000..90dd331 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 127bad5ad29e6ff4a8046375cc08a085 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity new file mode 100644 index 0000000..ce42a01 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta new file mode 100644 index 0000000..a94aaee --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenCreationInCoroutine.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 03423029b27428e4b8d43fab41200ed7 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs new file mode 100644 index 0000000..c0eaa22 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using UnityEngine; + +public class TweenDuration : BrainBase +{ + public Transform target; + + void Start() + { + Tween(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Tween")) Tween(); + + DGUtils.EndGUI(); + } + + void Tween() + { + float startTime = Time.realtimeSinceStartup; + target.DOMove(target.position + new Vector3(1, 2, 1), 1) + .OnStart(()=> Debug.Log("START > " + (Time.realtimeSinceStartup - startTime))) + .OnUpdate(()=> Debug.Log("UPDATE > frameCount: " + Time.frameCount)) + .OnComplete(()=> Debug.Log("COMPLETE > " + (Time.realtimeSinceStartup - startTime))); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs.meta new file mode 100644 index 0000000..a01dbe3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23b91610ba159ad4ab4637e369ccece5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity new file mode 100644 index 0000000..0e8e55b Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity.meta new file mode 100644 index 0000000..e3f3a5e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenDuration.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1ee0035aa7676a544944cb358d51e787 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs new file mode 100644 index 0000000..2c0d5fd --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs @@ -0,0 +1,42 @@ +using DG.Tweening; +using UnityEngine; + +public class TweenLookAt : BrainBase +{ + public AxisConstraint axisConstraint; + public Transform target, lookAtTarget; + + Quaternion targetOrRot; + Vector3 lookAtPos; + + void Start() + { + targetOrRot = target.rotation; + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("LookAt")) { + // target.DOLookAt(lookAtTarget.position, 0.15f, axisConstraint, Vector3.up); + + lookAtPos = lookAtTarget.position; + lookAtPos = target.InverseTransformPoint(lookAtPos); + // lookAtPos.y = 0; + lookAtPos = target.TransformPoint(lookAtPos); + target.LookAt(lookAtPos, target.up); + } + if (GUILayout.Button("Reset")) target.rotation = targetOrRot; + + DGUtils.EndGUI(); + } + + void OnDrawGizmos() + { + // Gizmos.DrawLine(target.position, lookAtTarget.position); + + Gizmos.color = Color.red; + Gizmos.DrawLine(target.position, lookAtPos); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs.meta new file mode 100644 index 0000000..8ae6f37 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce9894082c906d54fb4278d80c469b88 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity new file mode 100644 index 0000000..df37bc1 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity.meta b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity.meta new file mode 100644 index 0000000..8c11846 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Bugs/TweenLookAt.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2bdb92d1c6d866f4a891506d53b3376e +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs new file mode 100644 index 0000000..10a7171 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs @@ -0,0 +1,20 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class CallbacksOnlySequence : BrainBase +{ + public Transform target; + + void Start() + { + DOTween.Sequence() + .OnComplete(()=>Debug.Log(target.position.x.ToString("N10"))) + // .SetLoops(3, LoopType.Yoyo) + // .SetLoops(3) + .AppendCallback(()=> Debug.Log("[" + Time.realtimeSinceStartup + "] Callback 0")) + .AppendInterval(1) + // .Append(target.DOMoveX(1, 0.05f).SetRelative()) + .AppendCallback(()=> Debug.Log("[" + Time.realtimeSinceStartup + "] Callback FINAL")); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs.meta b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs.meta new file mode 100644 index 0000000..4c2bed1 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e20cc2cc14b6aff438c7792cc55de3c5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity new file mode 100644 index 0000000..19e1564 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity.meta b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity.meta new file mode 100644 index 0000000..6a2df7c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CallbacksOnlySequence.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1fed93f4e807dab4e8d043ca4526bced +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Clone.cs b/UnityTests.Unity5/Assets/_Tests/Clone.cs new file mode 100644 index 0000000..b1eee8c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Clone.cs @@ -0,0 +1,31 @@ +using DG.Tweening; +using UnityEngine; + +public class Clone : BrainBase +{ + public GameObject prefab; + public AnimationCurve animCurve; + + void Start() + { + Transform t = NewTransform(); + Tween tween = t.DOMoveY(5f, 1) + .SetDelay(2f) + .SetRelative() + .SetEase(animCurve) + .OnStart(()=> Debug.Log("OnStart")) + .SetLoops(-1, LoopType.Yoyo); + for (int i = 0; i < 4; ++i) { + t = NewTransform(); + Transform t2 = t; + t2.DOMoveY(5f, 1).SetAs(tween); + } + } + + Transform NewTransform() + { + Transform t = ((GameObject)Instantiate(prefab)).transform; + t.position = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)); + return t; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Clone.cs.meta b/UnityTests.Unity5/Assets/_Tests/Clone.cs.meta new file mode 100644 index 0000000..2749b6c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Clone.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fc0a0c23ad59c54398a17eddc720cd0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Clone.unity b/UnityTests.Unity5/Assets/_Tests/Clone.unity new file mode 100644 index 0000000..f6016c5 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Clone.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Clone.unity.meta b/UnityTests.Unity5/Assets/_Tests/Clone.unity.meta new file mode 100644 index 0000000..11f36e5 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Clone.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ddf80ce391cc562479047f67ce99079b +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Coroutines.cs b/UnityTests.Unity5/Assets/_Tests/Coroutines.cs new file mode 100644 index 0000000..fa49653 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Coroutines.cs @@ -0,0 +1,74 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Coroutines : BrainBase +{ + public Transform[] targets; + + void Start() + { + foreach (Transform t in targets) { + Tween tween = t.DOMove(new Vector3(Random.Range(10f, 10f), Random.Range(10f, 10f), 0), 2f).SetLoops(3).Pause(); + StartCoroutine(WaitForCompletion(t, tween)); + StartCoroutine(WaitForRewind(t, tween)); + StartCoroutine(WaitForKill(t, tween)); + StartCoroutine(WaitForStart(t, tween)); + StartCoroutine(WaitForElapsedLoops(t, tween)); + StartCoroutine(WaitForPosition(t, tween)); + } + } + + IEnumerator WaitForCompletion(Transform t, Tween tween) + { + yield return tween.WaitForCompletion(); + + Debug.Log(t + " complete"); + } + + IEnumerator WaitForRewind(Transform t, Tween tween) + { + yield return tween.WaitForRewind(); + + Debug.Log(t + " rewinded"); + } + + IEnumerator WaitForKill(Transform t, Tween tween) + { + yield return tween.WaitForKill(); + + Debug.Log(t + " killed"); + } + + IEnumerator WaitForElapsedLoops(Transform t, Tween tween) + { + yield return tween.WaitForElapsedLoops(2); + + Debug.Log(t + " loops elapsed"); + } + + IEnumerator WaitForPosition(Transform t, Tween tween) + { + yield return tween.WaitForPosition(3.5f); + + Debug.Log(t + " position reached"); + } + + IEnumerator WaitForStart(Transform t, Tween tween) + { + yield return tween.WaitForStart(); + + Debug.Log(t + " started"); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Play")) DOTween.PlayAll(); + if (GUILayout.Button("Kill")) DOTween.KillAll(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Coroutines.cs.meta b/UnityTests.Unity5/Assets/_Tests/Coroutines.cs.meta new file mode 100644 index 0000000..4e87b84 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Coroutines.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2af5300fe59f6b841b1dd64964bff266 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Coroutines.unity b/UnityTests.Unity5/Assets/_Tests/Coroutines.unity new file mode 100644 index 0000000..cb0a380 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Coroutines.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Coroutines.unity.meta b/UnityTests.Unity5/Assets/_Tests/Coroutines.unity.meta new file mode 100644 index 0000000..f64d95c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Coroutines.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4d31163086b70424994035f87ad10213 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example.meta b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example.meta new file mode 100644 index 0000000..1db83cc --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 94fe2615fb2eb4d4c93cb7ae6e77d5ad +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity new file mode 100644 index 0000000..be74781 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta new file mode 100644 index 0000000..86a3f2f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fe402d14dcffa8347be8e541d667ef7b +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs new file mode 100644 index 0000000..fed5cd6 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using DG.Tweening.Plugins; +using UnityEngine; + +public class CustomPluginExampleBrain : BrainBase +{ + public Transform target; + + void Start() + { + // DOTween.To(()=>target.position, x=> target.position = x, new Vector3(4, 4, 0), 1.5f) + // DOTween.To(new PlugCustomPlugin(()=>target.position, x=> target.position = x, 4), 1.5f) + // .SetDelay(2).SetRelative().SetLoops(5, LoopType.Yoyo).SetAutoKill(false) + // .OnStart(()=> Debug.Log("Start")) + // .OnStepComplete(()=> Debug.Log("Step Complete")) + // .OnComplete(()=> Debug.Log("Complete")); + } + + void OnGUI() + { + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta new file mode 100644 index 0000000..ffa3dd2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/CustomPluginExampleBrain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 550efdefde1a031469b9f78b16066882 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs new file mode 100644 index 0000000..928b04b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs @@ -0,0 +1,73 @@ +using DG.Tweening; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using System; +using UnityEngine; + +public struct PlugCustomPlugin : IPlugSetter +{ + readonly Vector3 _endValue; + readonly DOGetter _getter; + readonly DOSetter _setter; + + public PlugCustomPlugin(DOGetter getter, DOSetter setter, float endValue) + { + _getter = getter; + _setter = setter; + _endValue = new Vector3(endValue, 0, 0); + } + + public DOGetter Getter() { return _getter; } + public DOSetter Setter() { return _setter; } + public Vector3 EndValue() { return _endValue; } + public NoOptions GetOptions() { return new NoOptions(); } +} + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// ||| CLASS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +public class CustomPlugin : ABSTweenPlugin +{ + public override void Reset(TweenerCore t) {} + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector3 prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + t.setter(t.startValue); + } + + public override Vector3 ConvertToStartValue(TweenerCore t, Vector3 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue = t.startValue + t.changeValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, Vector3 changeValue) + { + float res = changeValue.magnitude / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) + { + Vector3 res = getter(); + float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + res.x = startValue.x + changeValue.x * easeVal; + setter(res); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta new file mode 100644 index 0000000..58744b5 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/CustomPlugin Example/PlugCustomPlugin.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af2497efc5625554ba3ad4d45cdad868 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs new file mode 100644 index 0000000..5a989f6 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs @@ -0,0 +1,92 @@ +using System; +using DG.Tweening; +using System.Collections; +using UnityEngine; +using UnityEngine.UI; + +public class EaseCurves : BrainBase +{ + public RawImage image; + public AnimationCurve easeCurve; + public float tweenDuration = 1; + public int txDistance = 2; + + int txH, txW; + int txBorder, easeH; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + Setup(); + } + + void Setup() + { + RectTransform rt = image.GetComponent(); + txW = (int)rt.sizeDelta.x; + txH = (int)rt.sizeDelta.y; + easeH = (int)(txH * 0.35f); + txBorder = (int)((txH - easeH) * 0.5f); + Color32[] colors = new Color32[txW * txH]; + for (int c = 0; c < colors.Length; ++c) colors[c] = new Color(0.1f, 0.1f, 0.1f, 1); + int lineP = txBorder * txW; + for (int c = lineP; c < lineP + txW; ++c) { + colors[c] = new Color(0.25f, 0.25f, 0.25f, 1); + colors[c + txW * easeH] = new Color(0.25f, 0.25f, 0.25f, 1); + } + + // Create a tween for each easeType + int totTypes = Enum.GetNames(typeof(Ease)).Length; + int distX = txW; + int distY = txH; + int totCols = Screen.width / txW - 1; + float startX = image.transform.position.x; + float startY = image.transform.position.y; + Vector2 gridCount = Vector2.zero; + for (int i = 0; i < totTypes + 1; ++i) { + // Instantiate and position new Images + Transform t = ((GameObject)Instantiate(image.gameObject)).transform; + t.SetParent(image.transform.parent); + t.position = new Vector3(startX + distX * gridCount.x + txDistance * gridCount.x, startY - distY * gridCount.y - txDistance * gridCount.y, 0); + gridCount.x++; + if (gridCount.x > totCols) { + gridCount.y++; + gridCount.x = 0; + } + // Set textures + Texture2D tx = new Texture2D(txW, txH, TextureFormat.ARGB32, false); + tx.filterMode = FilterMode.Point; + tx.SetPixels32(colors); + tx.Apply(); + RawImage img = t.GetComponent(); + img.texture = tx; + // Set tween and text + Ease easeType = (Ease)i; + float val = txBorder; + Tween tween = DOTween.To(() => val, x => val = x, txBorder + easeH, tweenDuration).SetDelay(1); + tween.OnUpdate(() => SetTextureEase(easeType, tx, tween.Elapsed(), (int)val)); + if (i == totTypes) { + img.GetComponentInChildren().text = "custom"; + tween.SetEase((time, duration, overshootOrAmplitude, period)=> { + return (float)Math.Sin(time /= duration) / (float)Math.Cos(time /= duration); + }); + } else { + img.GetComponentInChildren().text = easeType.ToString(); + if (easeType == Ease.INTERNAL_Custom) tween.SetEase(easeCurve); + else tween.SetEase(easeType); + } + } + // Disable original image + image.gameObject.SetActive(false); + } + + void SetTextureEase(Ease easeType, Texture2D tx, float elapsed, int y) + { + int x = (int)((txW - 1) * (elapsed / tweenDuration)); + if (y > txH - 1 || y < 0) return; // elastic/back eases + + tx.SetPixel(x, y, Color.white); + tx.Apply(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs.meta b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs.meta new file mode 100644 index 0000000..7d37807 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6e9584ee56ace64b9acf3120773f925 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity new file mode 100644 index 0000000..1078ddf Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity.meta b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity.meta new file mode 100644 index 0000000..7eebc07 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ab832caaf1412b246a8e3869250cd45c +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Eases.cs b/UnityTests.Unity5/Assets/_Tests/Eases.cs new file mode 100644 index 0000000..7b78600 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Eases.cs @@ -0,0 +1,35 @@ +using DG.Tweening; +using System; +using UnityEngine; + +public class Eases : BrainBase +{ + public GameObject prefab; + public AnimationCurve easeCurve; + + void Start() + { + // Create a tween for each easeType + int totTypes = Enum.GetNames(typeof(Ease)).Length; + const int distX = 2; + const int distY = 6; + const int totCols = 10; + float startX = -((totCols * distX) * 0.5f); + float startY = (int)(totTypes / totCols) * distY * 0.5f; + Vector2 gridCount = Vector2.zero; + for (int i = 0; i < totTypes; ++i) { + Transform t = ((GameObject)Instantiate(prefab)).transform; + t.position = new Vector3(startX + distX * gridCount.x, startY - distY * gridCount.y, 0); + gridCount.x++; + if (gridCount.x > totCols) { + gridCount.y++; + gridCount.x = 0; + } + Tween tween = t.DOMoveY(2, 1).SetRelative().SetLoops(-1, LoopType.Yoyo); + Ease easeType = (Ease)i; + Debug.Log(i + ", " + easeType); + if (easeType == Ease.INTERNAL_Custom) tween.SetEase(easeCurve); + else tween.SetEase(easeType); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Eases.cs.meta b/UnityTests.Unity5/Assets/_Tests/Eases.cs.meta new file mode 100644 index 0000000..50c9ece --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Eases.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d68cd89c84431274a9744a953a3a2a44 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Eases.unity b/UnityTests.Unity5/Assets/_Tests/Eases.unity new file mode 100644 index 0000000..0f28038 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Eases.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Eases.unity.meta b/UnityTests.Unity5/Assets/_Tests/Eases.unity.meta new file mode 100644 index 0000000..fdc9432 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Eases.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 65158459aebf1704daf4caba3ee3ed3b +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/From.cs b/UnityTests.Unity5/Assets/_Tests/From.cs new file mode 100644 index 0000000..25915d3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/From.cs @@ -0,0 +1,34 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class From : BrainBase +{ + public GameObject prefab; + + Transform t; + + void LateUpdate() + { + if (t != null) Debug.Log(">>> " + t.position); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("New FROM")) FromTween(); + + DGUtils.EndGUI(); + } + + void FromTween() + { + t = ((GameObject)Instantiate(prefab)).transform; + t.DOMove(new Vector3(0, 2, 0), 1) + .From() + .OnKill(() => Destroy(t.gameObject)); + + Debug.Log(t.position); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/From.cs.meta b/UnityTests.Unity5/Assets/_Tests/From.cs.meta new file mode 100644 index 0000000..0983a32 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/From.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 350ccf9fa0f06cf4b8cbcda8552199ab +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/From.unity b/UnityTests.Unity5/Assets/_Tests/From.unity new file mode 100644 index 0000000..5d6bb5f Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/From.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/From.unity.meta b/UnityTests.Unity5/Assets/_Tests/From.unity.meta new file mode 100644 index 0000000..e5551f6 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/From.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 43b284bfbb56388479e1f04f912b9123 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Ids.cs b/UnityTests.Unity5/Assets/_Tests/Ids.cs new file mode 100644 index 0000000..c126256 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Ids.cs @@ -0,0 +1,53 @@ +using DG.Tweening; +using UnityEngine; + +public class Ids : BrainBase +{ + public GameObject prefab; + + Transform[] ts; + + void Start() + { + ts = new Transform[3]; + float startX = -3; + for (int i = 0; i < 3; ++i) { + Transform t = ((GameObject)Instantiate(prefab)).transform; + ts[i] = t; + t.position = new Vector3(startX + 3 * i, 0, 0); + Tween tween = t.DOMoveY(4, 1).SetLoops(-1, LoopType.Yoyo); + switch (i) { + case 0: + tween.SetId(0); + break; + case 1: + tween.SetId("string"); + break; + case 2: + tween.SetId(this); + break; + } + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + GUILayout.Space(50); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause by Id")) DOTween.TogglePause(0); + if (GUILayout.Button("TogglePause by StringId")) DOTween.TogglePause("string"); + if (GUILayout.Button("TogglePause by ObjId")) DOTween.TogglePause(this); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause by Transform (0)")) DOTween.TogglePause(ts[0]); + if (GUILayout.Button("TogglePause by Transform (1)")) DOTween.TogglePause(ts[1]); + // This won't work because target was changed by applying a different objId + if (GUILayout.Button("TogglePause by Transform (2)")) DOTween.TogglePause(ts[2]); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Ids.cs.meta b/UnityTests.Unity5/Assets/_Tests/Ids.cs.meta new file mode 100644 index 0000000..ea4f0f2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Ids.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 965349a46531ac94b8febb892226c312 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Ids.unity b/UnityTests.Unity5/Assets/_Tests/Ids.unity new file mode 100644 index 0000000..81f0672 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Ids.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Ids.unity.meta b/UnityTests.Unity5/Assets/_Tests/Ids.unity.meta new file mode 100644 index 0000000..039f838 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Ids.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c14641586e8c0e04881d0bfd0ef61751 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Loops.cs b/UnityTests.Unity5/Assets/_Tests/Loops.cs new file mode 100644 index 0000000..b95d70f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Loops.cs @@ -0,0 +1,18 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Loops : BrainBase +{ + public Transform[] targets; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + Vector3 rot = new Vector3(0, 0, 45); + targets[0].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Restart); + targets[1].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo); + targets[2].DORotate(rot, 1).SetRelative().SetEase(Ease.Linear).SetLoops(-1, LoopType.Incremental); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Loops.cs.meta b/UnityTests.Unity5/Assets/_Tests/Loops.cs.meta new file mode 100644 index 0000000..bf714ff --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Loops.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b58c3976284ff642892a7340898e445 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Loops.unity b/UnityTests.Unity5/Assets/_Tests/Loops.unity new file mode 100644 index 0000000..c827bae Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Loops.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Loops.unity.meta b/UnityTests.Unity5/Assets/_Tests/Loops.unity.meta new file mode 100644 index 0000000..a6d2aeb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Loops.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 85d2b1fa3aefe5646af1df95601a306a +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs new file mode 100644 index 0000000..c2548d2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs @@ -0,0 +1,53 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class PathWaypointReached : BrainBase +{ + public Vector3[] waypoints; + public float duration = 5; + public bool relative = true; + public bool closedPath; + public PathType pathType; + public LoopType loopType; + public int loops = -1; + public Transform[] targets; + + Tween[] pathTweens; + + void Start() + { + pathTweens = new Tween[targets.Length]; + + pathTweens[0] = targets[0].DOPath(waypoints, duration, pathType).SetOptions(closedPath); + pathTweens[0].SetRelative(relative) + .SetEase(Ease.Linear) + .SetLoops(loops, loopType) + .SetAutoKill(false) + .OnComplete(()=> Debug.Log(targets[0].name + " > complete")) + .OnWaypointChange(x=> { + Debug.Log(targets[0].name + " > waypoint reached: " + x + " > " + targets[0].position + " - completed loops: " + pathTweens[0].CompletedLoops()); + pathTweens[0].Pause(); + }); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.Label("Is backwards: " + pathTweens[0].isBackwards); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Play")) DOTween.PlayAll(); + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto duration x 2")) DOTween.GotoAll(duration * 2); + if (GUILayout.Button("Goto duration x 0.5")) DOTween.GotoAll(duration * 0.5f); + if (GUILayout.Button("Goto WP 0")) pathTweens[0].GotoWaypoint(0); + if (GUILayout.Button("Goto WP 2")) pathTweens[0].GotoWaypoint(2); + if (GUILayout.Button("Goto WP 15")) pathTweens[0].GotoWaypoint(15); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs.meta b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs.meta new file mode 100644 index 0000000..e12e84e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d66587046eab2e4bbadb900677c3c16 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity new file mode 100644 index 0000000..1587bd1 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity.meta b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity.meta new file mode 100644 index 0000000..866c7cf --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathWaypointReached.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 92980e6627fb35644bdacde40b473d97 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/PathsFree.cs b/UnityTests.Unity5/Assets/_Tests/PathsFree.cs new file mode 100644 index 0000000..4572894 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathsFree.cs @@ -0,0 +1,19 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class PathsFree : BrainBase +{ + public Transform target; + public Ease ease = Ease.Linear; + public PathType pathType; + public bool closePath; + public Vector3[] waypoints; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + target.DOPath(waypoints, 3, pathType).SetOptions(closePath).SetEase(ease); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/PathsFree.cs.meta b/UnityTests.Unity5/Assets/_Tests/PathsFree.cs.meta new file mode 100644 index 0000000..86f6f69 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathsFree.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e29994a778b57941982cf357c77af8f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/PathsFree.unity b/UnityTests.Unity5/Assets/_Tests/PathsFree.unity new file mode 100644 index 0000000..996f04a Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/PathsFree.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/PathsFree.unity.meta b/UnityTests.Unity5/Assets/_Tests/PathsFree.unity.meta new file mode 100644 index 0000000..61bbaa8 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/PathsFree.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 24c80f8f3819bd44e95f4a095b78a88e +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Pooling.cs b/UnityTests.Unity5/Assets/_Tests/Pooling.cs new file mode 100644 index 0000000..67efe04 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Pooling.cs @@ -0,0 +1,202 @@ +using DG.Tweening; +using UnityEngine; + +public class Pooling : BrainBase +{ + public GameObject prefab; + + bool recycle; + Transform spawnsParent; + + void Start() + { + DOTween.Init(true, false, LogBehaviour.Verbose); + spawnsParent = new GameObject("Spawn Container").transform; + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + + GUILayout.Label("Position Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPosition(1); + if (GUILayout.Button("Spawn 10")) SpawnPosition(10); + if (GUILayout.Button("Spawn 100")) SpawnPosition(100); + if (GUILayout.Button("Spawn 300")) SpawnPosition(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionX Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionX(1); + if (GUILayout.Button("Spawn 10")) SpawnPositionX(10); + if (GUILayout.Button("Spawn 100")) SpawnPositionX(100); + if (GUILayout.Button("Spawn 300")) SpawnPositionX(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionX Tweens with snapping"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionX(1, true); + if (GUILayout.Button("Spawn 10")) SpawnPositionX(10, true); + if (GUILayout.Button("Spawn 100")) SpawnPositionX(100, true); + if (GUILayout.Button("Spawn 300")) SpawnPositionX(300, true); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("PositionY Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnPositionY(1); + if (GUILayout.Button("Spawn 10")) SpawnPositionY(10); + if (GUILayout.Button("Spawn 100")) SpawnPositionY(100); + if (GUILayout.Button("Spawn 300")) SpawnPositionY(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("Rotation Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnRotation(1); + if (GUILayout.Button("Spawn 10")) SpawnRotation(10); + if (GUILayout.Button("Spawn 100")) SpawnRotation(100); + if (GUILayout.Button("Spawn 300")) SpawnRotation(300); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.Label("Emit Particles Tweens"); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Spawn 1")) SpawnParticles(1); + if (GUILayout.Button("Spawn 10")) SpawnParticles(10); + if (GUILayout.Button("Spawn 100")) SpawnParticles(100); + if (GUILayout.Button("Spawn 300")) SpawnParticles(300); + if (GUILayout.Button("Spawn 1000")) SpawnParticles(1000); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Toggle Pause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Kill")) DOTween.KillAll(); + if (GUILayout.Button("Clear")) Clear(); + if (GUILayout.Button("Clear FULL")) Clear(true); + GUILayout.EndHorizontal(); + recycle = GUILayout.Toggle(recycle, "Recycle"); + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + void SpawnPosition(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.To(() => t.position, x => t.position = x, RandomVector3(), 1f) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + void SpawnPositionX(int tot, bool snapping = false) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(snapping) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + void SpawnPositionY(int tot, bool snapping = false) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + if (snapping) { + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(AxisConstraint.Y, true) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } else { + DOTween.ToAxis(() => t.position, x => t.position = x, RandomFloat(), 1f) + .SetOptions(AxisConstraint.Y) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + } + fpsGadget.ResetFps(); + } + void SpawnRotation(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + t.position = RandomVector3(); + DOTween.To(() => t.rotation, x => t.rotation = x, RandomVector3(720), 1f) + .SetRecyclable(recycle) + .OnComplete(() => Destroy(go)); + } + fpsGadget.ResetFps(); + } + + void SpawnParticles(int tot) + { + for (int i = 0; i < tot; i++) { + GameObject go = Instantiate(prefab) as GameObject; + go.name += i; + Transform t = go.transform; + t.parent = spawnsParent; + Material m = t.gameObject.GetComponent().material; + ResetParticleAndAssignTween(t, m); + } + fpsGadget.ResetFps(); + } + void ResetParticleAndAssignTween(Transform t, Material m) + { + t.position = Vector3.zero; + Color col = m.color; + col.a = 1; + m.color = col; + float duration = Random.Range(0.2f, 2f); + m.DOFade(0, duration).SetRecyclable(recycle); + t.DOMove(RandomVector3(), duration) + .SetRecyclable(recycle) + .OnComplete(()=> ResetParticleAndAssignTween(t, m)); + } + + void Clear(bool fullDOTweenClear = false) + { + DOTween.Clear(fullDOTweenClear); + Transform[] ts = spawnsParent.GetComponentsInChildren(); + foreach (Transform t in ts) { + if (t != spawnsParent) Destroy(t.gameObject); + } + } + + Vector3 RandomVector3(float limit = 10) + { + return new Vector3(Random.Range(-limit, limit), Random.Range(-limit, limit), Random.Range(-limit, limit)); + } + + float RandomFloat(float limit = 10) + { + return Random.Range(-limit, limit); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Pooling.cs.meta b/UnityTests.Unity5/Assets/_Tests/Pooling.cs.meta new file mode 100644 index 0000000..e672fc1 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Pooling.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f566ad46a388abe4d874c1f7fcdb7271 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Pooling.unity b/UnityTests.Unity5/Assets/_Tests/Pooling.unity new file mode 100644 index 0000000..421fcf4 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Pooling.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Pooling.unity.meta b/UnityTests.Unity5/Assets/_Tests/Pooling.unity.meta new file mode 100644 index 0000000..3d68218 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Pooling.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 98b859c0dc8e7e148a1733a2d04bbfe0 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs new file mode 100644 index 0000000..65bdda3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs @@ -0,0 +1,29 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Rigidbodies : BrainBase +{ + public Transform[] targets; + public Rigidbody2D r2D; + + IEnumerator Start() + { + yield return new WaitForSeconds(1); + + DOTween.Sequence() + .Append(targets[0].GetComponent().DORotate(new Vector3(0, 0, 90), 1, RotateMode.WorldAxisAdd)) + .Append(targets[0].GetComponent().DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)) + .Append(targets[0].GetComponent().DORotate(new Vector3(0, 810, 0), 1, RotateMode.LocalAxisAdd)); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Rotate 2D 360")) r2D.DORotate(360, 1); + if (GUILayout.Button("Rotate 2D 360 Relative")) r2D.DORotate(360, 1).SetRelative(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs.meta b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs.meta new file mode 100644 index 0000000..a8bf2bd --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dfa687efe27c93245b13f23cba1b9434 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity new file mode 100644 index 0000000..206f62b Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity.meta b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity.meta new file mode 100644 index 0000000..e2b8d38 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rigidbodies.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: adcc3ccdde792334aa4e421d01039437 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/RotationModes.cs b/UnityTests.Unity5/Assets/_Tests/RotationModes.cs new file mode 100644 index 0000000..ff53798 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RotationModes.cs @@ -0,0 +1,70 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class RotationModes : BrainBase +{ + public Transform[] targets; + + void Start() + { + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[0].DORotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360)) + .Append(targets[0].DORotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[1].DORotate(new Vector3(0, 450, 0), 1, RotateMode.Fast)) + .Append(targets[1].DORotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[2].DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd)) + .Append(targets[2].DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[3].DORotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd)) + .Append(targets[3].DORotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + // FROM versions + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[4].DORotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360).From()) + .Append(targets[4].DORotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[5].DORotate(new Vector3(0, 450, 0), 1, RotateMode.Fast).From()) + .Append(targets[5].DORotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[6].DORotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd).From()) + .Append(targets[6].DORotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[7].DORotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd).From()) + .Append(targets[7].DORotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[4].DOLocalRotate(new Vector3(0, 450, 0), 1, RotateMode.FastBeyond360)) + // .Append(targets[4].DOLocalRotate(new Vector3(450, 0, 0), 1, RotateMode.FastBeyond360)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[5].DOLocalRotate(new Vector3(0, 450, 0), 1, RotateMode.Fast)) + // .Append(targets[5].DOLocalRotate(new Vector3(450, 0, 0), 1, RotateMode.Fast)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[6].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.LocalAxisAdd)) + // .Append(targets[6].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.LocalAxisAdd)); + + // DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + // .Append(targets[7].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.WorldAxisAdd)) + // .Append(targets[7].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.WorldAxisAdd)); + + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[8].DORotate(new Vector3(0, 90, 0), 1, RotateMode.Fast)) + .Append(targets[8].DORotate(new Vector3(90, 0, 0), 1, RotateMode.Fast)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(targets[9].DOLocalRotate(new Vector3(0, 90, 0), 1, RotateMode.Fast)) + .Append(targets[9].DOLocalRotate(new Vector3(90, 0, 0), 1, RotateMode.Fast)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/RotationModes.cs.meta b/UnityTests.Unity5/Assets/_Tests/RotationModes.cs.meta new file mode 100644 index 0000000..1a5cf1c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RotationModes.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78d2f0703a302b94c83f859af5297e01 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/RotationModes.unity b/UnityTests.Unity5/Assets/_Tests/RotationModes.unity new file mode 100644 index 0000000..c10f20a Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/RotationModes.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/RotationModes.unity.meta b/UnityTests.Unity5/Assets/_Tests/RotationModes.unity.meta new file mode 100644 index 0000000..0c3c29d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RotationModes.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: db9c94d9f8e8f394aa19efcafa835f07 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Rotations.cs b/UnityTests.Unity5/Assets/_Tests/Rotations.cs new file mode 100644 index 0000000..ec9ce8c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rotations.cs @@ -0,0 +1,48 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Rotations : BrainBase +{ + public Transform[] ts; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + // Should take shortest rotation route + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[0].DORotate(new Vector3(0, -45, 0), 1)) + .Append(ts[0].DORotate(new Vector3(0, 0, 0), 1)); + + // Should take longest rotation route (because Unity will change the start Vector when the first tween ends) + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[1].DORotate(new Vector3(0, -45, 0), 1, RotateMode.FastBeyond360)) + .Append(ts[1].DORotate(new Vector3(0, 0, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[2].DORotate(new Vector3(0, -45, 0), 1) + .SetRelative()) + .Append(ts[2].DORotate(new Vector3(0, 360, 0), 1) + .SetRelative()); + + //////////////////////////////////////// + // FROM //////////////////////////////// + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[3].DORotate(new Vector3(0, -45, 0), 1) + .From()) + .Append(ts[3].DORotate(new Vector3(0, -45, 0), 1)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[4].DORotate(new Vector3(0, -45, 0), 1, RotateMode.FastBeyond360) + .From()) + .Append(ts[4].DORotate(new Vector3(0, 720, 0), 1, RotateMode.FastBeyond360)); + + DOTween.Sequence().SetLoops(-1, LoopType.Yoyo) + .Append(ts[5].DORotate(new Vector3(0, -45, 0), 1) + .From(true)) + .Append(ts[5].DORotate(new Vector3(0, -90, 0), 1) + .SetRelative()); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Rotations.cs.meta b/UnityTests.Unity5/Assets/_Tests/Rotations.cs.meta new file mode 100644 index 0000000..6c0c247 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rotations.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9520a14363388bd4c95a970f942a9ca4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Rotations.unity b/UnityTests.Unity5/Assets/_Tests/Rotations.unity new file mode 100644 index 0000000..add0713 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Rotations.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Rotations.unity.meta b/UnityTests.Unity5/Assets/_Tests/Rotations.unity.meta new file mode 100644 index 0000000..9e30ffe --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Rotations.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 28ece09eec0b07241a39d81fc2deb6ae +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs new file mode 100644 index 0000000..2ee2cb6 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs @@ -0,0 +1,96 @@ +using DG.Tweening; +using System; +using UnityEngine; + +public class RuntimeChanges : BrainBase +{ + enum FollowMode + { + OnClick, + Continuous + } + + public bool speedBased; + public GUIText txtDuration; + public Transform[] targets; + + Tweener[] tweens = new Tweener[2]; + Vector3[] originalPos = new Vector3[2]; + float durationToApply = 2f; + Vector3 prevMousePos; + FollowMode followMode; + string[] followModeList; + + void Start() + { + followModeList = Enum.GetNames(typeof(FollowMode)); + SetGUITexts(); + + int len = targets.Length; + tweens = new Tweener[len]; + originalPos = new Vector3[len]; + + for (int i = 0; i < len; ++i) { + originalPos[i] = targets[i].position; + tweens[i] = targets[i].DOMove(Vector3.zero, durationToApply) + .SetLoops(-1, LoopType.Yoyo).SetEase(speedBased ? Ease.Linear : Ease.OutQuint) + .SetSpeedBased(speedBased) + .Pause(); + } + } + + void Update() + { + if (Input.GetKeyDown(KeyCode.P)) DOTween.TogglePauseAll(); + else if (Input.GetKeyDown(KeyCode.KeypadMinus)) { + durationToApply -= 0.25f; + if (durationToApply < 0.25f) durationToApply = 0.25f; + SetGUITexts(); + } else if (Input.GetKeyDown(KeyCode.KeypadPlus)) { + durationToApply += 0.25f; + SetGUITexts(); + } + + if (followMode == FollowMode.Continuous || Input.GetMouseButtonDown(0)) { + // Find mouse position to set as tween's new endValue + Vector3 clickPos = Input.mousePosition; + if (clickPos == prevMousePos) return; + + prevMousePos = clickPos; + clickPos.z = -Camera.main.transform.position.z; + clickPos = Camera.main.ScreenToWorldPoint(clickPos); + + // Change end value - snapStartValue + tweens[0].ChangeEndValue(clickPos, durationToApply, true); + // Change end value - NO snapStartValue + tweens[1].ChangeEndValue(clickPos, durationToApply); + // Change start value + originalPos[2] = clickPos; + tweens[2].ChangeStartValue(clickPos, durationToApply); + // Change start and end value + Vector3 newStartValue = new Vector3(UnityEngine.Random.Range(-10f, 10f), UnityEngine.Random.Range(-10f, 10f), 0); + originalPos[3] = newStartValue; + tweens[3].ChangeValues(newStartValue, clickPos, durationToApply); + } + } + + void OnDrawGizmos() + { + Gizmos.DrawWireSphere(Vector3.zero, 0.25f); + foreach (Vector3 pos in originalPos) Gizmos.DrawWireCube(pos, Vector3.one); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + followMode = (FollowMode)GUILayout.Toolbar((int)followMode, followModeList); + + DGUtils.EndGUI(); + } + + void SetGUITexts() + { + txtDuration.text = "Duration: " + durationToApply + " (-/+ to change)"; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs.meta b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs.meta new file mode 100644 index 0000000..9573d33 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56384294fdf20944485d9f0274b97958 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity new file mode 100644 index 0000000..8aa904e Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity.meta b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity.meta new file mode 100644 index 0000000..98fed4b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/RuntimeChanges.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fc757d5707dd71b498e452e9cb31896a +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SafeMode.cs b/UnityTests.Unity5/Assets/_Tests/SafeMode.cs new file mode 100644 index 0000000..c0a1f83 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SafeMode.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class SafeMode : BrainBase +{ + public Transform target0, target1; + public GameObject nullGO; + + IEnumerator Start() + { + DOTween.Init(); + DOTween.useSafeMode = true; + + yield return new WaitForSeconds(0.7f); + + // Tween that will fail on callback + target0.DOMoveX(4, 1).SetRelative().OnComplete(()=> Debug.Log(nullGO.transform)); + // Tween whose target will be destroyed at half tween + target1.DOMoveX(4, 1).SetRelative(); + + yield return new WaitForSeconds(0.5f); + Destroy(target1.gameObject); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/SafeMode.cs.meta b/UnityTests.Unity5/Assets/_Tests/SafeMode.cs.meta new file mode 100644 index 0000000..bc2e5e0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SafeMode.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19f40aedcc73ca94ebeb19a55f5c14fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SafeMode.unity b/UnityTests.Unity5/Assets/_Tests/SafeMode.unity new file mode 100644 index 0000000..43601aa Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/SafeMode.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/SafeMode.unity.meta b/UnityTests.Unity5/Assets/_Tests/SafeMode.unity.meta new file mode 100644 index 0000000..ca3d647 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SafeMode.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e6488453970ef3040bb44995f5fe529b +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs new file mode 100644 index 0000000..b245638 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs @@ -0,0 +1,83 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class SequenceCallbacks : BrainBase +{ + public Transform[] targets; + + Sequence main; + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + if (GUILayout.Button("Complete")) DOTween.CompleteAll(); + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + if (GUILayout.Button("Goto 0.5")) DOTween.GotoAll(0.5f); + if (GUILayout.Button("Goto 1")) DOTween.GotoAll(1); + if (GUILayout.Button("Goto 1.5")) DOTween.GotoAll(1.5f); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Sequence > LoopType.Restart")) NewSequence(LoopType.Restart, false); + if (GUILayout.Button("Sequence > LoopType.Restart > Flipped")) NewSequence(LoopType.Restart, true); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Sequence > LoopType.Yoyo")) NewSequence(LoopType.Yoyo, false); + if (GUILayout.Button("Sequence > LoopType.Yoyo > Flipped")) NewSequence(LoopType.Yoyo, true); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } + + void NewSequence(LoopType loopType, bool flip) + { + main.Rewind(); + main.Kill(); + + Sequence innerS0 = DOTween.Sequence() + .SetId("INNER") + // .SetLoops(3, loopType) + .OnStepComplete(()=>Debug.Log("INNER Step Complete")); + // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + // innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); + + Sequence innerS1 = DOTween.Sequence() + .SetId("INNER INNER") + // .SetLoops(3, loopType) + .OnStepComplete(()=> Debug.Log("INNER INNER Step Complete")); + innerS1.Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + innerS1.InsertCallback(0.25f, ()=> Callback("INNER INNER")); + innerS0.Append(innerS1); + innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); + + main = DOTween.Sequence() + .SetId("MAIN") + .SetLoops(3, loopType) + .SetAutoKill(false) + .OnStepComplete(()=> Debug.Log("MAIN Step Complete")); + // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); + main.Append(innerS0); + main.InsertCallback(0.25f, ()=> Callback("MAIN")); + + if (flip) { + main.Complete(); + main.Flip(); + main.PlayBackwards(); + } + } + + void Callback(string id) + { + string prefix = ">>>"; + if (id == "INNER") prefix += ">>>"; + if (id == "INNER INNER") prefix += ">>>>>>"; + Debug.Log("" + prefix + " " + id + " > Callback > " + main.Elapsed(true) + ""); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs.meta b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs.meta new file mode 100644 index 0000000..4774e3e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad1abd97b06341d4ba034a86f24d639d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity new file mode 100644 index 0000000..2e2c121 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity.meta b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity.meta new file mode 100644 index 0000000..de81f42 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceCallbacks.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 431054a37e1666945a45e45adfc33c5c +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs b/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs new file mode 100644 index 0000000..55d0a61 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; +using System; + +public class SequenceEase : MonoBehaviour +{ + public Transform target; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + const float duration = 0.3f; + DOTween.Sequence() + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(5, duration).SetEase(Ease.Linear)) + .Append(target.DOMoveX(-5, duration).SetEase(Ease.Linear)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs.meta b/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs.meta new file mode 100644 index 0000000..597293e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceEase.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a50e1a8c7e9cde040866863cb046c193 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity b/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity new file mode 100644 index 0000000..1bcfa32 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity.meta b/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity.meta new file mode 100644 index 0000000..d9270be --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceEase.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9b6a786569f338d41976dd0d671b7926 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs new file mode 100644 index 0000000..b7f5a6b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs @@ -0,0 +1,18 @@ +using DG.Tweening; +using UnityEngine; +using System.Collections; + +public class SequenceIncremental : BrainBase +{ + public Transform target; + + void Start() + { + DOTween.Sequence() + .Append(target.DORotate(new Vector3(0, 45, 0), 1) + .SetLoops(2, LoopType.Incremental) + ) + .AppendInterval(0.5f) + .SetLoops(3, LoopType.Incremental); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs.meta b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs.meta new file mode 100644 index 0000000..2b8d027 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31bebc864b6c9c2459c51df1ad1718db +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity new file mode 100644 index 0000000..18499f0 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity.meta b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity.meta new file mode 100644 index 0000000..6b5bd42 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequenceIncremental.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 466fed659d30ce844a7cdf377bd80f03 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Sequences.cs b/UnityTests.Unity5/Assets/_Tests/Sequences.cs new file mode 100644 index 0000000..43345de --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Sequences.cs @@ -0,0 +1,165 @@ +using DG.Tweening; +using System.Text; +using UnityEngine; + +public class Sequences : BrainBase +{ + public int loops = 10001; + public LoopType loopType; + public GameObject prefab; + + Sequence mainSequence; + int stepCompleteMS, stepCompleteS1, stepCompleteS2, stepCompleteT1, stepCompleteT2, stepCompleteT3; + int completeMS, completeS1, completeS2, completeT1, completeT2, completeT3; + StringBuilder sb = new StringBuilder(); + + void Start() + { + mainSequence = CreateSequence(); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Restart")) { + ResetStepsCounters(); + mainSequence.Restart(); + } + if (GUILayout.Button("Rewind")) { + ResetStepsCounters(); + mainSequence.Rewind(); + } + if (GUILayout.Button("Complete")) mainSequence.Complete(); + if (GUILayout.Button("Flip")) mainSequence.Flip(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) mainSequence.TogglePause(); + if (GUILayout.Button("PlayForward")) mainSequence.PlayForward(); + if (GUILayout.Button("PlayBackwards")) mainSequence.PlayBackwards(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Kill All")) DOTween.KillAll(); + if (GUILayout.Button("Create MAIN Sequence")) mainSequence = CreateSequence(); + if (GUILayout.Button("Create FROM Sequence")) CreateFromSequence(); + if (GUILayout.Button("Create Tween")) CreateTween(); + GUILayout.EndHorizontal(); + + GUILayout.Space(10); + sb.Remove(0, sb.Length); + sb.Append("IsPlaying: ").Append(mainSequence.IsPlaying()); + sb.Append("\nIsBackwards: ").Append(mainSequence.IsBackwards()); + sb.Append("\nElapsed: ").Append(mainSequence.Elapsed(false)); + sb.Append("\nFullElapsed: ").Append(mainSequence.Elapsed()); + sb.Append("\nCompletedLoops: ").Append(mainSequence.CompletedLoops()); + GUILayout.Label(sb.ToString()); + + GUILayout.Space(10); + sb.Remove(0, sb.Length); + sb.Append("MAINSequence Steps/Complete: ").Append(stepCompleteMS).Append("/").Append(completeMS); + sb.Append("\nSequence OUTER Steps/Complete: ").Append(stepCompleteS1).Append("/").Append(completeS1); + sb.Append("\nSequence INNER Steps/Complete: ").Append(stepCompleteS2).Append("/").Append(completeS2); + sb.Append("\nMove Steps/Complete: ").Append(stepCompleteT1).Append("/").Append(completeT1); + sb.Append("\nRotation Steps/Complete: ").Append(stepCompleteT2).Append("/").Append(completeT2); + sb.Append("\nColor Steps/Complete: ").Append(stepCompleteT3).Append("/").Append(completeT3); + GUILayout.Label(sb.ToString()); + + DGUtils.EndGUI(); + } + + Sequence CreateSequence() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + Material mat = target.gameObject.GetComponent().material; + + Sequence seq = DOTween.Sequence() + .SetId("Sequence INNER") + .OnStart(()=> DGUtils.Log("Sequence INNER Start")) + .OnStepComplete(()=> { stepCompleteS2++; DGUtils.Log("SEQUENCE INNER Step Complete"); }) + .OnComplete(()=> { completeS2++; }); + + seq.AppendInterval(0.5f); + seq.Append( + target.DOMove(new Vector3(2, 2, 2), 1f).SetLoops(3, LoopType.Yoyo) + .SetSpeedBased() // will not work since it's not allowed + .SetId("Move") + .OnStart(()=> DGUtils.Log("Move Start")) + .OnStepComplete(()=> { stepCompleteT1++; DGUtils.Log("Move Step Complete"); }) + .OnComplete(()=> { completeT1++; }) + ); + seq.Append( + target.DORotate(new Vector3(0, 225, 2), 1) + .SetId("Rotate") + .SetDelay(1) + .OnStart(()=> DGUtils.Log("Rotate Start")) + .OnStepComplete(()=> { stepCompleteT2++; DGUtils.Log("Rotate Step Complete"); }) + .OnComplete(()=> { completeT2++; }) + ); + seq.Insert( + 0.5f, mat.DOColor(Color.green, 1) + .SetId("Color") + .OnStart(()=> DGUtils.Log("Color Start")) + .OnStepComplete(()=> { stepCompleteT3++; DGUtils.Log("Color Step Complete"); }) + .OnComplete(()=> { completeT3++; }) + ); + seq.AppendInterval(0.5f); + + seq.InsertCallback(1.25f, ()=> DGUtils.Log("1.25f Sequence callback")); + + Sequence seqPre = DOTween.Sequence() + .SetId("Sequence OUTER") + .OnStart(()=> DGUtils.Log("Sequence OUTER Start")) + .OnStepComplete(()=> { stepCompleteS1++; DGUtils.Log("Sequence OUTER Step Complete"); }) + .OnComplete(()=> { completeS1++; }); + seqPre.Append(seq); + seqPre.PrependInterval(1); + + Sequence mainSeq = DOTween.Sequence().SetUpdate(true).SetLoops(loops, loopType).SetAutoKill(false) + .SetId("MAIN SEQUENCE") + .OnStart(()=> DGUtils.Log("MAINSequence Start")) + .OnStepComplete(()=> { stepCompleteMS++; DGUtils.Log("MAINSEQUENCE Step Complete"); }) + .OnComplete(()=> { completeMS++; }); + mainSeq.Append(seqPre); + mainSeq.PrependInterval(1); + target = ((GameObject)Instantiate(prefab)).transform; + target.position = new Vector3(-5, 0, 0); + mainSeq.Append(target.DOMove(Vector3.zero, 1)); + + mainSeq.InsertCallback(1.75f, ()=> DGUtils.Log("1.75f MAINSEQUENCE callback")); + mainSeq.PrependCallback(()=> DGUtils.Log("1.75f MAINSEQUENCE prepended callback")); + + return mainSeq; + } + + void CreateFromSequence() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + Sequence seq = DOTween.Sequence() + .SetId("FROM Sequence") + .OnStart(()=> DGUtils.Log("FROM Sequence Start")) + .OnStepComplete(()=> { stepCompleteS2++; DGUtils.Log("FROM SEQUENCE Step Complete"); }) + .OnComplete(()=> DGUtils.Log("FROM SEQUENCE Complete")); + seq.Append(target.DOMove(new Vector3(0, -3, 0), 1) + .From(true) + ); + seq.Append(target.DOMove(new Vector3(0, 3, 0), 1) + .From(true) + ); + } + + void CreateTween() + { + Transform target = ((GameObject)Instantiate(prefab)).transform; + + target.DOMove(new Vector3(2, 2, 2), 1f).SetLoops(1, LoopType.Yoyo) + .SetId("Move (Tween)") + .SetLoops(3) + .OnComplete(()=> Destroy(target.gameObject)); + } + + void ResetStepsCounters() + { + stepCompleteMS = stepCompleteS1 = stepCompleteS2 = stepCompleteT1 = stepCompleteT2 = stepCompleteT3 = completeMS = completeS1 = completeS2 = completeT1 = completeT2 = completeT3 = 0; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Sequences.cs.meta b/UnityTests.Unity5/Assets/_Tests/Sequences.cs.meta new file mode 100644 index 0000000..88f6fab --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Sequences.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da126d837a515384d9a9877047a2da50 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Sequences.unity b/UnityTests.Unity5/Assets/_Tests/Sequences.unity new file mode 100644 index 0000000..ea31b4a Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Sequences.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Sequences.unity.meta b/UnityTests.Unity5/Assets/_Tests/Sequences.unity.meta new file mode 100644 index 0000000..d1da681 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Sequences.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ecaf5a81b86e6e24a850d97f71635011 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs new file mode 100644 index 0000000..b245d32 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs @@ -0,0 +1,72 @@ +using DG.Tweening; +using System; +using System.Collections.Generic; +using UnityEngine; + +public class SequencesExperiments : BrainBase +{ + public Camera cam; + public Transform multiCube; + + void Start() + { + CreateMultiCubeSequence(); + } + + void CreateMultiCubeSequence() + { + // Find and sort nested cubes from back to front, from TL clockwise + Transform[] children = multiCube.GetComponentsInChildren(); + List ts = new List(children.Length - 1); + foreach (Transform t in children) if (t != multiCube) ts.Add(t); + ts.Sort((x, y) => { + if (x.position.z > y.position.z) return -1; + if (x.position.z < y.position.z) return 1; + if (x.position.y > y.position.y) return -1; + if (x.position.y < y.position.y) return 1; + if (x.position.x < y.position.y) return -1; + if (x.position.x > y.position.y) return 1; + return 0; + }); + // Create sequence + const float duration = 1f; + const float delay = 1; + const Ease easeType = Ease.InCubic; + Sequence seq = DOTween.Sequence().SetId("MAIN").SetLoops(-1, LoopType.Yoyo).OnStepComplete(()=> Debug.Log("MultiCube :: Step Complete")); + seq.AppendInterval(delay); + seq.Insert(delay + (duration * 0.25f), multiCube.DORotate(new Vector3(0,450,45), (duration * 0.75f)).SetEase(easeType)); + seq.Insert(delay + (duration * 0.25f), multiCube.DOScale(new Vector3(0.001f,2,2), (duration * 0.75f)).SetEase(easeType)); + foreach (Transform t in ts) { + Vector3 to = t.localPosition; + to *= 4; + seq.Insert(delay, t.DOLocalMove(to, duration).SetEase(easeType)); + seq.Insert(delay, t.DOLocalRotate(new Vector3(0,360,0), duration).SetEase(easeType)); + seq.Insert(delay + (duration * 0.75f), t.gameObject.GetComponent().material.DOColor(cam.backgroundColor, duration * 0.25f)); + } + seq.Insert(delay + (duration * 0.75f), DOTween.To(()=> cam.backgroundColor, x=> cam.backgroundColor = x, Color.black, duration * 0.25f)); + seq.AppendInterval(0.5f); + } + + Color RandomColor() + { + return new Color(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value, 1); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Toggle Pause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Rewind")) { + Debug.Log("REWIND"); + DOTween.RewindAll(); + } + if (GUILayout.Button("Restart")) { + Debug.Log("RESTART"); + DOTween.RestartAll(); + } + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + GUILayout.EndHorizontal(); + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs.meta b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs.meta new file mode 100644 index 0000000..8742ce6 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 492c75105a1e9c047a963658350ce54a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity new file mode 100644 index 0000000..3d09a36 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity.meta b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity.meta new file mode 100644 index 0000000..628f85a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/SequencesExperiments.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 526221f9a38d74a4a8430b449b94243d +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs b/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs new file mode 100644 index 0000000..60ac147 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs @@ -0,0 +1,141 @@ +using DG.Tweening; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ShakePunch : BrainBase +{ + public float duration = 1; // Shake duration + public float shakePosStrength = 2; // Shake position power + public Vector3 shakePosStrengthV3 = new Vector3(2,2,2); + public float shakeRotStrength = 90; // Shake rotation power + public Vector3 shakeRotStrengthV3 = new Vector3(90,90,90); + public float shakeScaleStrength = 2; // Shake scale power + public Vector3 shakeScaleStrengthV3 = new Vector3(2,2,2); + public bool useVectorStrength; + public int shakeVibrato = 10; // Shake iterations x seconds + public float shakeRandomness = 90; + public int punchVibrato = 10; + public float punchElasticity = 1; + public Vector3 punchDirection = Vector3.up; + public Vector3 punchScale = new Vector3(2,2,2); + public Vector3 punchRotation = new Vector3(0, 180, 0); + public Transform[] targets; + + Tween shakePositionTween, shakeRotationTween, shakeScaleTween, punchPositionTween, punchScaleTween, punchRotationTween; + + void Start() + { + DOTween.defaultRecyclable = false; + // DOTween.logBehaviour = LogBehaviour.Verbose; + Camera.main.transform.LookAt(targets[0]); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Shake Camera Position")) ShakePosition(true); + if (GUILayout.Button("Shake Camera Position + LookAt")) ShakePosition(true, targets[0].position); + if (GUILayout.Button("Shake Camera Rotation")) ShakeRotation(true); + if (GUILayout.Button("Shake Camera All")) { + ShakePosition(true); + ShakeRotation(true); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Shake Position")) ShakePosition(); + if (GUILayout.Button("Shake Rotation")) ShakeRotation(); + if (GUILayout.Button("Shake Scale")) ShakeScale(); + if (GUILayout.Button("Shake All")) { + ShakePosition(); + ShakeRotation(); + ShakeScale(); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Punch Position")) PunchPosition(); + if (GUILayout.Button("Punch Scale")) PunchScale(); + if (GUILayout.Button("Punch Rotation")) PunchRotation(); + if (GUILayout.Button("Punch All")) { + PunchPosition(); + PunchRotation(); + PunchScale(); + } + if (GUILayout.Button("Punch All Semi-Random")) { + PunchPosition(true); + PunchRotation(true); + PunchScale(true); + } + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } + + void ShakePosition(bool isCamera = false, Vector3? lookAt = null) + { + shakePositionTween.Complete(); + + shakePositionTween = isCamera + ? useVectorStrength + ? Camera.main.DOShakePosition(duration, shakePosStrengthV3, shakeVibrato, shakeRandomness) + : Camera.main.DOShakePosition(duration, shakePosStrength, shakeVibrato, shakeRandomness) + : useVectorStrength + ? targets[0].DOShakePosition(duration, shakePosStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakePosition(duration, shakePosStrength, shakeVibrato, shakeRandomness); + if (isCamera && lookAt != null) { + shakePositionTween.OnUpdate(()=> Camera.main.transform.LookAt((Vector3)lookAt)); + } + } + + void ShakeRotation(bool isCamera = false) + { + shakeRotationTween.Complete(); + + shakeRotationTween = isCamera + ? useVectorStrength + ? Camera.main.DOShakeRotation(duration, shakeRotStrengthV3, shakeVibrato, shakeRandomness) + : Camera.main.DOShakeRotation(duration, shakeRotStrength, shakeVibrato, shakeRandomness) + : useVectorStrength + ? targets[0].DOShakeRotation(duration, shakeRotStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakeRotation(duration, shakeRotStrength, shakeVibrato, shakeRandomness); + } + + void ShakeScale() + { + shakeScaleTween.Complete(); + + shakeScaleTween = useVectorStrength + ? targets[0].DOShakeScale(duration, shakeScaleStrengthV3, shakeVibrato, shakeRandomness) + : targets[0].DOShakeScale(duration, shakeScaleStrength, shakeVibrato, shakeRandomness); + } + + void PunchPosition(bool random = false) + { + punchPositionTween.Complete(); + + punchPositionTween = targets[0].DOPunchPosition(random ? RandomVector3(-1, 1) : punchDirection, duration, punchVibrato, punchElasticity); + } + + void PunchScale(bool random = false) + { + punchScaleTween.Complete(); + + punchScaleTween = targets[0].DOPunchScale(random ? RandomVector3(0.5f, 1) : punchScale, duration, punchVibrato, punchElasticity); + } + + void PunchRotation(bool random = false) + { + punchRotationTween.Complete(); + + punchRotationTween = targets[0].DOPunchRotation(random ? RandomVector3(-180, 180) : punchRotation, duration, punchVibrato, punchElasticity); + } + + Vector3 RandomVector3(float min, float max) + { + return new Vector3(Random.Range(min, max), Random.Range(min, max), Random.Range(min, max)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs.meta b/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs.meta new file mode 100644 index 0000000..7091543 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/ShakePunch.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 60d403f9506094d499562cca7304b896 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity b/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity new file mode 100644 index 0000000..52eedaa Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity.meta b/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity.meta new file mode 100644 index 0000000..05dc9c0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/ShakePunch.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 80c5c33c61ea44a4a9bba554ed6c01e6 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs b/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs new file mode 100644 index 0000000..968a720 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs @@ -0,0 +1,42 @@ +using DG.Tweening; +using UnityEngine; + +public class Shortcuts : MonoBehaviour +{ + public GameObject prefab; + + void Start() + { + //////////////////////////////////////////// + // Transform shortcuts ///////////////////// + + // Position + NewTransform().DOMove(RandomVector3(), 1).SetLoops(-1, LoopType.Yoyo); + // X Position + NewTransform().DOMoveX(Random.Range(-10f, 10f), 1).SetLoops(-1, LoopType.Yoyo); + // Local position + NewTransform().DOLocalMove(RandomVector3(), 1).SetLoops(-1, LoopType.Yoyo); + // Rotation + NewTransform().DORotate(RandomVector3(720), 1).SetLoops(-1, LoopType.Yoyo); + // Local rotation + NewTransform().DOLocalRotate(RandomVector3(720), 1).SetLoops(-1, LoopType.Yoyo); + // Scale + NewTransform().DOScale(RandomVector3(3), 1).SetLoops(-1, LoopType.Yoyo); + // Color + NewTransform().GetComponent().material.DOColor(Color.green, 1).SetLoops(-1, LoopType.Yoyo); + // Alpha + NewTransform().GetComponent().material.DOFade(0, 1).SetLoops(-1, LoopType.Yoyo); + } + + Transform NewTransform(bool randomPos = true) + { + Transform t = ((GameObject)Instantiate(prefab)).transform; + if (randomPos) t.position = RandomVector3(); + return t; + } + + Vector3 RandomVector3(float limit = 10f) + { + return new Vector3(Random.Range(-limit, limit), Random.Range(-limit, limit), Random.Range(-limit, limit)); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs.meta b/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs.meta new file mode 100644 index 0000000..2c7b9ea --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Shortcuts.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f00c98fcdc2e0314a98e21aafd1e659f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity b/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity new file mode 100644 index 0000000..74148d7 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity.meta b/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity.meta new file mode 100644 index 0000000..fdc98b4 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Shortcuts.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0acb22747210d3e449c3d456f38fe8d8 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs new file mode 100644 index 0000000..502a903 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs @@ -0,0 +1,86 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class StartupSpeed : BrainBase +{ + const int maxIterations = 32000; + Vector3[] toPositions = new Vector3[maxIterations]; + float[] toValues = new float[maxIterations]; + Transform[] transforms = new Transform[maxIterations]; + SampleData[] sampleDatas = new SampleData[maxIterations]; + + float startupTime; + + void Start() + { + DOTween.Init(true, false, LogBehaviour.ErrorsOnly); + DOTween.SetTweensCapacity(maxIterations, 0); + + Transform container = new GameObject("Container").transform; + for (int i = 0; i < maxIterations; ++i) { + toPositions[i] = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f)); + toValues[i] = Random.Range(1f, 100f); + + Transform t = new GameObject("T " + i).transform; + t.parent = container; + transforms[i] = t; + + sampleDatas[i] = new SampleData(); + } + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 2,000 position tweens")) StartCoroutine(StartupPos(2000)); + if (GUILayout.Button("Startup 2,000 float tweens")) StartCoroutine(StartupFloats(2000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 5,000 position tweens")) StartCoroutine(StartupPos(5000)); + if (GUILayout.Button("Startup 5,000 float tweens")) StartCoroutine(StartupFloats(5000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 10,000 position tweens")) StartCoroutine(StartupPos(10000)); + if (GUILayout.Button("Startup 10,000 float tweens")) StartCoroutine(StartupFloats(10000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 20,000 position tweens")) StartCoroutine(StartupPos(20000)); + if (GUILayout.Button("Startup 20,000 float tweens")) StartCoroutine(StartupFloats(20000)); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Startup 32,000 position tweens")) StartCoroutine(StartupPos(32000)); + if (GUILayout.Button("Startup 32,000 float tweens")) StartCoroutine(StartupFloats(32000)); + GUILayout.EndHorizontal(); + + GUILayout.Label("Startup time: " + startupTime); + + DGUtils.EndGUI(); + } + + IEnumerator StartupPos(int tot) + { + DOTween.KillAll(); + yield return null; + + float time = Time.realtimeSinceStartup; + for (int i = 0; i < tot; ++i) transforms[i].DOMove(toPositions[i], 2); + startupTime = Time.realtimeSinceStartup - time; + } + + IEnumerator StartupFloats(int tot) + { + DOTween.KillAll(); + yield return null; + + float time = Time.realtimeSinceStartup; + for (int i = 0; i < tot; ++i) { + SampleData d = sampleDatas[i]; + SampleData dd = d; + DOTween.To(()=> dd.floatVal, x=> dd.floatVal = x, toValues[i], 2); + } + startupTime = Time.realtimeSinceStartup - time; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs.meta b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs.meta new file mode 100644 index 0000000..a584c72 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69f1048461841f445bd8f5bad2c7bba8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity new file mode 100644 index 0000000..3362cf9 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity.meta b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity.meta new file mode 100644 index 0000000..09bed5f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/StartupSpeed.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a9835b81837406b49b5190f2a1d583c3 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Strings.cs b/UnityTests.Unity5/Assets/_Tests/Strings.cs new file mode 100644 index 0000000..14f25e3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Strings.cs @@ -0,0 +1,62 @@ +using DG.Tweening; +using UnityEngine; + +public class Strings : BrainBase +{ + public GUIText[] txts; + string stringToTween0 = "Short text", + stringToTween1 = "Long text to show how it gets completely replaced", + stringToTween2 = "Relative text... ", + stringToTween3 = "Scramble short text", + stringToTween4 = "Scramble long text to show how it gets completely replaced", + stringToTween5 = "Scramble relative text... "; + string[] strings; + + void Start() + { + // String + DOTween.To(()=> stringToTween0, x=> stringToTween0 = x, "Hello I'm a new string!", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween1, x=> stringToTween1 = x, "Hello I'm a new string!", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween2, x=> stringToTween2 = x, "Hello I'm a new string!", 1.5f).SetRelative().SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + // String scramble + DOTween.To(()=> stringToTween3, x=> stringToTween3 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween4, x=> stringToTween4 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + DOTween.To(()=> stringToTween5, x=> stringToTween5 = x, "Hello I'm a new string!", 1.5f).SetOptions(true).SetRelative().SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + + // Additional string + strings = new string[500]; + for (int i = 0; i < strings.Length; ++i) { + int index = i; + strings[i] = "Some String"; + DOTween.To(()=> strings[index], x=> strings[index] = x, "Modified string", 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause(); + } + } + + void LateUpdate() + { + txts[0].text = "String 0: " + stringToTween0; + txts[1].text = "String 1: " + stringToTween1; + txts[2].text = "String 2 (relative tween): " + stringToTween2; + txts[3].text = "String 3 (scramble): " + stringToTween3; + txts[4].text = "String 4 (scramble): " + stringToTween4; + txts[5].text = "String 5 (scramble relative): " + stringToTween5; + } + + void OnGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + GUILayout.Space(100); + + if (GUILayout.Button("Toggle Pause")) { + DOTween.TogglePauseAll(); + } + + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Strings.cs.meta b/UnityTests.Unity5/Assets/_Tests/Strings.cs.meta new file mode 100644 index 0000000..1960ac0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Strings.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06f6de75519c8114fa02a4891777e37a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Strings.unity b/UnityTests.Unity5/Assets/_Tests/Strings.unity new file mode 100644 index 0000000..dcc3dbe Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Strings.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Strings.unity.meta b/UnityTests.Unity5/Assets/_Tests/Strings.unity.meta new file mode 100644 index 0000000..9196f19 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Strings.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 99d5c6c4e6271cc4480cae0276f92884 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.cs b/UnityTests.Unity5/Assets/_Tests/TempTests.cs new file mode 100644 index 0000000..6ddbfa1 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TempTests.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using System; + +public class TempTests : BrainBase +{ + public Transform target; + + void Start() + { + DOTween.To(()=>new Vector3(0,2,0), x=>target.position = x, new Vector3(2,4,2), 2); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.cs.meta b/UnityTests.Unity5/Assets/_Tests/TempTests.cs.meta new file mode 100644 index 0000000..804625e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TempTests.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 501d8bd74a44ee2408a65e2d6289c416 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.unity b/UnityTests.Unity5/Assets/_Tests/TempTests.unity new file mode 100644 index 0000000..aa64ee7 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/TempTests.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/TempTests.unity.meta b/UnityTests.Unity5/Assets/_Tests/TempTests.unity.meta new file mode 100644 index 0000000..4a84be8 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TempTests.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9aa6001cae7adc14f8692dfca268dd91 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs new file mode 100644 index 0000000..10a8137 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class TrailAndLineRenderer : BrainBase +{ + public LineRenderer lineRenderer; + public TrailRenderer trailRenderer; + + void OnGUI() + { + DGUtils.BeginGUI(); + + if (GUILayout.Button("Tween LineRenderer Colors")) { + lineRenderer.DOColor(new Color2(Color.white, Color.white), new Color2(Color.red, Color.white), 2).SetLoops(-1, LoopType.Yoyo); + } + if (GUILayout.Button("Tween TrailRenderer's Sizes")) { + trailRenderer.DOResize(2, 4, 2).SetLoops(-1, LoopType.Yoyo); + } + if (GUILayout.Button("Tween TrailRenderer's Time")) { + trailRenderer.DOTime(0.001f, 2).SetLoops(-1, LoopType.Yoyo); + } + + DGUtils.EndGUI(); + } +} diff --git a/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs.meta b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs.meta new file mode 100644 index 0000000..2a89c8b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88aceceac9228c443a863b83351cced8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity new file mode 100644 index 0000000..0687b84 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity.meta b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity.meta new file mode 100644 index 0000000..0418308 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TrailAndLineRenderer.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7fd8661721a418648adbade214d315ef +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta new file mode 100644 index 0000000..167c788 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: eaee708f7b5912b458129998869b2edc +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs new file mode 100644 index 0000000..046f0e9 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +public class TestObjectData +{ + // Only for GoKit, since it can't tween fields + public float floatValueProperty { get; set; } + public float floatValue; +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta new file mode 100644 index 0000000..b587a19 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TestObjectData.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75e2185d1388639498cc3b6d066f2051 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs new file mode 100644 index 0000000..a9a88b3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs @@ -0,0 +1,658 @@ +using DG.Tweening; +using Holoville.HOTween; +using System; +using System.Collections; +using UnityEngine; + +public class TweenEnginesComparisonInternal : BrainBase +{ + enum State { + Menu, + NoEmitWITween, + ConfirmGoKit, + ConfirmITween, + CreatingObjects, + TweensSetup, + Running + } + enum Engine { + DOTween, + HOTween, + LeanTween, + GoKit, + iTween + } + enum TestType { + Transforms, + Floats + } + enum TestSetup { + Emit, + Loop, + YoyoLoop + } + enum Easing { + Linear, + InOutQuad + } + + public bool doTweenSafeMode; + public GameObject prefab; + public float someVal; // used for iTween tests + + State state = State.Menu; + Engine engine = Engine.DOTween; + TestType testType = TestType.Transforms; + TestSetup testSetup = TestSetup.YoyoLoop; + Easing easing = Easing.Linear; + int numTweens; + float duration; + bool disableRenderers; + bool positionTween = true; + bool rotationTween, scaleTween; + Transform container; + GameObject[] testObjsGos; // Here to test LeanTween fairly + Transform[] testObjsTrans; + TestObjectData[] testObjsData; + Vector3[] rndPositions; + Vector3[] rndRotations; + Vector3[] rndStartupPos; + readonly Vector3 rndScale = new Vector3(6,6,6); + float[] rndFloats; + + float totCreationTime; + + bool guiInitialized; + GUIStyle labelStyle; + const int vspace = 10; + string[] engineList, testTypeList, testSetupList, easingList; + string[] durationList = new[] { + "0.25", "0.5", "1", "2", "4", "8", "16", "32" + }; + string[] numTweensList = new[] { + "1", "2", "50", "100", "500", "1000", "2000", "4000", "8000", "16000", "32000" + }; + int durationSelId = 2, numTweensSelId = 4; + + override protected void Awake() + { + base.Awake(); + DOTween.Init(true, false); + DOTween.useSafeMode = doTweenSafeMode; + HOTween.Init(true, false, false); + LeanTween.init(Convert.ToInt32(numTweensList[numTweensList.Length - 1]) + 1); + } + + void Start() + { + engineList = Enum.GetNames(typeof(Engine)); + testTypeList = Enum.GetNames(typeof(TestType)); + testSetupList = Enum.GetNames(typeof(TestSetup)); + easingList = Enum.GetNames(typeof(Easing)); + container = new GameObject("Test Objects Container").transform; + } + + IEnumerator StartRun() + { + state = State.CreatingObjects; + yield return null; + + duration = Convert.ToSingle(durationList[durationSelId]); + // Generate random values for tweens + rndStartupPos = new Vector3[numTweens]; + rndPositions = new Vector3[numTweens]; + rndRotations = new Vector3[numTweens]; + rndFloats = new float[numTweens]; + for (int i = 0; i < numTweens; ++i) { + rndStartupPos[i] = RandomVector3(50, 50, 20); + rndPositions[i] = RandomVector3(50, 50, 20); + rndRotations[i] = RandomVector3(180, 180, 180); + rndFloats[i] = UnityEngine.Random.Range(-1000f, 1000f); + } + // Generate testObjs + if (testType == TestType.Transforms) { + testObjsGos = new GameObject[numTweens]; + testObjsTrans = new Transform[numTweens]; + } else { + testObjsData = new TestObjectData[numTweens]; + } + for (int i = 0; i < numTweens; ++i) { + if (testType == TestType.Transforms) { + GameObject go = (GameObject)Instantiate(prefab); + go.SetActive(true); + Transform t = go.transform; + if (testSetup != TestSetup.Emit) t.position = rndStartupPos[i]; + t.parent = container; + testObjsGos[i] = go; + testObjsTrans[i] = t; + if (disableRenderers || testType == TestType.Floats) go.GetComponent().enabled = false; + } else testObjsData[i] = new TestObjectData(); + } + if (engine == Engine.DOTween) { + // Set max capacity for this run. + // We could set it to the correct amount, but it would be somehow unfair for LeanTween + int minCapacityToBeFair = Convert.ToInt32(numTweensList[numTweensList.Length - 1]); + int capacityX1 = Convert.ToInt32(numTweensList[numTweensSelId]); + int neededCapacity = 0; + int capacity = minCapacityToBeFair; + if (testType == TestType.Transforms && positionTween) neededCapacity += capacityX1; + if (testType == TestType.Transforms && rotationTween) neededCapacity += capacityX1; + if (testType == TestType.Transforms && scaleTween) neededCapacity += capacityX1; + if (minCapacityToBeFair < neededCapacity) capacity = neededCapacity; + DOTween.SetTweensCapacity(capacity, 0); + } + + yield return null; + state = State.TweensSetup; + yield return null; + totCreationTime = Time.realtimeSinceStartup; + SetupTweens(); + totCreationTime = Time.realtimeSinceStartup - totCreationTime; + yield return null; + state = State.Running; + // Reset FPS so average is more correct + fpsGadget.ResetFps(); + } + + void StopRun() + { + this.StopAllCoroutines(); + state = State.Menu; + // Clear tweens + if (engine == Engine.DOTween) DOTween.Clear(); + else if (engine == Engine.HOTween) HOTween.Kill(); + else if (engine == Engine.LeanTween) LeanTween.reset(); + else if (engine == Engine.GoKit) KillAllGoTweens(); + else if (engine == Engine.iTween) iTween.Stop(); + // Clean + if (testObjsGos != null) foreach (GameObject go in testObjsGos) Destroy(go); + testObjsGos = null; + testObjsTrans = null; + testObjsData = null; + rndPositions = null; + rndRotations = null; + } + + void Reset(bool complete = true) + { + if (complete) { + if (engine == Engine.DOTween) DOTween.Clear(); + else if (engine == Engine.HOTween) HOTween.Kill(); + else if (engine == Engine.LeanTween) LeanTween.reset(); + else if (engine == Engine.GoKit) KillAllGoTweens(); + else if (engine == Engine.iTween) iTween.Stop(); + } + if (testObjsTrans != null) { + for (int i = 0; i < testObjsTrans.Length; ++i) { + Transform t = testObjsTrans[i]; + t.position = rndStartupPos[i]; + t.localScale = Vector3.one; + t.rotation = Quaternion.identity; + } + } + } + + void SetupTweens() + { + // Ease + DG.Tweening.Ease dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad; + Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad; + LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad; + GoEaseType goEase = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut; + iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad; + // Loop + int loops = testSetup == TestSetup.Emit ? 1 : -1; + DG.Tweening.LoopType dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart; + Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart; + LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp; + GoLoopType goLoopType = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning; + iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop; + // Create tweens + switch (testType) { + case TestType.Floats: + for (int i = 0; i < numTweens; ++i) { + TestObjectData data = testObjsData[i]; + switch (engine) { + case Engine.HOTween: + HOTween.To(data, duration, new Holoville.HOTween.TweenParms() + .Prop("floatValue", rndFloats[i]) + .Ease(hotweenEase) + .Loops(loops, hotweenLoopType) + ); + break; + case Engine.LeanTween: + LeanTween.value(this.gameObject, x=> data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + break; + case Engine.GoKit: + Go.to(data, duration, new GoTweenConfig() + .floatProp("floatValueProperty", rndFloats[i]) + .setEaseType(goEase) + .setIterations(loops, goLoopType) + ); + break; + case Engine.iTween: + Hashtable hs = new Hashtable(); + hs.Add("from", data.floatValue); + hs.Add("to", rndFloats[i]); + hs.Add("time", duration); + hs.Add("onupdate", "UpdateiTweenFloat"); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.ValueTo(this.gameObject, hs); + break; + default: + // tCopy is needed to create correct closure object, + // otherwise closure will pass the same t to all the loop + TestObjectData dataCopy = data; + DOTween.To(()=> dataCopy.floatValue, x=> dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + break; + } + } + break; + default: + for (int i = 0; i < numTweens; ++i) { + float twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration; + Transform t = testObjsTrans[i]; + GameObject go = testObjsGos[i]; // Used by LeanTween and iTween + switch (engine) { + case Engine.HOTween: + Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms() + .Ease(hotweenEase) + .Loops(loops, hotweenLoopType); + if (positionTween) { + Vector3 toPos = rndPositions[i]; + tp.Prop("position", toPos); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + tp.Prop("rotation", toRot); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase)); + } + if (scaleTween) { + tp.Prop("localScale", rndScale); + if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase)); + } + HOTween.To(t, twDuration, tp); + break; + case Engine.LeanTween: + LTDescr leanTween; + if (positionTween) { + Vector3 toPos = rndPositions[i]; + leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase)); + } + if (scaleTween) { + leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); + if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase)); + } + break; + case Engine.GoKit: + GoTweenConfig goConfig = new GoTweenConfig() + .setEaseType(goEase) + .setIterations(loops, goLoopType); + if (positionTween) { + Vector3 toPos = rndPositions[i]; + goConfig.addTweenProperty(new PositionTweenProperty(toPos)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitPositionFor(t, toPos, twDuration, goEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + goConfig.addTweenProperty(new RotationTweenProperty(toRot)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitRotationFor(t, toRot, twDuration, goEase)); + } + if (scaleTween) { + goConfig.addTweenProperty(new ScaleTweenProperty(rndScale)); + if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitScaleFor(t, rndScale, twDuration, goEase)); + } + Go.to(t, twDuration, goConfig); + break; + case Engine.iTween: + Hashtable hs; + if (positionTween) { + hs = new Hashtable(); + hs.Add("position", rndPositions[i]); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.MoveTo(go, hs); + } + if (rotationTween) { + hs = new Hashtable(); + hs.Add("rotation", rndRotations[i]); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.RotateTo(go, hs); + } + if (scaleTween) { + hs = new Hashtable(); + hs.Add("scale", rndScale); + hs.Add("time", twDuration); + hs.Add("looptype", iTweenLoopType); + hs.Add("easetype", iTweenEase); + iTween.ScaleTo(go, hs); + } + break; + default: + // tCopy is needed to create correct closure object, + // otherwise closure will pass the same t to all the loop + Transform tCopy = t; + DG.Tweening.Tween dotween; + if (positionTween) { + Vector3 toPos = rndPositions[i]; + dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase)); + } + if (rotationTween) { + Vector3 toRot = rndRotations[i]; + dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase)); + } + if (scaleTween) { + dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); + if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase)); + } + break; + } + } + break; + } + } + + void EmitDOTweenPositionFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.position = Vector3.zero; + t.DOMove(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenPositionFor(t, to, twDuration, ease)); + } + void EmitDOTweenRotationFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.rotation = Quaternion.identity; + t.DORotate(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenRotationFor(t, to, twDuration, ease)); + } + void EmitDOTweenScaleFor(Transform t, Vector3 to, float twDuration, DG.Tweening.Ease ease) + { + t.localScale = Vector3.one; + t.DOScale(to, twDuration).SetEase(ease).OnComplete(()=> EmitDOTweenScaleFor(t, to, twDuration, ease)); + } + + void EmitHOTweenPositionFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.position = Vector3.zero; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("position", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenPositionFor(t, to, twDuration, ease)) + ); + } + void EmitHOTweenRotationFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.rotation = Quaternion.identity; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("rotation", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenRotationFor(t, to, twDuration, ease)) + ); + } + void EmitHOTweenScaleFor(Transform t, Vector3 to, float twDuration, Holoville.HOTween.EaseType ease) + { + t.localScale = Vector3.one; + HOTween.To(t, twDuration, new Holoville.HOTween.TweenParms() + .Prop("localScale", to) + .Ease(ease) + .OnComplete(()=> EmitHOTweenScaleFor(t, to, twDuration, ease)) + ); + } + + void EmitLeanTweenPositionFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.position = Vector3.zero; + LeanTween.move(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenPositionFor(t, go, to, twDuration, ease)); + } + void EmitLeanTweenRotationFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.rotation = Quaternion.identity; + LeanTween.rotate(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenRotationFor(t, go, to, twDuration, ease)); + } + void EmitLeanTweenScaleFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease) + { + t.localScale = Vector3.one; + LeanTween.scale(go, to, twDuration).setEase(ease).setOnComplete(()=> EmitLeanTweenScaleFor(t, go, to, twDuration, ease)); + } + + void EmitGoKitPositionFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.position = Vector3.zero; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new PositionTweenProperty(to)) + .onComplete(x=> EmitGoKitPositionFor(t, to, twDuration, ease)) + ); + } + void EmitGoKitRotationFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.rotation = Quaternion.identity; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new RotationTweenProperty(to)) + .onComplete(x=> EmitGoKitRotationFor(t, to, twDuration, ease)) + ); + } + void EmitGoKitScaleFor(Transform t, Vector3 to, float twDuration, GoEaseType ease) + { + t.localScale = Vector3.one; + Go.to(t, twDuration, new GoTweenConfig() + .addTweenProperty(new ScaleTweenProperty(to)) + .onComplete(x=> EmitGoKitScaleFor(t, to, twDuration, ease)) + ); + } + + Vector3 RandomVector3(float rangeX, float rangeY, float rangeZ) + { + return new Vector3(UnityEngine.Random.Range(-rangeX, rangeX), UnityEngine.Random.Range(-rangeY, rangeY), UnityEngine.Random.Range(-rangeZ, rangeZ)); + } + + // GoKit has no "KillAll" method, so we'll have to kill the tweens one by one based on target + void KillAllGoTweens() + { + if(testObjsTrans != null) foreach(Transform t in testObjsTrans) Go.killAllTweensWithTarget(t); + if(testObjsData != null) foreach(TestObjectData t in testObjsData) Go.killAllTweensWithTarget(t); + } + + public void UpdateiTweenFloat(float newVal) + { + // Practically does nothing: iTween can't logically tween many floats + // Still a valid test though, and even grants iTween some slack since it will do less than other engines + someVal = newVal; + } + + void OnGUI() + { + if (!guiInitialized) { + guiInitialized = true; + labelStyle = new GUIStyle(GUI.skin.label); + labelStyle.padding = new RectOffset(0, 0, 0, 0); + labelStyle.margin = new RectOffset(4, 4, 0, 0); + } + + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + + switch (state) { + case State.CreatingObjects: + DrawCreatingObjectsGUI(); + break; + case State.TweensSetup: + DrawTweensSetupGUI(); + break; + case State.Running: + DrawRunningGUI(); + break; + case State.NoEmitWITween: + DrawNoEmitWITweenGUI(); + break; + case State.ConfirmGoKit: + DrawConfirmGoKitGUI(); + break; + case State.ConfirmITween: + DrawConfirmITweenGUI(); + break; + default: + DrawMenuGUI(); + break; + } + + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + void DrawMenuGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Tween Duration", labelStyle); + durationSelId = GUILayout.Toolbar(durationSelId, durationList); + GUILayout.Space(vspace); + GUILayout.Label("Number of Tweens", labelStyle); + numTweensSelId = GUILayout.Toolbar(numTweensSelId, numTweensList); + GUILayout.Space(vspace); + GUILayout.Label("Tweens", labelStyle); + GUILayout.BeginHorizontal(); + positionTween = GUILayout.Toggle(positionTween, "Position"); + rotationTween = GUILayout.Toggle(rotationTween, "Rotation"); + scaleTween = GUILayout.Toggle(scaleTween, "Scale"); + if (!positionTween && !rotationTween && !scaleTween) positionTween = true; + GUILayout.EndHorizontal(); + GUILayout.Space(vspace); + GUILayout.Label("Test Type", labelStyle); + testType = (TestType)GUILayout.Toolbar((int)testType, testTypeList); + if (testType == TestType.Floats && testSetup == TestSetup.Emit) testSetup = TestSetup.Loop; + GUILayout.Space(vspace); + GUILayout.Label("Test Setup", labelStyle); + testSetup = (TestSetup)GUILayout.Toolbar((int)testSetup, testSetupList); + GUILayout.Space(vspace); + GUILayout.Label("Easing", labelStyle); + easing = (Easing)GUILayout.Toolbar((int)easing, easingList); + GUILayout.Space(vspace); + GUILayout.Label("Options", labelStyle); + disableRenderers = GUILayout.Toggle(disableRenderers, "Disable Renderers"); + GUILayout.Space(vspace); + GUILayout.Label("Engine", labelStyle); + engine = (Engine)GUILayout.Toolbar((int)engine, engineList); + GUILayout.Space(vspace); + if (GUILayout.Button("START")) { + numTweens = Convert.ToInt32(numTweensList[numTweensSelId]); + if (engine == Engine.GoKit && testType == TestType.Floats && numTweens >= 8000) state = State.ConfirmGoKit; + else if (engine == Engine.iTween) { + if (testSetup == TestSetup.Emit) state = State.NoEmitWITween; + else if (numTweens > 4000) state = State.ConfirmITween; + else StartCoroutine(StartRun()); + } + else StartCoroutine(StartRun()); + } + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawNoEmitWITweenGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Sorry, but iTween doesn't allow to create a good Emit test"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Ok")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawConfirmGoKitGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Beware, GoKit takes a long time to startup and to stop custom tweens,\nand your computer might hang for a while.\n\nAre you sure you want to proceed?"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Continue")) StartCoroutine(StartRun()); + if (GUILayout.Button("Cancel")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawConfirmITweenGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.Label("Beware, ITween takes a long time to startup and a longer time to stop tweens,\nand your computer might hang for a while.\n\nAre you sure you want to proceed?"); + GUILayout.Space(8); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Continue")) StartCoroutine(StartRun()); + if (GUILayout.Button("Cancel")) state = State.Menu; + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawCreatingObjectsGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(GUI.skin.box); + GUILayout.Space(8); + GUILayout.Label("Preparing environment..."); + GUILayout.Space(8); + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawTweensSetupGUI() + { + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(GUI.skin.box); + GUILayout.Space(8); + GUILayout.Label("Starting up tweens..."); + GUILayout.Space(8); + GUILayout.EndHorizontal(); + + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); + } + + void DrawRunningGUI() + { + GUILayout.BeginVertical(); + if (testType == TestType.Floats) { + GUILayout.FlexibleSpace(); + GUILayout.Label("Tweening random float values on each test object"); + } else if (disableRenderers) { + GUILayout.FlexibleSpace(); + GUILayout.Label("Tweening transforms even if you can't see them (renderers disabled)"); + } + GUILayout.FlexibleSpace(); + + GUILayout.Label(engine.ToString() + " (startup time: " + totCreationTime + ")"); + if (GUILayout.Button("STOP")) StopRun(); + + GUILayout.EndVertical(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta new file mode 100644 index 0000000..9d2693c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1edd352fa65b91e4b80a815c9087b31c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity new file mode 100644 index 0000000..a069e3e Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta new file mode 100644 index 0000000..4b1f8e4 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Tween Engines Comparison - INTERNAL/TweenEnginesComparisonInternal.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e5fb5611ff399c14892c4a3cc52fa439 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs new file mode 100644 index 0000000..b82ae26 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class TweenDelegate : BrainBase +{ + public Transform[] targets; + public Tween[] tweens; + + void Start() + { + tweens = new Tween[targets.Length]; + for (int i = 0; i < targets.Length; ++i) { + tweens[i] = targets[i].DOMoveY(5, 2).SetRelative().SetLoops(-1, LoopType.Yoyo); + } + } + + void OnGUI() + { + if (GUILayout.Button("Assign delegates")) { + for (int i = 0; i < tweens.Length - 1; ++i) DelegateTester.TogglePause += tweens[i].TogglePause; + } + if (GUILayout.Button("TogglePause via Delegate")) if (DelegateTester.TogglePause != null) DelegateTester.TogglePause(); + if (GUILayout.Button("Clear delegates")) { + // DelegateTester.Clear(); + DelegateTester.TogglePause = null; + } + } +} + +public static class DelegateTester +{ + public delegate void TweenActionDelegate(); + public static TweenActionDelegate TogglePause; + + public static void Clear() + { + TogglePause = null; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs.meta b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs.meta new file mode 100644 index 0000000..876c8e4 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00da5ef4c984e724b9e50d82c859341b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity new file mode 100644 index 0000000..eec5864 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity.meta b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity.meta new file mode 100644 index 0000000..b439d99 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenDelegate.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3b31d9d04bbfcbc4baf6ddd3e693c3ff +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TweenParms.unity b/UnityTests.Unity5/Assets/_Tests/TweenParms.unity new file mode 100644 index 0000000..b4c10d2 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/TweenParms.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/TweenParms.unity.meta b/UnityTests.Unity5/Assets/_Tests/TweenParms.unity.meta new file mode 100644 index 0000000..b1bd37f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenParms.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: be16601f8ac4c064ea73ff289146e270 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs b/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs new file mode 100644 index 0000000..40f874f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs @@ -0,0 +1,23 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class TweenParmsBrain : BrainBase +{ + public Transform[] ts; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + TweenParams tp = new TweenParams() + .SetRelative() + // .SetSpeedBased() + .SetEase(Ease.OutQuint) + .SetLoops(-1, LoopType.Yoyo); + + foreach (Transform t in ts) { + t.DOMoveY(2, 1).SetAs(tp); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs.meta b/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs.meta new file mode 100644 index 0000000..4bd2db9 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/TweenParmsBrain.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 030dffb8b6b9361499a15144f2d0cbb4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/UIMisc.cs b/UnityTests.Unity5/Assets/_Tests/UIMisc.cs new file mode 100644 index 0000000..4747762 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UIMisc.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using DG.Tweening; + +public class UIMisc : BrainBase +{ + public CanvasGroup cGroup; + public Image[] imgs; + public Text text, textScramble; + + IEnumerator Start() + { + yield return new WaitForSeconds(0.5f); + + // Radial + Sequence s = DOTween.Sequence(); + foreach (Image i in imgs) { + Image img = i; + img.fillAmount = 0; + s.Insert(0, img.DOFillAmount(1, 1).SetEase(Ease.Linear)) + .Join(img.DOFade(0, 1).From().SetEase(Ease.Linear)) + .SetLoops(-1, LoopType.Yoyo); + } + s.OnStepComplete(()=> { + foreach (Image img in imgs) img.fillClockwise = !img.fillClockwise; + }); + + // Text + DOTween.Sequence() + .AppendInterval(0.5f) + .Append(text.DOText("", 2).From().SetEase(Ease.Linear)) + .AppendInterval(0.5f) + .SetLoops(-1, LoopType.Yoyo); + DOTween.Sequence() + .AppendInterval(0.5f) + .Append(textScramble.DOText("", 2, true).From().SetEase(Ease.Linear)) + .AppendInterval(0.5f) + .SetLoops(-1, LoopType.Yoyo); + } + + void OnGUI() + { + if (GUILayout.Button("Fade CanvasGroup")) cGroup.DOFade(0, 1); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/UIMisc.cs.meta b/UnityTests.Unity5/Assets/_Tests/UIMisc.cs.meta new file mode 100644 index 0000000..0d10076 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UIMisc.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cc73e6408a0172e4fa41a0e280e6e5f4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/UIMisc.unity b/UnityTests.Unity5/Assets/_Tests/UIMisc.unity new file mode 100644 index 0000000..ef8381f Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/UIMisc.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/UIMisc.unity.meta b/UnityTests.Unity5/Assets/_Tests/UIMisc.unity.meta new file mode 100644 index 0000000..43af70b --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UIMisc.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 61e0db642e1d48b4ebee4405b9ae6d6c +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs new file mode 100644 index 0000000..daef8cb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs @@ -0,0 +1,20 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; + +public class UpdateTypes : BrainBase +{ + public Transform[] targets; + public bool independentUpdate; + public float timeScale = 1; + + void Start() + { + Time.timeScale = timeScale; + + targets[0].DOMoveX(5, 2).SetUpdate(UpdateType.Normal, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[1].DOMoveX(5, 2).SetUpdate(UpdateType.Late, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[2].DOMoveX(5, 2).SetUpdate(UpdateType.Fixed, independentUpdate).SetLoops(-1, LoopType.Yoyo); + targets[3].GetComponent().DOMoveX(5, 2).SetUpdate(UpdateType.Fixed, independentUpdate).SetLoops(-1, LoopType.Yoyo); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs.meta b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs.meta new file mode 100644 index 0000000..22e702a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1c6c3b51a750cd342a9a29837d3680af +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity new file mode 100644 index 0000000..928db79 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity.meta b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity.meta new file mode 100644 index 0000000..44909d0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/UpdateTypes.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a549635edee7bdd47a10615951b52cf4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs b/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs new file mode 100644 index 0000000..ee4e5d7 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs @@ -0,0 +1,40 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class Vector3Array : BrainBase +{ + public Transform target; + + void Start() + { + Vector3[] points = new[] { new Vector3(1,0,0), new Vector3(1,0,0), new Vector3(1,0,0), new Vector3(1,0,0) }; + float[] durations = new[] { 0.5f, 0.5f, 1.5f, 0.5f }; + DOTween.ToArray(()=> target.position, x=> target.localPosition = x, points, durations) + // .SetEase(Ease.Linear) + .SetRelative() + // .SetSpeedBased() + .SetEase(Ease.OutQuart) + .SetLoops(-1, LoopType.Yoyo) + .SetAutoKill(false); + } + + void OnGUI() + { + DGUtils.BeginGUI(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Complete")) DOTween.CompleteAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Goto 1")) DOTween.GotoAll(1); + if (GUILayout.Button("Goto 2")) DOTween.GotoAll(2); + if (GUILayout.Button("Goto 3")) DOTween.GotoAll(3); + GUILayout.EndHorizontal(); + + DGUtils.EndGUI(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs.meta b/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs.meta new file mode 100644 index 0000000..1a399cf --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Vector3Array.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0162140f466b9f749a5847e9360b15b1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity b/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity new file mode 100644 index 0000000..a126a4b Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity.meta b/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity.meta new file mode 100644 index 0000000..2c4c157 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/Vector3Array.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d08c471964b0b7a44b619b558765cea4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs new file mode 100644 index 0000000..1995d4a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs @@ -0,0 +1,22 @@ +using DG.Tweening; +using System.Collections; +using UnityEngine; + +public class VirtualTweens : BrainBase +{ + Vector3 vector = Vector3.zero; + + void Start() + { + DOVirtual.Float(0, 1, 3, UpdateCallback); + + DOVirtual.DelayedCall(2, ()=> Debug.Log("" + Time.realtimeSinceStartup + " > Wait call complete")); + } + + void UpdateCallback(float val) + { + vector.x = DOVirtual.EasedValue(15, 100, val, Ease.InQuad); + vector.y = DOVirtual.EasedValue(15, 100, val, Ease.OutQuad); + Debug.Log(vector); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs.meta b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs.meta new file mode 100644 index 0000000..f3fdac8 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b415dbc533166c64198cb655080524cc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity new file mode 100644 index 0000000..918d87b Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity.meta b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity.meta new file mode 100644 index 0000000..ed76b0a --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/VirtualTweens.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a66d15bb354a48446a753f8eb8d478e4 +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials.meta new file mode 100644 index 0000000..846bc92 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d58d8181f8588024ea2527a867686066 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png new file mode 100644 index 0000000..09d70c4 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta new file mode 100644 index 0000000..88f0829 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Cube TEX 00.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 09c84f27f9a6cd749928d447a6b044ef +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 256 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat new file mode 100644 index 0000000..1baef30 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta new file mode 100644 index 0000000..3dc0299 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3e39a51ca5059ee4fb0c9c7f9ae9a2af +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat new file mode 100644 index 0000000..69cac64 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta new file mode 100644 index 0000000..bf6ca88 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 01.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7cd0a2470f229154da6e671fc3925884 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat new file mode 100644 index 0000000..9a3e98a Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta new file mode 100644 index 0000000..e1f32db --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT 02.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4c8c2b254329d504f9e68c7b683fde02 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat new file mode 100644 index 0000000..ccea8db Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta new file mode 100644 index 0000000..28daaa0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Diffuse MAT DOTween.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a61c8e7218defef48a4bed6baf13a71f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat new file mode 100644 index 0000000..eb7633b Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta new file mode 100644 index 0000000..db69985 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/Specular MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9ac1e5f6c3d257a4c9a3dbf5b5451161 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat new file mode 100644 index 0000000..95f9073 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta new file mode 100644 index 0000000..b2c7af0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Materials/TransparentDiffuse MAT 00.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 19a7ba0e0aeb10e42b4072c1d3054b41 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Misc.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Misc.meta new file mode 100644 index 0000000..cfd6ffb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Misc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 38ca39821243ae346a651710299d93d5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset b/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset new file mode 100644 index 0000000..6f0efed Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset.meta new file mode 100644 index 0000000..f1553e0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Misc/New Terrain.asset.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 67969eb0a70e0a648acb6bace4f19d5f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs.meta new file mode 100644 index 0000000..52f221d --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b58c526f8021c3949aa4558c9a1bb799 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab new file mode 100644 index 0000000..224558e Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta new file mode 100644 index 0000000..4bc983f --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/- Environment.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2b5b9e91a5ac9f348bb19eff52368fbf +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab new file mode 100644 index 0000000..b376ee1 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta new file mode 100644 index 0000000..462cc73 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube W Transparency.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0134689cf2edc5a4faef1a6853b2d360 +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab new file mode 100644 index 0000000..ed806c0 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta new file mode 100644 index 0000000..e022bc2 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Cube.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6b0e36b42e0f7024eb9b052a60417e1b +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab new file mode 100644 index 0000000..7380a7f Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta new file mode 100644 index 0000000..d9a6512 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Dice.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: aae2e9c3c4f059e4c8ec71aab1fb107f +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab new file mode 100644 index 0000000..46b7ffc Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta new file mode 100644 index 0000000..6135173 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/Sphere.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d591dccaf57e34d4a93162ea900c70ed +NativeFormatImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts.meta new file mode 100644 index 0000000..9fc133c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: f447fcda6440bc14bb521fbef4a76667 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs new file mode 100644 index 0000000..667a6f1 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs @@ -0,0 +1,30 @@ +using DG.Tweening; +using Holoville.DebugFramework.Components; +using UnityEngine; + +public class BrainBase : MonoBehaviour +{ + public bool forceFrameRate; + public int forcedFrameRate = 10; + // public bool recycleTweens = true; + // public bool safeMode = false; + // public LogBehaviour logBehaviour = LogBehaviour.Default; + + public static HOFpsGadget fpsGadget; + + virtual protected void Awake() + { + if (fpsGadget == null) { + GameObject fpsGadgetGo = new GameObject("FPS"); + DontDestroyOnLoad(fpsGadgetGo); + fpsGadget = fpsGadgetGo.AddComponent(); + if (forceFrameRate) fpsGadget.limitFrameRate = forcedFrameRate; + fpsGadget.showMemory = true; + } + + // DOTween.showUnityEditorReport = true; + // DOTween.useSafeMode = safeMode; + // DOTween.defaultRecyclable = recycleTweens; + // DOTween.logBehaviour = logBehaviour; + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta new file mode 100644 index 0000000..5d25e8e --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/BrainBase.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3f085c97b762654ebae62fd830d6d19 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs new file mode 100644 index 0000000..e910abb --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs @@ -0,0 +1,57 @@ +using DG.Tweening; +using UnityEngine; + +public static class DGUtils +{ + static float sliderPos; + + public static void Log(object o) { + Debug.Log(Time.frameCount + "/" + Time.realtimeSinceStartup + " : " + o); + } + + public static void BeginGUI() + { + GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginVertical(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("RELOAD SCENE")) Application.LoadLevel(Application.loadedLevel); + if (GUILayout.Button("VALIDATE TWEENS")) Debug.Log("Invalid tweens found: " + DOTween.Validate()); + GUILayout.EndHorizontal(); + } + + public static void EndGUI() + { + GUILayout.EndVertical(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + } + + public static void GUIScrubber(float duration) { + GUIScrubber(duration, null); + } + public static void GUIScrubber(Tween controller) { + GUIScrubber(-1, controller); + } + static void GUIScrubber(float duration, Tween controller) + { + if (controller == null) { + float prevSliderPos = sliderPos; + sliderPos = GUILayout.HorizontalSlider(sliderPos, 0.0f, duration); + if (!Mathf.Approximately(sliderPos, prevSliderPos)) DOTween.GotoAll(sliderPos); + } else { + // Get slider ID to be used to check mouseDown behaviour + int sliderId = GUIUtility.GetControlID(FocusType.Passive) + 1; + DOTween.GotoAll(GUILayout.HorizontalSlider(controller.Elapsed(false), 0.0f, controller.Duration(false)), controller.IsPlaying()); + // Check mouse down on slider, and pause tweens accordingly. + if (sliderId != 0 && Event.current.type == EventType.used) { + if (GUIUtility.hotControl == sliderId) DOTween.PauseAll(); + } + + // DOTween.Goto(GUILayout.HorizontalSlider(controller.Elapsed(false), 0.0f, controller.Duration(false)), controller.IsPlaying()); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta new file mode 100644 index 0000000..757a546 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/DGUtils.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29bb3778f841e6449b79136d7775b780 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs new file mode 100644 index 0000000..13fb868 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs @@ -0,0 +1,4 @@ +public struct SampleData +{ + public float floatVal; +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs.meta new file mode 100644 index 0000000..1a827fe --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/SampleData.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91a9a4fa83b5d144a9e6de3be130621f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites.meta new file mode 100644 index 0000000..be2ee38 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ce8d71de69c2c334793ac308b4b74ff3 +folderAsset: yes +DefaultImporter: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png new file mode 100644 index 0000000..55960d4 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta new file mode 100644 index 0000000..056f5a3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/CircleOutline.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: ec4939dcfaa5ee9408157124a95b4daa +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 128 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 1 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png new file mode 100644 index 0000000..bedc536 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta new file mode 100644 index 0000000..7ce0d95 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Goscurry_char.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: fb9d948a67273c648b8011f736e55470 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 32 + textureSettings: + filterMode: 0 + aniso: 16 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/dotween_logo.png b/UnityTests.Unity5/Assets/dotween_logo.png new file mode 100644 index 0000000..1b5f710 Binary files /dev/null and b/UnityTests.Unity5/Assets/dotween_logo.png differ diff --git a/UnityTests.Unity5/Assets/dotween_logo.png.meta b/UnityTests.Unity5/Assets/dotween_logo.png.meta new file mode 100644 index 0000000..f8edb04 --- /dev/null +++ b/UnityTests.Unity5/Assets/dotween_logo.png.meta @@ -0,0 +1,48 @@ +fileFormatVersion: 2 +guid: dcaad08c6db395947abb73f0d831b3d3 +TextureImporter: + fileIDToRecycleName: + 21300000: dotween_logo + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/UnityTests.Unity5/Assets/dotweenpro_logo.png b/UnityTests.Unity5/Assets/dotweenpro_logo.png new file mode 100644 index 0000000..c6d8420 Binary files /dev/null and b/UnityTests.Unity5/Assets/dotweenpro_logo.png differ diff --git a/UnityTests.Unity5/Assets/dotweenpro_logo.png.meta b/UnityTests.Unity5/Assets/dotweenpro_logo.png.meta new file mode 100644 index 0000000..42bded0 --- /dev/null +++ b/UnityTests.Unity5/Assets/dotweenpro_logo.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 6cacfdc8052fc9647815e02657f36414 +timeCreated: 1426588447 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/ProjectSettings/AudioManager.asset b/UnityTests.Unity5/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..47d3cd3 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/AudioManager.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/DynamicsManager.asset b/UnityTests.Unity5/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..22d9747 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/DynamicsManager.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset b/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..31c920c Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/EditorSettings.asset b/UnityTests.Unity5/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..13aff1e Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/EditorSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/GraphicsSettings.asset b/UnityTests.Unity5/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..d75e792 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/GraphicsSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/InputManager.asset b/UnityTests.Unity5/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..8af48d3 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/InputManager.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/NavMeshAreas.asset b/UnityTests.Unity5/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 0000000..a2aa728 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/NavMeshAreas.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/NavMeshLayers.asset b/UnityTests.Unity5/ProjectSettings/NavMeshLayers.asset new file mode 100644 index 0000000..a2aa728 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/NavMeshLayers.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/NetworkManager.asset b/UnityTests.Unity5/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..735131d Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/NetworkManager.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/Physics2DSettings.asset b/UnityTests.Unity5/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..055659b Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/Physics2DSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..40d5f74 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt b/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt new file mode 100644 index 0000000..b0ac510 --- /dev/null +++ b/UnityTests.Unity5/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 5.0.0f4 +m_StandardAssetsVersion: 0 diff --git a/UnityTests.Unity5/ProjectSettings/QualitySettings.asset b/UnityTests.Unity5/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..7720878 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/QualitySettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/TagManager.asset b/UnityTests.Unity5/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..f73f240 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/TagManager.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/TimeManager.asset b/UnityTests.Unity5/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..50bfc21 Binary files /dev/null and b/UnityTests.Unity5/ProjectSettings/TimeManager.asset differ diff --git a/_DOTween.Assembly/DOTween.sln b/_DOTween.Assembly/DOTween.sln new file mode 100644 index 0000000..e28a7ed --- /dev/null +++ b/_DOTween.Assembly/DOTween.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTween", "DOTween\DOTween.csproj", "{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTweenEditor", "DOTweenEditor\DOTweenEditor.csproj", "{421ACC19-8922-4E98-8921-B52240CE172A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTweenPro", "DOTweenPro\DOTweenPro.csproj", "{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTween43", "DOTween43\DOTween43.csproj", "{978C0952-38D0-4C22-B96C-823EAFEDF0FA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTweenProEditor", "DOTweenProEditor\DOTweenProEditor.csproj", "{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOTween46", "DOTween46\DOTween46.csproj", "{AC1E5A23-CE58-419C-B165-EB1CD39AB433}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.Build.0 = Release|Any CPU + {421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.Build.0 = Release|Any CPU + {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.Build.0 = Release|Any CPU + {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release|Any CPU.Build.0 = Release|Any CPU + {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.Build.0 = Release|Any CPU + {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/_DOTween.Assembly/DOTween/AutoPlay.cs b/_DOTween.Assembly/DOTween/AutoPlay.cs new file mode 100644 index 0000000..c8f64b7 --- /dev/null +++ b/_DOTween.Assembly/DOTween/AutoPlay.cs @@ -0,0 +1,23 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/12 12:55 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Types of autoPlay behaviours + /// + public enum AutoPlay + { + /// No tween is automatically played + None, + /// Only Sequences are automatically played + AutoPlaySequences, + /// Only Tweeners are automatically played + AutoPlayTweeners, + /// All tweens are automatically played + All + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/AxisConstraint.cs b/_DOTween.Assembly/DOTween/AxisConstraint.cs new file mode 100644 index 0000000..37fbe9f --- /dev/null +++ b/_DOTween.Assembly/DOTween/AxisConstraint.cs @@ -0,0 +1,24 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/28 11:33 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + /// + /// What axis to constrain in case of Vector tweens + /// + [Flags] + public enum AxisConstraint + { + None = 0, + X = 2, + Y = 4, + Z = 8, + W = 16 + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Color2.cs b/_DOTween.Assembly/DOTween/Color2.cs new file mode 100644 index 0000000..b3e76b2 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Color2.cs @@ -0,0 +1,37 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/12/25 12:37 + +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + /// + /// Struct that stores two colors (used for LineRenderer tweens) + /// + public struct Color2 + { + public Color ca, cb; + + public Color2(Color ca, Color cb) + { + this.ca = ca; + this.cb = cb; + } + + public static Color2 operator +(Color2 c1, Color2 c2) + { + return new Color2(c1.ca + c2.ca, c1.cb + c2.cb); + } + + public static Color2 operator -(Color2 c1, Color2 c2) + { + return new Color2(c1.ca - c2.ca, c1.cb - c2.cb); + } + + public static Color2 operator *(Color2 c1, float f) + { + return new Color2(c1.ca * f, c1.cb * f); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/ABSSequentiable.cs b/_DOTween.Assembly/DOTween/Core/ABSSequentiable.cs new file mode 100644 index 0000000..ec8c456 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/ABSSequentiable.cs @@ -0,0 +1,19 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/16 11:43 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Core +{ + public abstract class ABSSequentiable + { + internal TweenType tweenType; + internal float sequencedPosition; // position in Sequence + internal float sequencedEndPosition; // end position in Sequence + + /// Called the first time the tween is set in a playing state, after any eventual delay + internal TweenCallback onStart; // Used also by SequenceCallback as main callback + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs b/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs new file mode 100644 index 0000000..1804c6d --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs @@ -0,0 +1,188 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/20 17:40 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System.Collections; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Core +{ + /// + /// Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + /// Contains all instance-based methods + /// + [AddComponentMenu("")] + public class DOTweenComponent : MonoBehaviour, IDOTweenInit + { + /// Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + public int inspectorUpdater; + + float _unscaledTime; + float _unscaledDeltaTime; + + bool _duplicateToDestroy; + + #region Unity Methods + + void Awake() + { + inspectorUpdater = 0; + _unscaledTime = Time.realtimeSinceStartup; + } + + void Start() + { + // Check if there's a leftover persistent DOTween object + // (should be impossible but some weird Unity freeze caused that to happen on Seith's project + if (DOTween.instance != this) { + _duplicateToDestroy = true; + Destroy(this.gameObject); + } + } + + void Update() + { + _unscaledDeltaTime = Time.realtimeSinceStartup - _unscaledTime; + if (TweenManager.hasActiveDefaultTweens) { + TweenManager.Update(UpdateType.Normal, Time.deltaTime * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale); + } + _unscaledTime = Time.realtimeSinceStartup; + + if (DOTween.isUnityEditor) { + inspectorUpdater++; + if (DOTween.showUnityEditorReport && TweenManager.hasActiveTweens) { + if (TweenManager.totActiveTweeners > DOTween.maxActiveTweenersReached) DOTween.maxActiveTweenersReached = TweenManager.totActiveTweeners; + if (TweenManager.totActiveSequences > DOTween.maxActiveSequencesReached) DOTween.maxActiveSequencesReached = TweenManager.totActiveSequences; + } + } + } + + void LateUpdate() + { + if (TweenManager.hasActiveLateTweens) { + TweenManager.Update(UpdateType.Late, Time.deltaTime * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale); + } + } + + void FixedUpdate() + { + if (TweenManager.hasActiveFixedTweens && Time.timeScale > 0) { + TweenManager.Update(UpdateType.Fixed, Time.deltaTime * DOTween.timeScale, (Time.deltaTime / Time.timeScale) * DOTween.timeScale); + } + } + + void OnLevelWasLoaded() + { + if (DOTween.useSafeMode) DOTween.Validate(); + } + + void OnDrawGizmos() + { + int len = DOTween.GizmosDelegates.Count; + if (len == 0) return; + + for (int i = 0; i < len; ++i) DOTween.GizmosDelegates[i](); + } + + void OnDestroy() + { + if (_duplicateToDestroy) return; + + if (DOTween.showUnityEditorReport) { + string s = "REPORT > Max overall simultaneous active Tweeners/Sequences: " + DOTween.maxActiveTweenersReached + "/" + DOTween.maxActiveSequencesReached; + Debugger.LogReport(s); + } +// DOTween.initialized = false; +// DOTween.instance = null; + if (DOTween.instance == this) DOTween.instance = null; + } + + void OnApplicationQuit() + { + DOTween.isQuitting = true; + } + + #endregion + + #region Public Methods + + /// + /// Directly sets the current max capacity of Tweeners and Sequences + /// (meaning how many Tweeners and Sequences can be running at the same time), + /// so that DOTween doesn't need to automatically increase them in case the max is reached + /// (which might lead to hiccups when that happens). + /// Sequences capacity must be less or equal to Tweeners capacity + /// (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + /// Beware: use this method only when there are no tweens running. + /// + /// Max Tweeners capacity. + /// Default: 200 + /// Max Sequences capacity. + /// Default: 50 + public IDOTweenInit SetCapacity(int tweenersCapacity, int sequencesCapacity) + { + TweenManager.SetCapacities(tweenersCapacity, sequencesCapacity); + return this; + } + + #endregion + + #region Yield Coroutines + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to be complete (or killed) + internal IEnumerator WaitForCompletion(Tween t) + { + while (t.active && !t.isComplete) yield return null; + } + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to be rewinded (or killed) + internal IEnumerator WaitForRewind(Tween t) + { + while (t.active && (!t.playedOnce || t.position * (t.completedLoops + 1) > 0)) yield return null; + } + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to be killed + internal IEnumerator WaitForKill(Tween t) + { + while (t.active) yield return null; + } + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to reach a given amount of loops (or to be killed) + internal IEnumerator WaitForElapsedLoops(Tween t, int elapsedLoops) + { + while (t.active && t.completedLoops < elapsedLoops) yield return null; + } + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to reach a given time position (or to be killed) + internal IEnumerator WaitForPosition(Tween t, float position) + { + while (t.active && t.position * (t.completedLoops + 1) < position) yield return null; + } + + // CALLED BY TweenExtensions, creates a coroutine that waits for the tween to be started (or killed) + internal IEnumerator WaitForStart(Tween t) + { + while (t.active && !t.playedOnce) yield return null; + } + + #endregion + + internal static void Create() + { + if (DOTween.instance != null) return; + + GameObject go = new GameObject("[DOTween]"); + DontDestroyOnLoad(go); + DOTween.instance = go.AddComponent(); + } + + internal static void DestroyInstance() + { + if (DOTween.instance != null) Destroy(DOTween.instance.gameObject); + DOTween.instance = null; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs b/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs new file mode 100644 index 0000000..9b62e1d --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/DOTweenSettings.cs @@ -0,0 +1,26 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2015/02/05 10:28 + +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Core +{ + public class DOTweenSettings : ScriptableObject + { + public const string AssetName = "DOTweenSettings"; + + public bool useSafeMode = true; + public bool showUnityEditorReport; + public LogBehaviour logBehaviour = LogBehaviour.ErrorsOnly; + public bool defaultRecyclable; + public AutoPlay defaultAutoPlay = AutoPlay.All; + public UpdateType defaultUpdateType; + public bool defaultTimeScaleIndependent; + public Ease defaultEaseType = Ease.OutQuad; + public float defaultEaseOvershootOrAmplitude = 1.70158f; + public float defaultEasePeriod = 0; + public bool defaultAutoKill = true; + public LoopType defaultLoopType = LoopType.Restart; + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Debugger.cs b/_DOTween.Assembly/DOTween/Core/Debugger.cs new file mode 100644 index 0000000..d33e5f5 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Debugger.cs @@ -0,0 +1,74 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/03 11:33 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +namespace DG.Tweening.Core +{ + internal static class Debugger + { + // 0: errors only - 1: default - 2: verbose + internal static int logPriority; + + internal static void Log(object message) + { + Debug.Log("DOTWEEN :: " + message); + } + internal static void LogWarning(object message) + { + Debug.LogWarning("DOTWEEN :: " + message); + } + internal static void LogError(object message) + { + Debug.LogError("DOTWEEN :: " + message); + } + + internal static void LogReport(object message) + { + Debug.Log("DOTWEEN :: " + message + ""); + } + + internal static void LogInvalidTween(Tween t) + { + LogWarning("This Tween has been killed and is now invalid"); + } + +// internal static void LogNullTarget() +// { +// LogWarning("The target for this tween shortcut is null"); +// } + + internal static void LogNestedTween(Tween t) + { + LogWarning("This Tween was added to a Sequence and can't be controlled directly"); + } + + internal static void LogNullTween(Tween t) + { + LogWarning("Null Tween"); + } + + internal static void LogNonPathTween(Tween t) + { + LogWarning("This Tween is not a path tween"); + } + + internal static void SetLogPriority(LogBehaviour logBehaviour) + { + switch (logBehaviour) { + case LogBehaviour.Default: + logPriority = 1; + break; + case LogBehaviour.Verbose: + logPriority = 2; + break; + default: + logPriority = 0; + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Delegates.cs b/_DOTween.Assembly/DOTween/Core/Delegates.cs new file mode 100644 index 0000000..c8a2ebe --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Delegates.cs @@ -0,0 +1,35 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/05 13:29 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Used for tween callbacks + /// + public delegate void TweenCallback(); + /// + /// Used for tween callbacks + /// + public delegate void TweenCallback(T value); + + /// + /// Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + /// + public delegate float EaseFunction(float time, float duration, float overshootOrAmplitude, float period); +} + +namespace DG.Tweening.Core +{ + /// + /// Used in place of System.Func, which is not available in mscorlib. + /// + public delegate T DOGetter(); + + /// + /// Used in place of System.Action. + /// + public delegate void DOSetter(T pNewValue); +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Easing/Bounce.cs b/_DOTween.Assembly/DOTween/Core/Easing/Bounce.cs new file mode 100644 index 0000000..9ef5380 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Easing/Bounce.cs @@ -0,0 +1,108 @@ +// +// Bounce.cs +// +// Author: Daniele Giardini (C# port of the easing equations created by Robert Penner - http://robertpenner.com/easing) +// +// TERMS OF USE - EASING EQUATIONS +// +// Open source under the BSD License. +// +// Copyright © 2001 Robert Penner +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +// - Neither the name of the author nor the names of contributors may be used to endorse +// or promote products derived from this software without specific prior written permission. +// - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +namespace DG.Tweening.Core.Easing +{ + /// + /// This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + /// + public static class Bounce + { + /// + /// Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + /// + /// + /// Current time (in frames or seconds). + /// + /// + /// Expected easing duration (in frames or seconds). + /// + /// Unused: here to keep same delegate for all ease types. + /// Unused: here to keep same delegate for all ease types. + /// + /// The eased value. + /// + public static float EaseIn(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod) + { + return 1 - EaseOut(duration - time, duration, -1, -1); + } + + /// + /// Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + /// + /// + /// Current time (in frames or seconds). + /// + /// + /// Expected easing duration (in frames or seconds). + /// + /// Unused: here to keep same delegate for all ease types. + /// Unused: here to keep same delegate for all ease types. + /// + /// The eased value. + /// + public static float EaseOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod) + { + if ((time /= duration) < (1 / 2.75f)) { + return (7.5625f * time * time); + } + if (time < (2 / 2.75f)) { + return (7.5625f * (time -= (1.5f / 2.75f)) * time + 0.75f); + } + if (time < (2.5f / 2.75f)) { + return (7.5625f * (time -= (2.25f / 2.75f)) * time + 0.9375f); + } + return (7.5625f * (time -= (2.625f / 2.75f)) * time + 0.984375f); + } + + /// + /// Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + /// + /// + /// Current time (in frames or seconds). + /// + /// + /// Expected easing duration (in frames or seconds). + /// + /// Unused: here to keep same delegate for all ease types. + /// Unused: here to keep same delegate for all ease types. + /// + /// The eased value. + /// + public static float EaseInOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod) + { + if (time < duration*0.5f) + { + return EaseIn(time*2, duration, -1, -1)*0.5f; + } + return EaseOut(time*2 - duration, duration, -1, -1)*0.5f + 0.5f; + } + } +} diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs new file mode 100644 index 0000000..0d773f9 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs @@ -0,0 +1,38 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2012/11/07 13:46 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +namespace DG.Tweening.Core.Easing +{ + /// + /// Used to interpret AnimationCurves as eases. + /// + internal class EaseCurve + { + readonly AnimationCurve _animCurve; + + // *********************************************************************************** + // CONSTRUCTOR + // *********************************************************************************** + + public EaseCurve(AnimationCurve animCurve) + { + _animCurve = animCurve; + } + + // =================================================================================== + // PUBLIC METHODS -------------------------------------------------------------------- + + public float Evaluate(float time, float duration, float unusedOvershoot, float unusedPeriod) + { + float curveLen = _animCurve[_animCurve.length - 1].time; + float timePerc = time / duration; + float eval = _animCurve.Evaluate(timePerc * curveLen); + return eval; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs new file mode 100644 index 0000000..93e763f --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs @@ -0,0 +1,171 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/19 14:11 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php +// +// ============================================================= +// Contains Daniele Giardini's C# port of the easing equations created +// by Robert Penner - http://robertpenner.com/easing, see license below: +// ============================================================= +// +// TERMS OF USE - EASING EQUATIONS +// +// Open source under the BSD License. +// +// Copyright © 2001 Robert Penner +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +// - Neither the name of the author nor the names of contributors may be used to endorse +// or promote products derived from this software without specific prior written permission. +// - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Core.Easing +{ + public static class EaseManager + { + const float _PiOver2 = Mathf.PI * 0.5f; + const float _TwoPi = Mathf.PI * 2; + + /// + /// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + /// + public static float Evaluate(Tween t, float time, float duration, float overshootOrAmplitude, float period) + { + // Overload used only to allow custom user plugins to avoid calling t.easeType and t.customEase since they're internal + return Evaluate(t.easeType, t.customEase, time, duration, overshootOrAmplitude, period); + } + + /// + /// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + /// + public static float Evaluate(Ease easeType, EaseFunction customEase, float time, float duration, float overshootOrAmplitude, float period) + { + switch (easeType) { + case Ease.Linear: + return time / duration; + case Ease.InSine: + return -(float)Math.Cos(time / duration * _PiOver2) + 1; + case Ease.OutSine: + return (float)Math.Sin(time / duration * _PiOver2); + case Ease.InOutSine: + return -0.5f * ((float)Math.Cos(Mathf.PI * time / duration) - 1); + case Ease.InQuad: + return (time /= duration) * time; + case Ease.OutQuad: + return -(time /= duration) * (time - 2); + case Ease.InOutQuad: + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time; + return -0.5f * ((--time) * (time - 2) - 1); + case Ease.InCubic: + return (time /= duration) * time * time; + case Ease.OutCubic: + return ((time = time / duration - 1) * time * time + 1); + case Ease.InOutCubic: + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time; + return 0.5f * ((time -= 2) * time * time + 2); + case Ease.InQuart: + return (time /= duration) * time * time * time; + case Ease.OutQuart: + return -((time = time / duration - 1) * time * time * time - 1); + case Ease.InOutQuart: + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time * time; + return -0.5f * ((time -= 2) * time * time * time - 2); + case Ease.InQuint: + return (time /= duration) * time * time * time * time; + case Ease.OutQuint: + return ((time = time / duration - 1) * time * time * time * time + 1); + case Ease.InOutQuint: + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time * time * time; + return 0.5f * ((time -= 2) * time * time * time * time + 2); + case Ease.InExpo: + return (time == 0) ? 0 : (float)Math.Pow(2, 10 * (time / duration - 1)); + case Ease.OutExpo: + if (time == duration) return 1; + return (-(float)Math.Pow(2, -10 * time / duration) + 1); + case Ease.InOutExpo: + if (time == 0) return 0; + if (time == duration) return 1; + if ((time /= duration * 0.5f) < 1) return 0.5f * (float)Math.Pow(2, 10 * (time - 1)); + return 0.5f * (-(float)Math.Pow(2, -10 * --time) + 2); + case Ease.InCirc: + return -((float)Math.Sqrt(1 - (time /= duration) * time) - 1); + case Ease.OutCirc: + return (float)Math.Sqrt(1 - (time = time / duration - 1) * time); + case Ease.InOutCirc: + if ((time /= duration * 0.5f) < 1) return -0.5f * ((float)Math.Sqrt(1 - time * time) - 1); + return 0.5f * ((float)Math.Sqrt(1 - (time -= 2) * time) + 1); + case Ease.InElastic: + float s0; + if (time == 0) return 0; + if ((time /= duration) == 1) return 1; + if (period == 0) period = duration * 0.3f; + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s0 = period / 4; + } else s0 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + return -(overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s0) * _TwoPi / period)); + case Ease.OutElastic: + float s1; + if (time == 0) return 0; + if ((time /= duration) == 1) return 1; + if (period == 0) period = duration * 0.3f; + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s1 = period / 4; + } else s1 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + return (overshootOrAmplitude * (float)Math.Pow(2, -10 * time) * (float)Math.Sin((time * duration - s1) * _TwoPi / period) + 1); + case Ease.InOutElastic: + float s; + if (time == 0) return 0; + if ((time /= duration * 0.5f) == 2) return 1; + if (period == 0) period = duration * (0.3f * 1.5f); + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s = period / 4; + } else s = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + if (time < 1) return -0.5f * (overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period)); + return overshootOrAmplitude * (float)Math.Pow(2, -10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period) * 0.5f + 1; + case Ease.InBack: + return (time /= duration) * time * ((overshootOrAmplitude + 1) * time - overshootOrAmplitude); + case Ease.OutBack: + return ((time = time / duration - 1) * time * ((overshootOrAmplitude + 1) * time + overshootOrAmplitude) + 1); + case Ease.InOutBack: + if ((time /= duration * 0.5f) < 1) return 0.5f * (time * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time - overshootOrAmplitude)); + return 0.5f * ((time -= 2) * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time + overshootOrAmplitude) + 2); + case Ease.InBounce: + return Bounce.EaseIn(time, duration, overshootOrAmplitude, period); + case Ease.OutBounce: + return Bounce.EaseOut(time, duration, overshootOrAmplitude, period); + case Ease.InOutBounce: + return Bounce.EaseInOut(time, duration, overshootOrAmplitude, period); + case Ease.INTERNAL_Custom: + return customEase(time, duration, overshootOrAmplitude, period); + case Ease.INTERNAL_Zero: + // 0 duration tween + return 1; + default: + // OutQuad + return -(time /= duration) * (time - 2); + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Enums/FilterType.cs b/_DOTween.Assembly/DOTween/Core/Enums/FilterType.cs new file mode 100644 index 0000000..21c23ba --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Enums/FilterType.cs @@ -0,0 +1,15 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/05 14:42 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening.Core.Enums +{ + internal enum FilterType + { + All, + TargetOrId, // Check both for id and target + DOGetter + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Enums/OperationType.cs b/_DOTween.Assembly/DOTween/Core/Enums/OperationType.cs new file mode 100644 index 0000000..c0277c0 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Enums/OperationType.cs @@ -0,0 +1,24 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/05 17:54 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening.Core.Enums +{ + internal enum OperationType + { + Complete, + Despawn, + Flip, + Goto, + Pause, + Play, + PlayForward, + PlayBackwards, + Rewind, + Restart, + TogglePause, + IsTweening + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Enums/SpecialStartupMode.cs b/_DOTween.Assembly/DOTween/Core/Enums/SpecialStartupMode.cs new file mode 100644 index 0000000..b72ff64 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Enums/SpecialStartupMode.cs @@ -0,0 +1,17 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/14 12:46 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening.Core.Enums +{ + internal enum SpecialStartupMode + { + None, + SetLookAt, + SetShake, + SetPunch, + SetCameraShakePosition, + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Enums/UpdateMode.cs b/_DOTween.Assembly/DOTween/Core/Enums/UpdateMode.cs new file mode 100644 index 0000000..9891295 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Enums/UpdateMode.cs @@ -0,0 +1,14 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/07 12:52 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening.Core.Enums +{ + internal enum UpdateMode + { + Update, + Goto // Treats update as a full goto, thus not calling eventual onStepComplete callbacks + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Extensions.cs b/_DOTween.Assembly/DOTween/Core/Extensions.cs new file mode 100644 index 0000000..335747e --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Extensions.cs @@ -0,0 +1,31 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/27 10:30 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core.Enums; + +namespace DG.Tweening.Core +{ + /// + /// Public only so custom shortcuts can access some of these methods + /// + public static class Extensions + { + // Used internally by DO shortcuts to set special startup mode + internal static T SetSpecialStartupMode(this T t, SpecialStartupMode mode) where T : Tween + { + t.specialStartupMode = mode; + return t; + } + + // Prevents a tween to use a From setup even if passed + internal static TweenerCore NoFrom(this TweenerCore t) + where TPlugOptions : struct + { + t.isFromAllowed = false; + return t; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/SequenceCallback.cs b/_DOTween.Assembly/DOTween/Core/SequenceCallback.cs new file mode 100644 index 0000000..6a17e6c --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/SequenceCallback.cs @@ -0,0 +1,18 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/16 11:38 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening.Core +{ + internal class SequenceCallback : ABSSequentiable + { + public SequenceCallback(float sequencedPosition, TweenCallback callback) + { + tweenType = TweenType.Callback; + this.sequencedPosition = sequencedPosition; + onStart = callback; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/TweenManager.cs b/_DOTween.Assembly/DOTween/Core/TweenManager.cs new file mode 100644 index 0000000..08c4d59 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/TweenManager.cs @@ -0,0 +1,886 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/07 13:00 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Collections.Generic; +using DG.Tweening.Core.Enums; +using UnityEngine; + +namespace DG.Tweening.Core +{ + internal static class TweenManager + { + const int _DefaultMaxTweeners = 200; + const int _DefaultMaxSequences = 50; + const string _MaxTweensReached = "Max Tweens reached: capacity will be automatically increased from #0 to #1. Use DOTween.SetTweensCapacity to set it manually at startup"; + + internal static int maxActive = _DefaultMaxTweeners; // Always equal to maxTweeners + internal static int maxTweeners = _DefaultMaxTweeners; // Always >= maxSequences + internal static int maxSequences = _DefaultMaxSequences; // Always <= maxTweeners + internal static bool hasActiveTweens, hasActiveDefaultTweens, hasActiveLateTweens, hasActiveFixedTweens; + internal static int totActiveTweens, totActiveDefaultTweens, totActiveLateTweens, totActiveFixedTweens; + internal static int totActiveTweeners, totActiveSequences; + internal static int totPooledTweeners, totPooledSequences; + internal static int totTweeners, totSequences; // Both active and pooled + internal static bool isUpdateLoop; // TRUE while an update cycle is running (used to treat direct tween Kills differently) + + // Tweens contained in Sequences are not inside the active lists + // Arrays are organized (max once per update) so that existing elements are next to each other from 0 to (totActiveTweens - 1) + static Tween[] _activeTweens = new Tween[_DefaultMaxTweeners]; + static Tween[] _pooledTweeners = new Tween[_DefaultMaxTweeners]; + static readonly Stack _PooledSequences = new Stack(); + + static readonly List _KillList = new List(_DefaultMaxTweeners); + static int _maxActiveLookupId = -1; // Highest full ID in _activeTweens + static bool _requiresActiveReorganization; // True when _activeTweens need to be reorganized to fill empty spaces + static int _reorganizeFromId = -1; // First null ID from which to reorganize + static int _minPooledTweenerId = -1; // Lowest PooledTweeners id that is actually full + static int _maxPooledTweenerId = -1; // Highest PooledTweeners id that is actually full + +#if DEBUG + static public int updateLoopCount; +#endif + + #region Main + + // Returns a new Tweener, from the pool if there's one available, + // otherwise by instantiating a new one + internal static TweenerCore GetTweener() + where TPlugOptions : struct + { + TweenerCore t; + // Search inside pool + if (totPooledTweeners > 0) { + Type typeofT1 = typeof(T1); + Type typeofT2 = typeof(T2); + Type typeofTPlugOptions = typeof(TPlugOptions); + for (int i = _maxPooledTweenerId; i > _minPooledTweenerId - 1; --i) { + Tween tween = _pooledTweeners[i]; + if (tween != null && tween.typeofT1 == typeofT1 && tween.typeofT2 == typeofT2 && tween.typeofTPlugOptions == typeofTPlugOptions) { + // Pooled Tweener exists: spawn it + t = (TweenerCore)tween; + AddActiveTween(t); + _pooledTweeners[i] = null; + if (_maxPooledTweenerId != _minPooledTweenerId) { + if (i == _maxPooledTweenerId) _maxPooledTweenerId--; + else if (i == _minPooledTweenerId) _minPooledTweenerId++; + } + totPooledTweeners--; + return t; + } + } + // Not found: remove a tween from the pool in case it's full + if (totTweeners >= maxTweeners) { + _pooledTweeners[_maxPooledTweenerId] = null; + _maxPooledTweenerId--; + totPooledTweeners--; + totTweeners--; + } + } else { + // Increase capacity in case max number of Tweeners has already been reached, then continue + if (totTweeners >= maxTweeners) { + if (Debugger.logPriority >= 1) Debugger.LogWarning(_MaxTweensReached + .Replace("#0", maxTweeners + "/" + maxSequences) + .Replace("#1", (maxTweeners + _DefaultMaxTweeners) + "/" + maxSequences) + ); + IncreaseCapacities(CapacityIncreaseMode.TweenersOnly); + } + } + // Not found: create new TweenerController + t = new TweenerCore(); + totTweeners++; + AddActiveTween(t); + return t; + } + + // Returns a new Sequence, from the pool if there's one available, + // otherwise by instantiating a new one + internal static Sequence GetSequence() + { + Sequence s; + if (totPooledSequences > 0) { + s = (Sequence)_PooledSequences.Pop(); + AddActiveTween(s); + totPooledSequences--; + return s; + } + // Increase capacity in case max number of Sequences has already been reached, then continue + if (totSequences >= maxSequences) { + if (Debugger.logPriority >= 1) Debugger.LogWarning(_MaxTweensReached + .Replace("#0", maxTweeners + "/" + maxSequences) + .Replace("#1", maxTweeners + "/" + (maxSequences + _DefaultMaxSequences)) + ); + IncreaseCapacities(CapacityIncreaseMode.SequencesOnly); + } + // Not found: create new Sequence + s = new Sequence(); + totSequences++; + AddActiveTween(s); + return s; + } + + internal static void SetUpdateType(Tween t, UpdateType updateType, bool isIndependentUpdate) + { + if (!t.active || t.updateType == updateType) { + t.updateType = updateType; + t.isIndependentUpdate = isIndependentUpdate; + return; + } + // Remove previous update type + if (t.updateType == UpdateType.Normal) { + totActiveDefaultTweens--; + hasActiveDefaultTweens = totActiveDefaultTweens > 0; + } else if (t.updateType == UpdateType.Fixed) { + totActiveFixedTweens--; + hasActiveFixedTweens = totActiveFixedTweens > 0; + } else { + totActiveLateTweens--; + hasActiveLateTweens = totActiveLateTweens > 0; + } + // Assign new one + t.updateType = updateType; + t.isIndependentUpdate = isIndependentUpdate; + if (updateType == UpdateType.Normal) { + totActiveDefaultTweens++; + hasActiveDefaultTweens = true; + } else if (updateType == UpdateType.Fixed) { + totActiveFixedTweens++; + hasActiveFixedTweens = true; + } else { + totActiveLateTweens++; + hasActiveLateTweens = true; + } + } + + // Removes the given tween from the active tweens list + internal static void AddActiveTweenToSequence(Tween t) + { + RemoveActiveTween(t); + } + + // Despawn all + internal static int DespawnAll() + { + int totDespawned = totActiveTweens; + for (int i = 0; i < _maxActiveLookupId + 1; ++i) { + Tween t = _activeTweens[i]; + if (t != null) Despawn(t, false); + } + ClearTweenArray(_activeTweens); + hasActiveTweens = hasActiveDefaultTweens = hasActiveLateTweens = hasActiveFixedTweens = false; + totActiveTweens = totActiveDefaultTweens = totActiveLateTweens = totActiveFixedTweens = 0; + totActiveTweeners = totActiveSequences = 0; + _maxActiveLookupId = _reorganizeFromId = -1; + _requiresActiveReorganization = false; + + return totDespawned; + } + + internal static void Despawn(Tween t, bool modifyActiveLists = true) + { + // Callbacks + if (t.onKill != null) Tween.OnTweenCallback(t.onKill); + + if (modifyActiveLists) { + // Remove tween from active list + RemoveActiveTween(t); + } + if (t.isRecyclable) { + // Put the tween inside a pool + switch (t.tweenType) { + case TweenType.Sequence: + _PooledSequences.Push(t); + totPooledSequences++; + // Despawn sequenced tweens + Sequence s = (Sequence)t; + int len = s.sequencedTweens.Count; + for (int i = 0; i < len; ++i) Despawn(s.sequencedTweens[i], false); + break; + case TweenType.Tweener: + if (_maxPooledTweenerId == -1) { + _maxPooledTweenerId = maxTweeners - 1; + _minPooledTweenerId = maxTweeners - 1; + } + if (_maxPooledTweenerId < maxTweeners - 1) { + _pooledTweeners[_maxPooledTweenerId + 1] = t; + _maxPooledTweenerId++; + if (_minPooledTweenerId > _maxPooledTweenerId) _minPooledTweenerId = _maxPooledTweenerId; + } else { + for (int i = _maxPooledTweenerId; i > -1; --i) { + if (_pooledTweeners[i] != null) continue; + _pooledTweeners[i] = t; + if (i < _minPooledTweenerId) _minPooledTweenerId = i; + if (_maxPooledTweenerId < _minPooledTweenerId) _maxPooledTweenerId = _minPooledTweenerId; + break; + } + } + totPooledTweeners++; + break; + } + } else { + // Remove + switch (t.tweenType) { + case TweenType.Sequence: + totSequences--; + // Despawn sequenced tweens + Sequence s = (Sequence)t; + int len = s.sequencedTweens.Count; + for (int i = 0; i < len; ++i) Despawn(s.sequencedTweens[i], false); + break; + case TweenType.Tweener: + totTweeners--; + break; + } + } + t.active = false; + t.Reset(); + } + + // Destroys any active tween without putting them back in a pool, + // then purges all pools and resets capacities + internal static void PurgeAll() + { + // Fire eventual onKill callbacks + for (int i = 0; i < totActiveTweens; ++i) { + Tween t = _activeTweens[i]; + if (t != null && t.onKill != null) Tween.OnTweenCallback(t.onKill); + } + + ClearTweenArray(_activeTweens); + hasActiveTweens = hasActiveDefaultTweens = hasActiveLateTweens = hasActiveFixedTweens = false; + totActiveTweens = totActiveDefaultTweens = totActiveLateTweens = totActiveFixedTweens = 0; + totActiveTweeners = totActiveSequences = 0; + _maxActiveLookupId = _reorganizeFromId = -1; + _requiresActiveReorganization = false; + PurgePools(); + ResetCapacities(); + totTweeners = totSequences = 0; + } + + // Removes any cached tween from the pools + internal static void PurgePools() + { + totTweeners -= totPooledTweeners; + totSequences -= totPooledSequences; + ClearTweenArray(_pooledTweeners); + _PooledSequences.Clear(); + totPooledTweeners = totPooledSequences = 0; + _minPooledTweenerId = _maxPooledTweenerId = -1; + } + + internal static void ResetCapacities() + { + SetCapacities(_DefaultMaxTweeners, _DefaultMaxSequences); + } + + internal static void SetCapacities(int tweenersCapacity, int sequencesCapacity) + { + if (tweenersCapacity < sequencesCapacity) tweenersCapacity = sequencesCapacity; + + maxActive = tweenersCapacity; + maxTweeners = tweenersCapacity; + maxSequences = sequencesCapacity; + Array.Resize(ref _activeTweens, maxActive); + Array.Resize(ref _pooledTweeners, tweenersCapacity); + _KillList.Capacity = maxActive; + } + + // Looks through all active tweens and removes the ones whose getters generate errors + // (usually meaning their target has become NULL). + // Returns the total number of invalid tweens found and removed + // BEWARE: this is an expensive operation + internal static int Validate() + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + int totInvalid = 0; + for (int i = 0; i < _maxActiveLookupId + 1; ++i) { + Tween t = _activeTweens[i]; + if (!t.Validate()) { + totInvalid++; + MarkForKilling(t); + } + } + // Kill all eventually marked tweens + if (totInvalid > 0) { + DespawnTweens(_KillList, false); + int count = _KillList.Count - 1; + for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]); + _KillList.Clear(); + } + return totInvalid; + } + + // deltaTime will be passed as fixedDeltaTime in case of UpdateType.Fixed + internal static void Update(UpdateType updateType, float deltaTime, float independentTime) + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + isUpdateLoop = true; +#if DEBUG + updateLoopCount++; + VerifyActiveTweensList(); +#endif + bool willKill = false; +// Debug.Log("::::::::::: " + updateType + " > " + (_maxActiveLookupId + 1)); + int len = _maxActiveLookupId + 1; // Stored here so if _maxActiveLookupId changed during update loop (like if new tween is created at onComplete) new tweens are still ignored + for (int i = 0; i < len; ++i) { + Tween t = _activeTweens[i]; + if (t == null || t.updateType != updateType) continue; // Wrong updateType or was added to a Sequence (thus removed from active list) while inside current updateLoop + if (!t.active) { + // Manually killed by another tween's callback + willKill = true; + MarkForKilling(t); + continue; + } + if (!t.isPlaying) continue; + t.creationLocked = true; // Lock tween creation methods from now on + float tDeltaTime = (t.isIndependentUpdate ? independentTime : deltaTime) * t.timeScale; + if (!t.delayComplete) { + tDeltaTime = t.UpdateDelay(t.elapsedDelay + tDeltaTime); + if (tDeltaTime <= -1) { + // Error during startup (can happen with FROM tweens): mark tween for killing + willKill = true; + MarkForKilling(t); + continue; + } + if (tDeltaTime <= 0) continue; + } + // Startup (needs to be here other than in Tween.DoGoto in case of speed-based tweens, to calculate duration correctly) + if (!t.startupDone) { + if (!t.Startup()) { + // Startup failure: mark for killing + willKill = true; + MarkForKilling(t); + continue; + } + } + // Find update data + float toPosition = t.position; + bool wasEndPosition = toPosition >= t.duration; + int toCompletedLoops = t.completedLoops; + if (t.duration <= 0) { + toPosition = 0; + toCompletedLoops = t.loops == -1 ? t.completedLoops + 1 : t.loops; + } else { + if (t.isBackwards) { + toPosition -= tDeltaTime; + while (toPosition < 0 && toCompletedLoops > 0) { + toPosition += t.duration; + toCompletedLoops--; + } + } else { + toPosition += tDeltaTime; + while (toPosition >= t.duration && (t.loops == -1 || toCompletedLoops < t.loops)) { + toPosition -= t.duration; + toCompletedLoops++; + } + } + if (wasEndPosition) toCompletedLoops--; + if (t.loops != -1 && toCompletedLoops >= t.loops) toPosition = t.duration; + } + // Goto + bool needsKilling = Tween.DoGoto(t, toPosition, toCompletedLoops, UpdateMode.Update); + if (needsKilling) { + willKill = true; + MarkForKilling(t); + } + } + // Kill all eventually marked tweens + if (willKill) { + DespawnTweens(_KillList, false); + int count = _KillList.Count - 1; + for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]); + _KillList.Clear(); + } + isUpdateLoop = false; + } + + internal static int FilteredOperation(OperationType operationType, FilterType filterType, object id, bool optionalBool, float optionalFloat) + { + int totInvolved = 0; + bool hasDespawned = false; + for (int i = _maxActiveLookupId; i > -1; --i) { + Tween t = _activeTweens[i]; + if (t == null || !t.active) continue; + + bool isFilterCompliant = false; + switch (filterType) { + case FilterType.All: + isFilterCompliant = true; + break; + case FilterType.TargetOrId: + isFilterCompliant = id.Equals(t.id) || id.Equals(t.target); + break; + } + if (isFilterCompliant) { + switch (operationType) { + case OperationType.Despawn: + totInvolved++; + if (isUpdateLoop) t.active = false; // Just mark it for killing, so the update loop will take care of it + else { + Despawn(t, false); + hasDespawned = true; + _KillList.Add(t); + } + break; + case OperationType.Complete: + bool hasAutoKill = t.autoKill; + if (Complete(t, false)) { + // If optionalBool is TRUE only returns tweens killed by completion + totInvolved += !optionalBool ? 1 : hasAutoKill ? 1 : 0; + if (hasAutoKill) { + if (isUpdateLoop) t.active = false; // Just mark it for killing, so the update loop will take care of it + else { + hasDespawned = true; + _KillList.Add(t); + } + } + } + break; + case OperationType.Flip: + if (Flip(t)) totInvolved++; + break; + case OperationType.Goto: + Goto(t, optionalFloat, optionalBool); + totInvolved++; + break; + case OperationType.Pause: + if (Pause(t)) totInvolved++; + break; + case OperationType.Play: + if (Play(t)) totInvolved++; + break; + case OperationType.PlayBackwards: + if (PlayBackwards(t)) totInvolved++; + break; + case OperationType.PlayForward: + if (PlayForward(t)) totInvolved++; + break; + case OperationType.Restart: + if (Restart(t, optionalBool)) totInvolved++; + break; + case OperationType.Rewind: + if (Rewind(t, optionalBool)) totInvolved++; + break; + case OperationType.TogglePause: + if (TogglePause(t)) totInvolved++; + break; + case OperationType.IsTweening: + totInvolved++; + break; + } + } + } + // Special additional operations in case of despawn + if (hasDespawned) { + int count = _KillList.Count - 1; + for (int i = count; i > -1; --i) RemoveActiveTween(_KillList[i]); + _KillList.Clear(); + } + + return totInvolved; + } + + #endregion + + #region Play Operations + + internal static bool Complete(Tween t, bool modifyActiveLists = true) + { + if (t.loops == -1) return false; + if (!t.isComplete) { + Tween.DoGoto(t, t.duration, t.loops, UpdateMode.Goto); + t.isPlaying = false; + // Despawn if needed + if (t.autoKill) { + if (isUpdateLoop) t.active = false; // Just mark it for killing, so the update loop will take care of it + else Despawn(t, modifyActiveLists); + } + return true; + } + return false; + } + + internal static bool Flip(Tween t) + { + t.isBackwards = !t.isBackwards; + return true; + } + + // Forces the tween to startup and initialize all its data + internal static void ForceInit(Tween t) + { + if (t.startupDone) return; + + if (!t.Startup()) { + // Startup failed: kill tween + if (isUpdateLoop) t.active = false; // Just mark it for killing, so the update loop will take care of it + else RemoveActiveTween(t); + } + } + + // Returns TRUE if there was an error and the tween needs to be destroyed + internal static bool Goto(Tween t, float to, bool andPlay = false, UpdateMode updateMode = UpdateMode.Goto) + { + bool wasPlaying = t.isPlaying; + t.isPlaying = andPlay; + t.delayComplete = true; + t.elapsedDelay = t.delay; + int toCompletedLoops = (int)(to / t.duration); + float toPosition = to % t.duration; + if (t.loops != -1 && toCompletedLoops >= t.loops) { + toCompletedLoops = t.loops; + toPosition = t.duration; + } else if (toPosition >= t.duration) toPosition = 0; + // If andPlay is FALSE manage onPause from here because DoGoto won't detect it (since t.isPlaying was already set from here) + bool needsKilling = Tween.DoGoto(t, toPosition, toCompletedLoops, updateMode); + if (!andPlay && wasPlaying && !needsKilling && t.onPause != null) Tween.OnTweenCallback(t.onPause); + return needsKilling; + } + + // Returns TRUE if the given tween was not already paused + internal static bool Pause(Tween t) + { + if (t.isPlaying) { + t.isPlaying = false; + if (t.onPause != null) Tween.OnTweenCallback(t.onPause); + return true; + } + return false; + } + + // Returns TRUE if the given tween was not already playing and is not complete + internal static bool Play(Tween t) + { + if (!t.isPlaying && (!t.isBackwards && !t.isComplete || t.isBackwards && (t.completedLoops > 0 || t.position > 0))) { + t.isPlaying = true; + if (t.playedOnce && t.onPlay != null) { + // Don't call in case it hasn't started because onStart routine will call it + Tween.OnTweenCallback(t.onPlay); + } + return true; + } + return false; + } + + internal static bool PlayBackwards(Tween t) + { + if (!t.isBackwards) { + t.isBackwards = true; + Play(t); + return true; + } + return Play(t); + } + + internal static bool PlayForward(Tween t) + { + if (t.isBackwards) { + t.isBackwards = false; + Play(t); + return true; + } + return Play(t); + } + + internal static bool Restart(Tween t, bool includeDelay = true) + { + bool wasPaused = t.isPlaying; + t.isBackwards = false; + Rewind(t, includeDelay); + t.isPlaying = true; + if (wasPaused && t.playedOnce && t.onPlay != null) { + // Don't call in case it hasn't started because onStart routine will call it + Tween.OnTweenCallback(t.onPlay); + } + return true; + } + + internal static bool Rewind(Tween t, bool includeDelay = true) + { + bool wasPlaying = t.isPlaying; // Manage onPause from this method because DoGoto won't detect it + t.isPlaying = false; + bool rewinded = false; + if (t.delay > 0) { + if (includeDelay) { + rewinded = t.delay > 0 && t.elapsedDelay > 0; + t.elapsedDelay = 0; + t.delayComplete = false; + } else { + rewinded = t.elapsedDelay < t.delay; + t.elapsedDelay = t.delay; + t.delayComplete = true; + } + } + if (t.position > 0 || t.completedLoops > 0 || !t.startupDone) { + rewinded = true; + bool needsKilling = Tween.DoGoto(t, 0, 0, UpdateMode.Goto); + if (!needsKilling && wasPlaying && t.onPause != null) Tween.OnTweenCallback(t.onPause); + } + return rewinded; + } + + internal static bool TogglePause(Tween t) + { + if (t.isPlaying) return Pause(t); + return Play(t); + } + + #endregion + + #region Info Getters + + internal static int TotalPooledTweens() + { + return totPooledTweeners + totPooledSequences; + } + + internal static int TotalPlayingTweens() + { + if (!hasActiveTweens) return 0; + + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + int tot = 0; + for (int i = 0; i < _maxActiveLookupId + 1; ++i) { + Tween t = _activeTweens[i]; + if (t != null && t.isPlaying) tot++; + } + return tot; + } + + // If playing is FALSE returns active paused tweens, otherwise active playing tweens + internal static List GetActiveTweens(bool playing) + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + if (totActiveTweens <= 0) return null; + int len = totActiveTweens; + List ts = new List(len); + for (int i = 0; i < len; ++i) { + Tween t = _activeTweens[i]; + if (t.isPlaying == playing) ts.Add(t); + } + if (ts.Count > 0) return ts; + return null; + } + + // Returns all active tweens with the given id + internal static List GetTweensById(object id) + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + if (totActiveTweens <= 0) return null; + int len = totActiveTweens; + List ts = new List(len); + for (int i = 0; i < len; ++i) { + Tween t = _activeTweens[i]; + if (t.id == id) ts.Add(t); + } + if (ts.Count > 0) return ts; + return null; + } + + // Returns all active tweens with the given target + internal static List GetTweensByTarget(object target) + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + if (totActiveTweens <= 0) return null; + int len = totActiveTweens; + List ts = new List(len); + for (int i = 0; i < len; ++i) { + Tween t = _activeTweens[i]; + if (t.target == target) ts.Add(t); + } + if (ts.Count > 0) return ts; + return null; + } + + #endregion + + #region Private Methods + + static void MarkForKilling(Tween t) + { + t.active = false; + _KillList.Add(t); + } + + // Adds the given tween to the active tweens list (updateType is always Normal, but can be changed by SetUpdateType) + static void AddActiveTween(Tween t) + { + if (_requiresActiveReorganization) ReorganizeActiveTweens(); + + t.active = true; + t.updateType = DOTween.defaultUpdateType; + t.isIndependentUpdate = DOTween.defaultTimeScaleIndependent; + t.activeId = _maxActiveLookupId = totActiveTweens; + _activeTweens[totActiveTweens] = t; + hasActiveDefaultTweens = true; + totActiveDefaultTweens++; + totActiveTweens++; + if (t.tweenType == TweenType.Tweener) totActiveTweeners++; + else totActiveSequences++; + hasActiveTweens = true; + } + + static void ReorganizeActiveTweens() + { + if (totActiveTweens <= 0) { + _maxActiveLookupId = -1; + _requiresActiveReorganization = false; + _reorganizeFromId = -1; + return; + } else if (_reorganizeFromId == _maxActiveLookupId) { + _maxActiveLookupId--; + _requiresActiveReorganization = false; + _reorganizeFromId = -1; + return; + } + + int shift = 1; + int len = _maxActiveLookupId + 1; + _maxActiveLookupId = _reorganizeFromId - 1; + for (int i = _reorganizeFromId + 1; i < len; ++i) { + Tween t = _activeTweens[i]; + if (t == null) { + shift++; + continue; + } + t.activeId = _maxActiveLookupId = i - shift; + _activeTweens[i - shift] = t; + _activeTweens[i] = null; + } + _requiresActiveReorganization = false; + _reorganizeFromId = -1; + } + + static void DespawnTweens(List tweens, bool modifyActiveLists = true) + { + int count = tweens.Count; + for (int i = 0; i < count; ++i) Despawn(tweens[i], modifyActiveLists); + } + + // Removes a tween from the active list, reorganizes said list + // and decreases the given total + static void RemoveActiveTween(Tween t) + { + int index = t.activeId; + + t.activeId = -1; + _requiresActiveReorganization = true; + if (_reorganizeFromId == -1 || _reorganizeFromId > index) _reorganizeFromId = index; + _activeTweens[index] = null; + + if (t.updateType == UpdateType.Normal) { + totActiveDefaultTweens--; + hasActiveDefaultTweens = totActiveDefaultTweens > 0; + } else if (t.updateType == UpdateType.Fixed) { + totActiveFixedTweens--; + hasActiveFixedTweens = totActiveFixedTweens > 0; + } else { + totActiveLateTweens--; + hasActiveLateTweens = totActiveLateTweens > 0; + } + totActiveTweens--; + hasActiveTweens = totActiveTweens > 0; + if (t.tweenType == TweenType.Tweener) totActiveTweeners--; + else totActiveSequences--; + } + + static void ClearTweenArray(Tween[] tweens) + { + int len = tweens.Length; + for (int i = 0; i < len; i++) tweens[i] = null; + } + + static void IncreaseCapacities(CapacityIncreaseMode increaseMode) + { + int killAdd = 0; + switch (increaseMode) { + case CapacityIncreaseMode.TweenersOnly: + killAdd += _DefaultMaxTweeners; + maxTweeners += _DefaultMaxTweeners; + Array.Resize(ref _pooledTweeners, maxTweeners); + break; + case CapacityIncreaseMode.SequencesOnly: + killAdd += _DefaultMaxSequences; + maxSequences += _DefaultMaxSequences; + break; + default: + killAdd += _DefaultMaxTweeners; + maxTweeners += _DefaultMaxTweeners; + maxSequences += _DefaultMaxSequences; + Array.Resize(ref _pooledTweeners, maxTweeners); + break; + } + maxActive = maxTweeners; + Array.Resize(ref _activeTweens, maxActive); + if (killAdd > 0) _KillList.Capacity += killAdd; + } + + #endregion + + #region Debug Methods +#if DEBUG + static void VerifyActiveTweensList() + { + int nullTweensWithinLookup = 0, inactiveTweensWithinLookup = 0, activeTweensAfterNull = 0; + List activeTweensAfterNullIds = new List(); + + for (int i = 0; i < _maxActiveLookupId + 1; ++i) { + Tween t = _activeTweens[i]; + if (t == null) nullTweensWithinLookup++; + else if (!t.active) inactiveTweensWithinLookup++; + } + int len = _activeTweens.Length; + int firstNullIndex = -1; + for (int i = 0; i < len; ++i) { + if (firstNullIndex == -1 && _activeTweens[i] == null) firstNullIndex = i; + else if (firstNullIndex > -1 && _activeTweens[i] != null) { + activeTweensAfterNull++; + activeTweensAfterNullIds.Add(i); + } + } + + if (nullTweensWithinLookup > 0 || inactiveTweensWithinLookup > 0 || activeTweensAfterNull > 0) { + string s = "VerifyActiveTweensList WARNING:"; + if (isUpdateLoop) s += " - UPDATE LOOP (" + updateLoopCount + ")"; + if (nullTweensWithinLookup > 0) s += " - NULL Tweens Within Lookup (" + nullTweensWithinLookup + ")"; + if (inactiveTweensWithinLookup > 0) s += " - Inactive Tweens Within Lookup (" + inactiveTweensWithinLookup + ")"; + if (activeTweensAfterNull > 0) { + string indexes = ""; + len = activeTweensAfterNullIds.Count; + for (int i = 0; i < len; ++i) { + if (i > 0) indexes += ","; + indexes += activeTweensAfterNullIds[i]; + } + s += " - Active tweens after NULL ones (" + (firstNullIndex - 1) + "/" + activeTweensAfterNull + "[" + indexes + "]" + ")"; + } + Debug.LogWarning(s); + } + } +#endif + #endregion + + #region Internal Classes + + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // ||| INTERNAL CLASSES |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + internal enum CapacityIncreaseMode + { + TweenersAndSequences, + TweenersOnly, + SequencesOnly + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/TweenerCore.cs b/_DOTween.Assembly/DOTween/Core/TweenerCore.cs new file mode 100644 index 0000000..47c79e3 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/TweenerCore.cs @@ -0,0 +1,173 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/07 12:56 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins.Core; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Core +{ + // Public so it can be used with SetOptions to show the correct overload + // and also to allow custom plugins to change start/end/changeValue. + // T1: type of value to tween + // T2: format in which value is stored while tweening + // TPlugOptions: options type + public class TweenerCore : Tweener where TPlugOptions : struct + { + // SETUP DATA //////////////////////////////////////////////// + + public T2 startValue, endValue, changeValue; + public TPlugOptions plugOptions; + public DOGetter getter; + public DOSetter setter; + internal ABSTweenPlugin tweenPlugin; + + const string _TxtCantChangeSequencedValues = "You cannot change the values of a tween contained inside a Sequence"; + + #region Constructor + + internal TweenerCore() + { + typeofT1 = typeof(T1); + typeofT2 = typeof(T2); + typeofTPlugOptions = typeof(TPlugOptions); + tweenType = TweenType.Tweener; + Reset(); + } + + #endregion + + #region Public Methods + + // No generics because T to T2 conversion isn't compatible with AOT + public override Tweener ChangeStartValue(object newStartValue, float newDuration = -1) + { + if (isSequenced) { + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + return this; + } + Type valT = newStartValue.GetType(); + if (valT != typeofT2) { + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeStartValue: incorrect newStartValue type (is " + valT + ", should be " + typeofT2 + ")"); + return this; + } + return DoChangeStartValue(this, (T2)newStartValue, newDuration); + } + + // No generics because T to T2 conversion isn't compatible with AOT + public override Tweener ChangeEndValue(object newEndValue, bool snapStartValue) + { return ChangeEndValue(newEndValue, -1, snapStartValue); } + // No generics because T to T2 conversion isn't compatible with AOT + public override Tweener ChangeEndValue(object newEndValue, float newDuration = -1, bool snapStartValue = false) + { + if (isSequenced) { + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + return this; + } + Type valT = newEndValue.GetType(); + if (valT != typeofT2) { + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeEndValue: incorrect newEndValue type (is " + valT + ", should be " + typeofT2 + ")"); + return this; + } + return DoChangeEndValue(this, (T2)newEndValue, newDuration, snapStartValue); + } + + // No generics because T to T2 conversion isn't compatible with AOT + public override Tweener ChangeValues(object newStartValue, object newEndValue, float newDuration = -1) + { + if (isSequenced) { + if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues); + return this; + } + Type valT0 = newStartValue.GetType(); + Type valT1 = newEndValue.GetType(); + if (valT0 != typeofT2) { + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT0 + ", should be " + typeofT2 + ")"); + return this; + } + if (valT1 != typeofT2) { + if (Debugger.logPriority >= 1) Debugger.LogWarning("ChangeValues: incorrect value type (is " + valT1 + ", should be " + typeofT2 + ")"); + return this; + } + return DoChangeValues(this, (T2)newStartValue, (T2)newEndValue, newDuration); + } + + #endregion + + // Sets From tweens, immediately sending the target to its endValue and assigning new start/endValues. + // Called by TweenSettings.From. + // Plugins that don't support From: + // - Vector3ArrayPlugin + // - Pro > PathPlugin, SpiralPlugin + internal override Tweener SetFrom(bool relative) + { + tweenPlugin.SetFrom(this, relative); + hasManuallySetStartValue = true; + return this; + } + + // _tweenPlugin is not reset since it's useful to keep it as a reference + internal override sealed void Reset() + { + base.Reset(); + + if (tweenPlugin != null) tweenPlugin.Reset(this); + plugOptions = new TPlugOptions(); + getter = null; + setter = null; + hasManuallySetStartValue = false; + isFromAllowed = true; + } + + // Called by TweenManager.Validate. + // Returns TRUE if the tween is valid + internal override bool Validate() + { + try { + getter(); + } catch { + return false; + } + return true; + } + + // CALLED BY TweenManager at each update. + // Returns TRUE if the tween needs to be killed + internal override float UpdateDelay(float elapsed) + { + return DoUpdateDelay(this, elapsed); + } + + // CALLED BY Tween the moment the tween starts, AFTER any delay has elapsed + // (unless it's a FROM tween, in which case it will be called BEFORE any eventual delay). + // Returns TRUE in case of success, + // FALSE if there are missing references and the tween needs to be killed + internal override bool Startup() + { + return DoStartup(this); + } + + // Applies the tween set by DoGoto. + // Returns TRUE if the tween needs to be killed + internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) + { + float updatePosition = useInversePosition ? duration - position : position; + if (DOTween.useSafeMode) { + try { + tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition); + } catch { + // Target/field doesn't exist anymore: kill tween + return true; + } + } else { + tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition); + } + return false; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Core/Utils.cs b/_DOTween.Assembly/DOTween/Core/Utils.cs new file mode 100644 index 0000000..9a7b60a --- /dev/null +++ b/_DOTween.Assembly/DOTween/Core/Utils.cs @@ -0,0 +1,36 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/17 19:40 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +namespace DG.Tweening.Core +{ + internal static class Utils + { + /// + /// Returns a Vector3 with z = 0 + /// + internal static Vector3 Vector3FromAngle(float degrees, float magnitude) + { + float radians = degrees * Mathf.Deg2Rad; + return new Vector3(magnitude * Mathf.Cos(radians), magnitude * Mathf.Sin(radians), 0); + } + + /// + /// Returns the 2D angle between two vectors + /// + public static float Angle2D(Vector3 from, Vector3 to) + { + Vector2 baseDir = Vector2.right; + to -= from; + float ang = Vector2.Angle(baseDir, to); + Vector3 cross = Vector3.Cross(baseDir, to); + if (cross.z > 0) ang = 360 - ang; + ang *= -1f; + return ang; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs new file mode 100644 index 0000000..c299eab --- /dev/null +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -0,0 +1,849 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/07 14:05 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Collections; +using System.Collections.Generic; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Main DOTween class. Contains static methods to create and control tweens in a generic way + /// + public class DOTween + { + /// DOTween's version + public static readonly string Version = "1.0.317"; + + /////////////////////////////////////////////// + // Options //////////////////////////////////// + + /// If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + /// (like targets becoming null while a tween is playing). + /// Default: TRUE + public static bool useSafeMode = true; + /// If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + /// Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + /// Beware, this will slightly slow down your tweens while inside Unity Editor. + /// Default: FALSE + public static bool showUnityEditorReport = false; + /// Global DOTween timeScale. + /// Default: 1 + public static float timeScale = 1; + /// DOTween's log behaviour. + /// Default: LogBehaviour.ErrorsOnly + public static LogBehaviour logBehaviour { + get { return _logBehaviour; } + set { _logBehaviour = value; Debugger.SetLogPriority(_logBehaviour); } + } + static LogBehaviour _logBehaviour = LogBehaviour.ErrorsOnly; + + /////////////////////////////////////////////// + // Default options for Tweens ///////////////// + + /// Default updateType for new tweens. + /// Default: UpdateType.Normal + public static UpdateType defaultUpdateType = UpdateType.Normal; + /// Sets whether Unity's timeScale should be taken into account by default or not. + /// Default: false + public static bool defaultTimeScaleIndependent = false; + /// Default autoPlay behaviour for new tweens. + /// Default: AutoPlay.All + public static AutoPlay defaultAutoPlay = AutoPlay.All; + /// Default autoKillOnComplete behaviour for new tweens. + /// Default: TRUE + public static bool defaultAutoKill = true; + /// Default loopType applied to all new tweens. + /// Default: LoopType.Restart + public static LoopType defaultLoopType = LoopType.Restart; + /// If TRUE all newly created tweens are set as recyclable, otherwise not. + /// Default: FALSE + public static bool defaultRecyclable; + /// Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + /// Default: Ease.InOutQuad + public static Ease defaultEaseType = Ease.OutQuad; + /// Default overshoot/amplitude used for eases + /// Default: 1.70158f + public static float defaultEaseOvershootOrAmplitude = 1.70158f; + /// Default period used for eases + /// Default: 0 + public static float defaultEasePeriod = 0; + + internal static DOTweenComponent instance; // Assigned/removed by DOTweenComponent.Create/DestroyInstance + internal static bool isUnityEditor; + internal static bool isDebugBuild; + internal static int maxActiveTweenersReached, maxActiveSequencesReached; // Controlled by DOTweenInspector if showUnityEditorReport is active + internal static readonly List GizmosDelegates = new List(); // Can be used by other classes to call internal gizmo draw methods + internal static bool initialized; // Can be set to false by DOTweenComponent OnDestroy + internal static bool isQuitting; // Set by DOTweenComponent when the application is quitting + + #region Static Constructor + + static DOTween() + { + isUnityEditor = Application.isEditor; +#if DEBUG + isDebugBuild = true; +#endif + } + + #endregion + + #region Public Methods + + /// + /// Must be called once, before the first ever DOTween call/reference, + /// otherwise it will be called automatically and will use default options. + /// Calling it a second time won't have any effect. + /// You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + /// DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + /// + /// If TRUE all new tweens will be set for recycling, meaning that when killed, + /// instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + /// GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + /// even if they were killed (since they might have been respawned and are now being used for other tweens). + /// If you want to automatically set your tween references to NULL when a tween is killed + /// you can use the OnKill callback like this: + /// .OnKill(()=> myTweenReference = null) + /// You can change this setting at any time by changing the static property, + /// or you can set the recycling behaviour for each tween separately, using: + /// SetRecyclable(bool recyclable) + /// Default: FALSE + /// If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + /// (like targets becoming null while a tween is playing). + /// You can change this setting at any time by changing the static property. + /// Default: FALSE + /// Type of logging to use. + /// You can change this setting at any time by changing the static property. + /// Default: ErrorsOnly + public static IDOTweenInit Init(bool? recycleAllByDefault = null, bool? useSafeMode = null, LogBehaviour? logBehaviour = null) + { + if (initialized) return instance; + if (!Application.isPlaying || isQuitting) return null; + + bool doRecycleAllByDefault = recycleAllByDefault == null ? false : (bool)recycleAllByDefault; + bool doUseSafeMode = useSafeMode == null ? true : (bool)useSafeMode; + LogBehaviour doLogBehaviour = logBehaviour == null ? LogBehaviour.ErrorsOnly : (LogBehaviour)logBehaviour; + DOTweenSettings settings = Resources.Load(DOTweenSettings.AssetName) as DOTweenSettings; + return Init(settings, doRecycleAllByDefault, doUseSafeMode, doLogBehaviour); + } + // Auto-init + static void AutoInit() + { + DOTweenSettings settings = Resources.Load(DOTweenSettings.AssetName) as DOTweenSettings; + if (settings == null) Init(null, defaultRecyclable, useSafeMode, logBehaviour); + else Init(settings, settings.defaultRecyclable, settings.useSafeMode, settings.logBehaviour); + } + // Full init + static IDOTweenInit Init(DOTweenSettings settings, bool recycleAllByDefault, bool useSafeMode, LogBehaviour logBehaviour) + { + initialized = true; + // Options + DOTween.defaultRecyclable = recycleAllByDefault; + DOTween.useSafeMode = useSafeMode; + DOTween.logBehaviour = logBehaviour; + // Gameobject - also assign instance + DOTweenComponent.Create(); + // Assign settings + if (settings != null) { +// DOTween.useSafeMode = settings.useSafeMode; +// DOTween.logBehaviour = settings.logBehaviour; +// DOTween.defaultRecyclable = settings.defaultRecyclable; + DOTween.showUnityEditorReport = settings.showUnityEditorReport; + DOTween.defaultAutoPlay = settings.defaultAutoPlay; + DOTween.defaultUpdateType = settings.defaultUpdateType; + DOTween.defaultTimeScaleIndependent = settings.defaultTimeScaleIndependent; + DOTween.defaultEaseType = settings.defaultEaseType; + DOTween.defaultEaseOvershootOrAmplitude = settings.defaultEaseOvershootOrAmplitude; + DOTween.defaultEasePeriod = settings.defaultEasePeriod; + DOTween.defaultAutoKill = settings.defaultAutoKill; + DOTween.defaultLoopType = settings.defaultLoopType; + } + // Log + if (Debugger.logPriority >= 2) Debugger.Log("DOTween initialization (useSafeMode: " + useSafeMode + ", logBehaviour: " + logBehaviour + ")"); + + return instance; + } + + /// + /// Directly sets the current max capacity of Tweeners and Sequences + /// (meaning how many Tweeners and Sequences can be running at the same time), + /// so that DOTween doesn't need to automatically increase them in case the max is reached + /// (which might lead to hiccups when that happens). + /// Sequences capacity must be less or equal to Tweeners capacity + /// (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + /// Beware: use this method only when there are no tweens running. + /// + /// Max Tweeners capacity. + /// Default: 200 + /// Max Sequences capacity. + /// Default: 50 + public static void SetTweensCapacity(int tweenersCapacity, int sequencesCapacity) + { + TweenManager.SetCapacities(tweenersCapacity, sequencesCapacity); + } + + /// + /// Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + /// + /// If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + /// (so that next time you use it it will need to be re-initialized) + public static void Clear(bool destroy = false) + { + TweenManager.PurgeAll(); + PluginsManager.PurgeAll(); + if (!destroy) return; + + initialized = false; + useSafeMode = false; + showUnityEditorReport = false; + timeScale = 1; + logBehaviour = LogBehaviour.ErrorsOnly; + defaultEaseType = Ease.OutQuad; + defaultEaseOvershootOrAmplitude = 1.70158f; + defaultEasePeriod = 0; + defaultUpdateType = UpdateType.Normal; + defaultTimeScaleIndependent = false; + defaultAutoPlay = AutoPlay.All; + defaultLoopType = LoopType.Restart; + defaultAutoKill = true; + defaultRecyclable = false; + maxActiveTweenersReached = maxActiveSequencesReached = 0; + + DOTweenComponent.DestroyInstance(); + } + + /// + /// Clears all cached tween pools. + /// + public static void ClearCachedTweens() + { + TweenManager.PurgePools(); + } + + /// + /// Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + /// and returns the total number of invalid tweens found and removed. + /// Automatically called when loading a new scene if is TRUE. + /// BEWARE: this is a slightly expensive operation so use it with care + /// + public static int Validate() + { + return TweenManager.Validate(); + } + + #endregion + + // =================================================================================== + // PUBLIC TWEEN CREATION METHODS ----------------------------------------------------- + + // Sadly can't make generic versions of default tweens with additional options + // where the TO method doesn't contain the options param, otherwise the correct Option type won't be inferred. + // So: overloads. Sigh. + // Also, Unity has a bug which doesn't allow method overloading with its own implicitly casteable types (like Vector4 and Color) + // and additional parameters, so in those cases I have to create overloads instead than using optionals. ARARGH! + + #region Tween TO + + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, float endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static Tweener To(DOGetter getter, DOSetter setter, int endValue,float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static Tweener To(DOGetter getter, DOSetter setter, uint endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, string endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Vector2 endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Vector3 endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Vector4 endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Vector3 endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Color endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To(DOGetter getter, DOSetter setter, Rect endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + /// Tweens a property or field to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static Tweener To(DOGetter getter, DOSetter setter, RectOffset endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + + /// Tweens a property or field to the given value using a custom plugin + /// The plugin to use. Each custom plugin implements a static Get() method + /// you'll need to call to assign the correct plugin in the correct way, like this: + /// CustomPlugin.Get() + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static TweenerCore To( + ABSTweenPlugin plugin, DOGetter getter, DOSetter setter, T2 endValue, float duration + ) + where TPlugOptions : struct + { return ApplyTo(getter, setter, endValue, duration, plugin); } + + /// Tweens only one axis of a Vector3 to the given value using default plugins. + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + /// The axis to tween + public static TweenerCore ToAxis(DOGetter getter, DOSetter setter, float endValue, float duration, AxisConstraint axisConstraint = AxisConstraint.X) + { + TweenerCore t = ApplyTo(getter, setter, new Vector3(endValue, endValue, endValue), duration); + t.plugOptions.axisConstraint = axisConstraint; + return t; + } + /// Tweens only the alpha of a Color to the given value using default plugins + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end value to reachThe tween's duration + public static Tweener ToAlpha(DOGetter getter, DOSetter setter, float endValue, float duration) + { return ApplyTo(getter, setter, new Color(0, 0, 0, endValue), duration).SetOptions(true); } + + #endregion + + #region Special TOs (No FROMs) + + /// Tweens a virtual property from the given start to the given end value + /// and implements a setter that allows to use that value with an external method or a lambda + /// Example: + /// To(MyMethod, 0, 12, 0.5f); + /// Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + /// The action to perform with the tweened value + /// The value to start from + /// The end value to reach + /// The duration of the virtual tween + /// + public static Tweener To(DOSetter setter, float startValue, float endValue, float duration) + { + float v = startValue; + return To(() => v, x => { v = x; setter(v); }, endValue, duration) + .NoFrom(); + } + + /// Punches a Vector3 towards the given direction and then back to the starting one + /// as if it was connected to the starting position via an elastic. + /// This tween type generates some GC allocations at startup + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The direction and strength of the punch + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + /// 1 creates a full oscillation between the direction and the opposite decaying direction, + /// while 0 oscillates only between the starting position and the decaying direction + public static TweenerCore Punch(DOGetter getter, DOSetter setter, Vector3 direction, float duration, int vibrato = 10, float elasticity = 1) + { + if (elasticity > 1) elasticity = 1; + else if (elasticity < 0) elasticity = 0; + float strength = direction.magnitude; + int totIterations = (int)(vibrato * duration); + if (totIterations < 2) totIterations = 2; + float decayXTween = strength / totIterations; + // Calculate and store the duration of each tween + float[] tDurations = new float[totIterations]; + float sum = 0; + for (int i = 0; i < totIterations; ++i) { + float iterationPerc = (i + 1) / (float)totIterations; + float tDuration = duration * iterationPerc; + sum += tDuration; + tDurations[i] = tDuration; + } + float tDurationMultiplier = duration / sum; // Multiplier that allows the sum of tDurations to equal the set duration + for (int i = 0; i < totIterations; ++i) tDurations[i] = tDurations[i] * tDurationMultiplier; + // Create the tween + Vector3[] tos = new Vector3[totIterations]; + for (int i = 0; i < totIterations; ++i) { + if (i < totIterations - 1) { + if (i == 0) tos[i] = direction; + else if (i % 2 != 0) tos[i] = -Vector3.ClampMagnitude(direction, strength * elasticity); + else tos[i] = Vector3.ClampMagnitude(direction, strength); + strength -= decayXTween; + } else tos[i] = Vector3.zero; + } + return ToArray(getter, setter, tos, tDurations) + .NoFrom() + .SetSpecialStartupMode(SpecialStartupMode.SetPunch); + } + + /// Shakes a Vector3 with the given values. + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction and behave like a random punch. + /// If TRUE only shakes on the X Y axis (looks better with things like cameras). + public static TweenerCore Shake(DOGetter getter, DOSetter setter, float duration, + float strength = 3, int vibrato = 10, float randomness = 90, bool ignoreZAxis = true + ) + { + return Shake(getter, setter, duration, new Vector3(strength, strength, strength), vibrato, randomness, ignoreZAxis, false); + } + /// Shakes a Vector3 with the given values. + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction and behave like a random punch. + public static TweenerCore Shake(DOGetter getter, DOSetter setter, float duration, + Vector3 strength, int vibrato = 10, float randomness = 90 + ) + { + return Shake(getter, setter, duration, strength, vibrato, randomness, false, true); + } + static TweenerCore Shake(DOGetter getter, DOSetter setter, float duration, + Vector3 strength, int vibrato, float randomness, bool ignoreZAxis, bool vectorBased + ) + { + float shakeMagnitude = vectorBased ? strength.magnitude : strength.x; + int totIterations = (int)(vibrato * duration); + if (totIterations < 2) totIterations = 2; + float decayXTween = shakeMagnitude / totIterations; + // Calculate and store the duration of each tween + float[] tDurations = new float[totIterations]; + float sum = 0; + for (int i = 0; i < totIterations; ++i) { + float iterationPerc = (i + 1) / (float)totIterations; + float tDuration = duration * iterationPerc; + sum += tDuration; + tDurations[i] = tDuration; + } + float tDurationMultiplier = duration / sum; // Multiplier that allows the sum of tDurations to equal the set duration + for (int i = 0; i < totIterations; ++i) tDurations[i] = tDurations[i] * tDurationMultiplier; + // Create the tween + float ang = UnityEngine.Random.Range(0f, 360f); + Vector3[] tos = new Vector3[totIterations]; + for (int i = 0; i < totIterations; ++i) { + if (i < totIterations - 1) { + if (i > 0) ang = ang - 180 + UnityEngine.Random.Range(-randomness, randomness); + if (vectorBased) { + Quaternion rndQuaternion = Quaternion.AngleAxis(UnityEngine.Random.Range(-randomness, randomness), Vector3.up); + Vector3 to = rndQuaternion * Utils.Vector3FromAngle(ang, shakeMagnitude); + to.x = Vector3.ClampMagnitude(to, strength.x).x; + to.y = Vector3.ClampMagnitude(to, strength.y).y; + to.z = Vector3.ClampMagnitude(to, strength.z).z; + tos[i] = to; + shakeMagnitude -= decayXTween; + strength = Vector3.ClampMagnitude(strength, shakeMagnitude); + } else { + if (ignoreZAxis) { + tos[i] = Utils.Vector3FromAngle(ang, shakeMagnitude); + } else { + Quaternion rndQuaternion = Quaternion.AngleAxis(UnityEngine.Random.Range(-randomness, randomness), Vector3.up); + tos[i] = rndQuaternion * Utils.Vector3FromAngle(ang, shakeMagnitude); + } + shakeMagnitude -= decayXTween; + } + } else tos[i] = Vector3.zero; + } + return ToArray(getter, setter, tos, tDurations) + .NoFrom().SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + + /// Tweens a property or field to the given values using default plugins. + /// Ease is applied between each segment and not as a whole. + /// This tween type generates some GC allocations at startup + /// A getter for the field or property to tween. + /// Example usage with lambda:()=> myProperty + /// A setter for the field or property to tween + /// Example usage with lambda:x=> myProperty = x + /// The end values to reach for each segment. This array must have the same length as durations + /// The duration of each segment. This array must have the same length as endValues + public static TweenerCore ToArray(DOGetter getter, DOSetter setter, Vector3[] endValues, float[] durations) + { + int len = durations.Length; + if (len != endValues.Length) { + Debugger.LogError("To Vector3 array tween: endValues and durations arrays must have the same length"); + return null; + } + + // Clone the arrays + Vector3[] endValuesClone = new Vector3[len]; + float[] durationsClone = new float[len]; + for (int i = 0; i < len; i++) { + endValuesClone[i] = endValues[i]; + durationsClone[i] = durations[i]; + } + + float totDuration = 0; + for (int i = 0; i < len; ++i) totDuration += durationsClone[i]; + TweenerCore t = + ApplyTo(getter, setter, endValuesClone, totDuration) + .NoFrom(); + t.plugOptions.durations = durationsClone; + return t; + } + + #endregion + + #region Special TOs (INTERNAL) + + internal static TweenerCore To(DOGetter getter, DOSetter setter, Color2 endValue, float duration) + { return ApplyTo(getter, setter, endValue, duration); } + + #endregion + + #region Tween SEQUENCE + + /// + /// Returns a new to be used for tween groups + /// + public static Sequence Sequence() + { + InitCheck(); + Sequence sequence = TweenManager.GetSequence(); + Tweening.Sequence.Setup(sequence); + return sequence; + } + #endregion + + ///////////////////////////////////////////////////////////////////// + // OTHER STUFF ////////////////////////////////////////////////////// + + #region Play Operations + + /// Completes all tweens and returns the number of actual tweens completed + /// (meaning tweens that don't have infinite loops and were not already complete) + public static int CompleteAll() + { + return TweenManager.FilteredOperation(OperationType.Complete, FilterType.All, null, false, 0); + } + /// Completes all tweens with the given ID or target and returns the number of actual tweens completed + /// (meaning the tweens that don't have infinite loops and were not already complete) + public static int Complete(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Complete, FilterType.TargetOrId, targetOrId, false, 0); + } + // Used internally to complete a tween and return only the number of killed tweens instead than just the completed ones + // (necessary for Kill(complete) operation. Sets optionalBool to TRUE) + internal static int CompleteAndReturnKilledTot() + { + return TweenManager.FilteredOperation(OperationType.Complete, FilterType.All, null, true, 0); + } + internal static int CompleteAndReturnKilledTot(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Complete, FilterType.TargetOrId, targetOrId, true, 0); + } + + /// Flips all tweens (changing their direction to forward if it was backwards and viceversa), + /// then returns the number of actual tweens flipped + public static int FlipAll() + { + return TweenManager.FilteredOperation(OperationType.Flip, FilterType.All, null, false, 0); + } + /// Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + /// then returns the number of actual tweens flipped + public static int Flip(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Flip, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + public static int GotoAll(float to, bool andPlay = false) + { + return TweenManager.FilteredOperation(OperationType.Goto, FilterType.All, null, andPlay, to); + } + /// Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + /// and returns the actual tweens involved + public static int Goto(object targetOrId, float to, bool andPlay = false) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Goto, FilterType.TargetOrId, targetOrId, andPlay, to); + } + + /// Kills all tweens and returns the number of actual tweens killed + /// If TRUE completes the tweens before killing them + public static int KillAll(bool complete = false) + { + int tot = complete ? CompleteAndReturnKilledTot() : 0; + return tot + TweenManager.DespawnAll(); + } + /// Kills all tweens with the given ID or target and returns the number of actual tweens killed + /// If TRUE completes the tweens before killing them + public static int Kill(object targetOrId, bool complete = false) + { + if (targetOrId == null) return 0; + int tot = complete ? CompleteAndReturnKilledTot(targetOrId) : 0; + return tot + TweenManager.FilteredOperation(OperationType.Despawn, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Pauses all tweens and returns the number of actual tweens paused + public static int PauseAll() + { + return TweenManager.FilteredOperation(OperationType.Pause, FilterType.All, null, false, 0); + } + /// Pauses all tweens with the given ID or target and returns the number of actual tweens paused + /// (meaning the tweens that were actually playing and have been paused) + public static int Pause(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Pause, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Plays all tweens and returns the number of actual tweens played + /// (meaning tweens that were not already playing or complete) + public static int PlayAll() + { + return TweenManager.FilteredOperation(OperationType.Play, FilterType.All, null, false, 0); + } + /// Plays all tweens with the given ID or target and returns the number of actual tweens played + /// (meaning the tweens that were not already playing or complete) + public static int Play(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Play, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Plays backwards all tweens and returns the number of actual tweens played + /// (meaning tweens that were not already started, playing backwards or rewinded) + public static int PlayBackwardsAll() + { + return TweenManager.FilteredOperation(OperationType.PlayBackwards, FilterType.All, null, false, 0); + } + /// Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + /// (meaning the tweens that were not already started, playing backwards or rewinded) + public static int PlayBackwards(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.PlayBackwards, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Plays forward all tweens and returns the number of actual tweens played + /// (meaning tweens that were not already playing forward or complete) + public static int PlayForwardAll() + { + return TweenManager.FilteredOperation(OperationType.PlayForward, FilterType.All, null, false, 0); + } + /// Plays forward all tweens with the given ID or target and returns the number of actual tweens played + /// (meaning the tweens that were not already playing forward or complete) + public static int PlayForward(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.PlayForward, FilterType.TargetOrId, targetOrId, false, 0); + } + + /// Restarts all tweens, then returns the number of actual tweens restarted + public static int RestartAll(bool includeDelay = true) + { + return TweenManager.FilteredOperation(OperationType.Restart, FilterType.All, null, includeDelay, 0); + } + /// Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + public static int Restart(object targetOrId, bool includeDelay = true) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Restart, FilterType.TargetOrId, targetOrId, includeDelay, 0); + } + + /// Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + /// (meaning tweens that were not already rewinded) + public static int RewindAll(bool includeDelay = true) + { + return TweenManager.FilteredOperation(OperationType.Rewind, FilterType.All, null, includeDelay, 0); + } + /// Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + /// (meaning the tweens that were not already rewinded) + public static int Rewind(object targetOrId, bool includeDelay = true) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.Rewind, FilterType.TargetOrId, targetOrId, includeDelay, 0); + } + + /// Toggles the play state of all tweens and returns the number of actual tweens toggled + /// (meaning tweens that could be played or paused, depending on the toggle state) + public static int TogglePauseAll() + { + return TweenManager.FilteredOperation(OperationType.TogglePause, FilterType.All, null, false, 0); + } + /// Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + /// (meaning the tweens that could be played or paused, depending on the toggle state) + public static int TogglePause(object targetOrId) + { + if (targetOrId == null) return 0; + return TweenManager.FilteredOperation(OperationType.TogglePause, FilterType.TargetOrId, targetOrId, false, 0); + } + #endregion + + #region Global Info Getters + + /// + /// Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). + /// You can also use this to know if a shortcut tween is active for a given target. + /// Example: + /// transform.DOMoveX(45, 1); // transform is automatically added as the tween target + /// DOTween.IsTweening(transform); // Returns true + /// + public static bool IsTweening(object targetOrId) + { + return TweenManager.FilteredOperation(OperationType.IsTweening, FilterType.TargetOrId, targetOrId, false, 0) > 0; + } + + /// + /// Returns the total number of active and playing tweens. + /// A tween is considered as playing even if its delay is actually playing + /// + public static int TotalPlayingTweens() + { + return TweenManager.TotalPlayingTweens(); + } + + /// + /// Returns a list of all active tweens in a playing state. + /// Returns NULL if there are no active playing tweens. + /// Beware: each time you call this method a new list is generated, so use it for debug only + /// + public static List PlayingTweens() + { + return TweenManager.GetActiveTweens(true); + } + + /// + /// Returns a list of all active tweens in a paused state. + /// Returns NULL if there are no active paused tweens. + /// Beware: each time you call this method a new list is generated, so use it for debug only + /// + public static List PausedTweens() + { + return TweenManager.GetActiveTweens(false); + } + + /// + /// Returns a list of all active tweens with the given id. + /// Returns NULL if there are no active tweens with the given id. + /// Beware: each time you call this method a new list is generated + /// + public static List TweensById(object id) + { + return TweenManager.GetTweensById(id); + } + + /// + /// Returns a list of all active tweens with the given target. + /// Returns NULL if there are no active tweens with the given target. + /// Beware: each time you call this method a new list is generated + /// + public static List TweensByTarget(object target) + { + return TweenManager.GetTweensByTarget(target); + } + + #endregion + + // =================================================================================== + // METHODS --------------------------------------------------------------------------- + + static void InitCheck() + { + if (initialized || !Application.isPlaying || isQuitting) return; + +// Init(defaultRecyclable, useSafeMode, logBehaviour); + AutoInit(); +// Debugger.LogWarning("DOTween auto-initialized with default settings (recycleAllByDefault: " + defaultRecyclable + ", useSafeMode: " + useSafeMode + ", logBehaviour: " + logBehaviour + "). Call DOTween.Init before creating your first tween in order to choose the settings yourself"); + } + + static TweenerCore ApplyTo( + DOGetter getter, DOSetter setter, T2 endValue, float duration, ABSTweenPlugin plugin = null + ) + where TPlugOptions : struct + { + InitCheck(); + TweenerCore tweener = TweenManager.GetTweener(); + if (!Tweener.Setup(tweener, getter, setter, endValue, duration, plugin)) { + TweenManager.Despawn(tweener); + return null; + } + return tweener; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/DOTween.csproj b/_DOTween.Assembly/DOTween/DOTween.csproj new file mode 100644 index 0000000..7255990 --- /dev/null +++ b/_DOTween.Assembly/DOTween/DOTween.csproj @@ -0,0 +1,165 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55} + Library + Properties + DG.Tweening + DOTween + v3.5 + 512 + + + true + full + false + ..\bin\ + DEBUG;TRACE + prompt + 4 + ..\bin\DOTween.XML + 1591 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + ..\bin\DOTween.XML + 1573 + + + + + C:\Program Files\_Design\Unity\Editor\Data\Managed\UnityEngine.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + set BinDir=bin.Global\DOTween +set DestinationDir=$(SolutionDir)..\..\%25BinDir%25 +set BinDirNoMeta=bin.Global_no_meta\DOTween +set DestinationDirNoMeta=$(SolutionDir)..\..\%25BinDirNoMeta%25 +set BinDirUnityTests=UnityTests.Unity4\Assets\Demigiant\DOTween +set DestinationDirUnityTests=$(SolutionDir)..\%25BinDirUnityTests%25 +set BinDirUnity5Tests=UnityTests.Unity5\Assets\Demigiant\DOTween +set DestinationDirUnity5Tests=$(SolutionDir)..\%25BinDirUnity5Tests%25 +set BinDirCompatibilityTests=UnityCompatibilityTests.Unity35\Assets\Demigiant\DOTween +set DestinationDirCompatibilityTests=$(SolutionDir)..\%25BinDirCompatibilityTests%25 + +echo %25DestinationDir%25 + +echo Deleting TMPs... +DEL $(TargetDir)\*.tmp + +CD $(TargetDir) +echo Converting PDB to MDB and deleting PDB... +"c:\Program Files\_Design\Unity 4.6\Editor\Data\MonoBleedingEdge\lib\mono\4.0\pdb2mdb.exe" $(TargetFileName) +DEL $(TargetName).pdb + +echo Exporting Assembly to %25DestinationDir%25 +echo Copying files to Destination... +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDir%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirNoMeta%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirNoMeta%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnityTests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnity5Tests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnity5Tests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirCompatibilityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirCompatibilityTests%25 /Y /I /E + + + \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/DOVirtual.cs b/_DOTween.Assembly/DOTween/DOVirtual.cs new file mode 100644 index 0000000..ea08e27 --- /dev/null +++ b/_DOTween.Assembly/DOTween/DOVirtual.cs @@ -0,0 +1,88 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2015/01/29 12:57 + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Creates virtual tweens that can be used to change other elements via their OnUpdate calls + /// + public static class DOVirtual + { + #region Virtual Tweens + + /// + /// Tweens a virtual float. + /// You can add regular settings to the generated tween, + /// but do not use SetUpdate or you will overwrite the onVirtualUpdate parameter + /// + /// The value to start from + /// The value to tween to + /// The duration of the tween + /// A callback which must accept a parameter of type float, called at each update + /// + public static Tweener Float(float from, float to, float duration, TweenCallback onVirtualUpdate) + { + float val = from; + return DOTween.To(() => val, x => val = x, to, duration).OnUpdate(() => onVirtualUpdate(val)); + } + + #endregion + + #region Virtual Functions + + /// Returns a value based on the given ease and lifetime percentage (0 to 1) + /// The value to start from when lifetimePercentage is 0 + /// The value to reach when lifetimePercentage is 1 + /// The time percentage (0 to 1) at which the value should be taken + /// The type of ease + public static float EasedValue(float from, float to, float lifetimePercentage, Ease easeType) + { + return from + (to - from) * EaseManager.Evaluate(easeType, null, lifetimePercentage, 1, DOTween.defaultEaseOvershootOrAmplitude, DOTween.defaultEasePeriod); + } + /// Returns a value based on the given ease and lifetime percentage (0 to 1) + /// The value to start from when lifetimePercentage is 0 + /// The value to reach when lifetimePercentage is 1 + /// The time percentage (0 to 1) at which the value should be taken + /// The type of ease + /// Eventual overshoot to use with Back ease + public static float EasedValue(float from, float to, float lifetimePercentage, Ease easeType, float overshoot) + { + return from + (to - from) * EaseManager.Evaluate(easeType, null, lifetimePercentage, 1, overshoot, DOTween.defaultEasePeriod); + } + /// Returns a value based on the given ease and lifetime percentage (0 to 1) + /// The value to start from when lifetimePercentage is 0 + /// The value to reach when lifetimePercentage is 1 + /// The time percentage (0 to 1) at which the value should be taken + /// The type of ease + /// Eventual amplitude to use with Elastic easeType + /// Eventual period to use with Elastic easeType + public static float EasedValue(float from, float to, float lifetimePercentage, Ease easeType, float amplitude, float period) + { + return from + (to - from) * EaseManager.Evaluate(easeType, null, lifetimePercentage, 1, amplitude, period); + } + /// Returns a value based on the given ease and lifetime percentage (0 to 1) + /// The value to start from when lifetimePercentage is 0 + /// The value to reach when lifetimePercentage is 1 + /// The time percentage (0 to 1) at which the value should be taken + /// The AnimationCurve to use for ease + public static float EasedValue(float from, float to, float lifetimePercentage, AnimationCurve easeCurve) + { + return from + (to - from) * EaseManager.Evaluate(Ease.INTERNAL_Custom, new EaseCurve(easeCurve).Evaluate, lifetimePercentage, 1, DOTween.defaultEaseOvershootOrAmplitude, DOTween.defaultEasePeriod); + } + + /// Fires the given callback after the given time. + /// Callback delay + /// Callback to fire when the delay has expired + /// If TRUE (default) ignores Unity's timeScale + public static Tween DelayedCall(float delay, TweenCallback callback, bool ignoreTimeScale = true) + { + return DOTween.Sequence().AppendInterval(delay).OnComplete(callback).SetUpdate(UpdateType.Normal, ignoreTimeScale).SetAutoKill(true); + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Ease.cs b/_DOTween.Assembly/DOTween/Ease.cs new file mode 100644 index 0000000..210b476 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Ease.cs @@ -0,0 +1,52 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/06/30 19:20 +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public enum Ease + { + Unset, // Used to let TweenParams know that the ease was not set and apply it differently if used on Tweeners or Sequences + Linear, + InSine, + OutSine, + InOutSine, + InQuad, + OutQuad, + InOutQuad, + InCubic, + OutCubic, + InOutCubic, + InQuart, + OutQuart, + InOutQuart, + InQuint, + OutQuint, + InOutQuint, + InExpo, + OutExpo, + InOutExpo, + InCirc, + OutCirc, + InOutCirc, + InElastic, + OutElastic, + InOutElastic, + InBack, + OutBack, + InOutBack, + InBounce, + OutBounce, + InOutBounce, + /// + /// Don't assign this! It's assigned automatically when creating 0 duration tweens + /// + INTERNAL_Zero, + /// + /// Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + /// + INTERNAL_Custom + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/IDOTweenInit.cs b/_DOTween.Assembly/DOTween/IDOTweenInit.cs new file mode 100644 index 0000000..9e54fa4 --- /dev/null +++ b/_DOTween.Assembly/DOTween/IDOTweenInit.cs @@ -0,0 +1,29 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/22 11:43 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Used to allow method chaining with DOTween.Init + /// + public interface IDOTweenInit + { + /// + /// Directly sets the current max capacity of Tweeners and Sequences + /// (meaning how many Tweeners and Sequences can be running at the same time), + /// so that DOTween doesn't need to automatically increase them in case the max is reached + /// (which might lead to hiccups when that happens). + /// Sequences capacity must be less or equal to Tweeners capacity + /// (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + /// Beware: use this method only when there are no tweens running. + /// + /// Max Tweeners capacity. + /// Default: 200 + /// Max Sequences capacity. + /// Default: 50 + IDOTweenInit SetCapacity(int tweenersCapacity, int sequencesCapacity); + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/LogBehaviour.cs b/_DOTween.Assembly/DOTween/LogBehaviour.cs new file mode 100644 index 0000000..ab94d1b --- /dev/null +++ b/_DOTween.Assembly/DOTween/LogBehaviour.cs @@ -0,0 +1,21 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/03 12:11 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Types of log behaviours + /// + public enum LogBehaviour + { + /// Log only warnings and errors + Default, + /// Log warnings, errors and additional infos + Verbose, + /// Log only errors + ErrorsOnly + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/LoopType.cs b/_DOTween.Assembly/DOTween/LoopType.cs new file mode 100644 index 0000000..3cf3d4c --- /dev/null +++ b/_DOTween.Assembly/DOTween/LoopType.cs @@ -0,0 +1,22 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/05 13:35 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Types of loop + /// + public enum LoopType + { + /// Each loop cycle restarts from the beginning + Restart, + /// The tween moves forward and backwards at alternate cycles + Yoyo, + /// Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + /// In case of String tweens works only if the tween is set as relative + Incremental + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/PathMode.cs b/_DOTween.Assembly/DOTween/PathMode.cs new file mode 100644 index 0000000..717a90c --- /dev/null +++ b/_DOTween.Assembly/DOTween/PathMode.cs @@ -0,0 +1,22 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/07 10:22 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php +namespace DG.Tweening +{ + /// + /// Path mode (used to determine correct LookAt orientation) + /// + public enum PathMode + { + /// Ignores the path mode (and thus LookAt behaviour) + Ignore, + /// Regular 3D path + Full3D, + /// 2D top-down path + TopDown2D, + /// 2D side-scroller path + Sidescroller2D + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/PathType.cs b/_DOTween.Assembly/DOTween/PathType.cs new file mode 100644 index 0000000..965c11e --- /dev/null +++ b/_DOTween.Assembly/DOTween/PathType.cs @@ -0,0 +1,19 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 10:19 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Type of path to use with DOPath tweens + /// + public enum PathType + { + /// Linear, composed of straight segments between each waypoint + Linear, + /// Curved path (which uses Catmull-Rom curves) + CatmullRom + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Color2Plugin.cs b/_DOTween.Assembly/DOTween/Plugins/Color2Plugin.cs new file mode 100644 index 0000000..1c97f2e --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Color2Plugin.cs @@ -0,0 +1,81 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/12/25 12:40 + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +namespace DG.Tweening.Plugins +{ + internal class Color2Plugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Color2 prevEndVal = t.endValue; + t.endValue = t.getter(); + if (isRelative) t.startValue = new Color2(t.endValue.ca + prevEndVal.ca, t.endValue.cb + prevEndVal.cb); + else t.startValue = new Color2(prevEndVal.ca, prevEndVal.cb); + Color2 to = t.endValue; + if (!t.plugOptions.alphaOnly) to = t.startValue; + else { + to.ca.a = t.startValue.ca.a; + to.cb.a = t.startValue.cb.a; + } + t.setter(to); + } + + public override Color2 ConvertToStartValue(TweenerCore t, Color2 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(ColorOptions options, float unitsXSecond, Color2 changeValue) + { + return 1f / unitsXSecond; + } + + public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + if (!options.alphaOnly) { + startValue.ca.r += changeValue.ca.r * easeVal; + startValue.ca.g += changeValue.ca.g * easeVal; + startValue.ca.b += changeValue.ca.b * easeVal; + startValue.ca.a += changeValue.ca.a * easeVal; + startValue.cb.r += changeValue.cb.r * easeVal; + startValue.cb.g += changeValue.cb.g * easeVal; + startValue.cb.b += changeValue.cb.b * easeVal; + startValue.cb.a += changeValue.cb.a * easeVal; + setter(startValue); + return; + } + + // Alpha only + Color2 res = getter(); + res.ca.a = startValue.ca.a + changeValue.ca.a * easeVal; + res.cb.a = startValue.cb.a + changeValue.cb.a * easeVal; + setter(res); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/ColorPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/ColorPlugin.cs new file mode 100644 index 0000000..4a101b5 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/ColorPlugin.cs @@ -0,0 +1,75 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 14:33 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class ColorPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Color prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + Color to = t.endValue; + if (!t.plugOptions.alphaOnly) to = t.startValue; + else to.a = t.startValue.a; + t.setter(to); + } + + public override Color ConvertToStartValue(TweenerCore t, Color value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(ColorOptions options, float unitsXSecond, Color changeValue) + { + return 1f / unitsXSecond; + } + + public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Color startValue, Color changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + if (!options.alphaOnly) { + startValue.r += changeValue.r * easeVal; + startValue.g += changeValue.g * easeVal; + startValue.b += changeValue.b * easeVal; + startValue.a += changeValue.a * easeVal; + setter(startValue); + return; + } + + // Alpha only + Color res = getter(); + res.a = startValue.a + changeValue.a * easeVal; + setter(res); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/ABSTweenPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/Core/ABSTweenPlugin.cs new file mode 100644 index 0000000..a3a264f --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/ABSTweenPlugin.cs @@ -0,0 +1,24 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/07 00:41 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core +{ + // Public so it can be extended by custom plugins + public abstract class ABSTweenPlugin : ITweenPlugin where TPlugOptions : struct + { + public abstract void Reset(TweenerCore t); // Resets specific TweenerCore stuff, not the plugin itself + public abstract void SetFrom(TweenerCore t, bool isRelative); + public abstract T2 ConvertToStartValue(TweenerCore t, T1 value); + public abstract void SetRelativeEndValue(TweenerCore t); + public abstract void SetChangeValue(TweenerCore t); + public abstract float GetSpeedBasedDuration(TPlugOptions options, float unitsXSecond, T2 changeValue); + // usingInversePosition is used by PathPlugin to calculate correctly the current waypoint reached + public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition); + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/IPlugSetter.cs b/_DOTween.Assembly/DOTween/Plugins/Core/IPlugSetter.cs new file mode 100644 index 0000000..c6370a0 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/IPlugSetter.cs @@ -0,0 +1,19 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/07 14:52 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core +{ + public interface IPlugSetter + { + DOGetter Getter(); + DOSetter Setter(); + T2 EndValue(); + TPlugOptions GetOptions(); + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/ITPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/Core/ITPlugin.cs new file mode 100644 index 0000000..f1b6891 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/ITPlugin.cs @@ -0,0 +1,14 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/28 09:49 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core +{ + public interface ITPlugin + { + + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/ITweenPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/Core/ITweenPlugin.cs new file mode 100644 index 0000000..7449fda --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/ITweenPlugin.cs @@ -0,0 +1,11 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/07 14:40 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core +{ + public interface ITweenPlugin {} +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ABSPathDecoder.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ABSPathDecoder.cs new file mode 100644 index 0000000..83942ef --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ABSPathDecoder.cs @@ -0,0 +1,26 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 10:47 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +namespace DG.Tweening.Plugins.Core.PathCore +{ + internal abstract class ABSPathDecoder + { + // Finalizes the path, assigning eventual control points and storing all required data + internal abstract void FinalizePath(Path p, Vector3[] wps, bool isClosedPath); + + // Gets a point on the path at the given percentage (0 to 1) + internal abstract Vector3 GetPoint(float perc, Vector3[] wps, Path p, ControlPoint[] controlPoints); + +// // If path is linear subdivisions is ignored +// // and waypointsLength are stored here instead than when calling SetWaypointsLengths +// internal abstract void SetTimeToLengthTables(Path p, int subdivisions); +// +// // If path is linear waypointsLengths were already stored when calling StoreTimeToLenTables +// internal abstract void SetWaypointsLengths(Path p, int subdivisions); + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/CatmullRomDecoder.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/CatmullRomDecoder.cs new file mode 100644 index 0000000..74231e3 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/CatmullRomDecoder.cs @@ -0,0 +1,113 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 11:01 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using UnityEngine; + +namespace DG.Tweening.Plugins.Core.PathCore +{ + internal class CatmullRomDecoder : ABSPathDecoder + { + internal override void FinalizePath(Path p, Vector3[] wps, bool isClosedPath) + { + // Add starting and ending control points (uses only one vector per control point) + int wpsLen = wps.Length; + if (p.controlPoints == null || p.controlPoints.Length != 2) p.controlPoints = new ControlPoint[2]; + if (isClosedPath) { + p.controlPoints[0] = new ControlPoint(wps[wpsLen - 2], Vector3.zero); + p.controlPoints[1] = new ControlPoint(wps[1], Vector3.zero); + } else { + p.controlPoints[0] = new ControlPoint(wps[1], Vector3.zero); + Vector3 lastP = wps[wpsLen - 1]; + Vector3 diffV = lastP - wps[wpsLen - 2]; + p.controlPoints[1] = new ControlPoint(lastP + diffV, Vector3.zero); + } + // Store total subdivisions +// p.subdivisions = (wpsLen + 2) * p.subdivisionsXSegment; + p.subdivisions = wpsLen * p.subdivisionsXSegment; + // Store time to len tables + SetTimeToLengthTables(p, p.subdivisions); + // Store waypoints lengths + SetWaypointsLengths(p, p.subdivisionsXSegment); + } + + // controlPoints as a separate parameter so we can pass custom ones from SetWaypointsLengths + internal override Vector3 GetPoint(float perc, Vector3[] wps, Path p, ControlPoint[] controlPoints) + { + int numSections = wps.Length - 1; // Considering also control points + int tSec = (int)Math.Floor(perc * numSections); + int currPt = numSections - 1; + if (currPt > tSec) currPt = tSec; + float u = perc * numSections - currPt; + + Vector3 a = currPt == 0 ? controlPoints[0].a : wps[currPt - 1]; + Vector3 b = wps[currPt]; + Vector3 c = wps[currPt + 1]; + Vector3 d = currPt + 2 > wps.Length - 1 ? controlPoints[1].a : wps[currPt + 2]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + internal void SetTimeToLengthTables(Path p, int subdivisions) + { + float pathLen = 0; + float incr = 1f / subdivisions; + float[] timesTable = new float[subdivisions]; + float[] lengthsTable = new float[subdivisions]; + Vector3 prevP = GetPoint(0, p.wps, p, p.controlPoints); + for (int i = 1; i < subdivisions + 1; ++i) { + float perc = incr * i; + Vector3 currP = GetPoint(perc, p.wps, p, p.controlPoints); + pathLen += Vector3.Distance(currP, prevP); + prevP = currP; + timesTable[i - 1] = perc; + lengthsTable[i - 1] = pathLen; + } + + // Assign + p.length = pathLen; + p.timesTable = timesTable; + p.lengthsTable = lengthsTable; + } + + internal void SetWaypointsLengths(Path p, int subdivisions) + { + // Create a relative path between each waypoint, + // with its start and end control lines coinciding with the next/prev waypoints. + int count = p.wps.Length; + float[] wpLengths = new float[count]; + wpLengths[0] = 0; + ControlPoint[] partialControlPs = new ControlPoint[2]; + Vector3[] partialWps = new Vector3[2]; + for (int i = 1; i < count; ++i) { + // Create partial path + partialControlPs[0].a = i == 1 ? p.controlPoints[0].a : p.wps[i - 2]; + partialWps[0] = p.wps[i - 1]; + partialWps[1] = p.wps[i]; + partialControlPs[1].a = i == count - 1 ? p.controlPoints[1].a : p.wps[i + 1]; + // Calculate length of partial path + float partialLen = 0; + float incr = 1f / subdivisions; + Vector3 prevP = GetPoint(0, partialWps, p, partialControlPs); + for (int c = 1; c < subdivisions + 1; ++c) { + float perc = incr * c; + Vector3 currP = GetPoint(perc, partialWps, p, partialControlPs); + partialLen += Vector3.Distance(currP, prevP); + prevP = currP; + } + wpLengths[i] = partialLen; + } + + // Assign + p.wpLengths = wpLengths; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs new file mode 100644 index 0000000..773d7f4 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs @@ -0,0 +1,26 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/10/07 11:28 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core.PathCore +{ + /// + /// Path control point + /// + [System.Serializable] + public struct ControlPoint + { + public Vector3 a, b; + + public ControlPoint(Vector3 a, Vector3 b) + { + this.a = a; + this.b = b; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/LinearDecoder.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/LinearDecoder.cs new file mode 100644 index 0000000..e3fb18f --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/LinearDecoder.cs @@ -0,0 +1,80 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 11:02 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +namespace DG.Tweening.Plugins.Core.PathCore +{ + internal class LinearDecoder : ABSPathDecoder + { + internal override void FinalizePath(Path p, Vector3[] wps, bool isClosedPath) + { + p.controlPoints = null; + // Store time to len tables + p.subdivisions = (wps.Length) * p.subdivisionsXSegment; // Unused + SetTimeToLengthTables(p, p.subdivisions); + } + + internal override Vector3 GetPoint(float perc, Vector3[] wps, Path p, ControlPoint[] controlPoints) + { + if (perc <= 0) { + p.linearWPIndex = 1; + return wps[0]; + } + + int startPIndex = 0; + int endPIndex = 0; + int count = p.timesTable.Length; + for (int i = 1; i < count; i++) { + if (p.timesTable[i] >= perc) { + startPIndex = i - 1; + endPIndex = i; + break; + } + } + + float startPPerc = p.timesTable[startPIndex]; + float partialPerc = perc - startPPerc; + float partialLen = p.length * partialPerc; + Vector3 wp0 = wps[startPIndex]; + Vector3 wp1 = wps[endPIndex]; + p.linearWPIndex = endPIndex; + return wp0 + Vector3.ClampMagnitude(wp1 - wp0, partialLen); + } + + // Linear exception: also sets waypoints lengths and doesn't set lengthsTable since it's useless + internal void SetTimeToLengthTables(Path p, int subdivisions) + { + float pathLen = 0; + int wpsLen = p.wps.Length; + float[] wpLengths = new float[wpsLen]; + Vector3 prevP = p.wps[0]; + for (int i = 0; i < wpsLen; i++) { + Vector3 currP = p.wps[i]; + float dist = Vector3.Distance(currP, prevP); + pathLen += dist; + prevP = currP; + wpLengths[i] = dist; + } + float[] timesTable = new float[wpsLen]; + float tmpLen = 0; + for (int i = 1; i < wpsLen; i++) { + tmpLen += wpLengths[i]; + timesTable[i] = tmpLen / pathLen; + } + + // Assign + p.length = pathLen; + p.wpLengths = wpLengths; + p.timesTable = timesTable; + } + + internal void SetWaypointsLengths(Path p, int subdivisions) + { + // Does nothing (waypoints lenghts were stored inside SetTimeToLengthTables) + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs new file mode 100644 index 0000000..2996ff1 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs @@ -0,0 +1,269 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 10:15 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System.Collections.Generic; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Core.PathCore +{ + // Public so it can be used internally as a T2 for PathPlugin. + // Also used by DOTweenPath and relative Inspector to set up visual paths. + [System.Serializable] + public class Path + { + // Static decoders stored to avoid creating new ones each time + static CatmullRomDecoder _catmullRomDecoder; + static LinearDecoder _linearDecoder; + + [SerializeField] internal PathType type; + [SerializeField] internal int subdivisionsXSegment; // Subdivisions x each segment + [SerializeField] internal int subdivisions; // Stored by PathPlugin > total subdivisions for whole path (derived automatically from subdivisionsXSegment) + [SerializeField] internal Vector3[] wps; // Waypoints (modified by PathPlugin when setting relative end value and change value) - also modified by DOTweenPathInspector + [SerializeField] internal ControlPoint[] controlPoints; // Control points used by non-linear paths + [SerializeField] internal float length; // Unit length of the path + [SerializeField] internal float[] wpLengths; // Unit length of each waypoint + [SerializeField] internal bool isFinalized; // TRUE when the path has been finalized (either by starting the tween or if the path was created by the Path Editor) + + [SerializeField] internal float[] timesTable; // Connected to lengthsTable, used for constant speed calculations + [SerializeField] internal float[] lengthsTable; // Connected to timesTable, used for constant speed calculations + internal int linearWPIndex = -1; // Waypoint towards which we're moving (only stored for linear paths, when calling GetPoint) + + ABSPathDecoder _decoder; + + // GIZMOS DATA /////////////////////////////////////////////// + + bool _changed; // Indicates that the path has changed (after an incremental loop moved on/back) and the gizmo points need to be recalculated + internal Vector3[] nonLinearDrawWps; // Used to store non-linear path gizmo points when inside Unity editor (also used by DOTweenPathInspector) + internal Vector3 targetPosition; // Set by PathPlugin at each update + internal Vector3? lookAtPosition; // Set by PathPlugin in case there's a lookAt active + internal Color gizmoColor = new Color(1, 1, 1, 0.7f); + + #region Main + + // *********************************************************************************** + // CONSTRUCTOR + // *********************************************************************************** + + public Path(PathType type, Vector3[] waypoints, int subdivisionsXSegment, Color? gizmoColor = null) + { + this.type = type; + this.subdivisionsXSegment = subdivisionsXSegment; + if (gizmoColor != null) this.gizmoColor = (Color)gizmoColor; + AssignWaypoints(waypoints, true); + AssignDecoder(type); + + if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Add(Draw); + } + + // Needs to be called once waypoints and decoder are assigned, to setup or refresh path data. + internal void FinalizePath(bool isClosedPath, AxisConstraint lockPositionAxes, Vector3 currTargetVal) + { + // Rebuild path to lock eventual axes + if (lockPositionAxes != AxisConstraint.None) { + bool lockX = ((lockPositionAxes & AxisConstraint.X) == AxisConstraint.X); + bool lockY = ((lockPositionAxes & AxisConstraint.Y) == AxisConstraint.Y); + bool lockZ = ((lockPositionAxes & AxisConstraint.Z) == AxisConstraint.Z); + for (int i = 0; i < wps.Length; ++i) { + Vector3 pt = wps[i]; + wps[i] = new Vector3( + lockX ? currTargetVal.x : pt.x, + lockY ? currTargetVal.y : pt.y, + lockZ ? currTargetVal.z : pt.z + ); + } + } + + _decoder.FinalizePath(this, wps, isClosedPath); + isFinalized = true; + } + + /// + /// Gets the point on the path at the given percentage (0 to 1) + /// + /// The percentage (0 to 1) at which to get the point + /// If TRUE constant speed is taken into account, otherwise not + internal Vector3 GetPoint(float perc, bool convertToConstantPerc = false) + { + if (convertToConstantPerc) perc = ConvertToConstantPathPerc(perc); + return _decoder.GetPoint(perc, wps, this, controlPoints); + } + + // Converts the given raw percentage to the correct percentage considering constant speed + internal float ConvertToConstantPathPerc(float perc) + { + if (type == PathType.Linear) return perc; + + if (perc > 0 && perc < 1) { + float tLen = length * perc; + // Find point in time/length table + float t0 = 0, l0 = 0, t1 = 0, l1 = 0; + int count = lengthsTable.Length; + for (int i = 0; i < count; ++i) { + if (lengthsTable[i] > tLen) { + t1 = timesTable[i]; + l1 = lengthsTable[i]; + if (i > 0) l0 = lengthsTable[i - 1]; + break; + } + t0 = timesTable[i]; + } + // Find correct time + perc = t0 + ((tLen - l0) / (l1 - l0)) * (t1 - t0); + } + + // Clamp value because path has limited range of 0-1 + if (perc > 1) perc = 1; + else if (perc < 0) perc = 0; + + return perc; + } + + // Returns the waypoint associated with the given path percentage + internal int GetWaypointIndexFromPerc(float perc, bool isMovingForward) + { + if (perc >= 1) return wps.Length - 1; + if (perc <= 0) return 0; + float totPercLen = length * perc; + float currLen = 0; + for (int i = 0, count = wpLengths.Length; i < count; i++) { + currLen += wpLengths[i]; + if (currLen < totPercLen) continue; + if (currLen > totPercLen) return isMovingForward ? i - 1 : i; + return i; + } + return 0; + } + + // Refreshes the waypoints used to draw non-linear gizmos and the PathInspector scene view. + // Called by Draw method or by DOTweenPathInspector + internal static void RefreshNonLinearDrawWps(Path p) + { + int wpsCount = p.wps.Length; + + int gizmosSubdivisions = wpsCount * 10; + if (p.nonLinearDrawWps == null || p.nonLinearDrawWps.Length != gizmosSubdivisions + 1) + p.nonLinearDrawWps = new Vector3[gizmosSubdivisions + 1]; + for (int i = 0; i <= gizmosSubdivisions; ++i) { + float perc = i / (float)gizmosSubdivisions; + Vector3 wp = p.GetPoint(perc); + p.nonLinearDrawWps[i] = wp; + } + } + + // Stops drawing the path gizmo + internal void Destroy() + { + if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Remove(Draw); + wps = null; + wpLengths = timesTable = lengthsTable = null; + nonLinearDrawWps = null; + isFinalized = false; + } + + #endregion + + // Deletes the previous waypoints and assigns the new ones + // (newWps length must be at least 1). + // Internal so DOTweenPathInspector can use it + internal void AssignWaypoints(Vector3[] newWps, bool cloneWps = false) + { + if (cloneWps) { + int count = newWps.Length; + wps = new Vector3[count]; + for (int i = 0; i < count; ++i) wps[i] = newWps[i]; + } else wps = newWps; + } +// // Deletes the previous waypoints and assigns the new ones, always cloning them +// // (newWps length must be at least 1). +// // Internal so DOTweenPathInspector can use it +// internal void AssignWaypoints(List newWps) +// { +// int count = newWps.Count; +// wps = new Vector3[count]; +// for (int i = 0; i < count; ++i) wps[i] = newWps[i]; +// } + + // Internal so DOTweenPathInspector and DOTweenPath can use it + internal void AssignDecoder(PathType pathType) + { + type = pathType; + switch (pathType) { + case PathType.Linear: + if (_linearDecoder == null) _linearDecoder = new LinearDecoder(); + _decoder = _linearDecoder; + break; + default: // Catmull-Rom + if (_catmullRomDecoder == null) _catmullRomDecoder = new CatmullRomDecoder(); + _decoder = _catmullRomDecoder; + break; + } + } + +// // If path is linear wpLengths were stored when calling FinalizePath +// void StoreWaypointsLengths() +// { +// _decoder.SetWaypointsLengths(this, subdivisions); +// } + + // Used in DOTween.OnDrawGizmos if we're inside Unity Editor + // and in DOTweenPath when setting up the pre-compiled path + internal void Draw() { Draw(this); } + static void Draw(Path p) + { + if (p.timesTable == null) return; + + Color gizmosFadedCol = p.gizmoColor; + gizmosFadedCol.a *= 0.5f; + Gizmos.color = p.gizmoColor; + int wpsCount = p.wps.Length; + + if (p._changed || p.type != PathType.Linear && p.nonLinearDrawWps == null) { + p._changed = false; + if (p.type != PathType.Linear) { + // Store draw points + RefreshNonLinearDrawWps(p); + } + } + + // Draw path + Vector3 currPt; + Vector3 prevPt; + switch (p.type) { + case PathType.Linear: + prevPt = p.wps[0]; + for (int i = 0; i < wpsCount; ++i) { + currPt = p.wps[i]; + Gizmos.DrawLine(currPt, prevPt); + prevPt = currPt; + } + break; + default: // Curved + prevPt = p.nonLinearDrawWps[0]; + int count = p.nonLinearDrawWps.Length; + for (int i = 1; i < count; ++i) { + currPt = p.nonLinearDrawWps[i]; + Gizmos.DrawLine(currPt, prevPt); + prevPt = currPt; + } + break; + } + + Gizmos.color = gizmosFadedCol; + const float spheresSize = 0.075f; + + // Draw path control points + for (int i = 0; i < wpsCount; ++i) Gizmos.DrawSphere(p.wps[i], spheresSize); + + // Draw eventual path lookAt + if (p.lookAtPosition != null) { + Vector3 lookAtP = (Vector3)p.lookAtPosition; + Gizmos.DrawLine(p.targetPosition, lookAtP); + Gizmos.DrawWireSphere(lookAtP, spheresSize); + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PluginsManager.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PluginsManager.cs new file mode 100644 index 0000000..dba849a --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PluginsManager.cs @@ -0,0 +1,131 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/06 18:11 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Collections.Generic; +using DG.Tweening.Core; +using UnityEngine; + +namespace DG.Tweening.Plugins.Core +{ + internal static class PluginsManager + { + // Default plugins + static ITweenPlugin _floatPlugin; + static ITweenPlugin _intPlugin; + static ITweenPlugin _uintPlugin; + static ITweenPlugin _vector2Plugin; + static ITweenPlugin _vector3Plugin; + static ITweenPlugin _vector4Plugin; + static ITweenPlugin _quaternionPlugin; + static ITweenPlugin _colorPlugin; + static ITweenPlugin _rectPlugin; + static ITweenPlugin _rectOffsetPlugin; + static ITweenPlugin _stringPlugin; + static ITweenPlugin _vector3ArrayPlugin; + static ITweenPlugin _color2Plugin; + + // Advanced and custom plugins + const int _MaxCustomPlugins = 20; + static Dictionary _customPlugins; + + // =================================================================================== + // INTERNAL METHODS ------------------------------------------------------------------ + + internal static ABSTweenPlugin GetDefaultPlugin() where TPlugOptions : struct + { + Type t1 = typeof(T1); + Type t2 = typeof(T2); + ITweenPlugin plugin = null; + + if (t1 == typeof(Vector3)) { + if (t1 == t2) { + if (_vector3Plugin == null) _vector3Plugin = new Vector3Plugin(); + plugin = _vector3Plugin; + } else if (t2 == typeof(Vector3[])) { + if (_vector3ArrayPlugin == null) _vector3ArrayPlugin = new Vector3ArrayPlugin(); + plugin = _vector3ArrayPlugin; + } + } else if (t1 == typeof(Quaternion)) { + if (t2 == typeof(Quaternion)) Debugger.LogError("Quaternion tweens require a Vector3 endValue"); + else { + if (_quaternionPlugin == null) _quaternionPlugin = new QuaternionPlugin(); + plugin = _quaternionPlugin; + } + } else if (t1 == typeof(Vector2)) { + if (_vector2Plugin == null) _vector2Plugin = new Vector2Plugin(); + plugin = _vector2Plugin; + } else if (t1 == typeof(float)) { + if (_floatPlugin == null) _floatPlugin = new FloatPlugin(); + plugin = _floatPlugin; + } else if (t1 == typeof(Color)) { + if (_colorPlugin == null) _colorPlugin = new ColorPlugin(); + plugin = _colorPlugin; + } else if (t1 == typeof(int)) { + if (_intPlugin == null) _intPlugin = new IntPlugin(); + plugin = _intPlugin; + } else if (t1 == typeof(Vector4)) { + if (_vector4Plugin == null) _vector4Plugin = new Vector4Plugin(); + plugin = _vector4Plugin; + } else if (t1 == typeof(Rect)) { + if (_rectPlugin == null) _rectPlugin = new RectPlugin(); + plugin = _rectPlugin; + } else if (t1 == typeof(RectOffset)) { + if (_rectOffsetPlugin == null) _rectOffsetPlugin = new RectOffsetPlugin(); + plugin = _rectOffsetPlugin; + } else if (t1 == typeof(uint)) { + if (_uintPlugin == null) _uintPlugin = new UintPlugin(); + plugin = _uintPlugin; + } else if (t1 == typeof(string)) { + if (_stringPlugin == null) _stringPlugin = new StringPlugin(); + plugin = _stringPlugin; + } else if (t1 == typeof(Color2)) { + if (_color2Plugin == null) _color2Plugin = new Color2Plugin(); + plugin = _color2Plugin; + } + + if (plugin != null) return plugin as ABSTweenPlugin; + + return null; + } + + // Public so it can be used by custom plugins Get method + public static ABSTweenPlugin GetCustomPlugin() + where TPlugin : ITweenPlugin, new() + where TPlugOptions : struct + { + Type t = typeof(TPlugin); + ITweenPlugin plugin; + + if (_customPlugins == null) _customPlugins = new Dictionary(_MaxCustomPlugins); + else if (_customPlugins.TryGetValue(t, out plugin)) return plugin as ABSTweenPlugin; + + plugin = new TPlugin(); + _customPlugins.Add(t, plugin); + return plugin as ABSTweenPlugin; + } + + // Un-caches all plugins + internal static void PurgeAll() + { + _floatPlugin = null; + _intPlugin = null; + _uintPlugin = null; + _vector2Plugin = null; + _vector3Plugin = null; + _vector4Plugin = null; + _quaternionPlugin = null; + _colorPlugin = null; + _rectPlugin = null; + _rectOffsetPlugin = null; + _stringPlugin = null; + _vector3ArrayPlugin = null; + _color2Plugin = null; + + if (_customPlugins != null) _customPlugins.Clear(); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/SpecialPluginsUtils.cs b/_DOTween.Assembly/DOTween/Plugins/Core/SpecialPluginsUtils.cs new file mode 100644 index 0000000..91499e6 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Core/SpecialPluginsUtils.cs @@ -0,0 +1,83 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/21 13:08 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +namespace DG.Tweening.Plugins.Core +{ + // Utils for special plugins + internal static class SpecialPluginsUtils + { + // Returns TRUE if it's successful, FALSE otherwise + internal static bool SetLookAt(TweenerCore t) + { + Transform trans = t.target as Transform; + Vector3 towards = t.endValue; + towards -= trans.position; + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + towards.x = 0; + break; + case AxisConstraint.Y: + towards.y = 0; + break; + case AxisConstraint.Z: + towards.z = 0; + break; + } + Vector3 lookAtRotation = Quaternion.LookRotation(towards, t.plugOptions.up).eulerAngles; + t.endValue = lookAtRotation; + return true; + } + + // Returns TRUE if it's successful, FALSE otherwise + internal static bool SetPunch(TweenerCore t) + { + Vector3 startupVal; + try { + startupVal = t.getter(); + } catch { return false; } + + // Force specific settings + t.isRelative = t.isSpeedBased = false; + t.easeType = Ease.OutQuad; + t.customEase = null; + + int len = t.endValue.Length; + for (int i = 0; i < len; i++) t.endValue[i] = t.endValue[i] + startupVal; + return true; + } + + // Returns TRUE if it's successful, FALSE otherwise + internal static bool SetShake(TweenerCore t) + { + if (!SetPunch(t)) return false; + t.easeType = Ease.Linear; + return true; + } + + // Returns TRUE if it's successful, FALSE otherwise + // Behaves like a regular shake, but also changes the endValues so that they reflect the local axis rotation of the camera + internal static bool SetCameraShakePosition(TweenerCore t) + { + if (!SetShake(t)) return false; + + Camera target = t.target as Camera; + if (target == null) return false; + + Vector3 startupVal = t.getter(); + Transform trans = target.transform; + int len = t.endValue.Length; + for (int i = 0; i < len; i++) { + Vector3 endVal = t.endValue[i]; + t.endValue[i] = (trans.localRotation * (endVal - startupVal)) + startupVal; + } + return true; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/FloatPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/FloatPlugin.cs new file mode 100644 index 0000000..1ea37a0 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/FloatPlugin.cs @@ -0,0 +1,66 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/06 16:33 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class FloatPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + float prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + t.setter(!t.plugOptions.snapping ? t.startValue : (float)Math.Round(t.startValue)); + } + + public override float ConvertToStartValue(TweenerCore t, float value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(FloatOptions options, float unitsXSecond, float changeValue) + { + float res = changeValue / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + setter( + !options.snapping + ? startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod) + : (float)Math.Round(startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)) + ); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/IntPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/IntPlugin.cs new file mode 100644 index 0000000..4068cd3 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/IntPlugin.cs @@ -0,0 +1,57 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 14:15 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class IntPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + int prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + t.setter(t.startValue); + } + + public override int ConvertToStartValue(TweenerCore t, int value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, int changeValue) + { + float res = changeValue / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, int startValue, int changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + + setter((int)Math.Round(startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod))); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/ColorOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/ColorOptions.cs new file mode 100644 index 0000000..cd78c7e --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/ColorOptions.cs @@ -0,0 +1,14 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/28 12:27 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct ColorOptions + { + public bool alphaOnly; + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/FloatOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/FloatOptions.cs new file mode 100644 index 0000000..239e6c0 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/FloatOptions.cs @@ -0,0 +1,14 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/08 18:37 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct FloatOptions + { + public bool snapping; + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/NoOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/NoOptions.cs new file mode 100644 index 0000000..8bd411c --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/NoOptions.cs @@ -0,0 +1,11 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/08 17:34 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct NoOptions {} +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/PathOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/PathOptions.cs new file mode 100644 index 0000000..ce0a8cb --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/PathOptions.cs @@ -0,0 +1,36 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/10/02 11:58 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public enum OrientType + { + None, + ToPath, + LookAtTransform, + LookAtPosition + } + + public struct PathOptions + { + public PathMode mode; + public OrientType orientType; + public AxisConstraint lockPositionAxis, lockRotationAxis; + public bool isClosedPath; + public Vector3 lookAtPosition; + public Transform lookAtTransform; + public float lookAhead; + public bool hasCustomForwardDirection; + public Quaternion forward; + public bool useLocalPosition; + public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE + + internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/QuaternionOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/QuaternionOptions.cs new file mode 100644 index 0000000..d61b5f4 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/QuaternionOptions.cs @@ -0,0 +1,18 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/01 18:50 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct QuaternionOptions + { + internal RotateMode rotateMode; + internal AxisConstraint axisConstraint; // Used by SpecialStartupMode SetLookAt + internal Vector3 up; // Used by SpecialStartupMode SetLookAt + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/RectOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/RectOptions.cs new file mode 100644 index 0000000..18b2c2c --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/RectOptions.cs @@ -0,0 +1,14 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 19:18 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct RectOptions + { + public bool snapping; + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/StringOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/StringOptions.cs new file mode 100644 index 0000000..ba7c62c --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/StringOptions.cs @@ -0,0 +1,15 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/13 16:37 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct StringOptions + { + public bool scramble; + public char[] scrambledChars; // If empty uses default scramble characters + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/Vector3ArrayOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/Vector3ArrayOptions.cs new file mode 100644 index 0000000..d1c1e2b --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/Vector3ArrayOptions.cs @@ -0,0 +1,17 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/21 12:11 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct Vector3ArrayOptions + { + public AxisConstraint axisConstraint; + public bool snapping; + + internal float[] durations; // Duration of each segment + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Options/VectorOptions.cs b/_DOTween.Assembly/DOTween/Plugins/Options/VectorOptions.cs new file mode 100644 index 0000000..15e78b7 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Options/VectorOptions.cs @@ -0,0 +1,15 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/28 11:23 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins.Options +{ + public struct VectorOptions + { + public AxisConstraint axisConstraint; + public bool snapping; + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs new file mode 100644 index 0000000..3d190a5 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs @@ -0,0 +1,195 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/03 19:36 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + /// + /// Path plugin works exclusively with Transforms + /// + public class PathPlugin : ABSTweenPlugin + { + public const float MinLookAhead = 0.0001f; + + public override void Reset(TweenerCore t) + { + t.endValue.Destroy(); // Clear path + t.startValue = t.endValue = t.changeValue = null; + } + + public override void SetFrom(TweenerCore t, bool isRelative) {} + + public static ABSTweenPlugin Get() + { + return PluginsManager.GetCustomPlugin(); + } + + public override Path ConvertToStartValue(TweenerCore t, Vector3 value) + { + // Simply sets the same path as start and endValue + return t.endValue; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + if (t.endValue.isFinalized) return; + + Vector3 startP = t.getter(); + int count = t.endValue.wps.Length; + for (int i = 0; i < count; ++i) t.endValue.wps[i] += startP; + } + + // Recreates waypoints with correct control points and eventual additional starting point + // then sets the final path version + public override void SetChangeValue(TweenerCore t) + { + if (t.endValue.isFinalized) { + t.changeValue = t.endValue; + return; + } + + Vector3 currVal = t.getter(); + Path path = t.endValue; + int unmodifiedWpsLen = path.wps.Length; + int additionalWps = 0; + bool hasAdditionalStartingP = false, hasAdditionalEndingP = false; + + // Create final wps and add eventual starting/ending waypoints + if (path.wps[0] != currVal) { + hasAdditionalStartingP = true; + additionalWps += 1; + } + if (t.plugOptions.isClosedPath && path.wps[unmodifiedWpsLen - 1] != currVal) { + hasAdditionalEndingP = true; + additionalWps += 1; + } + int wpsLen = unmodifiedWpsLen + additionalWps; + Vector3[] wps = new Vector3[wpsLen]; + int indMod = hasAdditionalStartingP ? 1 : 0; + if (hasAdditionalStartingP) wps[0] = currVal; + for (int i = 0; i < unmodifiedWpsLen; ++i) wps[i + indMod] = path.wps[i]; + if (hasAdditionalEndingP) wps[wps.Length - 1] = wps[0]; + path.wps = wps; + + // Finalize path + path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal); + + Transform trans = (Transform)t.target; + t.plugOptions.startupZRot = trans.eulerAngles.z; + if (t.plugOptions.orientType == OrientType.ToPath && t.plugOptions.useLocalPosition) t.plugOptions.parent = trans.parent; + + // Set changeValue as a reference to endValue + t.changeValue = t.endValue; + } + + public override float GetSpeedBasedDuration(PathOptions options, float unitsXSecond, Path changeValue) + { + return changeValue.length / unitsXSecond; + } + + public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition) + { + float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc); + Vector3 newPos = changeValue.GetPoint(constantPathPerc); + changeValue.targetPosition = newPos; // Used to draw editor gizmos + setter(newPos); + + if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) SetOrientation(options, t, changeValue, constantPathPerc, newPos); + + // Determine if current waypoint changed and eventually dispatch callback + bool isForward = !usingInversePosition; + if (t.isBackwards) isForward = !isForward; + int newWaypointIndex = changeValue.GetWaypointIndexFromPerc(pathPerc, isForward); + if (newWaypointIndex != t.miscInt) { + t.miscInt = newWaypointIndex; + if (t.onWaypointChange != null) Tween.OnTweenCallback(t.onWaypointChange, newWaypointIndex); + } + } + + // Public so it can be called by GotoWaypoint + public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos) + { + Transform trans = (Transform)t.target; + Quaternion newRot = Quaternion.identity; + + switch (options.orientType) { + case OrientType.LookAtPosition: + path.lookAtPosition = options.lookAtPosition; // Used to draw editor gizmos + newRot = Quaternion.LookRotation(options.lookAtPosition - trans.position, trans.up); + break; + case OrientType.LookAtTransform: + if (options.lookAtTransform != null) { + path.lookAtPosition = options.lookAtTransform.position; // Used to draw editor gizmos + newRot = Quaternion.LookRotation(options.lookAtTransform.position - trans.position, trans.up); + } + break; + case OrientType.ToPath: + Vector3 lookAtP; + if (path.type == PathType.Linear && options.lookAhead <= MinLookAhead) { + // Calculate lookAhead so that it doesn't turn until it starts moving on next waypoint + lookAtP = tPos + path.wps[path.linearWPIndex] - path.wps[path.linearWPIndex - 1]; + } else { + float lookAheadPerc = pathPerc + options.lookAhead; + if (lookAheadPerc > 1) lookAheadPerc = (options.isClosedPath ? lookAheadPerc - 1 : 1.00001f); + lookAtP = path.GetPoint(lookAheadPerc); + } + Vector3 transUp = trans.up; + // Apply basic modification for local position movement + if (options.useLocalPosition && options.parent != null) lookAtP = options.parent.TransformPoint(lookAtP); + // LookAt axis constraint + if (options.lockRotationAxis != AxisConstraint.None) { + if ((options.lockRotationAxis & AxisConstraint.X) == AxisConstraint.X) { + Vector3 v0 = trans.InverseTransformPoint(lookAtP); + v0.y = 0; + lookAtP = trans.TransformPoint(v0); + transUp = options.useLocalPosition && options.parent != null ? options.parent.up : Vector3.up; + } + if ((options.lockRotationAxis & AxisConstraint.Y) == AxisConstraint.Y) { + Vector3 v0 = trans.InverseTransformPoint(lookAtP); + if (v0.z < 0) v0.z = -v0.z; + v0.x = 0; + lookAtP = trans.TransformPoint(v0); + } + if ((options.lockRotationAxis & AxisConstraint.Z) == AxisConstraint.Z) { + // Fix to allow racing loops to keep cars straight and not flip it + if (options.useLocalPosition && options.parent != null) transUp = options.parent.TransformDirection(Vector3.up); + else transUp = trans.TransformDirection(Vector3.up); + transUp.z = options.startupZRot; + } + } + if (options.mode == PathMode.Full3D) { + // 3D path + Vector3 diff = lookAtP - trans.position; + if (diff == Vector3.zero) diff = trans.forward; + newRot = Quaternion.LookRotation(diff, transUp); + } else { + // 2D path + float rotY = 0; + float rotZ = Utils.Angle2D(trans.position, lookAtP); + if (rotZ < 0) rotZ = 360 + rotZ; + if (options.mode == PathMode.Sidescroller2D) { + // Manage Y and modified Z rotation + rotY = lookAtP.x < trans.position.x ? 180 : 0; + if (rotZ > 90 && rotZ < 270) rotZ = 180 - rotZ; + } + newRot = Quaternion.Euler(0, rotY, rotZ); + } + break; + } + + if (options.hasCustomForwardDirection) newRot *= options.forward; + trans.rotation = newRot; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/QuaternionPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/QuaternionPlugin.cs new file mode 100644 index 0000000..29c2f9e --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/QuaternionPlugin.cs @@ -0,0 +1,111 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/07 20:02 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class QuaternionPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector3 prevEndVal = t.endValue; + t.endValue = t.getter().eulerAngles; + if (t.plugOptions.rotateMode == RotateMode.Fast && !t.isRelative) { + t.startValue = prevEndVal; + } else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360) { + t.startValue = t.endValue + prevEndVal; + } else { + Quaternion rot = t.getter(); + if (t.plugOptions.rotateMode == RotateMode.WorldAxisAdd) { + t.startValue = (rot * Quaternion.Inverse(rot) * Quaternion.Euler(prevEndVal) * rot).eulerAngles; + } else { + t.startValue = (rot * Quaternion.Euler(prevEndVal)).eulerAngles; + } + t.endValue = -prevEndVal; + } + t.setter(Quaternion.Euler(t.startValue)); + } + + public override Vector3 ConvertToStartValue(TweenerCore t, Quaternion value) + { + return value.eulerAngles; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + if (t.plugOptions.rotateMode == RotateMode.Fast && !t.isRelative) { + // Rotation will be adapted to 360° and will take the shortest route + // - Adapt to 360° + Vector3 ev = t.endValue; + if (ev.x > 360) ev.x = ev.x % 360; + if (ev.y > 360) ev.y = ev.y % 360; + if (ev.z > 360) ev.z = ev.z % 360; + Vector3 changeVal = ev - t.startValue; + // - Find shortest rotation + float abs = (changeVal.x > 0 ? changeVal.x : -changeVal.x); + if (abs > 180) changeVal.x = changeVal.x > 0 ? -(360 - abs) : 360 - abs; + abs = (changeVal.y > 0 ? changeVal.y : -changeVal.y); + if (abs > 180) changeVal.y = changeVal.y > 0 ? -(360 - abs) : 360 - abs; + abs = (changeVal.z > 0 ? changeVal.z : -changeVal.z); + if (abs > 180) changeVal.z = changeVal.z > 0 ? -(360 - abs) : 360 - abs; + // - Assign + t.changeValue = changeVal; + } else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360) { + t.changeValue = t.endValue - t.startValue; + } else { + t.changeValue = t.endValue; + } + } + + public override float GetSpeedBasedDuration(QuaternionOptions options, float unitsXSecond, Vector3 changeValue) + { + return changeValue.magnitude / unitsXSecond; + } + + public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) + { + Vector3 endValue = startValue; + + if (t.loopType == LoopType.Incremental) endValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + endValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + switch (options.rotateMode) { + case RotateMode.WorldAxisAdd: + case RotateMode.LocalAxisAdd: + Quaternion startRot = Quaternion.Euler(startValue); // Reset rotation + endValue.x = changeValue.x * easeVal; + endValue.y = changeValue.y * easeVal; + endValue.z = changeValue.z * easeVal; + if (options.rotateMode == RotateMode.WorldAxisAdd) setter(startRot * Quaternion.Inverse(startRot) * Quaternion.Euler(endValue) * startRot); + else setter(startRot * Quaternion.Euler(endValue)); + break; + default: + endValue.x += changeValue.x * easeVal; + endValue.y += changeValue.y * easeVal; + endValue.z += changeValue.z * easeVal; + setter(Quaternion.Euler(endValue)); + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/RectOffsetPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/RectOffsetPlugin.cs new file mode 100644 index 0000000..f8fe406 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/RectOffsetPlugin.cs @@ -0,0 +1,110 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/11 13:04 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + // BEWARE: RectOffset seems a struct but is a class + // USING THIS PLUGIN WILL GENERATE GC ALLOCATIONS + public class RectOffsetPlugin : ABSTweenPlugin + { + static RectOffset _r = new RectOffset(); // Used to store incremental values without creating a new RectOffset each time + + public override void Reset(TweenerCore t) + { + t.startValue = t.endValue = t.changeValue = null; + } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + RectOffset prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = prevEndVal; + if (isRelative) { + t.startValue.left += t.endValue.left; + t.startValue.right += t.endValue.right; + t.startValue.top += t.endValue.top; + t.startValue.bottom += t.endValue.bottom; + } + t.setter(t.startValue); + } + + public override RectOffset ConvertToStartValue(TweenerCore t, RectOffset value) + { + return new RectOffset(value.left, value.right, value.top, value.bottom); + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue.left += t.startValue.left; + t.endValue.right += t.startValue.right; + t.endValue.top += t.startValue.top; + t.endValue.bottom += t.startValue.bottom; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = new RectOffset( + t.endValue.left - t.startValue.left, + t.endValue.right - t.startValue.right, + t.endValue.top - t.startValue.top, + t.endValue.bottom - t.startValue.bottom + ); + } + + public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, RectOffset changeValue) + { + // Uses length of diagonal to calculate units. + float diffW = changeValue.right; + if (diffW < 0) diffW = -diffW; + float diffH = changeValue.bottom; + if (diffH < 0) diffH = -diffH; + float diag = (float)Math.Sqrt(diffW * diffW + diffH * diffH); + return diag / unitsXSecond; + } + + public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, RectOffset startValue, RectOffset changeValue, float duration, bool usingInversePosition) + { + _r.left = startValue.left; + _r.right = startValue.right; + _r.top = startValue.top; + _r.bottom = startValue.bottom; + + if (t.loopType == LoopType.Incremental) { + int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; + _r.left += changeValue.left * iterations; + _r.right += changeValue.right * iterations; + _r.top += changeValue.top * iterations; + _r.bottom += changeValue.bottom * iterations; + } + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + int iterations = (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + _r.left += changeValue.left * iterations; + _r.right += changeValue.right * iterations; + _r.top += changeValue.top * iterations; + _r.bottom += changeValue.bottom * iterations; + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + setter( + new RectOffset( + (int)Math.Round(_r.left + changeValue.left * easeVal), + (int)Math.Round(_r.right + changeValue.right * easeVal), + (int)Math.Round(_r.top + changeValue.top * easeVal), + (int)Math.Round(_r.bottom + changeValue.bottom * easeVal) + ) + ); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/RectPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/RectPlugin.cs new file mode 100644 index 0000000..e4df111 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/RectPlugin.cs @@ -0,0 +1,106 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 19:17 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class RectPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Rect prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = prevEndVal; + if (isRelative) { + t.startValue.x += t.endValue.x; + t.startValue.y += t.endValue.y; + t.startValue.width += t.endValue.width; + t.startValue.height += t.endValue.height; + } + Rect to = t.startValue; + if (t.plugOptions.snapping) { + to.x = (float)Math.Round(to.x); + to.y = (float)Math.Round(to.y); + to.width = (float)Math.Round(to.width); + to.height = (float)Math.Round(to.height); + } + t.setter(to); + } + + public override Rect ConvertToStartValue(TweenerCore t, Rect value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue.x += t.startValue.x; + t.endValue.y += t.startValue.y; + t.endValue.width += t.startValue.width; + t.endValue.height += t.startValue.height; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = new Rect( + t.endValue.x - t.startValue.x, + t.endValue.y - t.startValue.y, + t.endValue.width - t.startValue.width, + t.endValue.height - t.startValue.height + ); + } + + public override float GetSpeedBasedDuration(RectOptions options, float unitsXSecond, Rect changeValue) + { + // Uses length of diagonal to calculate units. + float diffW = changeValue.width; + float diffH = changeValue.height; + float diag = (float)Math.Sqrt(diffW * diffW + diffH * diffH); + return diag / unitsXSecond; + } + + public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) { + int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; + startValue.x += changeValue.x * iterations; + startValue.y += changeValue.y * iterations; + startValue.width += changeValue.width * iterations; + startValue.height += changeValue.height * iterations; + } + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + int iterations = (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + startValue.x += changeValue.x * iterations; + startValue.y += changeValue.y * iterations; + startValue.width += changeValue.width * iterations; + startValue.height += changeValue.height * iterations; + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + startValue.x += changeValue.x * easeVal; + startValue.y += changeValue.y * easeVal; + startValue.width += changeValue.width * easeVal; + startValue.height += changeValue.height * easeVal; + if (options.snapping) { + startValue.x = (float)Math.Round(startValue.x); + startValue.y = (float)Math.Round(startValue.y); + startValue.width = (float)Math.Round(startValue.width); + startValue.height = (float)Math.Round(startValue.height); + } + setter(startValue); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/StringPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/StringPlugin.cs new file mode 100644 index 0000000..6d2e14a --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/StringPlugin.cs @@ -0,0 +1,160 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/11 11:34 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Text; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; +using Random = UnityEngine.Random; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + // USING THIS PLUGIN WILL GENERATE GC ALLOCATIONS + public class StringPlugin : ABSTweenPlugin + { + static readonly StringBuilder _Buffer = new StringBuilder(); + + public override void SetFrom(TweenerCore t, bool isRelative) + { + string prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = prevEndVal; + t.setter(t.startValue); + } + + public override void Reset(TweenerCore t) + { + t.startValue = t.endValue = t.changeValue = null; + } + + public override string ConvertToStartValue(TweenerCore t, string value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + // Do nothing (endValue stays the same) + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue; + } + + public override float GetSpeedBasedDuration(StringOptions options, float unitsXSecond, string changeValue) + { + float res = changeValue.Length / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + // ChangeValue is the same as endValue in this plugin + public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition) + { + _Buffer.Remove(0, _Buffer.Length); + + // Incremental works only with relative tweens (otherwise the tween makes no sense) + // Sequence with Incremental loops have no effect here (why should they?) + if (isRelative && t.loopType == LoopType.Incremental) { + int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; + if (iterations > 0) { + _Buffer.Append(startValue); + for (int i = 0; i < iterations; ++i) _Buffer.Append(changeValue); + startValue = _Buffer.ToString(); + _Buffer.Remove(0, _Buffer.Length); + } + } + + int startValueLen = startValue.Length; + int changeValueLen = changeValue.Length; + int len = (int)Math.Round(changeValueLen * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)); + if (len > changeValueLen) len = changeValueLen; + else if (len < 0) len = 0; + + if (isRelative) { + _Buffer.Append(startValue); + if (options.scramble) { + setter(_Buffer.Append(changeValue, 0, len).AppendScrambledChars(changeValueLen - len, options.scrambledChars ?? StringPluginExtensions.ScrambledChars).ToString()); + return; + } + setter(_Buffer.Append(changeValue, 0, len).ToString()); + return; + } + + if (options.scramble) { + setter(_Buffer.Append(changeValue, 0, len).AppendScrambledChars(changeValueLen - len, options.scrambledChars ?? StringPluginExtensions.ScrambledChars).ToString()); + return; + } + + int diff = startValueLen - changeValueLen; + int startValueMaxLen = startValueLen; + if (diff > 0) { + // String to be replaced is longer than endValue: remove parts of it while tweening + float perc = (float)len / changeValueLen; + startValueMaxLen -= (int)(startValueMaxLen * perc); + } else startValueMaxLen -= len; + _Buffer.Append(changeValue, 0, len); + if (len < changeValueLen && len < startValueLen) _Buffer.Append(startValue, len, startValueMaxLen); + setter(_Buffer.ToString()); + } + } + + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // ||| CLASS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + internal static class StringPluginExtensions + { + public static readonly char[] ScrambledChars = new[] { + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Y','Z', +// 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','y','z', +// '1','2','3','4','5','6','7','8','9','0' + }; + static int _lastRndSeed; + + static StringPluginExtensions() + { + ScrambledChars.ScrambleChars(); + } + + internal static void ScrambleChars(this char[] chars) + { + // Shuffle chars (uses Knuth shuggle algorithm) + int len = chars.Length; + for (int i = 0; i < len; i++) { + char tmp = chars[i]; + int r = Random.Range(i, len); + chars[i] = chars[r]; + chars[r] = tmp; + } + } + + internal static StringBuilder AppendScrambledChars(this StringBuilder buffer, int length, char[] chars) + { + if (length <= 0) return buffer; + + // Make sure random seed is different from previous one used + int len = chars.Length; + int rndSeed = _lastRndSeed; + while (rndSeed == _lastRndSeed) { + rndSeed = Random.Range(0, len); + } + _lastRndSeed = rndSeed; + // Append + for (int i = 0; i < length; ++i) { + if (rndSeed >= len) rndSeed = 0; + buffer.Append(chars[rndSeed]); + rndSeed += 1; + } + return buffer; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/UintPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/UintPlugin.cs new file mode 100644 index 0000000..2772f46 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/UintPlugin.cs @@ -0,0 +1,61 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 19:24 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class UintPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + uint prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + t.setter(t.startValue); + } + + public override uint ConvertToStartValue(TweenerCore t, uint value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + t.changeValue = t.endValue - t.startValue; + } + + public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, uint changeValue) + { + float res = changeValue / unitsXSecond; + if (res < 0) res = -res; + return res; + } + + public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += (uint)(changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops)); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += (uint)(changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops)); + } + + setter((uint)Math.Round(startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod))); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Vector2Plugin.cs b/_DOTween.Assembly/DOTween/Plugins/Vector2Plugin.cs new file mode 100644 index 0000000..d34f95b --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Vector2Plugin.cs @@ -0,0 +1,109 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 16:51 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class Vector2Plugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector2 prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + Vector2 to = t.endValue; + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + to.x = t.startValue.x; + break; + case AxisConstraint.Y: + to.y = t.startValue.y; + break; + default: + to = t.startValue; + break; + } + if (t.plugOptions.snapping) { + to.x = (float)Math.Round(to.x); + to.y = (float)Math.Round(to.y); + } + t.setter(to); + } + + public override Vector2 ConvertToStartValue(TweenerCore t, Vector2 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + t.changeValue = new Vector2(t.endValue.x - t.startValue.x, 0); + break; + case AxisConstraint.Y: + t.changeValue = new Vector2(0, t.endValue.y - t.startValue.y); + break; + default: + t.changeValue = t.endValue - t.startValue; + break; + } + } + + public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector2 changeValue) + { + return changeValue.magnitude / unitsXSecond; + } + + public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + switch (options.axisConstraint) { + case AxisConstraint.X: + Vector2 resX = getter(); + resX.x = startValue.x + changeValue.x * easeVal; + if (options.snapping) resX.x = (float)Math.Round(resX.x); + setter(resX); + break; + case AxisConstraint.Y: + Vector2 resY = getter(); + resY.y = startValue.y + changeValue.y * easeVal; + if (options.snapping) resY.y = (float)Math.Round(resY.y); + setter(resY); + break; + default: + startValue.x += changeValue.x * easeVal; + startValue.y += changeValue.y * easeVal; + if (options.snapping) { + startValue.x = (float)Math.Round(startValue.x); + startValue.y = (float)Math.Round(startValue.y); + } + setter(startValue); + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs new file mode 100644 index 0000000..654f7ff --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs @@ -0,0 +1,140 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/20 15:05 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + /// + /// This plugin generates some GC allocations at startup + /// + public class Vector3ArrayPlugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) + { + t.startValue = t.endValue = t.changeValue = null; + } + + public override void SetFrom(TweenerCore t, bool isRelative) {} + + public override Vector3[] ConvertToStartValue(TweenerCore t, Vector3 value) + { + int len = t.endValue.Length; + Vector3[] res = new Vector3[len]; + for (int i = 0; i < len; i++) { + if (i == 0) res[i] = value; + else res[i] = t.endValue[i - 1]; + } + return res; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + int len = t.endValue.Length; + for (int i = 0; i < len; ++i) { + if (i > 0) t.startValue[i] = t.endValue[i - 1]; + t.endValue[i] = t.startValue[i] + t.endValue[i]; + } + } + + public override void SetChangeValue(TweenerCore t) + { + int len = t.endValue.Length; + t.changeValue = new Vector3[len]; + for (int i = 0; i < len; ++i) t.changeValue[i] = t.endValue[i] - t.startValue[i]; + } + + public override float GetSpeedBasedDuration(Vector3ArrayOptions options, float unitsXSecond, Vector3[] changeValue) + { + float totDuration = 0; + int len = changeValue.Length; + for (int i = 0; i < len; ++i) { + float duration = changeValue[i].magnitude / options.durations[i]; + options.durations[i] = duration; + totDuration += duration; + } + return totDuration; + } + + public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition) + { + Vector3 incrementValue = Vector3.zero; + if (t.loopType == LoopType.Incremental) { + int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; + if (iterations > 0) { + int end = startValue.Length - 1; + incrementValue = (startValue[end] + changeValue[end] - startValue[0]) * iterations; + } + } + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + int iterations = (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + if (iterations > 0) { + int end = startValue.Length - 1; + incrementValue += (startValue[end] + changeValue[end] - startValue[0]) * iterations; + } + } + + // Find correct index and segmentElapsed + int index = 0; + float segmentElapsed = 0; + float segmentDuration = 0; + int len = options.durations.Length; + float count = 0; + for (int i = 0; i < len; i++) { + segmentDuration = options.durations[i]; + count += segmentDuration; + if (elapsed > count) { + segmentElapsed += segmentDuration; + continue; + } + index = i; + segmentElapsed = elapsed - segmentElapsed; + break; + } + // Evaluate + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, segmentElapsed, segmentDuration, t.easeOvershootOrAmplitude, t.easePeriod); + Vector3 res; + switch (options.axisConstraint) { + case AxisConstraint.X: + res = getter(); + res.x = startValue[index].x + incrementValue.x + changeValue[index].x * easeVal; + if (options.snapping) res.x = (float)Math.Round(res.x); + setter(res); + break; + case AxisConstraint.Y: + res = getter(); + res.y = startValue[index].y + incrementValue.y + changeValue[index].y * easeVal; + if (options.snapping) res.y = (float)Math.Round(res.y); + setter(res); + return; + case AxisConstraint.Z: + res = getter(); + res.z = startValue[index].z + incrementValue.z + changeValue[index].z * easeVal; + if (options.snapping) res.z = (float)Math.Round(res.z); + setter(res); + break; + default: + res.x = startValue[index].x + incrementValue.x + changeValue[index].x * easeVal; + res.y = startValue[index].y + incrementValue.y + changeValue[index].y * easeVal; + res.z = startValue[index].z + incrementValue.z + changeValue[index].z * easeVal; + if (options.snapping) { + res.x = (float)Math.Round(res.x); + res.y = (float)Math.Round(res.y); + res.z = (float)Math.Round(res.z); + } + setter(res); + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Vector3Plugin.cs b/_DOTween.Assembly/DOTween/Plugins/Vector3Plugin.cs new file mode 100644 index 0000000..349e2b2 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Vector3Plugin.cs @@ -0,0 +1,124 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/06 19:35 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class Vector3Plugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector3 prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + Vector3 to = t.endValue; + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + to.x = t.startValue.x; + break; + case AxisConstraint.Y: + to.y = t.startValue.y; + break; + case AxisConstraint.Z: + to.z = t.startValue.z; + break; + default: + to = t.startValue; + break; + } + if (t.plugOptions.snapping) { + to.x = (float)Math.Round(to.x); + to.y = (float)Math.Round(to.y); + to.z = (float)Math.Round(to.z); + } + t.setter(to); + } + + public override Vector3 ConvertToStartValue(TweenerCore t, Vector3 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + t.changeValue = new Vector3(t.endValue.x - t.startValue.x, 0, 0); + break; + case AxisConstraint.Y: + t.changeValue = new Vector3(0, t.endValue.y - t.startValue.y, 0); + break; + case AxisConstraint.Z: + t.changeValue = new Vector3(0, 0, t.endValue.z - t.startValue.z); + break; + default: + t.changeValue = t.endValue - t.startValue; + break; + } + } + + public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector3 changeValue) + { + return changeValue.magnitude / unitsXSecond; + } + + public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + switch (options.axisConstraint) { + case AxisConstraint.X: + Vector3 resX = getter(); + resX.x = startValue.x + changeValue.x * easeVal; + if (options.snapping) resX.x = (float)Math.Round(resX.x); + setter(resX); + break; + case AxisConstraint.Y: + Vector3 resY = getter(); + resY.y = startValue.y + changeValue.y * easeVal; + if (options.snapping) resY.y = (float)Math.Round(resY.y); + setter(resY); + break; + case AxisConstraint.Z: + Vector3 resZ = getter(); + resZ.z = startValue.z + changeValue.z * easeVal; + if (options.snapping) resZ.z = (float)Math.Round(resZ.z); + setter(resZ); + break; + default: + startValue.x += changeValue.x * easeVal; + startValue.y += changeValue.y * easeVal; + startValue.z += changeValue.z * easeVal; + if (options.snapping) { + startValue.x = (float)Math.Round(startValue.x); + startValue.y = (float)Math.Round(startValue.y); + startValue.z = (float)Math.Round(startValue.z); + } + setter(startValue); + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Plugins/Vector4Plugin.cs b/_DOTween.Assembly/DOTween/Plugins/Vector4Plugin.cs new file mode 100644 index 0000000..3b30fa6 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Plugins/Vector4Plugin.cs @@ -0,0 +1,139 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/10 16:53 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening.Plugins +{ + public class Vector4Plugin : ABSTweenPlugin + { + public override void Reset(TweenerCore t) { } + + public override void SetFrom(TweenerCore t, bool isRelative) + { + Vector4 prevEndVal = t.endValue; + t.endValue = t.getter(); + t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal; + Vector4 to = t.endValue; + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + to.x = t.startValue.x; + break; + case AxisConstraint.Y: + to.y = t.startValue.y; + break; + case AxisConstraint.Z: + to.z = t.startValue.z; + break; + case AxisConstraint.W: + to.w = t.startValue.w; + break; + default: + to = t.startValue; + break; + } + if (t.plugOptions.snapping) { + to.x = (float)Math.Round(to.x); + to.y = (float)Math.Round(to.y); + to.z = (float)Math.Round(to.z); + to.w = (float)Math.Round(to.w); + } + t.setter(to); + } + + public override Vector4 ConvertToStartValue(TweenerCore t, Vector4 value) + { + return value; + } + + public override void SetRelativeEndValue(TweenerCore t) + { + t.endValue += t.startValue; + } + + public override void SetChangeValue(TweenerCore t) + { + switch (t.plugOptions.axisConstraint) { + case AxisConstraint.X: + t.changeValue = new Vector4(t.endValue.x - t.startValue.x, 0, 0, 0); + break; + case AxisConstraint.Y: + t.changeValue = new Vector4(0, t.endValue.y - t.startValue.y, 0, 0); + break; + case AxisConstraint.Z: + t.changeValue = new Vector4(0, 0, t.endValue.z - t.startValue.z, 0); + break; + case AxisConstraint.W: + t.changeValue = new Vector4(0, 0, 0, t.endValue.w - t.startValue.w); + break; + default: + t.changeValue = t.endValue - t.startValue; + break; + } + } + + public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector4 changeValue) + { + return changeValue.magnitude / unitsXSecond; + } + + public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Vector4 startValue, Vector4 changeValue, float duration, bool usingInversePosition) + { + if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); + if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { + startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) + * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); + } + + float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); + switch (options.axisConstraint) { + case AxisConstraint.X: + Vector4 resX = getter(); + resX.x = startValue.x + changeValue.x * easeVal; + if (options.snapping) resX.x = (float)Math.Round(resX.x); + setter(resX); + break; + case AxisConstraint.Y: + Vector4 resY = getter(); + resY.y = startValue.y + changeValue.y * easeVal; + if (options.snapping) resY.y = (float)Math.Round(resY.y); + setter(resY); + break; + case AxisConstraint.Z: + Vector4 resZ = getter(); + resZ.z = startValue.z + changeValue.z * easeVal; + if (options.snapping) resZ.z = (float)Math.Round(resZ.z); + setter(resZ); + break; + case AxisConstraint.W: + Vector4 resW = getter(); + resW.w = startValue.w + changeValue.w * easeVal; + if (options.snapping) resW.w = (float)Math.Round(resW.w); + setter(resW); + break; + default: + startValue.x += changeValue.x * easeVal; + startValue.y += changeValue.y * easeVal; + startValue.z += changeValue.z * easeVal; + startValue.w += changeValue.w * easeVal; + if (options.snapping) { + startValue.x = (float)Math.Round(startValue.x); + startValue.y = (float)Math.Round(startValue.y); + startValue.z = (float)Math.Round(startValue.z); + startValue.w = (float)Math.Round(startValue.w); + } + setter(startValue); + break; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Properties/AssemblyInfo.cs b/_DOTween.Assembly/DOTween/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..20ef515 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Properties/AssemblyInfo.cs @@ -0,0 +1,42 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Friends +[assembly: InternalsVisibleTo("DOTweenEditor")] +[assembly: InternalsVisibleTo("DOTween43")] +[assembly: InternalsVisibleTo("DOTweenPro")] +[assembly: InternalsVisibleTo("DOTweenProEditor")] + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DOTween")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Demigiant")] +[assembly: AssemblyProduct("DOTween")] +[assembly: AssemblyCopyright("Copyright © Daniele Giardini, 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("807e068c-2a0e-4c81-a303-4b4fd3924511")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/_DOTween.Assembly/DOTween/RotateMode.cs b/_DOTween.Assembly/DOTween/RotateMode.cs new file mode 100644 index 0000000..5ec7ad8 --- /dev/null +++ b/_DOTween.Assembly/DOTween/RotateMode.cs @@ -0,0 +1,34 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/11/11 13:01 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php +namespace DG.Tweening +{ + /// + /// Rotation mode used with DORotate methods + /// + public enum RotateMode + { + /// + /// Fastest way that never rotates beyond 360° + /// + Fast, + /// + /// Fastest way that rotates beyond 360° + /// + FastBeyond360, + /// + /// Adds the given rotation to the transform using world axis and an advanced precision mode + /// (like when using transform.Rotate(Space.World)). + /// In this mode the end value is is always considered relative + /// + WorldAxisAdd, + /// + /// Adds the given rotation to the transform's local axis + /// (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + /// In this mode the end value is is always considered relative + /// + LocalAxisAdd, + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Sequence.cs b/_DOTween.Assembly/DOTween/Sequence.cs new file mode 100644 index 0000000..ee8b0d6 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Sequence.cs @@ -0,0 +1,316 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/15 17:50 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Collections.Generic; +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Core.Enums; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Controls other tweens as a group + /// + public sealed class Sequence : Tween + { + // SETUP DATA //////////////////////////////////////////////// + + internal readonly List sequencedTweens = new List(); // Only Tweens (used for despawning and validation) + readonly List _sequencedObjs = new List(); // Tweens plus SequenceCallbacks + internal float lastTweenInsertTime; // Used to insert a tween at the position of the previous one + + #region Constructor + + internal Sequence() + { + tweenType = TweenType.Sequence; + Reset(); + } + + #endregion + + #region Creation Methods + + internal static Sequence DoPrepend(Sequence inSequence, Tween t) + { + if (t.loops == -1) t.loops = 1; + float tFullTime = t.delay + (t.duration * t.loops); + inSequence.duration += tFullTime; + int len = inSequence._sequencedObjs.Count; + for (int i = 0; i < len; ++i) { + ABSSequentiable sequentiable = inSequence._sequencedObjs[i]; + sequentiable.sequencedPosition += tFullTime; + sequentiable.sequencedEndPosition += tFullTime; + } + + return DoInsert(inSequence, t, 0); + } + + internal static Sequence DoInsert(Sequence inSequence, Tween t, float atPosition) + { + TweenManager.AddActiveTweenToSequence(t); + + // If t has a delay add it as an interval + atPosition += t.delay; + inSequence.lastTweenInsertTime = atPosition; + + t.isSequenced = t.creationLocked = true; + t.sequenceParent = inSequence; + if (t.loops == -1) t.loops = 1; + float tFullTime = t.duration * t.loops; + t.autoKill = false; + t.delay = t.elapsedDelay = 0; + t.delayComplete = true; + t.isSpeedBased = false; + t.sequencedPosition = atPosition; + t.sequencedEndPosition = atPosition + tFullTime; + + if (t.sequencedEndPosition > inSequence.duration) inSequence.duration = t.sequencedEndPosition; + inSequence._sequencedObjs.Add(t); + inSequence.sequencedTweens.Add(t); + + return inSequence; + } + + internal static Sequence DoAppendInterval(Sequence inSequence, float interval) + { + inSequence.duration += interval; + return inSequence; + } + + internal static Sequence DoPrependInterval(Sequence inSequence, float interval) + { + inSequence.duration += interval; + int len = inSequence._sequencedObjs.Count; + for (int i = 0; i < len; ++i) { + ABSSequentiable sequentiable = inSequence._sequencedObjs[i]; + sequentiable.sequencedPosition += interval; + sequentiable.sequencedEndPosition += interval; + } + + return inSequence; + } + + internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition) + { + SequenceCallback c = new SequenceCallback(atPosition, callback); + c.sequencedPosition = c.sequencedEndPosition = atPosition; + inSequence._sequencedObjs.Add(c); + if (inSequence.duration < atPosition) inSequence.duration = atPosition; + return inSequence; + } + + #endregion + + internal override void Reset() + { + base.Reset(); + + sequencedTweens.Clear(); + _sequencedObjs.Clear(); + lastTweenInsertTime = 0; + } + + // Called by TweenManager.Validate. + // Returns TRUE if the tween is valid + internal override bool Validate() + { + int len = sequencedTweens.Count; + for (int i = 0; i < len; i++) { + if (!sequencedTweens[i].Validate()) return false; + } + return true; + } + + // CALLED BY Tween the moment the tween starts. + // Returns TRUE in case of success + internal override bool Startup() + { + return DoStartup(this); + } + + internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) + { + return DoApplyTween(this, prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode); + } + + // Called by DOTween when spawning/creating a new Sequence. + internal static void Setup(Sequence s) + { + s.autoKill = DOTween.defaultAutoKill; + s.isRecyclable = DOTween.defaultRecyclable; + s.isPlaying = DOTween.defaultAutoPlay == AutoPlay.All || DOTween.defaultAutoPlay == AutoPlay.AutoPlaySequences; + s.loopType = DOTween.defaultLoopType; + s.easeType = Ease.Linear; + s.easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; + s.easePeriod = DOTween.defaultEasePeriod; + } + + // Returns TRUE in case of success + internal static bool DoStartup(Sequence s) + { + if (s.sequencedTweens.Count == 0 && s._sequencedObjs.Count == 0 + && s.onComplete == null && s.onKill == null && s.onPause == null && s.onPlay == null && s.onRewind == null + && s.onStart == null && s.onStepComplete == null && s.onUpdate == null + ) return false; // Empty Sequence without any callback set + + s.startupDone = true; + s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity; + // Order sequencedObjs by start position + s._sequencedObjs.Sort(SortSequencedObjs); + return true; + } + + // Applies the tween set by DoGoto. + // Returns TRUE if the tween needs to be killed + internal static bool DoApplyTween(Sequence s, float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) + { + // Adapt to eventual ease position + float prevPos = prevPosition; + float newPos = s.position; + if (s.easeType != Ease.Linear) { + prevPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, prevPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod); + newPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, newPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod); + } + + + float from, to = 0; + // Determine if prevPos was inverse. + // Used to calculate correct "from" value when applying internal cycle + // and also in case of multiple loops within a single update + bool prevPosIsInverse = s.loopType == LoopType.Yoyo + && (prevPos < s.duration ? prevCompletedLoops % 2 != 0 : prevCompletedLoops % 2 == 0); + if (s.isBackwards) prevPosIsInverse = !prevPosIsInverse; + // Update multiple loop cycles within the same update + if (newCompletedSteps > 0) { + // Store expected completedLoops and position, in order to check them after the update cycles. + int expectedCompletedLoops = s.completedLoops + newCompletedSteps; + float expectedPosition = s.position; + // + int cycles = newCompletedSteps; + int cyclesDone = 0; + from = prevPos; + if (updateMode == UpdateMode.Update) { + // Run all cycles elapsed since last update + while (cyclesDone < cycles) { + if (cyclesDone > 0) from = to; + else if (prevPosIsInverse && !s.isBackwards) from = s.duration - from; + to = prevPosIsInverse ? 0 : s.duration; + if (ApplyInternalCycle(s, from, to, updateMode, useInversePosition, prevPosIsInverse, true)) return true; + cyclesDone++; + if (s.loopType == LoopType.Yoyo) prevPosIsInverse = !prevPosIsInverse; + } + } else { + // Simply determine correct prevPosition after steps + if (s.loopType == LoopType.Yoyo && newCompletedSteps % 2 != 0) { + prevPosIsInverse = !prevPosIsInverse; + prevPos = s.duration - prevPos; + } + newCompletedSteps = 0; + } + // If completedLoops or position were changed by some callback, exit here + if (expectedCompletedLoops != s.completedLoops || Math.Abs(expectedPosition - s.position) > Single.Epsilon) return !s.active; + } + // Run current cycle + if (newCompletedSteps == 1 && s.isComplete) return false; // Skip update if complete because multicycle took care of it + if (newCompletedSteps > 0 && !s.isComplete) { + from = useInversePosition ? s.duration : 0; + // In case of Restart loop rewind all tweens (keep "to > 0" or remove it?) + if (s.loopType == LoopType.Restart && to > 0) ApplyInternalCycle(s, s.duration, 0, UpdateMode.Goto, false, false, false); + } else from = useInversePosition ? s.duration - prevPos : prevPos; + return ApplyInternalCycle(s, from, useInversePosition ? s.duration - newPos : newPos, updateMode, useInversePosition, prevPosIsInverse); + } + + // =================================================================================== + // METHODS --------------------------------------------------------------------------- + + // Returns TRUE if the tween needs to be killed + static bool ApplyInternalCycle(Sequence s, float fromPos, float toPos, UpdateMode updateMode, bool useInverse, bool prevPosIsInverse, bool multiCycleStep = false) + { + bool isBackwardsUpdate = toPos < fromPos; +// Debug.Log(Time.frameCount + " " + s.id + " " + (multiCycleStep ? "Multicycle > " : "Cycle > ") + s.position + "/" + s.duration + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + " - UpdateMode: " + updateMode + ", isPlaying: " + s.isPlaying); + if (isBackwardsUpdate) { + int len = s._sequencedObjs.Count - 1; + for (int i = len; i > -1; --i) { + if (!s.active) return true; // Killed by some internal callback + ABSSequentiable sequentiable = s._sequencedObjs[i]; + if (sequentiable.sequencedEndPosition < toPos || sequentiable.sequencedPosition > fromPos) continue; + if (sequentiable.tweenType == TweenType.Callback) { + if (updateMode == UpdateMode.Update && prevPosIsInverse) { +// Debug.Log("BACKWARDS Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + ""); + OnTweenCallback(sequentiable.onStart); + } + } else { + // Nested Tweener/Sequence + float gotoPos = toPos - sequentiable.sequencedPosition; + if (gotoPos < 0) gotoPos = 0; + Tween t = (Tween)sequentiable; + if (!t.startupDone) continue; // since we're going backwards and this tween never started just ignore it + t.isBackwards = true; + if (TweenManager.Goto(t, gotoPos, false, updateMode)) return true; + + // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't + if (multiCycleStep && t.tweenType == TweenType.Sequence) { + if (s.position <= 0 && s.completedLoops == 0) t.position = 0; + else { + bool toZero = s.completedLoops == 0 || s.isBackwards && (s.completedLoops < s.loops || s.loops == -1); + if (t.isBackwards) toZero = !toZero; + if (useInverse) toZero = !toZero; + if (s.isBackwards && !useInverse && !prevPosIsInverse) toZero = !toZero; + t.position = toZero ? 0 : t.duration; + } + } + } + } + } else { + // Debug + int len = s._sequencedObjs.Count; + for (int i = 0; i < len; ++i) { + if (!s.active) return true; // Killed by some internal callback + ABSSequentiable sequentiable = s._sequencedObjs[i]; + if (sequentiable.sequencedPosition > toPos || sequentiable.sequencedEndPosition < fromPos) continue; + if (sequentiable.tweenType == TweenType.Callback) { + if (updateMode == UpdateMode.Update) { +// Debug.Log("FORWARD Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + ""); + bool fire = !s.isBackwards && !useInverse && !prevPosIsInverse + || s.isBackwards && useInverse && !prevPosIsInverse; + if (fire) OnTweenCallback(sequentiable.onStart); + } + } else { + // Nested Tweener/Sequence + float gotoPos = toPos - sequentiable.sequencedPosition; + if (gotoPos < 0) gotoPos = 0; + Tween t = (Tween)sequentiable; + t.isBackwards = false; + if (TweenManager.Goto(t, gotoPos, false, updateMode)) return true; + + // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't + if (multiCycleStep && t.tweenType == TweenType.Sequence) { + if (s.position <= 0 && s.completedLoops == 0) t.position = 0; + else { + bool toZero = s.completedLoops == 0 || !s.isBackwards && (s.completedLoops < s.loops || s.loops == -1); + if (t.isBackwards) toZero = !toZero; + if (useInverse) toZero = !toZero; + if (s.isBackwards && !useInverse && !prevPosIsInverse) toZero = !toZero; + t.position = toZero ? 0 : t.duration; + } + } + } + } + } + return false; + } + + static int SortSequencedObjs(ABSSequentiable a, ABSSequentiable b) + { + if (a.sequencedPosition > b.sequencedPosition) return 1; + if (a.sequencedPosition < b.sequencedPosition) return -1; + return 0; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs new file mode 100644 index 0000000..e671265 --- /dev/null +++ b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs @@ -0,0 +1,758 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/28 10:40 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System.Collections.Generic; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1573 +namespace DG.Tweening +{ + /// + /// Methods that extend known Unity objects and allow to directly create and control tweens from their instances + /// + public static class ShortcutExtensions + { + // =================================================================================== + // CREATION SHORTCUTS ---------------------------------------------------------------- + + #region Audio Shortcuts + + /// Tweens an AudioSource's volume to the given value. + /// Also stores the AudioSource as the tween's target so it can be used for filtered operations + /// The end value to reach (0 to 1)The duration of the tween + public static Tweener DOFade(this AudioSource target, float endValue, float duration) + { + if (endValue < 0) endValue = 0; + else if (endValue > 1) endValue = 1; + return DOTween.To(() => target.volume, x => target.volume = x, endValue, duration).SetTarget(target); + } + + /// Tweens an AudioSource's pitch to the given value. + /// Also stores the AudioSource as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOPitch(this AudioSource target, float endValue, float duration) + { + return DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration).SetTarget(target); + } + + #endregion + + #region Camera Shortcuts + + /// Shakes a Camera's localPosition along its relative X Y axes with the given values. + /// Also stores the camera as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakePosition(this Camera target, float duration, float strength = 3, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.transform.localPosition, x => target.transform.localPosition = x, duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetCameraShakePosition); + } + /// Shakes a Camera's localPosition along its relative X Y axes with the given values. + /// Also stores the camera as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakePosition(this Camera target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.transform.localPosition, x => target.transform.localPosition = x, duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetCameraShakePosition); + } + + /// Shakes a Camera's localRotation. + /// Also stores the camera as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeRotation(this Camera target, float duration, float strength = 90, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.transform.localEulerAngles, x => target.transform.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness, false) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + /// Shakes a Camera's localRotation. + /// Also stores the camera as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeRotation(this Camera target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.transform.localEulerAngles, x => target.transform.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + + /// Tweens a Camera's backgroundColor to the given value. + /// Also stores the camera as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Camera target, Color endValue, float duration) + { + return DOTween.To(() => target.backgroundColor, x => target.backgroundColor = x, endValue, duration).SetTarget(target); + } + + #endregion + + #region Light Shortcuts + + /// Tweens a Light's color to the given value. + /// Also stores the light as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Light target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Light's intensity to the given value. + /// Also stores the light as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOIntensity(this Light target, float endValue, float duration) + { + return DOTween.To(() => target.intensity, x => target.intensity = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Light's shadowStrength to the given value. + /// Also stores the light as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOShadowStrength(this Light target, float endValue, float duration) + { + return DOTween.To(() => target.shadowStrength, x => target.shadowStrength = x, endValue, duration).SetTarget(target); + } + + #endregion + + #region LineRenderer + + /// Tweens a LineRenderer's color to the given value. + /// Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + /// Note that this method requires to also insert the start colors for the tween, + /// since LineRenderers have no way to get them. + /// The start value to tween from + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this LineRenderer target, Color2 startValue, Color2 endValue, float duration) + { + return DOTween.To(() => startValue, x => target.SetColors(x.ca, x.cb), endValue, duration).SetTarget(target); + } + + #endregion + + #region Material Shortcuts + + /// Tweens a Material's color to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Material target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + /// Tweens a Material's named color property to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reach + /// The name of the material property to tween (like _Tint or _SpecColor) + /// The duration of the tween + public static Tweener DOColor(this Material target, Color endValue, string property, float duration) + { + return DOTween.To(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration).SetTarget(target); + } + + /// Tweens a Material's alpha color to the given value + /// (will have no effect unless your material supports transparency). + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this Material target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) + .SetTarget(target); + } + + /// Tweens a Material's named float property to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reach + /// The name of the material property to tween + /// The duration of the tween + public static Tweener DOFloat(this Material target, float endValue, string property, float duration) + { + return DOTween.To(() => target.GetFloat(property), x => target.SetFloat(property, x), endValue, duration).SetTarget(target); + } + + /// Tweens a Material's named Vector property to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reach + /// The name of the material property to tween + /// The duration of the tween + public static Tweener DOVector(this Material target, Vector4 endValue, string property, float duration) + { + return DOTween.To(() => target.GetVector(property), x => target.SetVector(property, x), endValue, duration).SetTarget(target); + } + + #endregion + + #region Rigidbody Shortcuts + + /// Tweens a Rigidbody's position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a Rigidbody's X position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetTarget(target); + } + + /// Tweens a Rigidbody's Y position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration) + .SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + } + + /// Tweens a Rigidbody's Z position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration) + .SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + } + + /// Tweens a Rigidbody's rotation to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// Rotation mode + public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast) + { + TweenerCore t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration); + t.SetTarget(target); + t.plugOptions.rotateMode = mode; + return t; + } + + /// Tweens a Rigidbody's rotation so that it will look towards the given position. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The position to look atThe duration of the tween + /// Eventual axis constraint for the rotation + /// The vector that defines in which direction up is (default: Vector3.up) + public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null) + { + TweenerCore t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt); + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up; + return t; + } + + #endregion + + #region TrailRenderer Shortcuts + + /// Tweens a TrailRenderer's startWidth/endWidth to the given value. + /// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + /// The end startWidth to reachThe end endWidth to reach + /// The duration of the tween + public static Tweener DOResize(this TrailRenderer target, float toStartWidth, float toEndWidth, float duration) + { + return DOTween.To(() => new Vector2(target.startWidth, target.endWidth), x => { + target.startWidth = x.x; + target.endWidth = x.y; + }, new Vector2(toStartWidth, toEndWidth), duration) + .SetTarget(target); + } + + /// Tweens a TrailRenderer's time to the given value. + /// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOTime(this TrailRenderer target, float endValue, float duration) + { + return DOTween.To(() => target.time, x => target.time = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region Transform Shortcuts + + /// Tweens a Transform's position to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMove(this Transform target, Vector3 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, x => target.position = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a Transform's X position to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveX(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue, 0, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetTarget(target); + } + + /// Tweens a Transform's Y position to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveY(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, endValue, 0), duration) + .SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + } + + /// Tweens a Transform's Z position to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveZ(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue), duration) + .SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + } + + /// Tweens a Transform's localPosition to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOLocalMove(this Transform target, Vector3 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.localPosition, x => target.localPosition = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a Transform's X localPosition to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOLocalMoveX(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue, 0, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetTarget(target); + } + + /// Tweens a Transform's Y localPosition to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOLocalMoveY(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, endValue, 0), duration) + .SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + } + + /// Tweens a Transform's Z localPosition to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOLocalMoveZ(this Transform target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue), duration) + .SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + } + + /// Tweens a Transform's rotation to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// Rotation mode + public static Tweener DORotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast) + { + TweenerCore t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration); + t.SetTarget(target); + t.plugOptions.rotateMode = mode; + return t; + } + + /// Tweens a Transform's localRotation to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// Rotation mode + public static Tweener DOLocalRotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast) + { + TweenerCore t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration); + t.SetTarget(target); + t.plugOptions.rotateMode = mode; + return t; + } + + /// Tweens a Transform's localScale to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOScale(this Transform target, Vector3 endValue, float duration) + { + return DOTween.To(() => target.localScale, x => target.localScale = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Transform's X localScale to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOScaleX(this Transform target, float endValue, float duration) + { + return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(endValue, 0, 0), duration) + .SetOptions(AxisConstraint.X) + .SetTarget(target); + } + + /// Tweens a Transform's Y localScale to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOScaleY(this Transform target, float endValue, float duration) + { + return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, endValue, 0), duration) + .SetOptions(AxisConstraint.Y) + .SetTarget(target); + } + + /// Tweens a Transform's Z localScale to the given value. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOScaleZ(this Transform target, float endValue, float duration) + { + return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, 0, endValue), duration) + .SetOptions(AxisConstraint.Z) + .SetTarget(target); + } + + /// Tweens a Transform's rotation so that it will look towards the given position. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The position to look atThe duration of the tween + /// Eventual axis constraint for the rotation + /// The vector that defines in which direction up is (default: Vector3.up) + public static Tweener DOLookAt(this Transform target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null) + { + TweenerCore t = DOTween.To(() => target.rotation, x => target.rotation = x, towards, duration) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt); + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up; + return t; + } + + /// Punches a Transform's localPosition towards the given direction and then back to the starting one + /// as if it was connected to the starting position via an elastic. + /// The direction and strength of the punch (added to the Transform's current position) + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + /// 1 creates a full oscillation between the punch direction and the opposite direction, + /// while 0 oscillates only between the punch and the start position + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOPunchPosition(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false) + { + return DOTween.Punch(() => target.localPosition, x => target.localPosition = x, punch, duration, vibrato, elasticity) + .SetTarget(target).SetOptions(snapping); + } + /// Punches a Transform's localScale towards the given size and then back to the starting one + /// as if it was connected to the starting scale via an elastic. + /// The punch strength (added to the Transform's current scale) + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + /// 1 creates a full oscillation between the punch scale and the opposite scale, + /// while 0 oscillates only between the punch scale and the start scale + public static Tweener DOPunchScale(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1) + { + return DOTween.Punch(() => target.localScale, x => target.localScale = x, punch, duration, vibrato, elasticity) + .SetTarget(target); + } + /// Punches a Transform's localRotation towards the given size and then back to the starting one + /// as if it was connected to the starting rotation via an elastic. + /// The punch strength (added to the Transform's current rotation) + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + /// 1 creates a full oscillation between the punch rotation and the opposite rotation, + /// while 0 oscillates only between the punch and the start rotation + public static Tweener DOPunchRotation(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1) + { + return DOTween.Punch(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), punch, duration, vibrato, elasticity) + .SetTarget(target); + } + + /// Shakes a Transform's localPosition with the given values. + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOShakePosition(this Transform target, float duration, float strength = 1, int vibrato = 10, float randomness = 90, bool snapping = false) + { + return DOTween.Shake(() => target.localPosition, x => target.localPosition = x, duration, strength, vibrato, randomness, false) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + /// Shakes a Transform's localPosition with the given values. + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOShakePosition(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90, bool snapping = false) + { + return DOTween.Shake(() => target.localPosition, x => target.localPosition = x, duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + /// Shakes a Transform's localRotation. + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeRotation(this Transform target, float duration, float strength = 90, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness, false) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + /// Shakes a Transform's localRotation. + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeRotation(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + /// Shakes a Transform's localScale. + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeScale(this Transform target, float duration, float strength = 1, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.localScale, x => target.localScale = x, duration, strength, vibrato, randomness, false) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + /// Shakes a Transform's localScale. + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + public static Tweener DOShakeScale(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90) + { + return DOTween.Shake(() => target.localScale, x => target.localScale = x, duration, strength, vibrato, randomness) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake); + } + + /// Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The waypoints to go through + /// The duration of the tween + /// The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOPath( + this Transform target, Vector3[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.position = x, new Path(pathType, path, resolution, gizmoColor), duration) + .SetTarget(target); + + t.plugOptions.mode = pathMode; + return t; + } + /// Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + /// Also stores the transform as the tween's target so it can be used for filtered operations + /// The waypoint to go through + /// The duration of the tween + /// The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOLocalPath( + this Transform target, Vector3[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.localPosition, x => target.localPosition = x, new Path(pathType, path, resolution, gizmoColor), duration) + .SetTarget(target); + + t.plugOptions.mode = pathMode; + return t; + } + // Used by path editor when creating the actual tween, so it can pass a pre-compiled path + internal static TweenerCore DOPath( + this Transform target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.position = x, path, duration) + .SetTarget(target); + + t.plugOptions.mode = pathMode; + return t; + } + internal static TweenerCore DOLocalPath( + this Transform target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.localPosition, x => target.localPosition = x, path, duration) + .SetTarget(target); + + t.plugOptions.mode = pathMode; + return t; + } + + #endregion + + // =================================================================================== + // OPERATION SHORTCUTS --------------------------------------------------------------- + + #region Operation Shortcuts + + /// + /// Completes all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens completed + /// (meaning the tweens that don't have infinite loops and were not already complete) + /// + public static int DOComplete(this Component target) + { + return DOTween.Complete(target); + } + + /// + /// Kills all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens killed. + /// + /// If TRUE completes the tween before killing it + public static int DOKill(this Component target, bool complete = false) + { +// int tot = complete ? DOTween.CompleteAndReturnKilledTot(target) : 0; +// return tot + DOTween.Kill(target); + return DOTween.Kill(target, complete); + } + + /// + /// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens flipped. + /// + public static int DOFlip(this Component target) + { + return DOTween.Flip(target); + } + + /// + /// Sends to the given position all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens involved. + /// + /// Time position to reach + /// (if higher than the whole tween duration the tween will simply reach its end) + /// If TRUE will play the tween after reaching the given position, otherwise it will pause it + public static int DOGoto(this Component target, float to, bool andPlay = false) + { + return DOTween.Goto(target, to, andPlay); + } + + /// + /// Pauses all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens paused. + /// + public static int DOPause(this Component target) + { + return DOTween.Pause(target); + } + + /// + /// Plays all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlay(this Component target) + { + return DOTween.Play(target); + } + + /// + /// Plays backwards all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlayBackwards(this Component target) + { + return DOTween.PlayBackwards(target); + } + + /// + /// Plays forward all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlayForward(this Component target) + { + return DOTween.PlayForward(target); + } + + /// + /// Restarts all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens restarted. + /// + public static int DORestart(this Component target) + { + return DOTween.RestartAll(target); + } + + /// + /// Rewinds all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens rewinded. + /// + public static int DORewind(this Component target) + { + return DOTween.RewindAll(target); + } + + /// + /// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens involved. + /// + public static int DOTogglePause(this Component target) + { + return DOTween.TogglePause(target); + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Tween.cs b/_DOTween.Assembly/DOTween/Tween.cs new file mode 100644 index 0000000..b427449 --- /dev/null +++ b/_DOTween.Assembly/DOTween/Tween.cs @@ -0,0 +1,284 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/07 13:03 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Indicates either a Tweener or a Sequence + /// + public abstract class Tween : ABSSequentiable + { + // OPTIONS /////////////////////////////////////////////////// + + // Modifiable at runtime + /// TimeScale for the tween + public float timeScale; + /// If TRUE the tween wil go backwards + public bool isBackwards; + /// Id (usable for filtering with DOTween static methods). Can be an int, a string, an object, or anything else + public object id; + /// Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shorcuts + public object target; // Automatically set by DO shortcuts using SetTarget extension. Also used during Tweener.DoStartup in some special cases + // Update type and eventual independence (changed via TweenManager.SetUpdateType) + internal UpdateType updateType; + internal bool isIndependentUpdate; +// public TweenCallback onStart; // (in ABSSequentiable) When the tween is set in a PLAY state the first time, AFTER any eventual delay + /// Called when the tween is set in a playing state, after any eventual delay. + /// Also called each time the tween resumes playing from a paused state + internal TweenCallback onPlay; + /// Called when the tween state changes from playing to paused. + /// If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + internal TweenCallback onPause; + /// Called when the tween is rewinded, + /// either by calling Rewind or by reaching the start position while playing backwards. + /// Rewinding a tween that is already rewinded will not fire this callback + internal TweenCallback onRewind; + /// Called each time the tween updates + internal TweenCallback onUpdate; + /// Called the moment the tween completes one loop cycle + internal TweenCallback onStepComplete; + /// Called the moment the tween reaches completion (loops included) + internal TweenCallback onComplete; + /// Called the moment the tween is killed + internal TweenCallback onKill; + /// Called when a path tween's current waypoint changes + internal TweenCallback onWaypointChange; + + // Fixed after creation + internal bool isFrom; // Used to prevent settings like isRelative from being applied on From tweens + internal bool isRecyclable; + internal bool isSpeedBased; + internal bool autoKill; + internal float duration; + internal int loops; + internal LoopType loopType; + // Tweeners-only (shared by Sequences only for compatibility reasons, otherwise not used) + internal float delay; + internal bool isRelative; + internal Ease easeType; + internal EaseFunction customEase; // Used both for AnimationCurve and custom eases +#pragma warning disable 1591 + public float easeOvershootOrAmplitude; // Public so it can be used with custom plugins + public float easePeriod; // Public so it can be used with custom plugins +#pragma warning restore 1591 + + // SETUP DATA //////////////////////////////////////////////// + + internal Type typeofT1; // Only used by Tweeners + internal Type typeofT2; // Only used by Tweeners + internal Type typeofTPlugOptions; // Only used by Tweeners + internal bool active; // FALSE when tween is (or should be) despawned - set only by TweenManager + internal bool isSequenced; // Set by Sequence when adding a Tween to it + internal Sequence sequenceParent; // Set by Sequence when adding a Tween to it + internal int activeId = -1; // Index inside its active list (touched only by TweenManager) + internal SpecialStartupMode specialStartupMode; + + // PLAY DATA ///////////////////////////////////////////////// + + /// Gets and sets the time position (loops included, delays excluded) of the tween + public float fullPosition { get { return this.Elapsed(true); } set { this.Goto(value, this.isPlaying); } } + + internal bool creationLocked; // TRUE after the tween was updated the first time (even if it was delayed), or when added to a Sequence + internal bool startupDone; // TRUE the first time the actual tween starts, AFTER any delay has elapsed (unless it's a FROM tween) + internal bool playedOnce; // TRUE after the tween was set in a play state at least once, AFTER any delay is elapsed + internal float position; // Time position within a single loop cycle + internal float fullDuration; // Total duration loops included + internal int completedLoops; + internal bool isPlaying; // Set by TweenManager when getting a new tween + internal bool isComplete; + internal float elapsedDelay; // Amount of eventual delay elapsed (shared by Sequences only for compatibility reasons, otherwise not used) + internal bool delayComplete = true; // TRUE when the delay has elapsed or isn't set, also set by Delay extension method (shared by Sequences only for compatibility reasons, otherwise not used) + + internal int miscInt = -1; // Used by some plugins to store data (currently only by Paths to store current waypoint index) + + #region Abstracts + Overrideables + + // Doesn't reset active state, activeId and despawned, since those are only touched by TweenManager + // Doesn't reset default values since those are set when Tweener.Setup is called + internal virtual void Reset() + { + timeScale = 1; + isBackwards = false; + id = null; + isIndependentUpdate = false; + onStart = onPlay = onRewind = onUpdate = onComplete = onStepComplete = onKill = null; + onWaypointChange = null; + + target = null; + isFrom = false; + isSpeedBased = false; + duration = 0; + loops = 1; + delay = 0; + isRelative = false; + customEase = null; + isSequenced = false; + sequenceParent = null; + specialStartupMode = SpecialStartupMode.None; + creationLocked = startupDone = playedOnce = false; + position = fullDuration = completedLoops = 0; + isPlaying = isComplete = false; + elapsedDelay = 0; + delayComplete = true; + + miscInt = -1; + + // The following are set during a tween's Setup +// isRecyclable = DOTween.defaultRecyclable; +// autoKill = DOTween.defaultAutoKill; +// loopType = DOTween.defaultLoopType; +// easeType = DOTween.defaultEaseType; +// easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; +// easePeriod = DOTween.defaultEasePeriod + + // The following are set during TweenManager.AddActiveTween + // (so the previous updateType is still stored while removing tweens) +// updateType = UpdateType.Normal; + } + + // Called by TweenManager.Validate. + // Returns TRUE if the tween is valid + internal abstract bool Validate(); + + // Called by TweenManager in case a tween has a delay that needs to be updated. + // Returns the eventual time in excess compared to the tween's delay time. + // Shared also by Sequences even if they don't use it, in order to make it compatible with Tween. + internal virtual float UpdateDelay(float elapsed) { return 0; } + + // Called the moment the tween starts. + // For tweeners, that means AFTER any delay has elapsed + // (unless it's a FROM tween, in which case it will be called BEFORE any eventual delay). + // Returns TRUE in case of success, + // FALSE if there are missing references and the tween needs to be killed + internal abstract bool Startup(); + + // Applies the tween set by DoGoto. + // Returns TRUE if the tween needs to be killed + internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode); + + #endregion + + #region Goto and Callbacks + + // Instead of advancing the tween from the previous position each time, + // uses the given position to calculate running time since startup, and places the tween there like a Goto. + // Executes regardless of whether the tween is playing. + // Returns TRUE if the tween needs to be killed + internal static bool DoGoto(Tween t, float toPosition, int toCompletedLoops, UpdateMode updateMode) + { + // Startup + if (!t.startupDone) { + if (!t.Startup()) return true; + } + // OnStart and first OnPlay callbacks + if (!t.playedOnce && updateMode == UpdateMode.Update) { + t.playedOnce = true; + if (t.onStart != null) { + OnTweenCallback(t.onStart); + if (!t.active) return true; // Tween might have been killed by onStart callback + } + if (t.onPlay != null) { + OnTweenCallback(t.onPlay); + if (!t.active) return true; // Tween might have been killed by onPlay callback + } + } + + float prevPosition = t.position; + int prevCompletedLoops = t.completedLoops; + t.completedLoops = toCompletedLoops; + bool wasRewinded = t.position <= 0 && prevCompletedLoops <= 0; + bool wasComplete = t.isComplete; + // Determine if it will be complete after update + if (t.loops != -1) t.isComplete = t.completedLoops == t.loops; + // Calculate newCompletedSteps (always useful with Sequences) + int newCompletedSteps = 0; + if (updateMode == UpdateMode.Update) { + if (t.isBackwards) { + newCompletedSteps = t.completedLoops < prevCompletedLoops ? prevCompletedLoops - t.completedLoops : (toPosition <= 0 && !wasRewinded ? 1 : 0); + if (wasComplete) newCompletedSteps--; + } else newCompletedSteps = t.completedLoops > prevCompletedLoops ? t.completedLoops - prevCompletedLoops : 0; + } else if (t.tweenType == TweenType.Sequence) { + newCompletedSteps = prevCompletedLoops - toCompletedLoops; + if (newCompletedSteps < 0) newCompletedSteps = -newCompletedSteps; + } + + // Set position (makes position 0 equal to position "end" when looping) + t.position = toPosition; + if (t.position > t.duration) t.position = t.duration; + else if (t.position <= 0) { + if (t.completedLoops > 0 || t.isComplete) t.position = t.duration; + else t.position = 0; + } + // Set playing state after update + bool wasPlaying = t.isPlaying; + if (t.isPlaying) { + if (!t.isBackwards) t.isPlaying = !t.isComplete; // Reached the end + else t.isPlaying = !(t.completedLoops == 0 && t.position <= 0); // Rewinded + } + + // updatePosition is different in case of Yoyo loop under certain circumstances + bool useInversePosition = t.loopType == LoopType.Yoyo + && (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0); + + // Get values from plugin and set them + if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode)) return true; + + // Additional callbacks + if (t.onUpdate != null) { + OnTweenCallback(t.onUpdate); + } + if (t.position <= 0 && t.completedLoops <= 0 && !wasRewinded && t.onRewind != null) { + OnTweenCallback(t.onRewind); + } + if (newCompletedSteps > 0 && updateMode == UpdateMode.Update && t.onStepComplete != null) { + for (int i = 0; i < newCompletedSteps; ++i) OnTweenCallback(t.onStepComplete); + } + if (t.isComplete && !wasComplete && t.onComplete != null) { + OnTweenCallback(t.onComplete); + } + if (!t.isPlaying && wasPlaying && (!t.isComplete || !t.autoKill) && t.onPause != null) { + OnTweenCallback(t.onPause); + } + + // Return + return t.autoKill && t.isComplete; + } + + // Assumes that the callback exists (because it was previously checked). + // Returns TRUE in case of success, FALSE in case of error (if safeMode is on) + internal static bool OnTweenCallback(TweenCallback callback) + { + if (DOTween.useSafeMode) { + try { + callback(); + } catch (Exception e) { + Debugger.LogWarning("An error inside a tween callback was silently taken care of > " + e.Message); + return false; // Callback error + } + } else callback(); + return true; + } + internal static bool OnTweenCallback(TweenCallback callback, T param) + { + if (DOTween.useSafeMode) { + try { + callback(param); + } catch (Exception e) { + Debugger.LogWarning("An error inside a tween callback was silently taken care of > " + e.Message); + return false; // Callback error + } + } else callback(param); + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/TweenExtensions.cs b/_DOTween.Assembly/DOTween/TweenExtensions.cs new file mode 100644 index 0000000..ac2d769 --- /dev/null +++ b/_DOTween.Assembly/DOTween/TweenExtensions.cs @@ -0,0 +1,498 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/05 18:31 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1573 +namespace DG.Tweening +{ + /// + /// Methods that extend Tween objects and allow to control or get data from them + /// + public static class TweenExtensions + { + // =================================================================================== + // TWEENERS + SEQUENCES -------------------------------------------------------------- + + #region Runtime Operations + + /// Completes the tween + public static void Complete(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.Complete(t); + } + + /// Flips the direction of this tween (backwards if it was going forward or viceversa) + public static void Flip(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.Flip(t); + } + + /// Forces the tween to initialize its settings immediately + public static void ForceInit(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.ForceInit(t); + } + + /// Send the tween to the given position in time + /// Time position to reach + /// (if higher than the whole tween duration the tween will simply reach its end) + /// If TRUE will play the tween after reaching the given position, otherwise it will pause it + public static void Goto(this Tween t, float to, bool andPlay = false) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + if (to < 0) to = 0; + TweenManager.Goto(t, to, andPlay); + } + + /// Kills the tween + /// If TRUE completes the tween before killing it + public static void Kill(this Tween t, bool complete = false) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + if (complete) { + TweenManager.Complete(t); + if (t.autoKill) return; // Already killed by Complete, so no need to go on + } + + if (TweenManager.isUpdateLoop) { + // Just mark it for killing, so the update loop will take care of it + t.active = false; + } else TweenManager.Despawn(t); + } + + /// Pauses the tween + public static T Pause(this T t) where T : Tween + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return t; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return t; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return t; + } + + TweenManager.Pause(t); + return t; + } + + /// Plays the tween + public static T Play(this T t) where T : Tween + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return t; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return t; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return t; + } + + TweenManager.Play(t); + return t; + } + + /// Sets the tween in a backwards direction and plays it + public static void PlayBackwards(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.PlayBackwards(t); + } + + /// Sets the tween in a forward direction and plays it + public static void PlayForward(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.PlayForward(t); + } + + /// Restarts the tween from the beginning + /// If TRUE includes the eventual tween delay, otherwise skips it + public static void Restart(this Tween t, bool includeDelay = true) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.Restart(t, includeDelay); + } + + /// Rewinds the tween + /// If TRUE includes the eventual tween delay, otherwise skips it + public static void Rewind(this Tween t, bool includeDelay = true) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.Rewind(t, includeDelay); + } + + /// Plays the tween if it was paused, pauses it if it was playing + public static void TogglePause(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenManager.TogglePause(t); + } + + #region Path Tweens + + /// Send a path tween to the given waypoint. + /// Has no effect if this is not a path tween. + /// BEWARE, this is a special utility method: + /// the lookAt direction might be wrong after calling this and might need to be set manually + /// (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + /// Waypoint index to reach + /// (if higher than the max waypoint index the tween will simply go to the last one) + /// If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + public static void GotoWaypoint(this Tween t, int waypointIndex, bool andPlay = false) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return; + } + + TweenerCore pathTween = t as TweenerCore; + if (pathTween == null) { + if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return; + } + + if (waypointIndex < 0) waypointIndex = 0; + else if (waypointIndex > pathTween.changeValue.wps.Length - 1) waypointIndex = pathTween.changeValue.wps.Length - 1; + // Find path percentage relative to given waypoint + float wpLength = 0; // Total length from start to the given waypoint + for (int i = 0; i < waypointIndex + 1; i++) wpLength += pathTween.changeValue.wpLengths[i]; + float wpPerc = wpLength / pathTween.changeValue.length; + // Convert to time taking eventual inverse direction into account + bool useInversePosition = t.loopType == LoopType.Yoyo + && (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0); + if (useInversePosition) wpPerc = 1 - wpPerc; + float to = (t.isComplete ? t.completedLoops - 1 : t.completedLoops) * t.duration + wpPerc * t.duration; + TweenManager.Goto(t, to, andPlay); + } + + #endregion + + #endregion + + #region Yield Coroutines + + /// + /// Creates a yield instruction that waits until the tween is killed or complete. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForCompletion(); + /// + public static YieldInstruction WaitForCompletion(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForCompletion(t)); + } + + /// + /// Creates a yield instruction that waits until the tween is killed or rewinded. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForRewind(); + /// + public static YieldInstruction WaitForRewind(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForRewind(t)); + } + + /// + /// Creates a yield instruction that waits until the tween is killed. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForKill(); + /// + public static YieldInstruction WaitForKill(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForKill(t)); + } + + /// + /// Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForElapsedLoops(2); + /// + /// Elapsed loops to wait for + public static YieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForElapsedLoops(t, elapsedLoops)); + } + + /// + /// Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForPosition(2.5f); + /// + /// Position (loops included, delays excluded) to wait for + public static YieldInstruction WaitForPosition(this Tween t, float position) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForPosition(t, position)); + } + + /// + /// Creates a yield instruction that waits until the tween is killed or started + /// (meaning when the tween is set in a playing state the first time, after any eventual delay). + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForStart(); + /// + public static Coroutine WaitForStart(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + + return DOTween.instance.StartCoroutine(DOTween.instance.WaitForStart(t)); + } + #endregion + + #region Info Getters + + /// Returns the total number of loops completed by this tween + public static int CompletedLoops(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + return t.completedLoops; + } + + /// Returns the eventual delay set for this tween + public static float Delay(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + return t.delay; + } + + /// Returns the duration of this tween (delays excluded). + /// NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + /// If TRUE returns the full duration loops included, + /// otherwise the duration of a single loop cycle + public static float Duration(this Tween t, bool includeLoops = true) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + // Calculate duration here instead than getting fullDuration because fullDuration might + // not be set yet, since it's set inside DoStartup + if (includeLoops) return t.loops == -1 ? Mathf.Infinity : t.duration * t.loops; + return t.duration; + } + + /// Returns the elapsed time for this tween (delays exluded) + /// If TRUE returns the elapsed time since startup loops included, + /// otherwise the elapsed time within the current loop cycle + public static float Elapsed(this Tween t, bool includeLoops = true) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + if (includeLoops) { + int loopsToCount = t.position >= t.duration ? t.completedLoops - 1 : t.completedLoops; + return (loopsToCount * t.duration) + t.position; + } + return t.position; + } + /// Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + /// If TRUE returns the elapsed percentage since startup loops included, + /// otherwise the elapsed percentage within the current loop cycle + public static float ElapsedPercentage(this Tween t, bool includeLoops = true) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + if (includeLoops) { + int loopsToCount = t.position >= t.duration ? t.completedLoops - 1 : t.completedLoops; + return ((loopsToCount * t.duration) + t.position) / t.fullDuration; + } + return t.position / t.duration; + } + + /// Returns FALSE if this tween has been killed. + /// BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + /// When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + /// If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + /// .OnKill(()=> myTweenReference = null) + public static bool IsActive(this Tween t) + { + return t.active; + } + + /// Returns TRUE if this tween was reversed and is set to go backwards + public static bool IsBackwards(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return false; + } + + return t.isBackwards; + } + + /// Returns TRUE if the tween is complete + /// (silently fails and returns FALSE if the tween has been killed) + public static bool IsComplete(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return false; + } + + return t.isComplete; + } + + /// Returns TRUE if this tween is playing + public static bool IsPlaying(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return false; + } + + return t.isPlaying; + } + + #region Path Tweens + + /// + /// Returns the length of a path (returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized). + /// A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + /// You can force a path to be initialized by calling myTween.ForceInit(). + /// + public static float PathLength(this Tween t) + { + if (t == null) { + if (Debugger.logPriority > 1) Debugger.LogNullTween(t); return -1; + } else if (!t.active) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return -1; + } else if (t.isSequenced) { + if (Debugger.logPriority > 1) Debugger.LogInvalidTween(t); return -1; + } + + TweenerCore pathTween = t as TweenerCore; + if (pathTween == null) { + if (Debugger.logPriority > 1) Debugger.LogNonPathTween(t); return -1; + } else if (!pathTween.endValue.isFinalized) { + if (Debugger.logPriority > 1) Debugger.LogWarning("The path is not finalized yet"); return -1; + } + + return pathTween.endValue.length; + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/TweenParams.cs b/_DOTween.Assembly/DOTween/TweenParams.cs new file mode 100644 index 0000000..3383254 --- /dev/null +++ b/_DOTween.Assembly/DOTween/TweenParams.cs @@ -0,0 +1,285 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/08/30 19:03 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// This class serves only as a utility class to store tween settings to apply on multiple tweens. + /// It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + /// + public class TweenParams + { + /// A variable you can eventually Clear and reuse when needed, + /// to avoid instantiating TweenParams objects + public static readonly TweenParams Params = new TweenParams(); + + internal object id; + internal object target; + internal UpdateType updateType; + internal bool isIndependentUpdate; + internal TweenCallback onStart; + internal TweenCallback onPlay; + internal TweenCallback onRewind; + internal TweenCallback onUpdate; + internal TweenCallback onStepComplete; + internal TweenCallback onComplete; + internal TweenCallback onKill; + internal TweenCallback onWaypointChange; + + internal bool isRecyclable; + internal bool isSpeedBased; + internal bool autoKill; + internal int loops; + internal LoopType loopType; + internal float delay; + internal bool isRelative; + internal Ease easeType; + internal EaseFunction customEase; + internal float easeOvershootOrAmplitude; + internal float easePeriod; + + // *********************************************************************************** + // CONSTRUCTOR + // *********************************************************************************** + + /// Creates a new TweenParams object, which you can use to store tween settings + /// to pass to multiple tweens via myTween.SetAs(myTweenParms) + public TweenParams() + { + Clear(); + } + + #region Methods + + /// Clears and resets this TweenParams instance using default values, + /// so it can be reused without instantiating another one + public TweenParams Clear() + { + id = target = null; + updateType = DOTween.defaultUpdateType; + isIndependentUpdate = DOTween.defaultTimeScaleIndependent; + onStart = onPlay = onRewind = onUpdate = onStepComplete = onComplete = onKill = null; + onWaypointChange = null; + isRecyclable = DOTween.defaultRecyclable; + isSpeedBased = false; + autoKill = DOTween.defaultAutoKill; + loops = 1; + loopType = DOTween.defaultLoopType; + delay = 0; + isRelative = false; + easeType = Ease.Unset; + customEase = null; + easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; + easePeriod = DOTween.defaultEasePeriod; + + return this; + } + + #endregion + + #region Settings : Tweeners + Sequences + + /// Sets the autoKill behaviour of the tween. + /// Has no effect if the tween has already started + /// If TRUE the tween will be automatically killed when complete + public TweenParams SetAutoKill(bool autoKillOnCompletion = true) + { + this.autoKill = autoKillOnCompletion; + return this; + } + + /// Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + /// The ID to assign to this tween. Can be an int, a string, an object or anything else. + public TweenParams SetId(object id) + { + this.id = id; + return this; + } + + /// Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + /// IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + /// When using shorcuts the shortcut target is already assigned as the tween's target, + /// so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + /// The target to assign to this tween. Can be an int, a string, an object or anything else. + public TweenParams SetTarget(object target) + { + this.target = target; + return this; + } + + /// Sets the looping options for the tween. + /// Has no effect if the tween has already started + /// Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + /// Loop behaviour type (default: LoopType.Restart) + public TweenParams SetLoops(int loops, LoopType? loopType = null) + { + if (loops < -1) loops = -1; + else if (loops == 0) loops = 1; + this.loops = loops; + if (loopType != null) this.loopType = (LoopType)loopType; + return this; + } + + /// Sets the ease of the tween. + /// If applied to Sequences eases the whole sequence animation + /// Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + /// Eventual period to use with Elastic easeType (default is 0) + public TweenParams SetEase(Ease ease, float? overshootOrAmplitude = null, float? period = null) + { + this.easeType = ease; + this.easeOvershootOrAmplitude = overshootOrAmplitude != null ? (float)overshootOrAmplitude : DOTween.defaultEaseOvershootOrAmplitude; + this.easePeriod = period != null ? (float)period : DOTween.defaultEasePeriod; + this.customEase = null; + return this; + } + /// Sets the ease of the tween using an AnimationCurve. + /// If applied to Sequences eases the whole sequence animation + public TweenParams SetEase(AnimationCurve animCurve) + { + this.easeType = Ease.INTERNAL_Custom; + this.customEase = new EaseCurve(animCurve).Evaluate; + return this; + } + /// Sets the ease of the tween using a custom ease function. + /// If applied to Sequences eases the whole sequence animation + public TweenParams SetEase(EaseFunction customEase) + { + this.easeType = Ease.INTERNAL_Custom; + this.customEase = customEase; + return this; + } + + /// Sets the recycling behaviour for the tween. + /// If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + public TweenParams SetRecyclable(bool recyclable = true) + { + this.isRecyclable = recyclable; + return this; + } + + /// Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + /// and lets you choose if it should be independent from Unity's Time.timeScale + /// If TRUE the tween will ignore Unity's Time.timeScale + public TweenParams SetUpdate(bool isIndependentUpdate) + { + this.updateType = DOTween.defaultUpdateType; + this.isIndependentUpdate = isIndependentUpdate; + return this; + } + /// Sets the type of update (default or independent) for the tween + /// The type of update (default: UpdateType.Normal) + /// If TRUE the tween will ignore Unity's Time.timeScale + public TweenParams SetUpdate(UpdateType updateType, bool isIndependentUpdate = false) + { + this.updateType = updateType; + this.isIndependentUpdate = isIndependentUpdate; + return this; + } + + /// Sets the onStart callback for the tween. + /// Called the first time the tween is set in a playing state, after any eventual delay + public TweenParams OnStart(TweenCallback action) + { + this.onStart = action; + return this; + } + + /// Sets the onPlay callback for the tween. + /// Called when the tween is set in a playing state, after any eventual delay. + /// Also called each time the tween resumes playing from a paused state + public TweenParams OnPlay(TweenCallback action) + { + this.onPlay = action; + return this; + } + + /// Sets the onRewind callback for the tween. + /// Called when the tween is rewinded, + /// either by calling Rewind or by reaching the start position while playing backwards. + /// Rewinding a tween that is already rewinded will not fire this callback + public TweenParams OnRewind(TweenCallback action) + { + this.onRewind = action; + return this; + } + + /// Sets the onUpdate callback for the tween. + /// Called each time the tween updates + public TweenParams OnUpdate(TweenCallback action) + { + this.onUpdate = action; + return this; + } + + /// Sets the onStepComplete callback for the tween. + /// Called the moment the tween completes one loop cycle, even when going backwards + public TweenParams OnStepComplete(TweenCallback action) + { + this.onStepComplete = action; + return this; + } + + /// Sets the onComplete callback for the tween. + /// Called the moment the tween reaches its final forward position, loops included + public TweenParams OnComplete(TweenCallback action) + { + this.onComplete = action; + return this; + } + + /// Sets the onKill callback for the tween. + /// Called the moment the tween is killed + public TweenParams OnKill(TweenCallback action) + { + this.onKill = action; + return this; + } + + /// Sets the onWaypointChange callback for the tween. + /// Called when a path tween reaches a new waypoint + public TweenParams OnWaypointChange(TweenCallback action) + { + this.onWaypointChange = action; + return this; + } + + #endregion + + #region Settings : Tweeners-only + + /// Sets a delayed startup for the tween. + /// Has no effect on Sequences or if the tween has already started + public TweenParams SetDelay(float delay) + { + this.delay = delay; + return this; + } + + /// If isRelative is TRUE sets the tween as relative + /// (the endValue will be calculated as startValue + endValue instead than being used directly). + /// Has no effect on Sequences or if the tween has already started + public TweenParams SetRelative(bool isRelative = true) + { + this.isRelative = isRelative; + return this; + } + + /// If isSpeedBased is TRUE sets the tween as speed based + /// (the duration will represent the number of units the tween moves x second). + /// Has no effect on Sequences, nested tweens, or if the tween has already started + public TweenParams SetSpeedBased(bool isSpeedBased = true) + { + this.isSpeedBased = isSpeedBased; + return this; + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs new file mode 100644 index 0000000..9494e35 --- /dev/null +++ b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs @@ -0,0 +1,810 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/05 16:36 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Easing; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1573 +namespace DG.Tweening +{ + /// + /// Methods that extend Tween objects and allow to set their parameters + /// + public static class TweenSettingsExtensions + { + #region Tweeners + Sequences + + /// Sets the autoKill behaviour of the tween. + /// Has no effect if the tween has already started + public static T SetAutoKill(this T t) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + t.autoKill = true; + return t; + } + /// Sets the autoKill behaviour of the tween. + /// Has no effect if the tween has already started + /// If TRUE the tween will be automatically killed when complete + public static T SetAutoKill(this T t, bool autoKillOnCompletion) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + t.autoKill = autoKillOnCompletion; + return t; + } + + /// Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + /// The ID to assign to this tween. Can be an int, a string, an object or anything else. + public static T SetId(this T t, object id) where T : Tween + { + if (!t.active) return t; + + t.id = id; + return t; + } + + /// Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + /// IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + /// When using shorcuts the shortcut target is already assigned as the tween's target, + /// so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + /// The target to assign to this tween. Can be an int, a string, an object or anything else. + public static T SetTarget(this T t, object target) where T : Tween + { + if (!t.active) return t; + + t.target = target; + return t; + } + + /// Sets the looping options for the tween. + /// Has no effect if the tween has already started + /// Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + public static T SetLoops(this T t, int loops) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + if (loops < -1) loops = -1; + else if (loops == 0) loops = 1; + t.loops = loops; +// if (t.tweenType == TweenType.Tweener) t.fullDuration = loops > -1 ? t.duration * loops : Mathf.Infinity; // Mysteriously Unity doesn't like this form + if (t.tweenType == TweenType.Tweener) { + if (loops > -1) t.fullDuration = t.duration * loops; + else t.fullDuration = Mathf.Infinity; + } + return t; + } + /// Sets the looping options for the tween. + /// Has no effect if the tween has already started + /// Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + /// Loop behaviour type (default: LoopType.Restart) + public static T SetLoops(this T t, int loops, LoopType loopType) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + if (loops < -1) loops = -1; + else if (loops == 0) loops = 1; + t.loops = loops; + t.loopType = loopType; +// if (t.tweenType == TweenType.Tweener) t.fullDuration = loops > -1 ? t.duration * loops : Mathf.Infinity; + if (t.tweenType == TweenType.Tweener) { + if (loops > -1) t.fullDuration = t.duration * loops; + else t.fullDuration = Mathf.Infinity; + } + return t; + } + + /// Sets the ease of the tween. + /// If applied to Sequences eases the whole sequence animation + public static T SetEase(this T t, Ease ease) where T : Tween + { + if (!t.active) return t; + + t.easeType = ease; + t.customEase = null; + return t; + } + /// Sets the ease of the tween. + /// If applied to Sequences eases the whole sequence animation + /// Eventual overshoot to use with Back ease (default is 1.70158) + public static T SetEase(this T t, Ease ease, float overshoot) where T : Tween + { + if (!t.active) return t; + + t.easeType = ease; + t.easeOvershootOrAmplitude = overshoot; + t.customEase = null; + return t; + } + /// Sets the ease of the tween. + /// If applied to Sequences eases the whole sequence animation + /// Eventual amplitude to use with Elastic easeType (default is 1.70158) + /// Eventual period to use with Elastic easeType (default is 0) + public static T SetEase(this T t, Ease ease, float amplitude, float period) where T : Tween + { + if (!t.active) return t; + + t.easeType = ease; + t.easeOvershootOrAmplitude = amplitude; + t.easePeriod = period; + t.customEase = null; + return t; + } + /// Sets the ease of the tween using an AnimationCurve. + /// If applied to Sequences eases the whole sequence animation + public static T SetEase(this T t, AnimationCurve animCurve) where T : Tween + { + if (!t.active) return t; + + t.easeType = Ease.INTERNAL_Custom; + t.customEase = new EaseCurve(animCurve).Evaluate; + return t; + } + /// Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + /// If applied to Sequences eases the whole sequence animation + public static T SetEase(this T t, EaseFunction customEase) where T : Tween + { + if (!t.active) return t; + + t.easeType = Ease.INTERNAL_Custom; + t.customEase = customEase; + return t; + } + + /// Allows the tween to be recycled after being killed. + public static T SetRecyclable(this T t) where T : Tween + { + if (!t.active) return t; + + t.isRecyclable = true; + return t; + } + /// Sets the recycling behaviour for the tween. + /// If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + public static T SetRecyclable(this T t, bool recyclable) where T : Tween + { + if (!t.active) return t; + + t.isRecyclable = recyclable; + return t; + } + + /// Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + /// If TRUE the tween will ignore Unity's Time.timeScale + public static T SetUpdate(this T t, bool isIndependentUpdate) where T : Tween + { + if (!t.active) return t; + + TweenManager.SetUpdateType(t, DOTween.defaultUpdateType, isIndependentUpdate); + return t; + } + /// Sets the type of update (default or independent) for the tween + /// The type of update (defalt: UpdateType.Normal) + /// If TRUE the tween will ignore Unity's Time.timeScale + public static T SetUpdate(this T t, UpdateType updateType, bool isIndependentUpdate = false) where T : Tween + { + if (!t.active) return t; + + TweenManager.SetUpdateType(t, updateType, isIndependentUpdate); + return t; + } + + /// Sets the onStart callback for the tween. + /// Called the first time the tween is set in a playing state, after any eventual delay + public static T OnStart(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onStart = action; + return t; + } + + /// Sets the onPlay callback for the tween. + /// Called when the tween is set in a playing state, after any eventual delay. + /// Also called each time the tween resumes playing from a paused state + public static T OnPlay(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onPlay = action; + return t; + } + + /// Sets the onPlay callback for the tween. + /// Called when the tween state changes from playing to paused. + /// If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + public static T OnPause(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onPause = action; + return t; + } + + /// Sets the onRewind callback for the tween. + /// Called when the tween is rewinded, + /// either by calling Rewind or by reaching the start position while playing backwards. + /// Rewinding a tween that is already rewinded will not fire this callback + public static T OnRewind(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onRewind = action; + return t; + } + + /// Sets the onUpdate callback for the tween. + /// Called each time the tween updates + public static T OnUpdate(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onUpdate = action; + return t; + } + + /// Sets the onStepComplete callback for the tween. + /// Called the moment the tween completes one loop cycle, even when going backwards + public static T OnStepComplete(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onStepComplete = action; + return t; + } + + /// Sets the onComplete callback for the tween. + /// Called the moment the tween reaches its final forward position, loops included + public static T OnComplete(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onComplete = action; + return t; + } + + /// Sets the onKill callback for the tween. + /// Called the moment the tween is killed + public static T OnKill(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onKill = action; + return t; + } + + /// Sets the onWaypointChange callback for the tween. + /// Called when a path tween's current waypoint changes + public static T OnWaypointChange(this T t, TweenCallback action) where T : Tween + { + if (!t.active) return t; + + t.onWaypointChange = action; + return t; + } + + /// Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + /// Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + /// Has no effect if the tween has already started. + /// NOTE: the tween's target will not be changed + /// Tween from which to copy the parameters + public static T SetAs(this T t, Tween asTween) where T : Tween + { + if (!t.active || t.creationLocked) return t; + +// t.isFrom = asTween.isFrom; +// t.target = asTween.target; + + t.timeScale = asTween.timeScale; + t.isBackwards = asTween.isBackwards; + TweenManager.SetUpdateType(t, asTween.updateType, asTween.isIndependentUpdate); + t.id = asTween.id; + t.onStart = asTween.onStart; + t.onPlay = asTween.onPlay; + t.onRewind = asTween.onRewind; + t.onUpdate = asTween.onUpdate; + t.onStepComplete = asTween.onStepComplete; + t.onComplete = asTween.onComplete; + t.onKill = asTween.onKill; + t.onWaypointChange = asTween.onWaypointChange; + + t.isRecyclable = asTween.isRecyclable; + t.isSpeedBased = asTween.isSpeedBased; + t.autoKill = asTween.autoKill; + t.loops = asTween.loops; + t.loopType = asTween.loopType; + if (t.tweenType == TweenType.Tweener) { + if (t.loops > -1) t.fullDuration = t.duration * t.loops; + else t.fullDuration = Mathf.Infinity; + } + + t.delay = asTween.delay; + t.delayComplete = t.delay <= 0; + t.isRelative = asTween.isRelative; + t.easeType = asTween.easeType; + t.customEase = asTween.customEase; + t.easeOvershootOrAmplitude = asTween.easeOvershootOrAmplitude; + t.easePeriod = asTween.easePeriod; + + return t; + } + + /// Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + /// Has no effect if the tween has already started. + /// TweenParams from which to copy the parameters + public static T SetAs(this T t, TweenParams tweenParams) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + TweenManager.SetUpdateType(t, tweenParams.updateType, tweenParams.isIndependentUpdate); + t.id = tweenParams.id; + t.onStart = tweenParams.onStart; + t.onPlay = tweenParams.onPlay; + t.onRewind = tweenParams.onRewind; + t.onUpdate = tweenParams.onUpdate; + t.onStepComplete = tweenParams.onStepComplete; + t.onComplete = tweenParams.onComplete; + t.onKill = tweenParams.onKill; + t.onWaypointChange = tweenParams.onWaypointChange; + + t.isRecyclable = tweenParams.isRecyclable; + t.isSpeedBased = tweenParams.isSpeedBased; + t.autoKill = tweenParams.autoKill; + t.loops = tweenParams.loops; + t.loopType = tweenParams.loopType; + if (t.tweenType == TweenType.Tweener) { + if (t.loops > -1) t.fullDuration = t.duration * t.loops; + else t.fullDuration = Mathf.Infinity; + } + + t.delay = tweenParams.delay; + t.delayComplete = t.delay <= 0; + t.isRelative = tweenParams.isRelative; + if (tweenParams.easeType == Ease.Unset) { + if (t.tweenType == TweenType.Sequence) t.easeType = Ease.Linear; + else t.easeType = DOTween.defaultEaseType; +// t.easeType = t.tweenType == TweenType.Sequence ? Ease.Linear : DOTween.defaultEaseType; // Doesn't work w webplayer (why?) + } else t.easeType = tweenParams.easeType; + t.customEase = tweenParams.customEase; + t.easeOvershootOrAmplitude = tweenParams.easeOvershootOrAmplitude; + t.easePeriod = tweenParams.easePeriod; + + return t; + } + + #endregion + + #region Sequences-only + + /// Adds the given tween to the end of the Sequence. + /// Has no effect if the Sequence has already started + /// The tween to append + public static Sequence Append(this Sequence s, Tween t) + { + if (!s.active || s.creationLocked) return s; + if (t == null || !t.active) return s; + + Sequence.DoInsert(s, t, s.duration); + return s; + } + /// Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + /// Has no effect if the Sequence has already started + /// The tween to prepend + public static Sequence Prepend(this Sequence s, Tween t) + { + if (!s.active || s.creationLocked) return s; + if (t == null || !t.active) return s; + + Sequence.DoPrepend(s, t); + return s; + } + /// Inserts the given tween at the same time position of the last tween added to the Sequence. + /// Has no effect if the Sequence has already started + public static Sequence Join(this Sequence s, Tween t) + { + if (!s.active || s.creationLocked) return s; + if (t == null || !t.active) return s; + + Sequence.DoInsert(s, t, s.lastTweenInsertTime); + return s; + } + /// Inserts the given tween at the given time position in the Sequence, + /// automatically adding an interval if needed. + /// Has no effect if the Sequence has already started + /// The time position where the tween will be placed + /// The tween to insert + public static Sequence Insert(this Sequence s, float atPosition, Tween t) + { + if (!s.active || s.creationLocked) return s; + if (t == null || !t.active) return s; + + Sequence.DoInsert(s, t, atPosition); + return s; + } + + /// Adds the given interval to the end of the Sequence. + /// Has no effect if the Sequence has already started + /// The interval duration + public static Sequence AppendInterval(this Sequence s, float interval) + { + if (!s.active || s.creationLocked) return s; + + Sequence.DoAppendInterval(s, interval); + return s; + } + /// Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + /// Has no effect if the Sequence has already started + /// The interval duration + public static Sequence PrependInterval(this Sequence s, float interval) + { + if (!s.active || s.creationLocked) return s; + + Sequence.DoPrependInterval(s, interval); + return s; + } + + /// Adds the given callback to the end of the Sequence. + /// Has no effect if the Sequence has already started + /// The callback to append + public static Sequence AppendCallback(this Sequence s, TweenCallback callback) + { + if (!s.active || s.creationLocked) return s; + if (callback == null) return s; + + Sequence.DoInsertCallback(s, callback, s.duration); + return s; + } + /// Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + /// Has no effect if the Sequence has already started + /// The callback to prepend + public static Sequence PrependCallback(this Sequence s, TweenCallback callback) + { + if (!s.active || s.creationLocked) return s; + if (callback == null) return s; + + Sequence.DoInsertCallback(s, callback, 0); + return s; + } + /// Inserts the given callback at the given time position in the Sequence, + /// automatically adding an interval if needed. + /// Has no effect if the Sequence has already started + /// The time position where the callback will be placed + /// The callback to insert + public static Sequence InsertCallback(this Sequence s, float atPosition, TweenCallback callback) + { + if (!s.active || s.creationLocked) return s; + if (callback == null) return s; + + Sequence.DoInsertCallback(s, callback, atPosition); + return s; + } + #endregion + + #region Tweeners-only + + /// Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + /// then immediately sends the target to the previously set endValue. + public static T From(this T t) where T : Tweener + { + if (!t.active || t.creationLocked || !t.isFromAllowed) return t; + + t.isFrom = true; + t.SetFrom(false); + return t; + } + /// Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + /// then immediately sends the target to the previously set endValue. + /// If TRUE the FROM value will be calculated as relative to the current one + public static T From(this T t, bool isRelative) where T : Tweener + { + if (!t.active || t.creationLocked || !t.isFromAllowed) return t; + + t.isFrom = true; + t.SetFrom(isRelative); + return t; + } + + /// Sets a delayed startup for the tween. + /// Has no effect on Sequences or if the tween has already started + public static T SetDelay(this T t, float delay) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + t.delay = delay; + t.delayComplete = delay <= 0; + return t; + } + + /// Sets the tween as relative + /// (the endValue will be calculated as startValue + endValue instead than being used directly). + /// Has no effect on Sequences or if the tween has already started + public static T SetRelative(this T t) where T : Tween + { + if (!t.active || t.creationLocked || t.isFrom) return t; + + t.isRelative = true; + return t; + } + /// If isRelative is TRUE sets the tween as relative + /// (the endValue will be calculated as startValue + endValue instead than being used directly). + /// Has no effect on Sequences or if the tween has already started + public static T SetRelative(this T t, bool isRelative) where T : Tween + { + if (!t.active || t.creationLocked || t.isFrom) return t; + + t.isRelative = isRelative; + return t; + } + + /// If isSpeedBased is TRUE sets the tween as speed based + /// (the duration will represent the number of units the tween moves x second). + /// Has no effect on Sequences, nested tweens, or if the tween has already started + public static T SetSpeedBased(this T t) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + t.isSpeedBased = true; + return t; + } + /// If isSpeedBased is TRUE sets the tween as speed based + /// (the duration will represent the number of units the tween moves x second). + /// Has no effect on Sequences, nested tweens, or if the tween has already started + public static T SetSpeedBased(this T t, bool isSpeedBased) where T : Tween + { + if (!t.active || t.creationLocked) return t; + + t.isSpeedBased = isSpeedBased; + return t; + } + + #endregion + + #region Tweeners Extra Options + + /// Options for float tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + + /// Options for Vector2 tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + /// Options for Vector2 tweens + /// Selecting an axis will tween the vector only on that axis, leaving the others untouched + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, AxisConstraint axisConstraint, bool snapping = false) + { + if (!t.active) return t; + + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.snapping = snapping; + return t; + } + + /// Options for Vector3 tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + /// Options for Vector3 tweens + /// Selecting an axis will tween the vector only on that axis, leaving the others untouched + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, AxisConstraint axisConstraint, bool snapping = false) + { + if (!t.active) return t; + + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.snapping = snapping; + return t; + } + + /// Options for Vector4 tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + /// Options for Vector4 tweens + /// Selecting an axis will tween the vector only on that axis, leaving the others untouched + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, AxisConstraint axisConstraint, bool snapping = false) + { + if (!t.active) return t; + + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.snapping = snapping; + return t; + } + + /// Options for Quaternion tweens + /// If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + /// If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + public static Tweener SetOptions(this TweenerCore t, bool useShortest360Route = true) + { + if (!t.active) return t; + + t.plugOptions.rotateMode = useShortest360Route ? RotateMode.Fast : RotateMode.FastBeyond360; + return t; + } + + /// Options for Color tweens + /// If TRUE only the alpha value of the color will be tweened + public static Tweener SetOptions(this TweenerCore t, bool alphaOnly) + { + if (!t.active) return t; + + t.plugOptions.alphaOnly = alphaOnly; + return t; + } + + /// Options for Vector4 tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + + /// Options for Vector4 tweens + /// If TRUE the string will appear from a random animation of characters + /// A string containing the characters to use for scrambling. + /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + /// Leave it to NULL to use default ones + public static Tweener SetOptions(this TweenerCore t, bool scramble, string scrambleChars = null) + { + if (!t.active) return t; + + t.plugOptions.scramble = scramble; + if (!string.IsNullOrEmpty(scrambleChars)) { + if (scrambleChars.Length <= 1) scrambleChars += scrambleChars; + t.plugOptions.scrambledChars = scrambleChars.ToCharArray(); + t.plugOptions.scrambledChars.ScrambleChars(); + } + return t; + } + + /// Options for Vector3Array tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, bool snapping) + { + if (!t.active) return t; + + t.plugOptions.snapping = snapping; + return t; + } + /// Options for Vector3Array tweens + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener SetOptions(this TweenerCore t, AxisConstraint axisConstraint, bool snapping = false) + { + if (!t.active) return t; + + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.snapping = snapping; + return t; + } + + #region Path Options + + /// Options for Path tweens (created via the DOPath shortcut) + /// The eventual movement axis to lock. You can input multiple axis if you separate them like this: + /// AxisConstrain.X | AxisConstraint.Y + /// The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + /// AxisConstrain.X | AxisConstraint.Y + public static TweenerCore SetOptions( + this TweenerCore t, + AxisConstraint lockPosition, AxisConstraint lockRotation = AxisConstraint.None + ) + { + return SetOptions(t, false, lockPosition, lockRotation); + } + /// Options for Path tweens (created via the DOPath shortcut) + /// If TRUE the path will be automatically closed + /// The eventual movement axis to lock. You can input multiple axis if you separate them like this: + /// AxisConstrain.X | AxisConstraint.Y + /// The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + /// AxisConstrain.X | AxisConstraint.Y + public static TweenerCore SetOptions( + this TweenerCore t, + bool closePath, AxisConstraint lockPosition = AxisConstraint.None, AxisConstraint lockRotation = AxisConstraint.None + ) + { + t.plugOptions.isClosedPath = closePath; + t.plugOptions.lockPositionAxis = lockPosition; + t.plugOptions.lockRotationAxis = lockRotation; + return t; + } + + /// Additional LookAt options for Path tweens (created via the DOPath shortcut). + /// Orients the target towards the given position. + /// Must be chained directly to the tween creation method or to a SetOptions + /// The position to look at + /// The eventual direction to consider as "forward". + /// If left to NULL defaults to the regular forward side of the transform + /// The vector that defines in which direction up is (default: Vector3.up) + public static TweenerCore SetLookAt( + this TweenerCore t, Vector3 lookAtPosition, Vector3? forwardDirection = null, Vector3? up = null + ) + { + t.plugOptions.orientType = OrientType.LookAtPosition; + t.plugOptions.lookAtPosition = lookAtPosition; + SetPathForwardDirection(t, forwardDirection, up); + return t; + } + /// Additional LookAt options for Path tweens (created via the DOPath shortcut). + /// Orients the target towards another transform. + /// Must be chained directly to the tween creation method or to a SetOptions + /// The transform to look at + /// The eventual direction to consider as "forward". + /// If left to NULL defaults to the regular forward side of the transform + /// The vector that defines in which direction up is (default: Vector3.up) + public static TweenerCore SetLookAt( + this TweenerCore t, Transform lookAtTransform, Vector3? forwardDirection = null, Vector3? up = null + ) + { + t.plugOptions.orientType = OrientType.LookAtTransform; + t.plugOptions.lookAtTransform = lookAtTransform; + SetPathForwardDirection(t, forwardDirection, up); + return t; + } + /// Additional LookAt options for Path tweens (created via the DOPath shortcut). + /// Orients the target to the path, with the given lookAhead. + /// Must be chained directly to the tween creation method or to a SetOptions + /// The percentage of lookAhead to use (0 to 1) + /// The eventual direction to consider as "forward". + /// If left to NULL defaults to the regular forward side of the transform + /// The vector that defines in which direction up is (default: Vector3.up) + public static TweenerCore SetLookAt( + this TweenerCore t, float lookAhead, Vector3? forwardDirection = null, Vector3? up = null + ) + { + t.plugOptions.orientType = OrientType.ToPath; + if (lookAhead < PathPlugin.MinLookAhead) lookAhead = PathPlugin.MinLookAhead; + t.plugOptions.lookAhead = lookAhead; + SetPathForwardDirection(t, forwardDirection, up); + return t; + } + + static void SetPathForwardDirection(this TweenerCore t, Vector3? forwardDirection = null, Vector3? up = null) + { + t.plugOptions.hasCustomForwardDirection = forwardDirection != null && forwardDirection != Vector3.zero || up != null && up != Vector3.zero; + if (t.plugOptions.hasCustomForwardDirection) { + if (forwardDirection == Vector3.zero) forwardDirection = Vector3.forward; + t.plugOptions.forward = Quaternion.LookRotation( + forwardDirection == null ? Vector3.forward : (Vector3)forwardDirection, + up == null ? Vector3.up : (Vector3)up + ); + } + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/TweenType.cs b/_DOTween.Assembly/DOTween/TweenType.cs new file mode 100644 index 0000000..cffc486 --- /dev/null +++ b/_DOTween.Assembly/DOTween/TweenType.cs @@ -0,0 +1,20 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/06/29 19:25 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Used internally + /// + public enum TweenType + { +#pragma warning disable 1591 + Tweener, + Sequence, + Callback // Indicates a callback in a Sequence +#pragma warning restore 1591 + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/Tweener.cs b/_DOTween.Assembly/DOTween/Tweener.cs new file mode 100644 index 0000000..36528ce --- /dev/null +++ b/_DOTween.Assembly/DOTween/Tweener.cs @@ -0,0 +1,268 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/07/12 16:24 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Animates a single value + /// + public abstract class Tweener : Tween + { + // TRUE when start value has been changed via From or ChangeStart/Values (allows DoStartup to take it into account). + // Reset by TweenerCore + internal bool hasManuallySetStartValue; + internal bool isFromAllowed = true; // if FALSE from tweens won't be allowed. Reset by TweenerCore + + internal Tweener() {} + + // =================================================================================== + // ABSTRACT METHODS ------------------------------------------------------------------ + + /// Changes the start value of a tween and rewinds it (without pausing it). + /// Has no effect with tweens that are inside Sequences + /// The new start value + /// If bigger than 0 applies it as the new tween duration + public abstract Tweener ChangeStartValue(object newStartValue, float newDuration = -1); + + /// Changes the end value of a tween and rewinds it (without pausing it). + /// Has no effect with tweens that are inside Sequences + /// The new end value + /// If bigger than 0 applies it as the new tween duration + /// If TRUE the start value will become the current target's value, otherwise it will stay the same + public abstract Tweener ChangeEndValue(object newEndValue, float newDuration = -1, bool snapStartValue = false); + /// Changes the end value of a tween and rewinds it (without pausing it). + /// Has no effect with tweens that are inside Sequences + /// The new end value + /// If TRUE the start value will become the current target's value, otherwise it will stay the same + public abstract Tweener ChangeEndValue(object newEndValue, bool snapStartValue); + + /// Changes the start and end value of a tween and rewinds it (without pausing it). + /// Has no effect with tweens that are inside Sequences + /// The new start value + /// The new end value + /// If bigger than 0 applies it as the new tween duration + public abstract Tweener ChangeValues(object newStartValue, object newEndValue, float newDuration = -1); + + internal abstract Tweener SetFrom(bool relative); + + // =================================================================================== + // INTERNAL METHODS ------------------------------------------------------------------ + + // CALLED BY DOTween when spawning/creating a new Tweener. + // Returns TRUE if the setup is successful + internal static bool Setup( + TweenerCore t, DOGetter getter, DOSetter setter, T2 endValue, float duration, ABSTweenPlugin plugin = null + ) + where TPlugOptions : struct + { + if (plugin != null) t.tweenPlugin = plugin; + else { + if (t.tweenPlugin == null) t.tweenPlugin = PluginsManager.GetDefaultPlugin(); + if (t.tweenPlugin == null) { + // No suitable plugin found. Kill + Debugger.LogError("No suitable plugin found for this type"); + return false; + } + } + + t.getter = getter; + t.setter = setter; + t.endValue = endValue; + t.duration = duration; + // Defaults + t.autoKill = DOTween.defaultAutoKill; + t.isRecyclable = DOTween.defaultRecyclable; + t.easeType = DOTween.defaultEaseType; // Set to INTERNAL_Zero in case of 0 duration, but in DoStartup + t.easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; + t.easePeriod = DOTween.defaultEasePeriod; + t.loopType = DOTween.defaultLoopType; + t.isPlaying = DOTween.defaultAutoPlay == AutoPlay.All || DOTween.defaultAutoPlay == AutoPlay.AutoPlayTweeners; + return true; + } + + // CALLED BY TweenerCore + // Returns the elapsed time minus delay in case of success, + // -1 if there are missing references and the tween needs to be killed + internal static float DoUpdateDelay(TweenerCore t, float elapsed) where TPlugOptions : struct + { + float tweenDelay = t.delay; + if (elapsed > tweenDelay) { + // Delay complete + t.elapsedDelay = tweenDelay; + t.delayComplete = true; + return elapsed - tweenDelay; + } + t.elapsedDelay = elapsed; + return 0; + } + + // CALLED VIA Tween the moment the tween starts, AFTER any delay has elapsed + // (unless it's a FROM tween, in which case it will be called BEFORE any eventual delay). + // Returns TRUE in case of success, + // FALSE if there are missing references and the tween needs to be killed + internal static bool DoStartup(TweenerCore t) where TPlugOptions : struct + { + t.startupDone = true; + + // Special startup operations + if (t.specialStartupMode != SpecialStartupMode.None) { + if (!DOStartupSpecials(t)) return false; + } + + if (!t.hasManuallySetStartValue) { + // Take start value from current target value + if (DOTween.useSafeMode) { + try { + t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter()); + } catch { + return false; // Target/field doesn't exist: kill tween + } + } else t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter()); + } + + if (t.isRelative) t.tweenPlugin.SetRelativeEndValue(t); + + t.tweenPlugin.SetChangeValue(t); + + // Duration based startup operations + DOStartupDurationBased(t); + + // Applied here so that the eventual duration derived from a speedBased tween has been set + if (t.duration <= 0) t.easeType = Ease.INTERNAL_Zero; + + return true; + } + + // CALLED BY TweenerCore + internal static Tweener DoChangeStartValue( + TweenerCore t, T2 newStartValue, float newDuration + ) where TPlugOptions : struct + { + t.hasManuallySetStartValue = true; + t.startValue = newStartValue; + + if (t.startupDone) { + if (t.specialStartupMode != SpecialStartupMode.None) { + if (!DOStartupSpecials(t)) return null; + } + t.tweenPlugin.SetChangeValue(t); + } + + if (newDuration > 0) { + t.duration = newDuration; + if (t.startupDone) DOStartupDurationBased(t); + } + + // Force rewind + DoGoto(t, 0, 0, UpdateMode.Goto); + + return t; + } + + // CALLED BY TweenerCore + internal static Tweener DoChangeEndValue( + TweenerCore t, T2 newEndValue, float newDuration, bool snapStartValue + ) where TPlugOptions : struct + { + t.endValue = newEndValue; + t.isRelative = false; + + if (t.startupDone) { + if (t.specialStartupMode != SpecialStartupMode.None) { + if (!DOStartupSpecials(t)) return null; + } + if (snapStartValue) { + // Reassign startValue with current target's value + if (DOTween.useSafeMode) { + try { + t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter()); + } catch { + // Target/field doesn't exist: kill tween + TweenManager.Despawn(t); + return null; + } + } else t.startValue = t.tweenPlugin.ConvertToStartValue(t, t.getter()); + } + t.tweenPlugin.SetChangeValue(t); + } + + if (newDuration > 0) { + t.duration = newDuration; + if (t.startupDone) DOStartupDurationBased(t); + } + + // Force rewind + DoGoto(t, 0, 0, UpdateMode.Goto); + + return t; + } + + internal static Tweener DoChangeValues( + TweenerCore t, T2 newStartValue, T2 newEndValue, float newDuration + ) where TPlugOptions : struct + { + t.hasManuallySetStartValue = true; + t.isRelative = t.isFrom = false; + t.startValue = newStartValue; + t.endValue = newEndValue; + + if (t.startupDone) { + if (t.specialStartupMode != SpecialStartupMode.None) { + if (!DOStartupSpecials(t)) return null; + } + t.tweenPlugin.SetChangeValue(t); + } + + if (newDuration > 0) { + t.duration = newDuration; + if (t.startupDone) DOStartupDurationBased(t); + } + + // Force rewind + DoGoto(t, 0, 0, UpdateMode.Goto); + + return t; + } + + // Commands shared by DOStartup/ChangeStart/End/Values if the tween has already started up + // and thus some settings needs to be reapplied. + // Returns TRUE in case of SUCCESS, FALSE if there were managed errors + static bool DOStartupSpecials(TweenerCore t) where TPlugOptions : struct + { + try { + switch (t.specialStartupMode) { + case SpecialStartupMode.SetLookAt: + if (!SpecialPluginsUtils.SetLookAt(t as TweenerCore)) return false; + break; + case SpecialStartupMode.SetPunch: + if (!SpecialPluginsUtils.SetPunch(t as TweenerCore)) return false; + break; + case SpecialStartupMode.SetShake: + if (!SpecialPluginsUtils.SetShake(t as TweenerCore)) return false; + break; + case SpecialStartupMode.SetCameraShakePosition: + if (!SpecialPluginsUtils.SetCameraShakePosition(t as TweenerCore)) return false; + break; + } + return true; + } catch { + // Erro in SpecialPluginUtils (usually due to target being destroyed) + return false; + } + } + static void DOStartupDurationBased(TweenerCore t) where TPlugOptions : struct + { + if (t.isSpeedBased) t.duration = t.tweenPlugin.GetSpeedBasedDuration(t.plugOptions, t.duration, t.changeValue); + t.fullDuration = t.loops > -1 ? t.duration * t.loops : Mathf.Infinity; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/UpdateType.cs b/_DOTween.Assembly/DOTween/UpdateType.cs new file mode 100644 index 0000000..1bc7143 --- /dev/null +++ b/_DOTween.Assembly/DOTween/UpdateType.cs @@ -0,0 +1,21 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/05/06 17:46 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +namespace DG.Tweening +{ + /// + /// Update type + /// + public enum UpdateType + { + /// Updates every frame during Update calls + Normal, + /// Updates every frame during LateUpdate calls + Late, + /// Updates using FixedUpdate calls + Fixed + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween43/DOTween43.csproj b/_DOTween.Assembly/DOTween43/DOTween43.csproj new file mode 100644 index 0000000..67205d6 --- /dev/null +++ b/_DOTween.Assembly/DOTween43/DOTween43.csproj @@ -0,0 +1,101 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {978C0952-38D0-4C22-B96C-823EAFEDF0FA} + Library + Properties + DG.Tweening + DOTween43 + v3.5 + 512 + + + true + full + false + ..\bin\ + DEBUG;TRACE + prompt + 4 + ..\bin\DOTween43.xml + 1591 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + ..\bin\DOTween43.xml + 1573 + + + + + C:\Program Files\_Design\Unity 4.3\Editor\Data\Managed\UnityEngine.dll + False + + + + + + + + + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55} + DOTween + False + + + + + set BinDir=bin.Global\DOTween +set DestinationDir=$(SolutionDir)..\..\%25BinDir%25 +set BinDirNoMeta=bin.Global_no_meta\DOTween +set DestinationDirNoMeta=$(SolutionDir)..\..\%25BinDirNoMeta%25 +set BinDirUnityTests=UnityTests.Unity4\Assets\Demigiant\DOTween +set DestinationDirUnityTests=$(SolutionDir)..\%25BinDirUnityTests%25 +set BinDirUnity5Tests=UnityTests.Unity5\Assets\Demigiant\DOTween +set DestinationDirUnity5Tests=$(SolutionDir)..\%25BinDirUnity5Tests%25 +set BinDirCompatibilityTests=UnityCompatibilityTests.Unity35\Assets\Demigiant\DOTween +set DestinationDirCompatibilityTests=$(SolutionDir)..\%25BinDirCompatibilityTests%25 + +echo %25DestinationDir%25 + +echo Deleting TMPs... +DEL $(TargetDir)\*.tmp + +CD $(TargetDir) +echo Converting PDB to MDB and deleting PDB... +"c:\Program Files\_Design\Unity 4.6\Editor\Data\MonoBleedingEdge\lib\mono\4.0\pdb2mdb.exe" $(TargetFileName) +DEL $(TargetName).pdb + +echo Exporting Assembly to %25DestinationDir%25 +echo Copying files to Destination... +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDir%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirNoMeta%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirNoMeta%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnityTests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnity5Tests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnity5Tests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirCompatibilityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirCompatibilityTests%25 /Y /I /E + + + \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween43/Properties/AssemblyInfo.cs b/_DOTween.Assembly/DOTween43/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..52301c3 --- /dev/null +++ b/_DOTween.Assembly/DOTween43/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DOTween43")] +[assembly: AssemblyDescription("DOTween shortcuts for Unity 4.3 or later")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Demigiant")] +[assembly: AssemblyProduct("DOTween43")] +[assembly: AssemblyCopyright("Copyright © Daniele Giardini, 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("807e068c-2a0e-4c81-a303-4b4fd3924511")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs new file mode 100644 index 0000000..5ad489b --- /dev/null +++ b/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs @@ -0,0 +1,84 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/04 17:55 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + /// These, as all DOTween43 methods, require Unity 4.3 or later. + /// + public static class ShortcutExtensions + { + #region SpriteRenderer + + /// Tweens a SpriteRenderer's color to the given value. + /// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this SpriteRenderer target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Material's alpha color to the given value. + /// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this SpriteRenderer target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region Rigidbody2D Shortcuts + + /// Tweens a Rigidbody2D's position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a Rigidbody2D's X position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetTarget(target); + } + + /// Tweens a Rigidbody2D's Y position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration) + .SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + } + + /// Tweens a Rigidbody2D's rotation to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DORotate(this Rigidbody2D target, float endValue, float duration) + { + return DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration) + .SetTarget(target); + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween46/DOTween46.csproj b/_DOTween.Assembly/DOTween46/DOTween46.csproj new file mode 100644 index 0000000..ffef922 --- /dev/null +++ b/_DOTween.Assembly/DOTween46/DOTween46.csproj @@ -0,0 +1,105 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {AC1E5A23-CE58-419C-B165-EB1CD39AB433} + Library + Properties + DG.Tweening + DOTween46 + v3.5 + 512 + + + true + full + false + ..\bin\ + DEBUG;TRACE + prompt + 4 + ..\bin\DOTween43.xml + 1591 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + ..\bin\DOTween46.xml + 1573 + + + + + C:\Program Files\_Design\Unity 4.6\Editor\Data\Managed\UnityEngine.dll + False + + + C:\Program Files\_Design\Unity 4.6\Editor\Data\UnityExtensions\Unity\GUISystem\4.6.1\UnityEngine.UI.dll + False + + + + + + + + + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55} + DOTween + False + + + + + set BinDir=bin.Global\DOTween +set DestinationDir=$(SolutionDir)..\..\%25BinDir%25 +set BinDirNoMeta=bin.Global_no_meta\DOTween +set DestinationDirNoMeta=$(SolutionDir)..\..\%25BinDirNoMeta%25 +set BinDirUnityTests=UnityTests.Unity4\Assets\Demigiant\DOTween +set DestinationDirUnityTests=$(SolutionDir)..\%25BinDirUnityTests%25 +set BinDirUnity5Tests=UnityTests.Unity5\Assets\Demigiant\DOTween +set DestinationDirUnity5Tests=$(SolutionDir)..\%25BinDirUnity5Tests%25 +set BinDirCompatibilityTests=UnityCompatibilityTests.Unity35\Assets\Demigiant\DOTween +set DestinationDirCompatibilityTests=$(SolutionDir)..\%25BinDirCompatibilityTests%25 + +echo %25DestinationDir%25 + +echo Deleting TMPs... +DEL $(TargetDir)\*.tmp + +CD $(TargetDir) +echo Converting PDB to MDB and deleting PDB... +"c:\Program Files\_Design\Unity 4.6\Editor\Data\MonoBleedingEdge\lib\mono\4.0\pdb2mdb.exe" $(TargetFileName) +DEL $(TargetName).pdb + +echo Exporting Assembly to %25DestinationDir%25 +echo Copying files to Destination... +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDir%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirNoMeta%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirNoMeta%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnityTests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnity5Tests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirUnity5Tests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirCompatibilityTests%25 +echo f | xcopy "$(SolutionDir)\bin" %25DestinationDirCompatibilityTests%25 /Y /I /E + + + \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween46/Properties/AssemblyInfo.cs b/_DOTween.Assembly/DOTween46/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..77d48d1 --- /dev/null +++ b/_DOTween.Assembly/DOTween46/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DOTween46")] +[assembly: AssemblyDescription("DOTween shortcuts for Unity 4.6 or later")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Demigiant")] +[assembly: AssemblyProduct("DOTween46")] +[assembly: AssemblyCopyright("Copyright © Daniele Giardini, 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("807e068c-2a0e-4c81-a303-4b4fd3924511")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/_DOTween.Assembly/DOTween46/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween46/ShortcutExtensions.cs new file mode 100644 index 0000000..68459ad --- /dev/null +++ b/_DOTween.Assembly/DOTween46/ShortcutExtensions.cs @@ -0,0 +1,244 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/29 11:53 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using UnityEngine; +using UnityEngine.UI; + +namespace DG.Tweening +{ + /// + /// Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + /// These, as all DOTween46 methods, require Unity 4.6 or later. + /// + public static class ShortcutExtensions + { + #region Unity UI + + #region CanvasGroup + + /// Tweens a CanvasGroup's alpha color to the given value. + /// Also stores the canvasGroup as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this CanvasGroup target, float endValue, float duration) + { + return DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region Graphic + + /// Tweens an Graphic's color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Graphic target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + + /// Tweens an Graphic's alpha color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this Graphic target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region Image + + /// Tweens an Image's color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Image target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + + /// Tweens an Image's alpha color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this Image target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) + .SetTarget(target); + } + + /// Tweens an Image's fillAmount to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reach (0 to 1)The duration of the tween + public static Tweener DOFillAmount(this Image target, float endValue, float duration) + { + if (endValue > 1) endValue = 1; + else if (endValue < 0) endValue = 0; + return DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region LayoutElement + + /// Tweens an LayoutElement's flexibleWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => { + target.flexibleWidth = x.x; + target.flexibleHeight = x.y; + }, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens an LayoutElement's minWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => { + target.minWidth = x.x; + target.minHeight = x.y; + }, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens an LayoutElement's preferredWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => { + target.preferredWidth = x.x; + target.preferredHeight = x.y; + }, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + #endregion + + #region Outline + + /// Tweens a Outline's effectColor to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Outline target, Color endValue, float duration) + { + return DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Outline's effectColor alpha to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this Outline target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration) + .SetTarget(target); + } + + /// Tweens a Outline's effectDistance to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOScale(this Outline target, Vector2 endValue, float duration) + { + return DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration) + .SetTarget(target); + } + + #endregion + + #region RectTransform + + /// Tweens a RectTransform's anchoredPosition to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a RectTransform's anchoredPosition3D to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + /// Tweens a RectTransform's sizeDelta to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + #endregion + + #region Slider + + /// Tweens a Slider's value to the given value. + /// Also stores the Slider as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOValue(this Slider target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.value, x => target.value = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + #endregion + + #region Text + + /// Tweens a Text's color to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOColor(this Text target, Color endValue, float duration) + { + return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target); + } + + /// Tweens a Text's alpha color to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static Tweener DOFade(this Text target, float endValue, float duration) + { + return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) + .SetTarget(target); + } + + /// Tweens a Text's text to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end string to tween toThe duration of the tween + /// If TRUE the string will appear from a random animation of characters + /// A string containing the characters to use for scrambling. + /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + /// Leave it to NULL (default) to use default ones + public static Tweener DOText(this Text target, string endValue, float duration, bool scramble = false, string scrambleChars = null) + { + return DOTween.To(() => target.text, x => target.text = x, endValue, duration) + .SetOptions(scramble, scrambleChars) + .SetTarget(target); + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/Core/DelayedCall.cs b/_DOTween.Assembly/DOTweenEditor/Core/DelayedCall.cs new file mode 100644 index 0000000..e32c4e0 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/Core/DelayedCall.cs @@ -0,0 +1,32 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2015/03/11 18:21 + +using System; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor.Core +{ + public class DelayedCall + { + public float delay; + public Action callback; + float _startupTime; + + public DelayedCall(float delay, Action callback) + { + this.delay = delay; + this.callback = callback; + _startupTime = Time.realtimeSinceStartup; + EditorApplication.update += Update; + } + + void Update() + { + if (Time.realtimeSinceStartup - _startupTime >= delay) { + if (EditorApplication.update != null) EditorApplication.update -= Update; + if (callback != null) callback(); + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/Core/EditorGUIUtils.cs b/_DOTween.Assembly/DOTweenEditor/Core/EditorGUIUtils.cs new file mode 100644 index 0000000..0386ff5 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/Core/EditorGUIUtils.cs @@ -0,0 +1,149 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2015/03/12 16:04 + +using System; +using DG.Tweening; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor.Core +{ + public static class EditorGUIUtils + { + static bool _stylesSet, _additionalStylesSet; + public static GUIStyle boldLabelStyle, + setupLabelStyle, + redLabelStyle, + btStyle, + btImgStyle, + wrapCenterLabelStyle; + public static GUIStyle handlelabelStyle, + handleSelectedLabelStyle, + wordWrapLabelStyle, + wordWrapItalicLabelStyle, + titleStyle, + logoIconStyle; + public static GUIStyle sideBtStyle, + sideLogoIconBoldLabelStyle; + + // Filtered ease types to show desired eases in Inspector panels + internal static readonly string[] FilteredEaseTypes = new[] { + "Linear", + "InSine", + "OutSine", + "InOutSine", + "InQuad", + "OutQuad", + "InOutQuad", + "InCubic", + "OutCubic", + "InOutCubic", + "InQuart", + "OutQuart", + "InOutQuart", + "InQuint", + "OutQuint", + "InOutQuint", + "InExpo", + "OutExpo", + "InOutExpo", + "InCirc", + "OutCirc", + "InOutCirc", + "InElastic", + "OutElastic", + "InOutElastic", + "InBack", + "OutBack", + "InOutBack", + "InBounce", + "OutBounce", + "InOutBounce", + ":: AnimationCurve" // Must be set manually to INTERNAL_Custom + }; + + // =================================================================================== + // PUBLIC METHODS -------------------------------------------------------------------- + + // Ease popup with filtered eases + public static Ease FilteredEasePopup(Ease currEase) + { + int stringEaseId = currEase == Ease.INTERNAL_Custom + ? FilteredEaseTypes.Length - 1 + : Array.IndexOf(FilteredEaseTypes, currEase.ToString()); + if (stringEaseId == -1) stringEaseId = 0; + stringEaseId = EditorGUILayout.Popup("Ease", stringEaseId, FilteredEaseTypes); + return stringEaseId == FilteredEaseTypes.Length - 1 ? Ease.INTERNAL_Custom : (Ease)Enum.Parse(typeof(Ease), FilteredEaseTypes[stringEaseId]); + } + + public static void SetGUIStyles(Vector2? footerSize = null) + { + if (!_additionalStylesSet && footerSize != null) { + _additionalStylesSet = true; + + Vector2 footerSizeV = (Vector2)footerSize; + btImgStyle = new GUIStyle(GUI.skin.button); + btImgStyle.normal.background = null; + btImgStyle.imagePosition = ImagePosition.ImageOnly; + btImgStyle.padding = new RectOffset(0, 0, 0, 0); + btImgStyle.fixedWidth = footerSizeV.x; + btImgStyle.fixedHeight = footerSizeV.y; + } + + if (!_stylesSet) { + _stylesSet = true; + + boldLabelStyle = new GUIStyle(GUI.skin.label); + boldLabelStyle.fontStyle = FontStyle.Bold; + redLabelStyle = new GUIStyle(GUI.skin.label); + redLabelStyle.normal.textColor = Color.red; + setupLabelStyle = new GUIStyle(boldLabelStyle); + setupLabelStyle.alignment = TextAnchor.MiddleCenter; + + wrapCenterLabelStyle = new GUIStyle(GUI.skin.label); + wrapCenterLabelStyle.wordWrap = true; + wrapCenterLabelStyle.alignment = TextAnchor.MiddleCenter; + + btStyle = new GUIStyle(GUI.skin.button); + btStyle.padding = new RectOffset(0, 0, 10, 10); + + // + + titleStyle = new GUIStyle(GUI.skin.label) { + fontSize = 12, + fontStyle = FontStyle.Bold + }; + + handlelabelStyle = new GUIStyle(GUI.skin.label) { + normal = { textColor = Color.white }, + alignment = TextAnchor.MiddleLeft + }; + handleSelectedLabelStyle = new GUIStyle(handlelabelStyle) { + normal = { textColor = Color.yellow }, + fontStyle = FontStyle.Bold + }; + + wordWrapLabelStyle = new GUIStyle(GUI.skin.label); + wordWrapLabelStyle.wordWrap = true; + + wordWrapItalicLabelStyle = new GUIStyle(wordWrapLabelStyle); + wordWrapItalicLabelStyle.fontStyle = FontStyle.Italic; + + logoIconStyle = new GUIStyle(GUI.skin.box); + logoIconStyle.active.background = logoIconStyle.normal.background = null; + logoIconStyle.margin = new RectOffset(0, 0, 4, 4); + logoIconStyle.padding = new RectOffset(0, 0, 0, 0); + + // + + sideBtStyle = new GUIStyle(GUI.skin.button); + sideBtStyle.margin.top = 1; + sideBtStyle.padding = new RectOffset(0, 0, 2, 2); + + sideLogoIconBoldLabelStyle = new GUIStyle(boldLabelStyle); + sideLogoIconBoldLabelStyle.alignment = TextAnchor.MiddleLeft; + sideLogoIconBoldLabelStyle.padding.top = 6; + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/Core/EditorUtils.cs b/_DOTween.Assembly/DOTweenEditor/Core/EditorUtils.cs new file mode 100644 index 0000000..9520859 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/Core/EditorUtils.cs @@ -0,0 +1,189 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/12/24 13:50 + +using System; +using System.Collections; +using System.Reflection; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor.Core +{ + public static class EditorUtils + { + public static string projectPath { get; private set; } // Without final slash + public static string assetsPath { get; private set; } // Without final slash + public static bool hasPro { get { if (!_hasCheckedForPro) CheckForPro(); return _hasPro; } } + public static string proVersion { get { if (!_hasCheckedForPro) CheckForPro(); return _proVersion; } } + // Editor path from Assets (not included) with final slash, in AssetDatabase format (/) + public static string editorADBDir { get { if (string.IsNullOrEmpty(_editorADBDir)) StoreEditorADBDir(); return _editorADBDir; } } + // With final slash (system based) + public static string dotweenDir { get { if (string.IsNullOrEmpty(_dotweenDir)) StoreDOTweenDirs(); return _dotweenDir; } } + // With final slash (system based) + public static string dotweenProDir { get { if (string.IsNullOrEmpty(_dotweenProDir)) StoreDOTweenDirs(); return _dotweenProDir; } } + public static bool isOSXEditor { get; private set; } + public static string pathSlash { get; private set; } // for full paths + public static string pathSlashToReplace { get; private set; } // for full paths + + static bool _hasPro; + static string _proVersion; + static bool _hasCheckedForPro; + static string _editorADBDir; + static string _dotweenDir; // with final slash + static string _dotweenProDir; // with final slash + + static EditorUtils() + { + isOSXEditor = Application.platform == RuntimePlatform.OSXEditor; + bool useWindowsSlashes = Application.platform == RuntimePlatform.WindowsEditor; + pathSlash = useWindowsSlashes ? "\\" : "/"; + pathSlashToReplace = useWindowsSlashes ? "/" : "\\"; + + projectPath = Application.dataPath; + projectPath = projectPath.Substring(0, projectPath.LastIndexOf("/")); + projectPath = projectPath.Replace(pathSlashToReplace, pathSlash); + + assetsPath = projectPath + pathSlash + "Assets"; + } + + // =================================================================================== + // PUBLIC METHODS -------------------------------------------------------------------- + + public static void DelayedCall(float delay, Action callback) + { + new DelayedCall(delay, callback); + } + + /// + /// Checks that the given editor texture use the correct import settings, + /// and applies them if they're incorrect. + /// + public static void SetEditorTexture(Texture2D texture, FilterMode filterMode = FilterMode.Point, int maxTextureSize = 32) + { + if (texture.wrapMode == TextureWrapMode.Clamp) return; + + string path = AssetDatabase.GetAssetPath(texture); + TextureImporter tImporter = AssetImporter.GetAtPath(path) as TextureImporter; + tImporter.textureType = TextureImporterType.GUI; + tImporter.npotScale = TextureImporterNPOTScale.None; + tImporter.filterMode = filterMode; + tImporter.wrapMode = TextureWrapMode.Clamp; + tImporter.maxTextureSize = maxTextureSize; + tImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor; + AssetDatabase.ImportAsset(path); + } + + /// + /// Returns TRUE if addons setup is required. + /// + public static bool DOTweenSetupRequired() + { + if (!Directory.Exists(dotweenDir)) return false; // Can happen if we were deleting DOTween + return Directory.GetFiles(dotweenDir, "*.addon").Length > 0 || hasPro && Directory.GetFiles(dotweenProDir, "*.addon").Length > 0; + } + + /// + /// Returns TRUE if the file/directory at the given path exists. + /// + /// Path, relative to Unity's project folder + /// + public static bool AssetExists(string adbPath) + { + string fullPath = ADBPathToFullPath(adbPath); + return File.Exists(fullPath) || Directory.Exists(fullPath); + } + + /// + /// Converts the given project-relative path to a full path, + /// with backward (\) slashes). + /// + public static string ADBPathToFullPath(string adbPath) + { + adbPath = adbPath.Replace(pathSlashToReplace, pathSlash); + return projectPath + pathSlash + adbPath; + } + + /// + /// Converts the given full path to a path usable with AssetDatabase methods + /// (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + /// + public static string FullPathToADBPath(string fullPath) + { + string adbPath = fullPath.Substring(projectPath.Length + 1); + return adbPath.Replace("\\", "/"); + } + + /// + /// Connects to a asset. + /// If the asset already exists at the given path, loads it and returns it. + /// Otherwise, either returns NULL or automatically creates it before loading and returning it + /// (depending on the given parameters). + /// + /// Asset type + /// File path (relative to Unity's project folder) + /// If TRUE and the requested asset doesn't exist, forces its creation + public static T ConnectToSourceAsset(string adbFilePath, bool createIfMissing = false) where T : ScriptableObject + { + if (!AssetExists(adbFilePath)) { + if (createIfMissing) CreateScriptableAsset(adbFilePath); + else return null; + } + T source = (T)Resources.LoadAssetAtPath(adbFilePath, typeof(T)); + if (source == null) { + // Source changed (or editor file was moved from outside of Unity): overwrite it + CreateScriptableAsset(adbFilePath); + source = (T)Resources.LoadAssetAtPath(adbFilePath, typeof(T)); + } + return source; + } + + // =================================================================================== + // METHODS --------------------------------------------------------------------------- + + static void CheckForPro() + { + _hasCheckedForPro = true; + try { + Assembly additionalAssembly = Assembly.Load("DOTweenPro, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); + _proVersion = additionalAssembly.GetType("DG.Tweening.DOTweenPro").GetField("Version", BindingFlags.Static | BindingFlags.Public).GetValue(null) as string; + _hasPro = true; + } catch { + // No DOTweenPro present + _hasPro = false; + _proVersion = "-"; + } + } + + // AssetDatabase formatted path to DOTween's Editor folder + static void StoreEditorADBDir() + { + string codeBase = Assembly.GetExecutingAssembly().CodeBase; + UriBuilder uri = new UriBuilder(codeBase); + string fullPath = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path)); + string adbPath = fullPath.Substring(Application.dataPath.Length + 1); + _editorADBDir = adbPath.Replace("\\", "/") + "/"; + } + + static void StoreDOTweenDirs() + { + string codeBase = Assembly.GetExecutingAssembly().CodeBase; + UriBuilder uri = new UriBuilder(codeBase); + _dotweenDir = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path)); + string pathSeparator = _dotweenDir.IndexOf("/") != -1 ? "/" : "\\"; + _dotweenDir = _dotweenDir.Substring(0, _dotweenDir.LastIndexOf(pathSeparator) + 1); + + _dotweenProDir = _dotweenDir.Substring(0, _dotweenDir.LastIndexOf(pathSeparator)); + _dotweenProDir = _dotweenProDir.Substring(0, _dotweenProDir.LastIndexOf(pathSeparator) + 1) + "DOTweenPro" + pathSeparator; + + _dotweenDir = _dotweenDir.Replace(pathSlashToReplace, pathSlash); + _dotweenProDir = _dotweenProDir.Replace(pathSlashToReplace, pathSlash); + } + + static void CreateScriptableAsset(string adbFilePath) where T : ScriptableObject + { + T data = ScriptableObject.CreateInstance(); + AssetDatabase.CreateAsset(data, adbFilePath); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj new file mode 100644 index 0000000..c6a4e24 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenEditor.csproj @@ -0,0 +1,111 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {421ACC19-8922-4E98-8921-B52240CE172A} + Library + Properties + DG.DOTweenEditor + DOTweenEditor + v3.5 + 512 + + + true + full + false + ..\bin\Editor\ + DEBUG;TRACE + prompt + 4 + ..\bin\Editor\DOTweenEditor.XML + 1591 + + + pdbonly + true + ..\bin\Editor\ + TRACE + prompt + 4 + ..\bin\Editor\DOTweenEditor.XML + 1591 + + + + + C:\Program Files\_Design\Unity\Editor\Data\Managed\UnityEditor.dll + False + + + C:\Program Files\_Design\Unity\Editor\Data\Managed\UnityEngine.dll + False + + + + + + + + + + + + + + + {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55} + DOTween + False + + + + + set BinDir=bin.Global\DOTween\Editor +set DestinationDir=$(SolutionDir)..\..\%25BinDir%25 +set BinDirNoMeta=bin.Global_no_meta\DOTween\Editor +set DestinationDirNoMeta=$(SolutionDir)..\..\%25BinDirNoMeta%25 +set BinDirUnityTests=UnityTests.Unity4\Assets\Demigiant\DOTween\Editor +set DestinationDirUnityTests=$(SolutionDir)..\%25BinDirUnityTests%25 +set BinDirUnity5Tests=UnityTests.Unity5\Assets\Demigiant\DOTween\Editor +set DestinationDirUnity5Tests=$(SolutionDir)..\%25BinDirUnity5Tests%25 +set BinDirCompatibilityTests=UnityCompatibilityTests.Unity35\Assets\Demigiant\DOTween\Editor +set DestinationDirCompatibilityTests=$(SolutionDir)..\%25BinDirCompatibilityTests%25 + +echo %25DestinationDir%25 + +echo Deleting TMPs... +DEL $(TargetDir)\*.tmp + +CD $(TargetDir) +echo Converting PDB to MDB and deleting PDB... +"c:\Program Files\_Design\Unity 4.6\Editor\Data\MonoBleedingEdge\lib\mono\4.0\pdb2mdb.exe" $(TargetFileName) +DEL $(TargetName).pdb + +echo Exporting Assembly to %25DestinationDir%25 +echo Copying files to Destination... +echo f | xcopy "$(SolutionDir)\bin\Editor" %25DestinationDir%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirNoMeta%25 +echo f | xcopy "$(SolutionDir)\bin\Editor" %25DestinationDirNoMeta%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnityTests%25 +echo f | xcopy "$(SolutionDir)\bin\Editor" %25DestinationDirUnityTests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirUnity5Tests%25 +echo f | xcopy "$(SolutionDir)\bin\Editor" %25DestinationDirUnity5Tests%25 /Y /I /E + +echo Exporting Assembly to %25DestinationDirCompatibilityTests%25 +echo f | xcopy "$(SolutionDir)\bin\Editor" %25DestinationDirCompatibilityTests%25 /Y /I /E + + + \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenInspector.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenInspector.cs new file mode 100644 index 0000000..da90fb4 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenInspector.cs @@ -0,0 +1,104 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/06/29 20:37 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.Reflection; +using System.Text; +using DG.DOTweenEditor.Core; +using DG.Tweening; +using DG.Tweening.Core; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor +{ + [CustomEditor(typeof(DOTweenComponent))] + public class DOTweenInspector : Editor + { +// DOTweenComponent _src; + string _title; + readonly StringBuilder _strBuilder = new StringBuilder(); + + // =================================================================================== + // MONOBEHAVIOUR METHODS ------------------------------------------------------------- + + void OnEnable() + { + _strBuilder.Remove(0, _strBuilder.Length); + _strBuilder.Append("DOTween v").Append(DOTween.Version); + if (DOTween.isDebugBuild) _strBuilder.Append(" [Debug build]"); + else _strBuilder.Append(" [Release build]"); + + if (EditorUtils.hasPro) _strBuilder.Append("\nDOTweenPro v").Append(EditorUtils.proVersion); + else _strBuilder.Append("\nDOTweenPro not installed"); + _title = _strBuilder.ToString(); + } + + override public void OnInspectorGUI() + { + EditorGUIUtils.SetGUIStyles(); + + int totActiveTweens = TweenManager.totActiveTweens; + int totPlayingTweens = TweenManager.TotalPlayingTweens(); + int totPausedTweens = totActiveTweens - totPlayingTweens; + int totActiveDefaultTweens = TweenManager.totActiveDefaultTweens; + int totActiveLateTweens = TweenManager.totActiveLateTweens; + + GUILayout.Space(4); + GUILayout.Label(_title, DOTween.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle); + + GUILayout.Space(6); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Documentation")) Application.OpenURL("http://dotween.demigiant.com/documentation.php"); + if (GUILayout.Button("Check Updates")) Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); + GUILayout.EndHorizontal(); + + GUILayout.Space(8); + _strBuilder.Remove(0, _strBuilder.Length); + _strBuilder.Append("Active tweens: ").Append(totActiveTweens) + .Append(" (").Append(TweenManager.totActiveTweeners) + .Append("/").Append(TweenManager.totActiveSequences).Append(")") + .Append("\nDefault/Late tweens: ").Append(totActiveDefaultTweens) + .Append("/").Append(totActiveLateTweens) + .Append("\nPlaying tweens: ").Append(totPlayingTweens) + .Append("\nPaused tweens: ").Append(totPausedTweens) + .Append("\nPooled tweens: ").Append(TweenManager.TotalPooledTweens()) + .Append(" (").Append(TweenManager.totPooledTweeners) + .Append("/").Append(TweenManager.totPooledSequences).Append(")"); + GUILayout.Label(_strBuilder.ToString()); + + GUILayout.Space(8); + _strBuilder.Remove(0, _strBuilder.Length); + _strBuilder.Append("Tweens Capacity: ").Append(TweenManager.maxTweeners).Append("/").Append(TweenManager.maxSequences) + .Append("\nMax Simultaneous Active Tweens: ").Append(DOTween.maxActiveTweenersReached).Append("/").Append(DOTween.maxActiveSequencesReached); + GUILayout.Label(_strBuilder.ToString()); + + GUILayout.Space(8); + _strBuilder.Remove(0, _strBuilder.Length); + _strBuilder.Append("SETTINGS ▼"); + _strBuilder.Append("\nSafe Mode: ").Append(DOTween.useSafeMode ? "ON" : "OFF"); + _strBuilder.Append("\nLog Behaviour: ").Append(DOTween.logBehaviour); + _strBuilder.Append("\nShow Unity Editor Report: ").Append(DOTween.showUnityEditorReport); + _strBuilder.Append("\nTimeScale (Unity/DOTween): ").Append(Time.timeScale).Append("/").Append(DOTween.timeScale); + GUILayout.Label(_strBuilder.ToString()); + GUILayout.Label("NOTE: DOTween's TimeScale is not the same as Unity's Time.timeScale: it is actually multiplied by it except for tweens that are set to update independently", EditorGUIUtils.wordWrapItalicLabelStyle); + + GUILayout.Space(8); + _strBuilder.Remove(0, _strBuilder.Length); + _strBuilder.Append("DEFAULTS ▼"); + _strBuilder.Append("\ndefaultRecyclable: ").Append(DOTween.defaultRecyclable); + _strBuilder.Append("\ndefaultUpdateType: ").Append(DOTween.defaultUpdateType); + _strBuilder.Append("\ndefaultTSIndependent: ").Append(DOTween.defaultTimeScaleIndependent); + _strBuilder.Append("\ndefaultAutoKill: ").Append(DOTween.defaultAutoKill); + _strBuilder.Append("\ndefaultAutoPlay: ").Append(DOTween.defaultAutoPlay); + _strBuilder.Append("\ndefaultEaseType: ").Append(DOTween.defaultEaseType); + _strBuilder.Append("\ndefaultLoopType: ").Append(DOTween.defaultLoopType); + GUILayout.Label(_strBuilder.ToString()); + + GUILayout.Space(10); + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenSettingsInspector.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenSettingsInspector.cs new file mode 100644 index 0000000..0bcf048 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenSettingsInspector.cs @@ -0,0 +1,32 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2015/02/05 19:50 + +using DG.Tweening.Core; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor +{ + [CustomEditor(typeof(DOTweenSettings))] + public class DOTweenSettingsInspector : Editor + { + DOTweenSettings _src; + + // =================================================================================== + // MONOBEHAVIOUR METHODS ------------------------------------------------------------- + + void OnEnable() + { + _src = target as DOTweenSettings; + } + + override public void OnInspectorGUI() + { + GUI.enabled = false; + + DrawDefaultInspector(); + + GUI.enabled = true; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenSetupMenuItem.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenSetupMenuItem.cs new file mode 100644 index 0000000..f80b69f --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenSetupMenuItem.cs @@ -0,0 +1,146 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/09/30 11:59 +// +// License Copyright (c) Daniele Giardini. +// This work is subject to the terms at http://dotween.demigiant.com/license.php + +using System; +using System.IO; +using System.Reflection; +using DG.DOTweenEditor.Core; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor +{ + /// + /// Not used as menu item anymore, but as a utiity function + /// + class DOTweenSetupMenuItem + { +// [MenuItem("Tools/" + _Title)] +// static void StartSetup() { Setup(); } + + const string _Title = "DOTween Setup"; + + /// + /// Setups DOTween + /// + /// If TRUE, no warning window appears in case there is no need for setup + public static void Setup(bool partiallySilent = false) + { + bool setupRequired = EditorUtils.DOTweenSetupRequired(); + if (setupRequired) { + string msg = "Based on your Unity version (" + Application.unityVersion + ") and eventual plugins, DOTween will now import additional tween elements, if available."; + if (!EditorUtility.DisplayDialog(_Title, msg, "Ok", "Cancel")) return; + } else { + if (!partiallySilent) { + string msg = "This project has already been setup for your version of DOTween.\nUpdate to a new DOTween version before running the setup again."; + EditorUtility.DisplayDialog(_Title, msg, "Ok"); + } + return; + } + + string addonsDir = EditorUtils.dotweenDir; + string proAddonsDir = EditorUtils.dotweenProDir; + string projectPath = Application.dataPath + EditorUtils.pathSlash; + + EditorUtility.DisplayProgressBar(_Title, "Importing additional DOTween elements based on your Unity version and eventual plugins...", 0.25f); + + int totImported = 0; + // Unity version-based files + string[] vs = Application.unityVersion.Split("."[0]); + int majorVersion = Convert.ToInt32(vs[0]); + int minorVersion = Convert.ToInt32(vs[1]); + if (majorVersion < 4) { + SetupComplete(addonsDir, proAddonsDir, totImported); + return; + } + if (majorVersion == 4) { + if (minorVersion < 3) { + SetupComplete(addonsDir, proAddonsDir, totImported); + return; + } + totImported += ImportAddons("43", addonsDir); + if (minorVersion >= 6) totImported += ImportAddons("46", addonsDir); + } else { + // 5.x + totImported += ImportAddons("43", addonsDir); + totImported += ImportAddons("46", addonsDir); + } + // Additional plugin files + // Pro plugins + if (EditorUtils.hasPro) { + if (Directory.Exists(projectPath + "TK2DROOT")) { + // PRO > 2DToolkit shortcuts + totImported += ImportAddons("Tk2d", proAddonsDir); + } + } + + SetupComplete(addonsDir, proAddonsDir, totImported); + } + + static void SetupComplete(string addonsDir, string proAddonsDir, int totImported) + { + + // Delete all remaining addon files + string[] leftoverAddonFiles = Directory.GetFiles(addonsDir, "*.addon"); + if (leftoverAddonFiles.Length > 0) { + EditorUtility.DisplayProgressBar(_Title, "Removing " + leftoverAddonFiles.Length + " unused additional files...", 0.5f); + foreach (string leftoverAddonFile in leftoverAddonFiles) File.Delete(leftoverAddonFile); + } + if (EditorUtils.hasPro) { + leftoverAddonFiles = Directory.GetFiles(proAddonsDir, "*.addon"); + if (leftoverAddonFiles.Length > 0) { + EditorUtility.DisplayProgressBar(_Title, "Removing " + leftoverAddonFiles.Length + " unused additional files...", 0.5f); + foreach (string leftoverAddonFile in leftoverAddonFiles) File.Delete(leftoverAddonFile); + } + } + // Delete all remaining addon meta files + leftoverAddonFiles = Directory.GetFiles(addonsDir, "*.addon.meta"); + if (leftoverAddonFiles.Length > 0) { + EditorUtility.DisplayProgressBar(_Title, "Removing " + leftoverAddonFiles.Length + " unused additional meta files...", 0.75f); + foreach (string leftoverAddonFile in leftoverAddonFiles) File.Delete(leftoverAddonFile); + } + if (EditorUtils.hasPro) { + leftoverAddonFiles = Directory.GetFiles(proAddonsDir, "*.addon.meta"); + if (leftoverAddonFiles.Length > 0) { + EditorUtility.DisplayProgressBar(_Title, "Removing " + leftoverAddonFiles.Length + " unused additional meta files...", 0.75f); + foreach (string leftoverAddonFile in leftoverAddonFiles) File.Delete(leftoverAddonFile); + } + } + + EditorUtility.DisplayProgressBar(_Title, "Refreshing...", 0.9f); + AssetDatabase.Refresh(); + + EditorUtility.ClearProgressBar(); + EditorUtility.DisplayDialog(_Title, "DOTween setup is now complete." + (totImported == 0 ? "" : "\n" + totImported + " additional libraries were imported or updated."), "Ok"); + } + + // Removes relative .addon extension thus activating files + static int ImportAddons(string version, string addonsDir) + { + bool imported = false; + string[] filenames = new[] { + "DOTween" + version + ".dll", + "DOTween" + version + ".xml", + "DOTween" + version + ".dll.mdb", + "DOTween" + version + ".cs" + }; + + foreach (string filename in filenames) { + string addonFilepath = addonsDir + filename + ".addon"; + string finalFilepath = addonsDir + filename; + if (File.Exists(addonFilepath)) { + // Delete eventual existing final file + if (File.Exists(finalFilepath)) File.Delete(finalFilepath); + // Rename addon file to final + File.Move(addonFilepath, finalFilepath); + imported = true; + } + } + + return imported ? 1 : 0; + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/DOTweenUtilityWindow.cs b/_DOTween.Assembly/DOTweenEditor/DOTweenUtilityWindow.cs new file mode 100644 index 0000000..9d603f3 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/DOTweenUtilityWindow.cs @@ -0,0 +1,224 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2014/12/24 13:37 + +using System.IO; +using DG.DOTweenEditor.Core; +using DG.Tweening; +using DG.Tweening.Core; +using UnityEditor; +using UnityEngine; + +namespace DG.DOTweenEditor +{ + public class UtilityWindowProcessor : AssetPostprocessor + { + static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature) + + static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) + { + if (_setupDialogRequested) return; + + string[] dotweenEntries = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png")); + bool dotweenImported = dotweenEntries.Length > 0; + if (dotweenImported) { + bool openSetupDialog = EditorUtils.DOTweenSetupRequired() + && (EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version + || EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion); + if (openSetupDialog) { + _setupDialogRequested = true; + EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version); + EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion); + EditorUtility.DisplayDialog("DOTween", "DOTween needs to be setup.\n\nSelect \"Tools > DOTween Utility Panel\" and press \"Setup DOTween...\" in the panel that opens.", "Ok"); + // Opening window after a postProcess doesn't work on Unity 3 so check that + string[] vs = Application.unityVersion.Split("."[0]); + int majorVersion = System.Convert.ToInt32(vs[0]); + if (majorVersion >= 4) EditorUtils.DelayedCall(0.5f, DOTweenUtilityWindow.Open); + EditorUtils.DelayedCall(8, ()=> _setupDialogRequested = false); + } + } + } + } + + class DOTweenUtilityWindow : EditorWindow + { + [MenuItem("Tools/" + _Title)] + static void ShowWindow() { Open(); } + + const string _Title = "DOTween Utility Panel"; + const string _SrcFile = "DOTweenSettings.asset"; + static readonly Vector2 _WinSize = new Vector2(300,350); + public const string Id = "DOTweenVersion"; + public const string IdPro = "DOTweenProVersion"; + static readonly float _HalfBtSize = _WinSize.x * 0.5f - 6; + + DOTweenSettings _src; + Texture2D _headerImg, _footerImg; + Vector2 _headerSize, _footerSize; + string _innerTitle; + bool _setupRequired; + + int _selectedTab; + string[] _tabLabels = new[] { "Setup", "Preferences" }; + + // If force is FALSE opens the window only if DOTween's version has changed + // (set to FALSE by OnPostprocessAllAssets) + public static void Open() + { + EditorWindow window = EditorWindow.GetWindow(true, _Title, true); + window.minSize = _WinSize; + window.maxSize = _WinSize; + window.ShowUtility(); + EditorPrefs.SetString(Id, DOTween.Version); + EditorPrefs.SetString(IdPro, EditorUtils.proVersion); + } + + // =================================================================================== + // UNITY METHODS --------------------------------------------------------------------- + + void OnHierarchyChange() + { Repaint(); } + + void OnEnable() + { + _innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug build]" : " [Release build]"); + if (EditorUtils.hasPro) _innerTitle += "\nDOTweenPro v" + EditorUtils.proVersion; + else _innerTitle += "\nDOTweenPro not installed"; + + if (_headerImg == null) { + _headerImg = Resources.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + "Imgs/Header.jpg", typeof(Texture2D)) as Texture2D; + EditorUtils.SetEditorTexture(_headerImg, FilterMode.Bilinear, 512); + _headerSize.x = _WinSize.x; + _headerSize.y = (int)((_WinSize.x * _headerImg.height) / _headerImg.width); + _footerImg = Resources.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + (EditorGUIUtility.isProSkin ? "Imgs/Footer.png" : "Imgs/Footer_dark.png"), typeof(Texture2D)) as Texture2D; + EditorUtils.SetEditorTexture(_footerImg, FilterMode.Bilinear, 256); + _footerSize.x = _WinSize.x; + _footerSize.y = (int)((_WinSize.x * _footerImg.height) / _footerImg.width); + } + + _setupRequired = EditorUtils.DOTweenSetupRequired(); + } + + void OnGUI() + { + Connect(); + EditorGUIUtils.SetGUIStyles(_footerSize); + + if (Application.isPlaying) { + GUILayout.Space(40); + GUILayout.BeginHorizontal(); + GUILayout.Space(40); + GUILayout.Label("DOTween Utility Panel\nis disabled while in Play Mode", EditorGUIUtils.wrapCenterLabelStyle, GUILayout.ExpandWidth(true)); + GUILayout.Space(40); + GUILayout.EndHorizontal(); + } else { + Rect areaRect = new Rect(0, 0, _headerSize.x, 30); + _selectedTab = GUI.Toolbar(areaRect, _selectedTab, _tabLabels); + + switch (_selectedTab) { + case 1: + DrawPreferencesGUI(); + break; + default: + DrawSetupGUI(); + break; + } + } + } + + // =================================================================================== + // GUI METHODS ----------------------------------------------------------------------- + + void DrawSetupGUI() + { + Rect areaRect = new Rect(0, 30, _headerSize.x, _headerSize.y); + GUI.DrawTexture(areaRect, _headerImg, ScaleMode.StretchToFill, false); + GUILayout.Space(areaRect.y + _headerSize.y + 2); + GUILayout.Label(_innerTitle, DOTween.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle); + + if (_setupRequired) { + GUI.backgroundColor = Color.red; + GUILayout.BeginVertical(GUI.skin.box); + GUILayout.Label("DOTWEEN SETUP REQUIRED", EditorGUIUtils.setupLabelStyle); + GUILayout.EndVertical(); + GUI.backgroundColor = Color.white; + } else GUILayout.Space(8); + if (GUILayout.Button("Setup DOTween...", EditorGUIUtils.btStyle)) { + DOTweenSetupMenuItem.Setup(); + _setupRequired = EditorUtils.DOTweenSetupRequired(); + } + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Documentation", EditorGUIUtils.btStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/documentation.php"); + if (GUILayout.Button("Support", EditorGUIUtils.btStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/support.php"); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Changelog", EditorGUIUtils.btStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/download.php"); + if (GUILayout.Button("Check Updates", EditorGUIUtils.btStyle, GUILayout.Width(_HalfBtSize))) Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); + GUILayout.EndHorizontal(); + GUILayout.Space(14); + if (GUILayout.Button(_footerImg, EditorGUIUtils.btImgStyle)) Application.OpenURL("http://www.demigiant.com/"); + } + + void DrawPreferencesGUI() + { + GUILayout.Space(40); + if (GUILayout.Button("Reset", EditorGUIUtils.btStyle)) { + // Reset to original defaults + _src.useSafeMode = true; + _src.showUnityEditorReport = false; + _src.logBehaviour = LogBehaviour.ErrorsOnly; + _src.defaultRecyclable = false; + _src.defaultAutoPlay = AutoPlay.All; + _src.defaultUpdateType = UpdateType.Normal; + _src.defaultTimeScaleIndependent = false; + _src.defaultEaseType = Ease.OutQuad; + _src.defaultEaseOvershootOrAmplitude = 1.70158f; + _src.defaultEasePeriod = 0; + _src.defaultAutoKill = true; + _src.defaultLoopType = LoopType.Restart; + EditorUtility.SetDirty(_src); + } + GUILayout.Space(8); + _src.useSafeMode = EditorGUILayout.Toggle("Safe Mode", _src.useSafeMode); + _src.showUnityEditorReport = EditorGUILayout.Toggle("Editor Report", _src.showUnityEditorReport); + _src.logBehaviour = (LogBehaviour)EditorGUILayout.EnumPopup("Log Behaviour", _src.logBehaviour); + GUILayout.Space(8); + GUILayout.Label("DEFAULTS ▼"); + _src.defaultRecyclable = EditorGUILayout.Toggle("Recycle Tweens", _src.defaultRecyclable); + _src.defaultAutoPlay = (AutoPlay)EditorGUILayout.EnumPopup("AutoPlay", _src.defaultAutoPlay); + _src.defaultUpdateType = (UpdateType)EditorGUILayout.EnumPopup("Update Type", _src.defaultUpdateType); + _src.defaultTimeScaleIndependent = EditorGUILayout.Toggle("TimeScale Independent", _src.defaultTimeScaleIndependent); + _src.defaultEaseType = (Ease)EditorGUILayout.EnumPopup("Ease", _src.defaultEaseType); + _src.defaultEaseOvershootOrAmplitude = EditorGUILayout.FloatField("Ease Overshoot", _src.defaultEaseOvershootOrAmplitude); + _src.defaultEasePeriod = EditorGUILayout.FloatField("Ease Period", _src.defaultEasePeriod); + _src.defaultAutoKill = EditorGUILayout.Toggle("AutoKill", _src.defaultAutoKill); + _src.defaultLoopType = (LoopType)EditorGUILayout.EnumPopup("Loop Type", _src.defaultLoopType); + + if (GUI.changed) EditorUtility.SetDirty(_src); + } + + // =================================================================================== + // METHODS --------------------------------------------------------------------------- + + void Connect() + { + if (_src == null) { + string srcDir = EditorUtils.assetsPath + EditorUtils.pathSlash + "Resources"; + if (!Directory.Exists(srcDir)) AssetDatabase.CreateFolder("Assets", "Resources"); + string adbSrcFilePath = EditorUtils.FullPathToADBPath(srcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset"); + + // Legacy: check if there are settings saved in old mode (inside DOTween/Resources folder) and eventually move them + string legacySrcDir = EditorUtils.dotweenDir + "Resources"; + string legacySrcFilePath = legacySrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset"; + if (File.Exists(legacySrcFilePath)) { + // Move legacy src file to correct folder + AssetDatabase.MoveAsset(EditorUtils.FullPathToADBPath(legacySrcFilePath), adbSrcFilePath); + // Delete legacy Resources folder + AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(legacySrcDir)); + } + + _src = EditorUtils.ConnectToSourceAsset(adbSrcFilePath, true); + } + } + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/DOTweenEditor/Properties/AssemblyInfo.cs b/_DOTween.Assembly/DOTweenEditor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7d11576 --- /dev/null +++ b/_DOTween.Assembly/DOTweenEditor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DOTweenEditor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Demigiant")] +[assembly: AssemblyProduct("DOTweenEditor")] +[assembly: AssemblyCopyright("Copyright © Daniele Giardini, 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("807e068c-2a0e-4c81-a303-4b4fd3924511")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML new file mode 100644 index 0000000..b562aa2 --- /dev/null +++ b/_DOTween.Assembly/bin/DOTween.XML @@ -0,0 +1,1906 @@ + + + + DOTween + + + + + Update type + + + + Updates every frame during Update calls + + + Updates every frame during LateUpdate calls + + + Updates using FixedUpdate calls + + + + Path mode (used to determine correct LookAt orientation) + + + + Ignores the path mode (and thus LookAt behaviour) + + + Regular 3D path + + + 2D top-down path + + + 2D side-scroller path + + + + Used internally + + + + + This class serves only as a utility class to store tween settings to apply on multiple tweens. + It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + + + + A variable you can eventually Clear and reuse when needed, + to avoid instantiating TweenParams objects + + + Creates a new TweenParams object, which you can use to store tween settings + to pass to multiple tweens via myTween.SetAs(myTweenParms) + + + Clears and resets this TweenParams instance using default values, + so it can be reused without instantiating another one + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function. + If applied to Sequences eases the whole sequence animation + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (default: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween reaches a new waypoint + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + + Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + Contains all instance-based methods + + + + + Used to allow method chaining with DOTween.Init + + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Controls other tweens as a group + + + + + Indicates either a Tweener or a Sequence + + + + Called the first time the tween is set in a playing state, after any eventual delay + + + TimeScale for the tween + + + If TRUE the tween wil go backwards + + + Id (usable for filtering with DOTween static methods). Can be an int, a string, an object, or anything else + + + Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shorcuts + + + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Called each time the tween updates + + + Called the moment the tween completes one loop cycle + + + Called the moment the tween reaches completion (loops included) + + + Called the moment the tween is killed + + + Called when a path tween's current waypoint changes + + + Gets and sets the time position (loops included, delays excluded) of the tween + + + + Rotation mode used with DORotate methods + + + + + Fastest way that never rotates beyond 360° + + + + + Fastest way that rotates beyond 360° + + + + + Adds the given rotation to the transform using world axis and an advanced precision mode + (like when using transform.Rotate(Space.World)). + In this mode the end value is is always considered relative + + + + + Adds the given rotation to the transform's local axis + (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + In this mode the end value is is always considered relative + + + + + This plugin generates some GC allocations at startup + + + + + Don't assign this! It's assigned automatically when creating 0 duration tweens + + + + + Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + + + + + Types of log behaviours + + + + Log only warnings and errors + + + Log warnings, errors and additional infos + + + Log only errors + + + + Methods that extend Tween objects and allow to set their parameters + + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot to use with Back ease (default is 1.70158) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual amplitude to use with Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + If applied to Sequences eases the whole sequence animation + + + Allows the tween to be recycled after being killed. + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (defalt: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onPlay callback for the tween. + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween's current waypoint changes + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + Has no effect if the tween has already started. + NOTE: the tween's target will not be changed + Tween from which to copy the parameters + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + Has no effect if the tween has already started. + TweenParams from which to copy the parameters + + + Adds the given tween to the end of the Sequence. + Has no effect if the Sequence has already started + The tween to append + + + Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The tween to prepend + + + Inserts the given tween at the same time position of the last tween added to the Sequence. + Has no effect if the Sequence has already started + + + Inserts the given tween at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the tween will be placed + The tween to insert + + + Adds the given interval to the end of the Sequence. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given callback to the end of the Sequence. + Has no effect if the Sequence has already started + The callback to append + + + Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The callback to prepend + + + Inserts the given callback at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the callback will be placed + The callback to insert + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + If TRUE the FROM value will be calculated as relative to the current one + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + Sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + Options for float tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Quaternion tweens + If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + + + Options for Color tweens + If TRUE only the alpha value of the color will be tweened + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL to use default ones + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Path tweens (created via the DOPath shortcut) + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Options for Path tweens (created via the DOPath shortcut) + If TRUE the path will be automatically closed + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target to the path, with the given lookAhead. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + + Methods that extend Tween objects and allow to control or get data from them + + + + Completes the tween + + + Flips the direction of this tween (backwards if it was going forward or viceversa) + + + Forces the tween to initialize its settings immediately + + + Send the tween to the given position in time + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Kills the tween + If TRUE completes the tween before killing it + + + Pauses the tween + + + Plays the tween + + + Sets the tween in a backwards direction and plays it + + + Sets the tween in a forward direction and plays it + + + Restarts the tween from the beginning + If TRUE includes the eventual tween delay, otherwise skips it + + + Rewinds the tween + If TRUE includes the eventual tween delay, otherwise skips it + + + Plays the tween if it was paused, pauses it if it was playing + + + Send a path tween to the given waypoint. + Has no effect if this is not a path tween. + BEWARE, this is a special utility method: + the lookAt direction might be wrong after calling this and might need to be set manually + (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + Waypoint index to reach + (if higher than the max waypoint index the tween will simply go to the last one) + If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + + + + Creates a yield instruction that waits until the tween is killed or complete. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForCompletion(); + + + + + Creates a yield instruction that waits until the tween is killed or rewinded. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForRewind(); + + + + + Creates a yield instruction that waits until the tween is killed. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForKill(); + + + + + Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForElapsedLoops(2); + + Elapsed loops to wait for + + + + Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForPosition(2.5f); + + Position (loops included, delays excluded) to wait for + + + + Creates a yield instruction that waits until the tween is killed or started + (meaning when the tween is set in a playing state the first time, after any eventual delay). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForStart(); + + + + Returns the total number of loops completed by this tween + + + Returns the eventual delay set for this tween + + + Returns the duration of this tween (delays excluded). + NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + If TRUE returns the full duration loops included, + otherwise the duration of a single loop cycle + + + Returns the elapsed time for this tween (delays exluded) + If TRUE returns the elapsed time since startup loops included, + otherwise the elapsed time within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + If TRUE returns the elapsed percentage since startup loops included, + otherwise the elapsed percentage within the current loop cycle + + + Returns FALSE if this tween has been killed. + BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + + + Returns TRUE if this tween was reversed and is set to go backwards + + + Returns TRUE if the tween is complete + (silently fails and returns FALSE if the tween has been killed) + + + Returns TRUE if this tween is playing + + + + Returns the length of a path (returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized). + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + + + + Used for tween callbacks + + + + + Used for tween callbacks + + + + + Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + Types of autoPlay behaviours + + + + No tween is automatically played + + + Only Sequences are automatically played + + + Only Tweeners are automatically played + + + All tweens are automatically played + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances + + + + Tweens an AudioSource's volume to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an AudioSource's pitch to the given value. + Also stores the AudioSource as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Camera's backgroundColor to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's color to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's intensity to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's shadowStrength to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a LineRenderer's color to the given value. + Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + Note that this method requires to also insert the start colors for the tween, + since LineRenderers have no way to get them. + The start value to tween from + The end value to reachThe duration of the tween + + + Tweens a Material's color to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named color property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named float property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Rigidbody's position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's X position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Y position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's Z position to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody's rotation to the given value. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Rigidbody's rotation so that it will look towards the given position. + Also stores the rigidbody as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Tweens a TrailRenderer's startWidth/endWidth to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end startWidth to reachThe end endWidth to reach + The duration of the tween + + + Tweens a TrailRenderer's time to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's rotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localRotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's X localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Y localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Z localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's rotation so that it will look towards the given position. + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Punches a Transform's localPosition towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + The direction and strength of the punch (added to the Transform's current position) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the punch direction and the opposite direction, + while 0 oscillates only between the punch and the start position + If TRUE the tween will smoothly snap all values to integers + + + Punches a Transform's localScale towards the given size and then back to the starting one + as if it was connected to the starting scale via an elastic. + The punch strength (added to the Transform's current scale) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + 1 creates a full oscillation between the punch scale and the opposite scale, + while 0 oscillates only between the punch scale and the start scale + + + Punches a Transform's localRotation towards the given size and then back to the starting one + as if it was connected to the starting rotation via an elastic. + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + + + Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoints to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoint to go through + The duration of the tween + The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + Type of path to use with DOPath tweens + + + + Linear, composed of straight segments between each waypoint + + + Curved path (which uses Catmull-Rom curves) + + + + Main DOTween class. Contains static methods to create and control tweens in a generic way + + + + DOTween's version + + + If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + Default: TRUE + + + If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + Beware, this will slightly slow down your tweens while inside Unity Editor. + Default: FALSE + + + Global DOTween timeScale. + Default: 1 + + + Default updateType for new tweens. + Default: UpdateType.Normal + + + Sets whether Unity's timeScale should be taken into account by default or not. + Default: false + + + Default autoPlay behaviour for new tweens. + Default: AutoPlay.All + + + Default autoKillOnComplete behaviour for new tweens. + Default: TRUE + + + Default loopType applied to all new tweens. + Default: LoopType.Restart + + + If TRUE all newly created tweens are set as recyclable, otherwise not. + Default: FALSE + + + Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + Default: Ease.InOutQuad + + + Default overshoot/amplitude used for eases + Default: 1.70158f + + + Default period used for eases + Default: 0 + + + + Must be called once, before the first ever DOTween call/reference, + otherwise it will be called automatically and will use default options. + Calling it a second time won't have any effect. + You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + + If TRUE all new tweens will be set for recycling, meaning that when killed, + instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + even if they were killed (since they might have been respawned and are now being used for other tweens). + If you want to automatically set your tween references to NULL when a tween is killed + you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + You can change this setting at any time by changing the static property, + or you can set the recycling behaviour for each tween separately, using: + SetRecyclable(bool recyclable) + Default: FALSE + If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + You can change this setting at any time by changing the static property. + Default: FALSE + Type of logging to use. + You can change this setting at any time by changing the static property. + Default: ErrorsOnly + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + + If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + (so that next time you use it it will need to be re-initialized) + + + + Clears all cached tween pools. + + + + + Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + and returns the total number of invalid tweens found and removed. + Automatically called when loading a new scene if is TRUE. + BEWARE: this is a slightly expensive operation so use it with care + + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using a custom plugin + The plugin to use. Each custom plugin implements a static Get() method + you'll need to call to assign the correct plugin in the correct way, like this: + CustomPlugin.Get() + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens only one axis of a Vector3 to the given value using default plugins. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + The axis to tween + + + Tweens only the alpha of a Color to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a virtual property from the given start to the given end value + and implements a setter that allows to use that value with an external method or a lambda + Example: + To(MyMethod, 0, 12, 0.5f); + Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + The action to perform with the tweened value + The value to start from + The end value to reach + The duration of the virtual tween + + + + Punches a Vector3 towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The direction and strength of the punch + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the direction and the opposite decaying direction, + while 0 oscillates only between the starting position and the decaying direction + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE only shakes on the X Y axis (looks better with things like cameras). + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + + + Tweens a property or field to the given values using default plugins. + Ease is applied between each segment and not as a whole. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end values to reach for each segment. This array must have the same length as durations + The duration of each segment. This array must have the same length as endValues + + + + Returns a new to be used for tween groups + + + + Completes all tweens and returns the number of actual tweens completed + (meaning tweens that don't have infinite loops and were not already complete) + + + Completes all tweens with the given ID or target and returns the number of actual tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + + Flips all tweens (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + + + Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + and returns the actual tweens involved + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens with the given ID or target and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Pauses all tweens and returns the number of actual tweens paused + + + Pauses all tweens with the given ID or target and returns the number of actual tweens paused + (meaning the tweens that were actually playing and have been paused) + + + Plays all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing or complete) + + + Plays all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays backwards all tweens and returns the number of actual tweens played + (meaning tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays forward all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing forward or complete) + + + Restarts all tweens, then returns the number of actual tweens restarted + + + Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + + + Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + (meaning tweens that were not already rewinded) + + + Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + (meaning the tweens that were not already rewinded) + + + Toggles the play state of all tweens and returns the number of actual tweens toggled + (meaning tweens that could be played or paused, depending on the toggle state) + + + Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + (meaning the tweens that could be played or paused, depending on the toggle state) + + + + Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). + You can also use this to know if a shortcut tween is active for a given target. + Example: + transform.DOMoveX(45, 1); // transform is automatically added as the tween target + DOTween.IsTweening(transform); // Returns true + + + + + Returns the total number of active and playing tweens. + A tween is considered as playing even if its delay is actually playing + + + + + Returns a list of all active tweens in a playing state. + Returns NULL if there are no active playing tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens in a paused state. + Returns NULL if there are no active paused tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + + + + Returns a list of all active tweens with the given id. + Returns NULL if there are no active tweens with the given id. + Beware: each time you call this method a new list is generated + + + + + Returns a list of all active tweens with the given target. + Returns NULL if there are no active tweens with the given target. + Beware: each time you call this method a new list is generated + + + + DOTween's log behaviour. + Default: LogBehaviour.ErrorsOnly + + + + Path plugin works exclusively with Transforms + + + + + Types of loop + + + + Each loop cycle restarts from the beginning + + + The tween moves forward and backwards at alternate cycles + + + Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + In case of String tweens works only if the tween is set as relative + + + + Animates a single value + + + + Changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Creates virtual tweens that can be used to change other elements via their OnUpdate calls + + + + + Tweens a virtual float. + You can add regular settings to the generated tween, + but do not use SetUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type float, called at each update + + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Fires the given callback after the given time. + Callback delay + Callback to fire when the delay has expired + If TRUE (default) ignores Unity's timeScale + + + + Used to interpret AnimationCurves as eases. + + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Struct that stores two colors (used for LineRenderer tweens) + + + + + What axis to constrain in case of Vector tweens + + + + + Path control point + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Returns a Vector3 with z = 0 + + + + + Returns the 2D angle between two vectors + + + + + Gets the point on the path at the given percentage (0 to 1) + + The percentage (0 to 1) at which to get the point + If TRUE constant speed is taken into account, otherwise not + + + + Public only so custom shortcuts can access some of these methods + + + + diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll new file mode 100644 index 0000000..842485e Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween.dll differ diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb new file mode 100644 index 0000000..7966c10 Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ diff --git a/_DOTween.Assembly/bin/DOTween43.dll b/_DOTween.Assembly/bin/DOTween43.dll new file mode 100644 index 0000000..1c4d441 Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween43.dll differ diff --git a/_DOTween.Assembly/bin/DOTween43.dll.mdb b/_DOTween.Assembly/bin/DOTween43.dll.mdb new file mode 100644 index 0000000..0c3b9cd Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween43.dll.mdb differ diff --git a/_DOTween.Assembly/bin/DOTween43.xml b/_DOTween.Assembly/bin/DOTween43.xml new file mode 100644 index 0000000..faa6a44 --- /dev/null +++ b/_DOTween.Assembly/bin/DOTween43.xml @@ -0,0 +1,47 @@ + + + + DOTween43 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween43 methods, require Unity 4.3 or later. + + + + Tweens a SpriteRenderer's color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's alpha color to the given value. + Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Rigidbody2D's position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's X position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's Y position to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Rigidbody2D's rotation to the given value. + Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + diff --git a/_DOTween.Assembly/bin/DOTween46.dll b/_DOTween.Assembly/bin/DOTween46.dll new file mode 100644 index 0000000..ca86829 Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween46.dll differ diff --git a/_DOTween.Assembly/bin/DOTween46.dll.mdb b/_DOTween.Assembly/bin/DOTween46.dll.mdb new file mode 100644 index 0000000..44d0a29 Binary files /dev/null and b/_DOTween.Assembly/bin/DOTween46.dll.mdb differ diff --git a/_DOTween.Assembly/bin/DOTween46.xml b/_DOTween.Assembly/bin/DOTween46.xml new file mode 100644 index 0000000..d630ed1 --- /dev/null +++ b/_DOTween.Assembly/bin/DOTween46.xml @@ -0,0 +1,120 @@ + + + + DOTween46 + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances. + These, as all DOTween46 methods, require Unity 4.6 or later. + + + + Tweens a CanvasGroup's alpha color to the given value. + Also stores the canvasGroup as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Graphic's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's alpha color to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens an Image's fillAmount to the given value. + Also stores the image as the tween's target so it can be used for filtered operations + The end value to reach (0 to 1)The duration of the tween + + + Tweens an LayoutElement's flexibleWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's minWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens an LayoutElement's preferredWidth/Height to the given value. + Also stores the LayoutElement as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Outline's effectColor to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectColor alpha to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Outline's effectDistance to the given value. + Also stores the Outline as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a RectTransform's anchoredPosition to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's anchoredPosition3D to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a RectTransform's sizeDelta to the given value. + Also stores the RectTransform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Slider's value to the given value. + Also stores the Slider as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Text's color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's alpha color to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Text's text to the given value. + Also stores the Text as the tween's target so it can be used for filtered operations + The end string to tween toThe duration of the tween + If TRUE the string will appear from a random animation of characters + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL (default) to use default ones + + + diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML b/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML new file mode 100644 index 0000000..09c788c --- /dev/null +++ b/_DOTween.Assembly/bin/Editor/DOTweenEditor.XML @@ -0,0 +1,60 @@ + + + + DOTweenEditor + + + + + Not used as menu item anymore, but as a utiity function + + + + + Setups DOTween + + If TRUE, no warning window appears in case there is no need for setup + + + + Checks that the given editor texture use the correct import settings, + and applies them if they're incorrect. + + + + + Returns TRUE if addons setup is required. + + + + + Returns TRUE if the file/directory at the given path exists. + + Path, relative to Unity's project folder + + + + + Converts the given project-relative path to a full path, + with backward (\) slashes). + + + + + Converts the given full path to a path usable with AssetDatabase methods + (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + + + + + Connects to a asset. + If the asset already exists at the given path, loads it and returns it. + Otherwise, either returns NULL or automatically creates it before loading and returning it + (depending on the given parameters). + + Asset type + File path (relative to Unity's project folder) + If TRUE and the requested asset doesn't exist, forces its creation + + + diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll new file mode 100644 index 0000000..a19c6e8 Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll differ diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb new file mode 100644 index 0000000..eac2d43 Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb differ diff --git a/_DOTween.Assembly/bin/Editor/Imgs/DOTweenIcon.png b/_DOTween.Assembly/bin/Editor/Imgs/DOTweenIcon.png new file mode 100644 index 0000000..d06fc7c Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/Imgs/DOTweenIcon.png differ diff --git a/_DOTween.Assembly/bin/Editor/Imgs/Footer.png b/_DOTween.Assembly/bin/Editor/Imgs/Footer.png new file mode 100644 index 0000000..e29d02f Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/Imgs/Footer.png differ diff --git a/_DOTween.Assembly/bin/Editor/Imgs/Footer_dark.png b/_DOTween.Assembly/bin/Editor/Imgs/Footer_dark.png new file mode 100644 index 0000000..e48db5e Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/Imgs/Footer_dark.png differ diff --git a/_DOTween.Assembly/bin/Editor/Imgs/Header.jpg b/_DOTween.Assembly/bin/Editor/Imgs/Header.jpg new file mode 100644 index 0000000..4d710d7 Binary files /dev/null and b/_DOTween.Assembly/bin/Editor/Imgs/Header.jpg differ diff --git a/_DOTween.Assembly/bin/readme.txt b/_DOTween.Assembly/bin/readme.txt new file mode 100644 index 0000000..3439db1 --- /dev/null +++ b/_DOTween.Assembly/bin/readme.txt @@ -0,0 +1,18 @@ +DOTween and DOTween Pro are copyright (c) 2014 Daniele Giardini - Demigiant + +// GET STARTED ////////////////////////////////////////////// + +- After importing a new DOTween update, select DOTween's Utility Panel from the Tools menu (if it doesn't open automatically) and press the "Setup DOTween..." button to set up additional features based on your Unity version. +- In your code, add "using DG.Tweening" to each class where you want to use DOTween. +- You're ready to tween. Check out the links below for full documentation and license info. + + +// LINKS /////////////////////////////////////////////////////// + +DOTween website (documentation, examples, etc): http://dotween.demigiant.com +DOTween license: http://dotween.demigiant.com/license.php +DOTween repository (Google Code): https://code.google.com/p/dotween/ + +// NOTES ////////////////////////////////////////////////////// + +- DOTween's Utility Panel can be found under "Tools > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences \ No newline at end of file