1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 01:36:05 +08:00

Added DOTween.PlayForward/Backwards overloads that accept both a target and an id

This commit is contained in:
Demigiant 2016-04-11 16:39:59 +02:00
parent 8718c07287
commit eb989352ef
49 changed files with 130 additions and 1 deletions

View File

@ -634,6 +634,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayBackwards(System.Object,System.Object)">
<summary>Plays backwards all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForwardAll">
<summary>Plays forward all tweens and returns the number of actual tweens played
(meaning tweens that were not already playing forward or complete)</summary>
@ -642,6 +646,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForward(System.Object,System.Object)">
<summary>Plays forward all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>

View File

@ -634,6 +634,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayBackwards(System.Object,System.Object)">
<summary>Plays backwards all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForwardAll">
<summary>Plays forward all tweens and returns the number of actual tweens played
(meaning tweens that were not already playing forward or complete)</summary>
@ -642,6 +646,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForward(System.Object,System.Object)">
<summary>Plays forward all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>

View File

@ -634,6 +634,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayBackwards(System.Object,System.Object)">
<summary>Plays backwards all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForwardAll">
<summary>Plays forward all tweens and returns the number of actual tweens played
(meaning tweens that were not already playing forward or complete)</summary>
@ -642,6 +646,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForward(System.Object,System.Object)">
<summary>Plays forward all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>

View File

@ -0,0 +1,63 @@
using UnityEngine;
using DG.Tweening;
public class DrawSegmentWithBounce : MonoBehaviour
{
public Material material;
bool isDrawing;
LineRenderer currLine;
Vector3 startPos, endPos;
void Update()
{
if (isDrawing) {
// Update line
endPos = GetWorldMousePos();
currLine.SetPosition(1, endPos);
}
if (Input.GetMouseButtonDown(0)) {
// Start new line
CreateLine();
isDrawing = true;
} else if (Input.GetMouseButtonUp(0) && isDrawing) {
// End line and add collider
isDrawing = false;
EdgeCollider2D col = currLine.gameObject.AddComponent<EdgeCollider2D>();
col.points = new Vector2[] { startPos, endPos };
// Tween line ending
// Find max bounce distance (along the correct axis)
// Change the last value (0.65f) to increase or decrease the bounce distance (inverse)
Vector3 bouncePoint = (endPos - startPos) - ((endPos - startPos) * 0.65f);
Vector3 tweenP = endPos;
LineRenderer tweenedL = currLine;
// The last 3 parameters indicate:
// - the duration of the tween
// - the vibration (how much it will oscillate)
// - if the bounce should go beyond the end point or not (0 means not)
DOTween.Punch(()=> tweenP, x=> tweenP = x, -bouncePoint, 0.6f, 8, 0)
.OnUpdate(()=> tweenedL.SetPosition(1, tweenP));
}
}
void CreateLine()
{
currLine = new GameObject("Line").AddComponent<LineRenderer>();
currLine.material = material;
currLine.SetVertexCount(2);
currLine.SetWidth(0.12f, 0.12f);
currLine.material.color = new Color(0, 0.7f, 0.63f, 0.2f);
currLine.useWorldSpace = false;
startPos = GetWorldMousePos();
currLine.SetPosition(0, startPos);
currLine.SetPosition(1, startPos);
}
Vector3 GetWorldMousePos()
{
Vector3 p = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10));
p.z = 0;
return p;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5aba8f1127277e04d81fa13572be38d5
timeCreated: 1460373263
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1c238e38f60bd374ea1bf52edf672bb9
timeCreated: 1460373241
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.260";
public static readonly string Version = "1.1.270";
///////////////////////////////////////////////
// Options ////////////////////////////////////
@ -772,6 +772,13 @@ namespace DG.Tweening
if (targetOrId == null) return 0;
return TweenManager.FilteredOperation(OperationType.PlayBackwards, FilterType.TargetOrId, targetOrId, false, 0);
}
/// <summary>Plays backwards all tweens with the given target and ID and returns the number of actual tweens played
/// (meaning the tweens that were not already started, playing backwards or rewinded)</summary>
public static int PlayBackwards(object target, object id)
{
if (target == null || id == null) return 0;
return TweenManager.FilteredOperation(OperationType.PlayBackwards, FilterType.TargetAndId, id, false, 0, target);
}
/// <summary>Plays forward all tweens and returns the number of actual tweens played
/// (meaning tweens that were not already playing forward or complete)</summary>
@ -786,6 +793,13 @@ namespace DG.Tweening
if (targetOrId == null) return 0;
return TweenManager.FilteredOperation(OperationType.PlayForward, FilterType.TargetOrId, targetOrId, false, 0);
}
/// <summary>Plays forward all tweens with the given target and ID and returns the number of actual tweens played
/// (meaning the tweens that were not already started, playing backwards or rewinded)</summary>
public static int PlayForward(object target, object id)
{
if (target == null || id == null) return 0;
return TweenManager.FilteredOperation(OperationType.PlayForward, FilterType.TargetAndId, id, false, 0, target);
}
/// <summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
public static int RestartAll(bool includeDelay = true)

View File

@ -634,6 +634,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayBackwards(System.Object,System.Object)">
<summary>Plays backwards all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForwardAll">
<summary>Plays forward all tweens and returns the number of actual tweens played
(meaning tweens that were not already playing forward or complete)</summary>
@ -642,6 +646,10 @@
<summary>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)</summary>
</member>
<member name="M:DG.Tweening.DOTween.PlayForward(System.Object,System.Object)">
<summary>Plays forward all tweens with the given target and ID and returns the number of actual tweens played
(meaning the tweens that were not already started, playing backwards or rewinded)</summary>
</member>
<member name="M:DG.Tweening.DOTween.RestartAll(System.Boolean)">
<summary>Restarts all tweens, then returns the number of actual tweens restarted</summary>
</member>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.