no message
This commit is contained in:
8
Assets/Audio.meta
Normal file
8
Assets/Audio.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11df597fea8fb461a965d831c26e7568
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Audio/camera-shutter1.mp3
Executable file
BIN
Assets/Audio/camera-shutter1.mp3
Executable file
Binary file not shown.
23
Assets/Audio/camera-shutter1.mp3.meta
Normal file
23
Assets/Audio/camera-shutter1.mp3.meta
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6a6771d05326c4775a47c0ec4c4e4558
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 8
|
||||||
|
defaultSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
preloadAudioData: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -308,6 +308,8 @@ GameObject:
|
|||||||
- component: {fileID: 162178408}
|
- component: {fileID: 162178408}
|
||||||
- component: {fileID: 162178410}
|
- component: {fileID: 162178410}
|
||||||
- component: {fileID: 162178409}
|
- component: {fileID: 162178409}
|
||||||
|
- component: {fileID: 162178412}
|
||||||
|
- component: {fileID: 162178411}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Image Character
|
m_Name: Image Character
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -331,7 +333,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: -267.873, y: 126.63}
|
m_AnchoredPosition: {x: -162, y: 80}
|
||||||
m_SizeDelta: {x: 424.251, y: 424.25}
|
m_SizeDelta: {x: 424.251, y: 424.25}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &162178409
|
--- !u!114 &162178409
|
||||||
@@ -372,6 +374,247 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 162178407}
|
m_GameObject: {fileID: 162178407}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!82 &162178411
|
||||||
|
AudioSource:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 162178407}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 4
|
||||||
|
OutputAudioMixerGroup: {fileID: 0}
|
||||||
|
m_audioClip: {fileID: 0}
|
||||||
|
m_Resource: {fileID: 8300000, guid: 6a6771d05326c4775a47c0ec4c4e4558, type: 3}
|
||||||
|
m_PlayOnAwake: 0
|
||||||
|
m_Volume: 1
|
||||||
|
m_Pitch: 1
|
||||||
|
Loop: 0
|
||||||
|
Mute: 0
|
||||||
|
Spatialize: 0
|
||||||
|
SpatializePostEffects: 0
|
||||||
|
Priority: 128
|
||||||
|
DopplerLevel: 1
|
||||||
|
MinDistance: 1
|
||||||
|
MaxDistance: 500
|
||||||
|
Pan2D: 0
|
||||||
|
rolloffMode: 0
|
||||||
|
BypassEffects: 0
|
||||||
|
BypassListenerEffects: 0
|
||||||
|
BypassReverbZones: 0
|
||||||
|
rolloffCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 1
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
panLevelCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
spreadCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
reverbZoneMixCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
--- !u!114 &162178412
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 162178407}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4d0390bd8b8ffd640b34fe25065ff1df, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp-firstpass::DG.Tweening.DOTweenAnimation
|
||||||
|
updateType: 0
|
||||||
|
isSpeedBased: 0
|
||||||
|
hasOnStart: 0
|
||||||
|
hasOnPlay: 1
|
||||||
|
hasOnUpdate: 0
|
||||||
|
hasOnStepComplete: 0
|
||||||
|
hasOnComplete: 1
|
||||||
|
hasOnTweenCreated: 0
|
||||||
|
hasOnRewind: 0
|
||||||
|
onStart:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
onPlay:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 162178409}
|
||||||
|
m_TargetAssemblyTypeName: UnityEngine.UI.Image, UnityEngine.UI
|
||||||
|
m_MethodName: set_sprite
|
||||||
|
m_Mode: 2
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 21300000, guid: b003007f0724f4eb39ca05642c497ce4, type: 3}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Sprite, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 162178411}
|
||||||
|
m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine
|
||||||
|
m_MethodName: Play
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
onUpdate:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
onStepComplete:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
onComplete:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 162178409}
|
||||||
|
m_TargetAssemblyTypeName: UnityEngine.UI.Image, UnityEngine.UI
|
||||||
|
m_MethodName: set_sprite
|
||||||
|
m_Mode: 2
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 21300000, guid: 7ab63bd8191ef49a6918352ece3c5364, type: 3}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Sprite, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
onTweenCreated:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
onRewind:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
targetIsSelf: 1
|
||||||
|
targetGO: {fileID: 0}
|
||||||
|
tweenTargetIsTargetGO: 1
|
||||||
|
delay: 0
|
||||||
|
duration: 0.5
|
||||||
|
easeType: 6
|
||||||
|
easeCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 1
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
loopType: 0
|
||||||
|
loops: 1
|
||||||
|
id:
|
||||||
|
isRelative: 0
|
||||||
|
isFrom: 0
|
||||||
|
isIndependentUpdate: 0
|
||||||
|
autoKill: 0
|
||||||
|
autoGenerate: 1
|
||||||
|
isActive: 1
|
||||||
|
isValid: 1
|
||||||
|
target: {fileID: 162178408}
|
||||||
|
animationType: 9
|
||||||
|
targetType: 5
|
||||||
|
forcedTargetType: 0
|
||||||
|
autoPlay: 0
|
||||||
|
useTargetAsV3: 0
|
||||||
|
endValueFloat: 0
|
||||||
|
endValueV3: {x: 0, y: 10, z: 1}
|
||||||
|
endValueV2: {x: 0, y: 0}
|
||||||
|
endValueColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
endValueString:
|
||||||
|
endValueRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 0
|
||||||
|
height: 0
|
||||||
|
endValueTransform: {fileID: 0}
|
||||||
|
optionalBool0: 0
|
||||||
|
optionalBool1: 0
|
||||||
|
optionalFloat0: 1
|
||||||
|
optionalInt0: 1
|
||||||
|
optionalRotationMode: 0
|
||||||
|
optionalScrambleMode: 0
|
||||||
|
optionalShakeRandomnessMode: 0
|
||||||
|
optionalString:
|
||||||
--- !u!1 &240954698
|
--- !u!1 &240954698
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -469,6 +712,18 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 162178412}
|
||||||
|
m_TargetAssemblyTypeName: DG.Tweening.DOTweenAnimation, Assembly-CSharp-firstpass
|
||||||
|
m_MethodName: DORestart
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
--- !u!114 &240954701
|
--- !u!114 &240954701
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -522,7 +777,7 @@ MonoBehaviour:
|
|||||||
selectMonitorIndex: 2
|
selectMonitorIndex: 2
|
||||||
takeNumber: 0
|
takeNumber: 0
|
||||||
inputPrefix: {fileID: 56188227}
|
inputPrefix: {fileID: 56188227}
|
||||||
inputResult: {fileID: 0}
|
inputResult: {fileID: 975488549}
|
||||||
directorySelector: {fileID: 1438379834}
|
directorySelector: {fileID: 1438379834}
|
||||||
--- !u!1 &519420028
|
--- !u!1 &519420028
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -889,7 +1144,7 @@ MonoBehaviour:
|
|||||||
m_lineSpacingMax: 0
|
m_lineSpacingMax: 0
|
||||||
m_paragraphSpacing: 0
|
m_paragraphSpacing: 0
|
||||||
m_charWidthMaxAdj: 0
|
m_charWidthMaxAdj: 0
|
||||||
m_TextWrappingMode: 3
|
m_TextWrappingMode: 1
|
||||||
m_wordWrappingRatios: 0.4
|
m_wordWrappingRatios: 0.4
|
||||||
m_overflowMode: 3
|
m_overflowMode: 3
|
||||||
m_linkedTextComponent: {fileID: 0}
|
m_linkedTextComponent: {fileID: 0}
|
||||||
@@ -1395,7 +1650,7 @@ MonoBehaviour:
|
|||||||
m_InputType: 0
|
m_InputType: 0
|
||||||
m_AsteriskChar: 42
|
m_AsteriskChar: 42
|
||||||
m_KeyboardType: 0
|
m_KeyboardType: 0
|
||||||
m_LineType: 0
|
m_LineType: 1
|
||||||
m_HideMobileInput: 0
|
m_HideMobileInput: 0
|
||||||
m_HideSoftKeyboard: 0
|
m_HideSoftKeyboard: 0
|
||||||
m_CharacterValidation: 0
|
m_CharacterValidation: 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d4fb1de9b00bfac42af0a35ff2a01f89
|
guid: 9f80792dcd2829e41b1f075e7245ca5b
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,144 +1,144 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<doc>
|
<doc>
|
||||||
<assembly>
|
<assembly>
|
||||||
<name>DOTweenEditor</name>
|
<name>DOTweenEditor</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="T:DG.DOTweenEditor.EditorCompatibilityUtils">
|
<member name="T:DG.DOTweenEditor.EditorCompatibilityUtils">
|
||||||
<summary>
|
<summary>
|
||||||
Contains compatibility methods taken from DemiEditor (for when DOTween is without it)
|
Contains compatibility methods taken from DemiEditor (for when DOTween is without it)
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType``1(System.Boolean)">
|
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType``1(System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType(System.Type,System.Boolean)">
|
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType(System.Type,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType``1(System.Boolean)">
|
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType``1(System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType(System.Type,System.Boolean)">
|
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType(System.Type,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Start(System.Action)">
|
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Start(System.Action)">
|
||||||
<summary>
|
<summary>
|
||||||
Starts the update loop of tween in the editor. Has no effect during playMode.
|
Starts the update loop of tween in the editor. Has no effect during playMode.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="onPreviewUpdated">Eventual callback to call after every update</param>
|
<param name="onPreviewUpdated">Eventual callback to call after every update</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Stop(System.Boolean,System.Boolean)">
|
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Stop(System.Boolean,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Stops the update loop and clears the onPreviewUpdated callback.
|
Stops the update loop and clears the onPreviewUpdated callback.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="resetTweenTargets">If TRUE also resets the tweened objects to their original state.
|
<param name="resetTweenTargets">If TRUE also resets the tweened objects to their original state.
|
||||||
Note that this works by calling Rewind on all tweens, so it will work correctly
|
Note that this works by calling Rewind on all tweens, so it will work correctly
|
||||||
only if you have a single tween type per object and it wasn't killed</param>
|
only if you have a single tween type per object and it wasn't killed</param>
|
||||||
<param name="clearTweens">If TRUE also kills any cached tween</param>
|
<param name="clearTweens">If TRUE also kills any cached tween</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.PrepareTweenForPreview(DG.Tweening.Tween,System.Boolean,System.Boolean,System.Boolean)">
|
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.PrepareTweenForPreview(DG.Tweening.Tween,System.Boolean,System.Boolean,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings.
|
Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="t">The tween to ready</param>
|
<param name="t">The tween to ready</param>
|
||||||
<param name="clearCallbacks">If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc)</param>
|
<param name="clearCallbacks">If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc)</param>
|
||||||
<param name="preventAutoKill">If TRUE prevents the tween from being auto-killed at completion</param>
|
<param name="preventAutoKill">If TRUE prevents the tween from being auto-killed at completion</param>
|
||||||
<param name="andPlay">If TRUE starts playing the tween immediately</param>
|
<param name="andPlay">If TRUE starts playing the tween immediately</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.EditorVersion.Version">
|
<member name="F:DG.DOTweenEditor.EditorVersion.Version">
|
||||||
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
|
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.EditorVersion.MajorVersion">
|
<member name="F:DG.DOTweenEditor.EditorVersion.MajorVersion">
|
||||||
<summary>Major version</summary>
|
<summary>Major version</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.EditorVersion.MinorVersion">
|
<member name="F:DG.DOTweenEditor.EditorVersion.MinorVersion">
|
||||||
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
|
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.SetEditorTexture(UnityEngine.Texture2D,UnityEngine.FilterMode,System.Int32)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.SetEditorTexture(UnityEngine.Texture2D,UnityEngine.FilterMode,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
Checks that the given editor texture use the correct import settings,
|
Checks that the given editor texture use the correct import settings,
|
||||||
and applies them if they're incorrect.
|
and applies them if they're incorrect.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.DOTweenSetupRequired">
|
<member name="M:DG.DOTweenEditor.EditorUtils.DOTweenSetupRequired">
|
||||||
<summary>
|
<summary>
|
||||||
Returns TRUE if setup is required
|
Returns TRUE if setup is required
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.AssetExists(System.String)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.AssetExists(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Returns TRUE if the file/directory at the given path exists.
|
Returns TRUE if the file/directory at the given path exists.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="adbPath">Path, relative to Unity's project folder</param>
|
<param name="adbPath">Path, relative to Unity's project folder</param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.ADBPathToFullPath(System.String)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.ADBPathToFullPath(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Converts the given project-relative path to a full path,
|
Converts the given project-relative path to a full path,
|
||||||
with backward (\) slashes).
|
with backward (\) slashes).
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.FullPathToADBPath(System.String)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.FullPathToADBPath(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Converts the given full path to a path usable with AssetDatabase methods
|
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).
|
(relative to Unity's project folder, and with the correct Unity forward (/) slashes).
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.ConnectToSourceAsset``1(System.String,System.Boolean)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.ConnectToSourceAsset``1(System.String,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
Connects to a <see cref="T:UnityEngine.ScriptableObject"/> asset.
|
Connects to a <see cref="T:UnityEngine.ScriptableObject"/> asset.
|
||||||
If the asset already exists at the given path, loads it and returns it.
|
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
|
Otherwise, either returns NULL or automatically creates it before loading and returning it
|
||||||
(depending on the given parameters).
|
(depending on the given parameters).
|
||||||
</summary>
|
</summary>
|
||||||
<typeparam name="T">Asset type</typeparam>
|
<typeparam name="T">Asset type</typeparam>
|
||||||
<param name="adbFilePath">File path (relative to Unity's project folder)</param>
|
<param name="adbFilePath">File path (relative to Unity's project folder)</param>
|
||||||
<param name="createIfMissing">If TRUE and the requested asset doesn't exist, forces its creation</param>
|
<param name="createIfMissing">If TRUE and the requested asset doesn't exist, forces its creation</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.GetAssemblyFilePath(System.Reflection.Assembly)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.GetAssemblyFilePath(System.Reflection.Assembly)">
|
||||||
<summary>
|
<summary>
|
||||||
Full path for the given loaded assembly, assembly file included
|
Full path for the given loaded assembly, assembly file included
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.AddGlobalDefine(System.String)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.AddGlobalDefine(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Adds the given global define if it's not already present
|
Adds the given global define if it's not already present
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.RemoveGlobalDefine(System.String)">
|
<member name="M:DG.DOTweenEditor.EditorUtils.RemoveGlobalDefine(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Removes the given global define if it's present
|
Removes the given global define if it's present
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.DOTweenEditor.EditorUtils.HasGlobalDefine(System.String,System.Nullable{UnityEditor.BuildTargetGroup})">
|
<member name="M:DG.DOTweenEditor.EditorUtils.HasGlobalDefine(System.String,System.Nullable{UnityEditor.BuildTargetGroup})">
|
||||||
<summary>
|
<summary>
|
||||||
Returns TRUE if the given global define is present in all the <see cref="T:UnityEditor.BuildTargetGroup"/>
|
Returns TRUE if the given global define is present in all the <see cref="T:UnityEditor.BuildTargetGroup"/>
|
||||||
or only in the given <see cref="T:UnityEditor.BuildTargetGroup"/>, depending on passed parameters.<para/>
|
or only in the given <see cref="T:UnityEditor.BuildTargetGroup"/>, depending on passed parameters.<para/>
|
||||||
</summary>
|
</summary>
|
||||||
<param name="id"></param>
|
<param name="id"></param>
|
||||||
<param name="buildTargetGroup"><see cref="T:UnityEditor.BuildTargetGroup"/>to use. Leave NULL to check in all of them.</param>
|
<param name="buildTargetGroup"><see cref="T:UnityEditor.BuildTargetGroup"/>to use. Leave NULL to check in all of them.</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:DG.DOTweenEditor.DOTweenDefines">
|
<member name="T:DG.DOTweenEditor.DOTweenDefines">
|
||||||
<summary>
|
<summary>
|
||||||
Not used as menu item anymore, but as a utility function
|
Not used as menu item anymore, but as a utility function
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.UnityEditorVersion.Version">
|
<member name="F:DG.DOTweenEditor.UnityEditorVersion.Version">
|
||||||
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
|
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MajorVersion">
|
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MajorVersion">
|
||||||
<summary>Major version</summary>
|
<summary>Major version</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MinorVersion">
|
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MinorVersion">
|
||||||
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
|
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<doc>
|
|
||||||
<assembly>
|
|
||||||
<name>DOTweenUpgradeManager</name>
|
|
||||||
</assembly>
|
|
||||||
<members>
|
|
||||||
<member name="T:DG.DOTweenUpgradeManager.Autorun">
|
|
||||||
<summary>
|
|
||||||
This class and its whole library are deleted the first time DOTween's setup is run after an upgrade (or after a new install).
|
|
||||||
NOTE: DidReloadScripts doesn't work on first install so it's useless, InitializeOnLoad is the only way
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
</members>
|
|
||||||
</doc>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3df9fdaadcb4c394e826a4d8d20bb952
|
|
||||||
TextScriptImporter:
|
|
||||||
userData:
|
|
||||||
AssetOrigin:
|
|
||||||
serializedVersion: 1
|
|
||||||
productId: 27676
|
|
||||||
packageName: DOTween (HOTween v2)
|
|
||||||
packageVersion: 1.2.790
|
|
||||||
assetPath: Assets/Plugins/Demigiant/DOTween/Editor/DOTweenUpgradeManager.XML
|
|
||||||
uploadId: 831234
|
|
||||||
Binary file not shown.
@@ -1,29 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 2bf936a5d80799e4e88ec9270fea75a4
|
|
||||||
PluginImporter:
|
|
||||||
serializedVersion: 1
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
isPreloaded: 0
|
|
||||||
platformData:
|
|
||||||
Any:
|
|
||||||
enabled: 0
|
|
||||||
settings: {}
|
|
||||||
Editor:
|
|
||||||
enabled: 1
|
|
||||||
settings:
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
WindowsStoreApps:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: AnyCPU
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
AssetOrigin:
|
|
||||||
serializedVersion: 1
|
|
||||||
productId: 27676
|
|
||||||
packageName: DOTween (HOTween v2)
|
|
||||||
packageVersion: 1.2.790
|
|
||||||
assetPath: Assets/Plugins/Demigiant/DOTween/Editor/DOTweenUpgradeManager.dll
|
|
||||||
uploadId: 831234
|
|
||||||
@@ -1,198 +1,198 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Audio; // Required for AudioMixer
|
using UnityEngine.Audio; // Required for AudioMixer
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
public static class DOTweenModuleAudio
|
public static class DOTweenModuleAudio
|
||||||
{
|
{
|
||||||
#region Shortcuts
|
#region Shortcuts
|
||||||
|
|
||||||
#region Audio
|
#region Audio
|
||||||
|
|
||||||
/// <summary>Tweens an AudioSource's volume to the given value.
|
/// <summary>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</summary>
|
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
if (endValue < 0) endValue = 0;
|
if (endValue < 0) endValue = 0;
|
||||||
else if (endValue > 1) endValue = 1;
|
else if (endValue > 1) endValue = 1;
|
||||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an AudioSource's pitch to the given value.
|
/// <summary>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</summary>
|
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region AudioMixer
|
#region AudioMixer
|
||||||
|
|
||||||
/// <summary>Tweens an AudioMixer's exposed float to the given value.
|
/// <summary>Tweens an AudioMixer's exposed float to the given value.
|
||||||
/// Also stores the AudioMixer as the tween's target so it can be used for filtered operations.
|
/// Also stores the AudioMixer as the tween's target so it can be used for filtered operations.
|
||||||
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
||||||
/// <param name="floatName">Name given to the exposed float to set</param>
|
/// <param name="floatName">Name given to the exposed float to set</param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
|
||||||
float currVal;
|
float currVal;
|
||||||
target.GetFloat(floatName, out currVal);
|
target.GetFloat(floatName, out currVal);
|
||||||
return currVal;
|
return currVal;
|
||||||
}, x=> target.SetFloat(floatName, x), endValue, duration);
|
}, x=> target.SetFloat(floatName, x), endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Operation Shortcuts
|
#region Operation Shortcuts
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Completes all tweens that have this target as a reference
|
/// 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)
|
/// (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
|
/// and returns the total number of tweens completed
|
||||||
/// (meaning the tweens that don't have infinite loops and were not already complete)
|
/// (meaning the tweens that don't have infinite loops and were not already complete)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
|
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
|
||||||
/// otherwise they will be ignored</param>
|
/// otherwise they will be ignored</param>
|
||||||
public static int DOComplete(this AudioMixer target, bool withCallbacks = false)
|
public static int DOComplete(this AudioMixer target, bool withCallbacks = false)
|
||||||
{
|
{
|
||||||
return DOTween.Complete(target, withCallbacks);
|
return DOTween.Complete(target, withCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kills all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens killed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="complete">If TRUE completes the tween before killing it</param>
|
/// <param name="complete">If TRUE completes the tween before killing it</param>
|
||||||
public static int DOKill(this AudioMixer target, bool complete = false)
|
public static int DOKill(this AudioMixer target, bool complete = false)
|
||||||
{
|
{
|
||||||
return DOTween.Kill(target, complete);
|
return DOTween.Kill(target, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens flipped.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOFlip(this AudioMixer target)
|
public static int DOFlip(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.Flip(target);
|
return DOTween.Flip(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends to the given position all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens involved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="to">Time position to reach
|
/// <param name="to">Time position to reach
|
||||||
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
|
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
|
||||||
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
|
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
|
||||||
public static int DOGoto(this AudioMixer target, float to, bool andPlay = false)
|
public static int DOGoto(this AudioMixer target, float to, bool andPlay = false)
|
||||||
{
|
{
|
||||||
return DOTween.Goto(target, to, andPlay);
|
return DOTween.Goto(target, to, andPlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pauses all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens paused.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOPause(this AudioMixer target)
|
public static int DOPause(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.Pause(target);
|
return DOTween.Pause(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plays all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens played.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOPlay(this AudioMixer target)
|
public static int DOPlay(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.Play(target);
|
return DOTween.Play(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plays backwards all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens played.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOPlayBackwards(this AudioMixer target)
|
public static int DOPlayBackwards(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.PlayBackwards(target);
|
return DOTween.PlayBackwards(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plays forward all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens played.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOPlayForward(this AudioMixer target)
|
public static int DOPlayForward(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.PlayForward(target);
|
return DOTween.PlayForward(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restarts all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens restarted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DORestart(this AudioMixer target)
|
public static int DORestart(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.Restart(target);
|
return DOTween.Restart(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rewinds all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens rewinded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DORewind(this AudioMixer target)
|
public static int DORewind(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.Rewind(target);
|
return DOTween.Rewind(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Smoothly rewinds all tweens that have this target as a reference
|
/// Smoothly 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)
|
/// (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.
|
/// and returns the total number of tweens rewinded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOSmoothRewind(this AudioMixer target)
|
public static int DOSmoothRewind(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.SmoothRewind(target);
|
return DOTween.SmoothRewind(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
|
/// 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)
|
/// (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.
|
/// and returns the total number of tweens involved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int DOTogglePause(this AudioMixer target)
|
public static int DOTogglePause(this AudioMixer target)
|
||||||
{
|
{
|
||||||
return DOTween.TogglePause(target);
|
return DOTween.TogglePause(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,146 +1,146 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#if false || EPO_DOTWEEN // MODULE_MARKER
|
#if false || EPO_DOTWEEN // MODULE_MARKER
|
||||||
|
|
||||||
using EPOOutline;
|
using EPOOutline;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
public static class DOTweenModuleEPOOutline
|
public static class DOTweenModuleEPOOutline
|
||||||
{
|
{
|
||||||
public static int DOKill(this SerializedPass target, bool complete)
|
public static int DOKill(this SerializedPass target, bool complete)
|
||||||
{
|
{
|
||||||
return DOTween.Kill(target, complete);
|
return DOTween.Kill(target, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, string propertyName, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, string propertyName, float endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration);
|
||||||
tweener.SetOptions(true).SetTarget(target);
|
tweener.SetOptions(true).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, string propertyName, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, string propertyName, float endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
|
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
|
||||||
tweener.SetOptions(true).SetTarget(target);
|
tweener.SetOptions(true).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, string propertyName, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, string propertyName, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
|
||||||
tweener.SetOptions(false).SetTarget(target);
|
tweener.SetOptions(false).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration)
|
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration);
|
||||||
tweener.SetOptions(false).SetTarget(target);
|
tweener.SetOptions(false).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, int propertyId, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, int propertyId, float endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration);
|
||||||
tweener.SetOptions(true).SetTarget(target);
|
tweener.SetOptions(true).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, int propertyId, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, int propertyId, float endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
|
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
|
||||||
tweener.SetOptions(true).SetTarget(target);
|
tweener.SetOptions(true).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, int propertyId, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, int propertyId, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
|
||||||
tweener.SetOptions(false).SetTarget(target);
|
tweener.SetOptions(false).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration)
|
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration);
|
var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration);
|
||||||
tweener.SetOptions(false).SetTarget(target);
|
tweener.SetOptions(false).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false)
|
public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false)
|
||||||
{
|
{
|
||||||
return DOTween.Kill(target, complete);
|
return DOTween.Kill(target, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int DOKill(this Outliner target, bool complete = false)
|
public static int DOKill(this Outliner target, bool complete = false)
|
||||||
{
|
{
|
||||||
return DOTween.Kill(target, complete);
|
return DOTween.Kill(target, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the alpha (transparency) of the outline
|
/// Controls the alpha (transparency) of the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outlinable.OutlineProperties target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outlinable.OutlineProperties target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration);
|
var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration);
|
||||||
tweener.SetOptions(true).SetTarget(target);
|
tweener.SetOptions(true).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the color of the outline
|
/// Controls the color of the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration);
|
var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration);
|
||||||
tweener.SetOptions(false).SetTarget(target);
|
tweener.SetOptions(false).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the amount of blur applied to the outline
|
/// Controls the amount of blur applied to the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
|
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
|
||||||
tweener.SetOptions(snapping).SetTarget(target);
|
tweener.SetOptions(snapping).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the amount of blur applied to the outline
|
/// Controls the amount of blur applied to the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
|
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
|
||||||
tweener.SetOptions(snapping).SetTarget(target);
|
tweener.SetOptions(snapping).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the amount of dilation applied to the outline
|
/// Controls the amount of dilation applied to the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
|
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
|
||||||
tweener.SetOptions(snapping).SetTarget(target);
|
tweener.SetOptions(snapping).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the amount of dilation applied to the outline
|
/// Controls the amount of dilation applied to the outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
|
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
|
||||||
tweener.SetOptions(snapping).SetTarget(target);
|
tweener.SetOptions(snapping).SetTarget(target);
|
||||||
return tweener;
|
return tweener;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,216 +1,216 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
using DG.Tweening.Plugins;
|
using DG.Tweening.Plugins;
|
||||||
using DG.Tweening.Plugins.Core.PathCore;
|
using DG.Tweening.Plugins.Core.PathCore;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
public static class DOTweenModulePhysics
|
public static class DOTweenModulePhysics
|
||||||
{
|
{
|
||||||
#region Shortcuts
|
#region Shortcuts
|
||||||
|
|
||||||
#region Rigidbody
|
#region Rigidbody
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
t.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's X position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
|
||||||
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Y position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
|
||||||
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Z position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
|
||||||
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's rotation to the given value.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="mode">Rotation mode</param>
|
/// <param name="mode">Rotation mode</param>
|
||||||
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
t.plugOptions.rotateMode = mode;
|
t.plugOptions.rotateMode = mode;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's rotation so that it will look towards the given position.
|
/// <summary>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</summary>
|
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
||||||
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
||||||
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
||||||
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
||||||
t.plugOptions.axisConstraint = axisConstraint;
|
t.plugOptions.axisConstraint = axisConstraint;
|
||||||
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
|
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Special
|
#region Special
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis.
|
/// <summary>Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis.
|
||||||
/// Returns a Sequence instead of a Tweener.
|
/// Returns a Sequence instead of a Tweener.
|
||||||
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
|
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
|
||||||
/// <param name="numJumps">Total number of jumps</param>
|
/// <param name="numJumps">Total number of jumps</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
|
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
if (numJumps < 1) numJumps = 1;
|
if (numJumps < 1) numJumps = 1;
|
||||||
float startPosY = 0;
|
float startPosY = 0;
|
||||||
float offsetY = -1;
|
float offsetY = -1;
|
||||||
bool offsetYSet = false;
|
bool offsetYSet = false;
|
||||||
Sequence s = DOTween.Sequence();
|
Sequence s = DOTween.Sequence();
|
||||||
Tween yTween = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
|
Tween yTween = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
|
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
|
||||||
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
||||||
.OnStart(() => startPosY = target.position.y);
|
.OnStart(() => startPosY = target.position.y);
|
||||||
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
|
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||||
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
|
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
|
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
|
||||||
).Join(yTween)
|
).Join(yTween)
|
||||||
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||||
yTween.OnUpdate(() => {
|
yTween.OnUpdate(() => {
|
||||||
if (!offsetYSet) {
|
if (!offsetYSet) {
|
||||||
offsetYSet = true;
|
offsetYSet = true;
|
||||||
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
||||||
}
|
}
|
||||||
Vector3 pos = target.position;
|
Vector3 pos = target.position;
|
||||||
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
|
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
|
||||||
target.MovePosition(pos);
|
target.MovePosition(pos);
|
||||||
});
|
});
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
/// <summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
|
||||||
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
|
||||||
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
/// <param name="path">The waypoints to go through</param>
|
/// <param name="path">The waypoints to go through</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
||||||
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
/// <param name="resolution">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</param>
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (resolution < 1) resolution = 1;
|
if (resolution < 1) resolution = 1;
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration)
|
||||||
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody = true;
|
t.plugOptions.isRigidbody = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
/// <summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations
|
||||||
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
/// <param name="path">The waypoint to go through</param>
|
/// <param name="path">The waypoint to go through</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
||||||
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
/// <param name="resolution">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</param>
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (resolution < 1) resolution = 1;
|
if (resolution < 1) resolution = 1;
|
||||||
Transform trans = target.transform;
|
Transform trans = target.transform;
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration)
|
||||||
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody = true;
|
t.plugOptions.isRigidbody = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
t.plugOptions.useLocalPosition = true;
|
t.plugOptions.useLocalPosition = true;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
|
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
|
||||||
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody = true;
|
t.plugOptions.isRigidbody = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Transform trans = target.transform;
|
Transform trans = target.transform;
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody = true;
|
t.plugOptions.isRigidbody = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
t.plugOptions.useLocalPosition = true;
|
t.plugOptions.useLocalPosition = true;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,193 +1,193 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins;
|
using DG.Tweening.Plugins;
|
||||||
using DG.Tweening.Plugins.Core.PathCore;
|
using DG.Tweening.Plugins.Core.PathCore;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
public static class DOTweenModulePhysics2D
|
public static class DOTweenModulePhysics2D
|
||||||
{
|
{
|
||||||
#region Shortcuts
|
#region Shortcuts
|
||||||
|
|
||||||
#region Rigidbody2D Shortcuts
|
#region Rigidbody2D Shortcuts
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
t.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's X position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
|
||||||
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
|
/// <summary>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</summary>
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
|
||||||
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
|
/// <summary>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</summary>
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Special
|
#region Special
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
|
/// <summary>Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
|
||||||
/// Returns a Sequence instead of a Tweener.
|
/// Returns a Sequence instead of a Tweener.
|
||||||
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
|
||||||
/// <para>IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position</para></summary>
|
/// <para>IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position</para></summary>
|
||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
|
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
|
||||||
/// <param name="numJumps">Total number of jumps</param>
|
/// <param name="numJumps">Total number of jumps</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||||
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
|
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
if (numJumps < 1) numJumps = 1;
|
if (numJumps < 1) numJumps = 1;
|
||||||
float startPosY = 0;
|
float startPosY = 0;
|
||||||
float offsetY = -1;
|
float offsetY = -1;
|
||||||
bool offsetYSet = false;
|
bool offsetYSet = false;
|
||||||
Sequence s = DOTween.Sequence();
|
Sequence s = DOTween.Sequence();
|
||||||
Tween yTween = DOTween.To(() => target.position, x => target.position = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
|
Tween yTween = DOTween.To(() => target.position, x => target.position = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
|
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
|
||||||
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
||||||
.OnStart(() => startPosY = target.position.y);
|
.OnStart(() => startPosY = target.position.y);
|
||||||
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration)
|
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration)
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||||
).Join(yTween)
|
).Join(yTween)
|
||||||
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||||
yTween.OnUpdate(() => {
|
yTween.OnUpdate(() => {
|
||||||
if (!offsetYSet) {
|
if (!offsetYSet) {
|
||||||
offsetYSet = true;
|
offsetYSet = true;
|
||||||
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
||||||
}
|
}
|
||||||
Vector3 pos = target.position;
|
Vector3 pos = target.position;
|
||||||
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
|
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
|
||||||
target.MovePosition(pos);
|
target.MovePosition(pos);
|
||||||
});
|
});
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's position through the given path waypoints, using the chosen path algorithm.
|
/// <summary>Tweens a Rigidbody2D's position through the given path waypoints, using the chosen path algorithm.
|
||||||
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
|
||||||
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
|
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
|
||||||
/// <param name="path">The waypoints to go through</param>
|
/// <param name="path">The waypoints to go through</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
||||||
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
|
/// <param name="resolution">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</param>
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
|
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (resolution < 1) resolution = 1;
|
if (resolution < 1) resolution = 1;
|
||||||
int len = path.Length;
|
int len = path.Length;
|
||||||
Vector3[] path3D = new Vector3[len];
|
Vector3[] path3D = new Vector3[len];
|
||||||
for (int i = 0; i < len; ++i) path3D[i] = path[i];
|
for (int i = 0; i < len; ++i) path3D[i] = path[i];
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), new Path(pathType, path3D, resolution, gizmoColor), duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), new Path(pathType, path3D, resolution, gizmoColor), duration)
|
||||||
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody2D = true;
|
t.plugOptions.isRigidbody2D = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Rigidbody2D's localPosition through the given path waypoints, using the chosen path algorithm.
|
/// <summary>Tweens a Rigidbody2D's localPosition through the given path waypoints, using the chosen path algorithm.
|
||||||
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
|
||||||
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
|
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
|
||||||
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
|
||||||
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
|
||||||
/// <param name="path">The waypoint to go through</param>
|
/// <param name="path">The waypoint to go through</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
|
||||||
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
|
||||||
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
|
/// <param name="resolution">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</param>
|
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
|
||||||
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
|
||||||
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
|
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
|
||||||
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (resolution < 1) resolution = 1;
|
if (resolution < 1) resolution = 1;
|
||||||
int len = path.Length;
|
int len = path.Length;
|
||||||
Vector3[] path3D = new Vector3[len];
|
Vector3[] path3D = new Vector3[len];
|
||||||
for (int i = 0; i < len; ++i) path3D[i] = path[i];
|
for (int i = 0; i < len; ++i) path3D[i] = path[i];
|
||||||
Transform trans = target.transform;
|
Transform trans = target.transform;
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path3D, resolution, gizmoColor), duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path3D, resolution, gizmoColor), duration)
|
||||||
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
.SetTarget(target).SetUpdate(UpdateType.Fixed);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody2D = true;
|
t.plugOptions.isRigidbody2D = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
t.plugOptions.useLocalPosition = true;
|
t.plugOptions.useLocalPosition = true;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
|
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
|
||||||
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
|
||||||
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), path, duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), path, duration)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody2D = true;
|
t.plugOptions.isRigidbody2D = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
|
||||||
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Transform trans = target.transform;
|
Transform trans = target.transform;
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
|
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
|
||||||
t.plugOptions.isRigidbody2D = true;
|
t.plugOptions.isRigidbody2D = true;
|
||||||
t.plugOptions.mode = pathMode;
|
t.plugOptions.mode = pathMode;
|
||||||
t.plugOptions.useLocalPosition = true;
|
t.plugOptions.useLocalPosition = true;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,93 +1,93 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
public static class DOTweenModuleSprite
|
public static class DOTweenModuleSprite
|
||||||
{
|
{
|
||||||
#region Shortcuts
|
#region Shortcuts
|
||||||
|
|
||||||
#region SpriteRenderer
|
#region SpriteRenderer
|
||||||
|
|
||||||
/// <summary>Tweens a SpriteRenderer's color to the given value.
|
/// <summary>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</summary>
|
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SpriteRenderer target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SpriteRenderer target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's alpha color to the given value.
|
/// <summary>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</summary>
|
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SpriteRenderer target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SpriteRenderer target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
||||||
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
|
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
|
||||||
public static Sequence DOGradientColor(this SpriteRenderer target, Gradient gradient, float duration)
|
public static Sequence DOGradientColor(this SpriteRenderer target, Gradient gradient, float duration)
|
||||||
{
|
{
|
||||||
Sequence s = DOTween.Sequence();
|
Sequence s = DOTween.Sequence();
|
||||||
GradientColorKey[] colors = gradient.colorKeys;
|
GradientColorKey[] colors = gradient.colorKeys;
|
||||||
int len = colors.Length;
|
int len = colors.Length;
|
||||||
for (int i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
GradientColorKey c = colors[i];
|
GradientColorKey c = colors[i];
|
||||||
if (i == 0 && c.time <= 0) {
|
if (i == 0 && c.time <= 0) {
|
||||||
target.color = c.color;
|
target.color = c.color;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float colorDuration = i == len - 1
|
float colorDuration = i == len - 1
|
||||||
? duration - s.Duration(false) // Verifies that total duration is correct
|
? duration - s.Duration(false) // Verifies that total duration is correct
|
||||||
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
||||||
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
|
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
|
||||||
}
|
}
|
||||||
s.SetTarget(target);
|
s.SetTarget(target);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Blendables
|
#region Blendables
|
||||||
|
|
||||||
#region SpriteRenderer
|
#region SpriteRenderer
|
||||||
|
|
||||||
/// <summary>Tweens a SpriteRenderer's color to the given value,
|
/// <summary>Tweens a SpriteRenderer's color to the given value,
|
||||||
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
/// instead than fight each other as multiple DOColor would do.
|
/// instead than fight each other as multiple DOColor would do.
|
||||||
/// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration)
|
public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
endValue = endValue - target.color;
|
endValue = endValue - target.color;
|
||||||
Color to = new Color(0, 0, 0, 0);
|
Color to = new Color(0, 0, 0, 0);
|
||||||
return DOTween.To(() => to, x => {
|
return DOTween.To(() => to, x => {
|
||||||
Color diff = x - to;
|
Color diff = x - to;
|
||||||
to = x;
|
to = x;
|
||||||
target.color += diff;
|
target.color += diff;
|
||||||
}, endValue, duration)
|
}, endValue, duration)
|
||||||
.Blendable().SetTarget(target);
|
.Blendable().SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,389 +1,389 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
//#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
|
//#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
|
||||||
//using Task = System.Threading.Tasks.Task;
|
//using Task = System.Threading.Tasks.Task;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shortcuts/functions that are not strictly related to specific Modules
|
/// Shortcuts/functions that are not strictly related to specific Modules
|
||||||
/// but are available only on some Unity versions
|
/// but are available only on some Unity versions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class DOTweenModuleUnityVersion
|
public static class DOTweenModuleUnityVersion
|
||||||
{
|
{
|
||||||
#region Material
|
#region Material
|
||||||
|
|
||||||
/// <summary>Tweens a Material's color using the given gradient
|
/// <summary>Tweens a Material's color using the given gradient
|
||||||
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
|
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
|
||||||
public static Sequence DOGradientColor(this Material target, Gradient gradient, float duration)
|
public static Sequence DOGradientColor(this Material target, Gradient gradient, float duration)
|
||||||
{
|
{
|
||||||
Sequence s = DOTween.Sequence();
|
Sequence s = DOTween.Sequence();
|
||||||
GradientColorKey[] colors = gradient.colorKeys;
|
GradientColorKey[] colors = gradient.colorKeys;
|
||||||
int len = colors.Length;
|
int len = colors.Length;
|
||||||
for (int i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
GradientColorKey c = colors[i];
|
GradientColorKey c = colors[i];
|
||||||
if (i == 0 && c.time <= 0) {
|
if (i == 0 && c.time <= 0) {
|
||||||
target.color = c.color;
|
target.color = c.color;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float colorDuration = i == len - 1
|
float colorDuration = i == len - 1
|
||||||
? duration - s.Duration(false) // Verifies that total duration is correct
|
? duration - s.Duration(false) // Verifies that total duration is correct
|
||||||
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
||||||
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
|
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
|
||||||
}
|
}
|
||||||
s.SetTarget(target);
|
s.SetTarget(target);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named color property using the given gradient
|
/// <summary>Tweens a Material's named color property using the given gradient
|
||||||
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="gradient">The gradient to use</param>
|
/// <param name="gradient">The gradient to use</param>
|
||||||
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Sequence DOGradientColor(this Material target, Gradient gradient, string property, float duration)
|
public static Sequence DOGradientColor(this Material target, Gradient gradient, string property, float duration)
|
||||||
{
|
{
|
||||||
Sequence s = DOTween.Sequence();
|
Sequence s = DOTween.Sequence();
|
||||||
GradientColorKey[] colors = gradient.colorKeys;
|
GradientColorKey[] colors = gradient.colorKeys;
|
||||||
int len = colors.Length;
|
int len = colors.Length;
|
||||||
for (int i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
GradientColorKey c = colors[i];
|
GradientColorKey c = colors[i];
|
||||||
if (i == 0 && c.time <= 0) {
|
if (i == 0 && c.time <= 0) {
|
||||||
target.SetColor(property, c.color);
|
target.SetColor(property, c.color);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float colorDuration = i == len - 1
|
float colorDuration = i == len - 1
|
||||||
? duration - s.Duration(false) // Verifies that total duration is correct
|
? duration - s.Duration(false) // Verifies that total duration is correct
|
||||||
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
|
||||||
s.Append(target.DOColor(c.color, property, colorDuration).SetEase(Ease.Linear));
|
s.Append(target.DOColor(c.color, property, colorDuration).SetEase(Ease.Linear));
|
||||||
}
|
}
|
||||||
s.SetTarget(target);
|
s.SetTarget(target);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CustomYieldInstructions
|
#region CustomYieldInstructions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or complete.
|
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or complete.
|
||||||
/// It can be used inside a coroutine as a yield.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForCompletion(t);
|
return new DOTweenCYInstruction.WaitForCompletion(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
|
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
|
||||||
/// It can be used inside a coroutine as a yield.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForRewind(t);
|
return new DOTweenCYInstruction.WaitForRewind(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed.
|
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed.
|
||||||
/// It can be used inside a coroutine as a yield.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForKill(t);
|
return new DOTweenCYInstruction.WaitForKill(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
|
/// Returns a <see cref="CustomYieldInstruction"/> 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.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
||||||
public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForElapsedLoops(t, elapsedLoops);
|
return new DOTweenCYInstruction.WaitForElapsedLoops(t, elapsedLoops);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed
|
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed
|
||||||
/// or has reached the given time position (loops included, delays excluded).
|
/// or has reached the given time position (loops included, delays excluded).
|
||||||
/// It can be used inside a coroutine as a yield.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
||||||
public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForPosition(t, position);
|
return new DOTweenCYInstruction.WaitForPosition(t, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or started
|
/// Returns a <see cref="CustomYieldInstruction"/> 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).
|
/// (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.
|
/// It can be used inside a coroutine as a yield.
|
||||||
/// <para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
|
/// <para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction)
|
public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new DOTweenCYInstruction.WaitForStart(t);
|
return new DOTweenCYInstruction.WaitForStart(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if UNITY_2018_1_OR_NEWER
|
#if UNITY_2018_1_OR_NEWER
|
||||||
#region Unity 2018.1 or Newer
|
#region Unity 2018.1 or Newer
|
||||||
|
|
||||||
#region Material
|
#region Material
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named texture offset property with the given ID to the given value.
|
/// <summary>Tweens a Material's named texture offset property with the given ID to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region .NET 4.6 or Newer
|
#region .NET 4.6 or Newer
|
||||||
|
|
||||||
#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
|
#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
|
||||||
|
|
||||||
#region Async Instructions
|
#region Async Instructions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or complete.
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or complete.
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.WaitForCompletion();</code>
|
/// <para>Example usage:</para><code>await myTween.WaitForCompletion();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForCompletion(this Tween t)
|
public static async System.Threading.Tasks.Task AsyncWaitForCompletion(this Tween t)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active && !t.IsComplete()) await System.Threading.Tasks.Task.Yield();
|
while (t.active && !t.IsComplete()) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or rewinded.
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or rewinded.
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.AsyncWaitForRewind();</code>
|
/// <para>Example usage:</para><code>await myTween.AsyncWaitForRewind();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForRewind(this Tween t)
|
public static async System.Threading.Tasks.Task AsyncWaitForRewind(this Tween t)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0)) await System.Threading.Tasks.Task.Yield();
|
while (t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0)) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
|
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForKill(this Tween t)
|
public static async System.Threading.Tasks.Task AsyncWaitForKill(this Tween t)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active) await System.Threading.Tasks.Task.Yield();
|
while (t.active) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or has gone through the given amount of loops.
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or has gone through the given amount of loops.
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.AsyncWaitForElapsedLoops();</code>
|
/// <para>Example usage:</para><code>await myTween.AsyncWaitForElapsedLoops();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops)
|
public static async System.Threading.Tasks.Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active && t.CompletedLoops() < elapsedLoops) await System.Threading.Tasks.Task.Yield();
|
while (t.active && t.CompletedLoops() < elapsedLoops) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or started
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> 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).
|
/// (meaning when the tween is set in a playing state the first time, after any eventual delay).
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.AsyncWaitForPosition();</code>
|
/// <para>Example usage:</para><code>await myTween.AsyncWaitForPosition();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForPosition(this Tween t, float position)
|
public static async System.Threading.Tasks.Task AsyncWaitForPosition(this Tween t, float position)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active && t.position * (t.CompletedLoops() + 1) < position) await System.Threading.Tasks.Task.Yield();
|
while (t.active && t.position * (t.CompletedLoops() + 1) < position) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
|
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
|
||||||
/// It can be used inside an async operation.
|
/// It can be used inside an async operation.
|
||||||
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
|
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async System.Threading.Tasks.Task AsyncWaitForStart(this Tween t)
|
public static async System.Threading.Tasks.Task AsyncWaitForStart(this Tween t)
|
||||||
{
|
{
|
||||||
if (!t.active) {
|
if (!t.active) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (t.active && !t.playedOnce) await System.Threading.Tasks.Task.Yield();
|
while (t.active && !t.playedOnce) await System.Threading.Tasks.Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
// ███ CLASSES █████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// ███ CLASSES █████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
|
|
||||||
public static class DOTweenCYInstruction
|
public static class DOTweenCYInstruction
|
||||||
{
|
{
|
||||||
public class WaitForCompletion : CustomYieldInstruction
|
public class WaitForCompletion : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active && !t.IsComplete();
|
return t.active && !t.IsComplete();
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
public WaitForCompletion(Tween tween)
|
public WaitForCompletion(Tween tween)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaitForRewind : CustomYieldInstruction
|
public class WaitForRewind : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0);
|
return t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0);
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
public WaitForRewind(Tween tween)
|
public WaitForRewind(Tween tween)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaitForKill : CustomYieldInstruction
|
public class WaitForKill : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active;
|
return t.active;
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
public WaitForKill(Tween tween)
|
public WaitForKill(Tween tween)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaitForElapsedLoops : CustomYieldInstruction
|
public class WaitForElapsedLoops : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active && t.CompletedLoops() < elapsedLoops;
|
return t.active && t.CompletedLoops() < elapsedLoops;
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
readonly int elapsedLoops;
|
readonly int elapsedLoops;
|
||||||
public WaitForElapsedLoops(Tween tween, int elapsedLoops)
|
public WaitForElapsedLoops(Tween tween, int elapsedLoops)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
this.elapsedLoops = elapsedLoops;
|
this.elapsedLoops = elapsedLoops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaitForPosition : CustomYieldInstruction
|
public class WaitForPosition : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active && t.position * (t.CompletedLoops() + 1) < position;
|
return t.active && t.position * (t.CompletedLoops() + 1) < position;
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
readonly float position;
|
readonly float position;
|
||||||
public WaitForPosition(Tween tween, float position)
|
public WaitForPosition(Tween tween, float position)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaitForStart : CustomYieldInstruction
|
public class WaitForStart : CustomYieldInstruction
|
||||||
{
|
{
|
||||||
public override bool keepWaiting { get {
|
public override bool keepWaiting { get {
|
||||||
return t.active && !t.playedOnce;
|
return t.active && !t.playedOnce;
|
||||||
}}
|
}}
|
||||||
readonly Tween t;
|
readonly Tween t;
|
||||||
public WaitForStart(Tween tween)
|
public WaitForStart(Tween tween)
|
||||||
{
|
{
|
||||||
t = tween;
|
t = tween;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,167 +1,167 @@
|
|||||||
// Author: Daniele Giardini - http://www.demigiant.com
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
// Created: 2018/07/13
|
// Created: 2018/07/13
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Core.PathCore;
|
using DG.Tweening.Plugins.Core.PathCore;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Utility functions that deal with available Modules.
|
/// Utility functions that deal with available Modules.
|
||||||
/// Modules defines:
|
/// Modules defines:
|
||||||
/// - DOTAUDIO
|
/// - DOTAUDIO
|
||||||
/// - DOTPHYSICS
|
/// - DOTPHYSICS
|
||||||
/// - DOTPHYSICS2D
|
/// - DOTPHYSICS2D
|
||||||
/// - DOTSPRITE
|
/// - DOTSPRITE
|
||||||
/// - DOTUI
|
/// - DOTUI
|
||||||
/// Extra defines set and used for implementation of external assets:
|
/// Extra defines set and used for implementation of external assets:
|
||||||
/// - DOTWEEN_TMP ► TextMesh Pro
|
/// - DOTWEEN_TMP ► TextMesh Pro
|
||||||
/// - DOTWEEN_TK2D ► 2D Toolkit
|
/// - DOTWEEN_TK2D ► 2D Toolkit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class DOTweenModuleUtils
|
public static class DOTweenModuleUtils
|
||||||
{
|
{
|
||||||
static bool _initialized;
|
static bool _initialized;
|
||||||
|
|
||||||
#region Reflection
|
#region Reflection
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called via Reflection by DOTweenComponent on Awake
|
/// Called via Reflection by DOTweenComponent on Awake
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if UNITY_2018_1_OR_NEWER
|
#if UNITY_2018_1_OR_NEWER
|
||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
if (_initialized) return;
|
if (_initialized) return;
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
DOTweenExternalCommand.SetOrientationOnPath += Physics.SetOrientationOnPath;
|
DOTweenExternalCommand.SetOrientationOnPath += Physics.SetOrientationOnPath;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
|
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
|
||||||
UnityEditor.EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
|
UnityEditor.EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
|
||||||
#else
|
#else
|
||||||
UnityEditor.EditorApplication.playModeStateChanged += PlaymodeStateChanged;
|
UnityEditor.EditorApplication.playModeStateChanged += PlaymodeStateChanged;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_2018_1_OR_NEWER
|
#if UNITY_2018_1_OR_NEWER
|
||||||
#pragma warning disable
|
#pragma warning disable
|
||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
// Just used to preserve methods when building, never called
|
// Just used to preserve methods when building, never called
|
||||||
static void Preserver()
|
static void Preserver()
|
||||||
{
|
{
|
||||||
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
|
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
MethodInfo mi = typeof(MonoBehaviour).GetMethod("Stub");
|
MethodInfo mi = typeof(MonoBehaviour).GetMethod("Stub");
|
||||||
}
|
}
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
// Fires OnApplicationPause in DOTweenComponent even when Editor is paused (otherwise it's only fired at runtime)
|
// Fires OnApplicationPause in DOTweenComponent even when Editor is paused (otherwise it's only fired at runtime)
|
||||||
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
|
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
|
||||||
static void PlaymodeStateChanged()
|
static void PlaymodeStateChanged()
|
||||||
#else
|
#else
|
||||||
static void PlaymodeStateChanged(UnityEditor.PlayModeStateChange state)
|
static void PlaymodeStateChanged(UnityEditor.PlayModeStateChange state)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (DOTween.instance == null) return;
|
if (DOTween.instance == null) return;
|
||||||
DOTween.instance.OnApplicationPause(UnityEditor.EditorApplication.isPaused);
|
DOTween.instance.OnApplicationPause(UnityEditor.EditorApplication.isPaused);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
|
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
|
|
||||||
public static class Physics
|
public static class Physics
|
||||||
{
|
{
|
||||||
// Called via DOTweenExternalCommand callback
|
// Called via DOTweenExternalCommand callback
|
||||||
public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans)
|
public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans)
|
||||||
{
|
{
|
||||||
#if true // PHYSICS_MARKER
|
#if true // PHYSICS_MARKER
|
||||||
if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot;
|
if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot;
|
||||||
else trans.rotation = newRot;
|
else trans.rotation = newRot;
|
||||||
#else
|
#else
|
||||||
trans.rotation = newRot;
|
trans.rotation = newRot;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached
|
// Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached
|
||||||
public static bool HasRigidbody2D(Component target)
|
public static bool HasRigidbody2D(Component target)
|
||||||
{
|
{
|
||||||
#if true // PHYSICS2D_MARKER
|
#if true // PHYSICS2D_MARKER
|
||||||
return target.GetComponent<Rigidbody2D>() != null;
|
return target.GetComponent<Rigidbody2D>() != null;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Called via Reflection
|
#region Called via Reflection
|
||||||
|
|
||||||
|
|
||||||
// Called via Reflection by DOTweenPathInspector
|
// Called via Reflection by DOTweenPathInspector
|
||||||
// Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached
|
// Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached
|
||||||
#if UNITY_2018_1_OR_NEWER
|
#if UNITY_2018_1_OR_NEWER
|
||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
public static bool HasRigidbody(Component target)
|
public static bool HasRigidbody(Component target)
|
||||||
{
|
{
|
||||||
#if true // PHYSICS_MARKER
|
#if true // PHYSICS_MARKER
|
||||||
return target.GetComponent<Rigidbody>() != null;
|
return target.GetComponent<Rigidbody>() != null;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called via Reflection by DOTweenPath
|
// Called via Reflection by DOTweenPath
|
||||||
#if UNITY_2018_1_OR_NEWER
|
#if UNITY_2018_1_OR_NEWER
|
||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
public static TweenerCore<Vector3, Path, PathOptions> CreateDOTweenPathTween(
|
public static TweenerCore<Vector3, Path, PathOptions> CreateDOTweenPathTween(
|
||||||
MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode
|
MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode
|
||||||
){
|
){
|
||||||
TweenerCore<Vector3, Path, PathOptions> t = null;
|
TweenerCore<Vector3, Path, PathOptions> t = null;
|
||||||
bool rBodyFoundAndTweened = false;
|
bool rBodyFoundAndTweened = false;
|
||||||
#if true // PHYSICS_MARKER
|
#if true // PHYSICS_MARKER
|
||||||
if (tweenRigidbody) {
|
if (tweenRigidbody) {
|
||||||
Rigidbody rBody = target.GetComponent<Rigidbody>();
|
Rigidbody rBody = target.GetComponent<Rigidbody>();
|
||||||
if (rBody != null) {
|
if (rBody != null) {
|
||||||
rBodyFoundAndTweened = true;
|
rBodyFoundAndTweened = true;
|
||||||
t = isLocal
|
t = isLocal
|
||||||
? rBody.DOLocalPath(path, duration, pathMode)
|
? rBody.DOLocalPath(path, duration, pathMode)
|
||||||
: rBody.DOPath(path, duration, pathMode);
|
: rBody.DOPath(path, duration, pathMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if true // PHYSICS2D_MARKER
|
#if true // PHYSICS2D_MARKER
|
||||||
if (!rBodyFoundAndTweened && tweenRigidbody) {
|
if (!rBodyFoundAndTweened && tweenRigidbody) {
|
||||||
Rigidbody2D rBody2D = target.GetComponent<Rigidbody2D>();
|
Rigidbody2D rBody2D = target.GetComponent<Rigidbody2D>();
|
||||||
if (rBody2D != null) {
|
if (rBody2D != null) {
|
||||||
rBodyFoundAndTweened = true;
|
rBodyFoundAndTweened = true;
|
||||||
t = isLocal
|
t = isLocal
|
||||||
? rBody2D.DOLocalPath(path, duration, pathMode)
|
? rBody2D.DOLocalPath(path, duration, pathMode)
|
||||||
: rBody2D.DOPath(path, duration, pathMode);
|
: rBody2D.DOPath(path, duration, pathMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!rBodyFoundAndTweened) {
|
if (!rBodyFoundAndTweened) {
|
||||||
t = isLocal
|
t = isLocal
|
||||||
? target.transform.DOLocalPath(path, duration, pathMode)
|
? target.transform.DOLocalPath(path, duration, pathMode)
|
||||||
: target.transform.DOPath(path, duration, pathMode);
|
: target.transform.DOPath(path, duration, pathMode);
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
DOTween and DOTween Pro are copyright (c) 2014-2018 Daniele Giardini - Demigiant
|
DOTween and DOTween Pro are copyright (c) 2014-2018 Daniele Giardini - Demigiant
|
||||||
|
|
||||||
// IMPORTANT!!! /////////////////////////////////////////////
|
// IMPORTANT!!! /////////////////////////////////////////////
|
||||||
// Upgrading DOTween from versions older than 1.2.000 ///////
|
// Upgrading DOTween from versions older than 1.2.000 ///////
|
||||||
// (or DOTween Pro older than 1.0.000) //////////////////////
|
// (or DOTween Pro older than 1.0.000) //////////////////////
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
If you're upgrading your project from a version of DOTween older than 1.2.000 (or DOTween Pro older than 1.0.000) please follow these instructions carefully.
|
If you're upgrading your project from a version of DOTween older than 1.2.000 (or DOTween Pro older than 1.0.000) please follow these instructions carefully.
|
||||||
1) Import the new version in the same folder as the previous one, overwriting old files. A lot of errors will appear but don't worry
|
1) Import the new version in the same folder as the previous one, overwriting old files. A lot of errors will appear but don't worry
|
||||||
2) Close and reopen Unity (and your project). This is fundamental: skipping this step will cause a bloodbath
|
2) Close and reopen Unity (and your project). This is fundamental: skipping this step will cause a bloodbath
|
||||||
3) Open DOTween's Utility Panel (Tools > Demigiant > DOTween Utility Panel) if it doesn't open automatically, then press "Setup DOTween...": this will run the upgrade setup
|
3) Open DOTween's Utility Panel (Tools > Demigiant > DOTween Utility Panel) if it doesn't open automatically, then press "Setup DOTween...": this will run the upgrade setup
|
||||||
4) From the Add/Remove Modules panel that opens, activate/deactivate Modules for Unity systems and for external assets (Pro version only)
|
4) From the Add/Remove Modules panel that opens, activate/deactivate Modules for Unity systems and for external assets (Pro version only)
|
||||||
|
|
||||||
// GET STARTED //////////////////////////////////////////////
|
// GET STARTED //////////////////////////////////////////////
|
||||||
|
|
||||||
- After importing a new DOTween update, select DOTween's Utility Panel from the "Tools/Demigiant" menu (if it doesn't open automatically) and press the "Setup DOTween..." button to activate/deactivate Modules. You can also access a Preferences Tab from there to choose default settings for DOTween.
|
- After importing a new DOTween update, select DOTween's Utility Panel from the "Tools/Demigiant" menu (if it doesn't open automatically) and press the "Setup DOTween..." button to activate/deactivate Modules. You can also access a Preferences Tab from there to choose default settings for DOTween.
|
||||||
- In your code, add "using DG.Tweening" to each class where you want to use DOTween.
|
- 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.
|
- You're ready to tween. Check out the links below for full documentation and license info.
|
||||||
|
|
||||||
|
|
||||||
// LINKS ///////////////////////////////////////////////////////
|
// LINKS ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
DOTween website (documentation, examples, etc): http://dotween.demigiant.com
|
DOTween website (documentation, examples, etc): http://dotween.demigiant.com
|
||||||
DOTween license: http://dotween.demigiant.com/license.php
|
DOTween license: http://dotween.demigiant.com/license.php
|
||||||
DOTween repository (Google Code): https://code.google.com/p/dotween/
|
DOTween repository (Google Code): https://code.google.com/p/dotween/
|
||||||
Demigiant website (documentation, examples, etc): http://www.demigiant.com
|
Demigiant website (documentation, examples, etc): http://www.demigiant.com
|
||||||
|
|
||||||
// NOTES //////////////////////////////////////////////////////
|
// NOTES //////////////////////////////////////////////////////
|
||||||
|
|
||||||
- DOTween's Utility Panel can be found under "Tools > Demigiant > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences
|
- DOTween's Utility Panel can be found under "Tools > Demigiant > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences
|
||||||
8
Assets/Resources.meta
Normal file
8
Assets/Resources.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: edff7c9c5dfec49dbae75dcfc0b847d3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
54
Assets/Resources/DOTweenSettings.asset
Normal file
54
Assets/Resources/DOTweenSettings.asset
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 16995157, guid: a811bde74b26b53498b4f6d872b09b6d, type: 3}
|
||||||
|
m_Name: DOTweenSettings
|
||||||
|
m_EditorClassIdentifier: DOTween.dll::DG.Tweening.Core.DOTweenSettings
|
||||||
|
useSafeMode: 1
|
||||||
|
safeModeOptions:
|
||||||
|
logBehaviour: 2
|
||||||
|
nestedTweenFailureBehaviour: 0
|
||||||
|
timeScale: 1
|
||||||
|
unscaledTimeScale: 1
|
||||||
|
useSmoothDeltaTime: 0
|
||||||
|
maxSmoothUnscaledTime: 0.15
|
||||||
|
rewindCallbackMode: 0
|
||||||
|
showUnityEditorReport: 0
|
||||||
|
logBehaviour: 0
|
||||||
|
drawGizmos: 1
|
||||||
|
defaultRecyclable: 0
|
||||||
|
defaultAutoPlay: 3
|
||||||
|
defaultUpdateType: 0
|
||||||
|
defaultTimeScaleIndependent: 0
|
||||||
|
defaultEaseType: 6
|
||||||
|
defaultEaseOvershootOrAmplitude: 1.70158
|
||||||
|
defaultEasePeriod: 0
|
||||||
|
defaultAutoKill: 1
|
||||||
|
defaultLoopType: 0
|
||||||
|
debugMode: 0
|
||||||
|
debugStoreTargetId: 1
|
||||||
|
showPreviewPanel: 1
|
||||||
|
storeSettingsLocation: 0
|
||||||
|
modules:
|
||||||
|
showPanel: 0
|
||||||
|
audioEnabled: 1
|
||||||
|
physicsEnabled: 1
|
||||||
|
physics2DEnabled: 1
|
||||||
|
spriteEnabled: 1
|
||||||
|
uiEnabled: 1
|
||||||
|
textMeshProEnabled: 0
|
||||||
|
tk2DEnabled: 0
|
||||||
|
deAudioEnabled: 0
|
||||||
|
deUnityExtendedEnabled: 0
|
||||||
|
epoOutlineEnabled: 0
|
||||||
|
createASMDEF: 0
|
||||||
|
showPlayingTweens: 0
|
||||||
|
showPausedTweens: 0
|
||||||
8
Assets/Resources/DOTweenSettings.asset.meta
Normal file
8
Assets/Resources/DOTweenSettings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f3fb915957f684d8abb924862bfc3cb3
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,43 +1,28 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms; // 모니터 식별 및 스크린 정보
|
|
||||||
using System.Drawing; // Bitmap 관련
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Unity.VisualScripting;
|
using System.Runtime.InteropServices;
|
||||||
using Application = UnityEngine.Application;
|
|
||||||
using Screen = System.Windows.Forms.Screen;
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using Graphics = System.Drawing.Graphics;
|
using Graphics = System.Drawing.Graphics;
|
||||||
|
#endif
|
||||||
|
|
||||||
public class TakeScreen : MonoBehaviour
|
public class TakeScreen : MonoBehaviour
|
||||||
{
|
{
|
||||||
// 캡처할 모니터 인덱스 (2 = 첫번째 모니터)
|
|
||||||
public int selectMonitorIndex = 2;
|
public int selectMonitorIndex = 2;
|
||||||
public int takeNumber;
|
public int takeNumber;
|
||||||
int monitorIndex = 0;
|
|
||||||
|
|
||||||
MONITORINFO selectMonitor;
|
[SerializeField] TMP_InputField inputPrefix;
|
||||||
int selectWidth;
|
[SerializeField] TMP_InputField inputResult;
|
||||||
int selectHeight;
|
[SerializeField] DirectorySelect directorySelector;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
TMP_InputField inputPrefix;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
TMP_InputField inputResult;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
DirectorySelect directorySelector;
|
|
||||||
|
|
||||||
// WinAPI 구조체
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct RECT
|
|
||||||
{
|
|
||||||
public int left, top, right, bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// --- Windows 전용 구조체 및 변수 ---
|
||||||
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
|
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int left, top, right, bottom; }
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||||
public struct MONITORINFO
|
public struct MONITORINFO
|
||||||
{
|
{
|
||||||
@@ -45,109 +30,107 @@ public class TakeScreen : MonoBehaviour
|
|||||||
public RECT rcMonitor;
|
public RECT rcMonitor;
|
||||||
public RECT rcWork;
|
public RECT rcWork;
|
||||||
public int dwFlags;
|
public int dwFlags;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szDevice;
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
|
||||||
public string szDevice;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WinAPI 델리게이트
|
|
||||||
private delegate bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData);
|
private delegate bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData);
|
||||||
|
[DllImport("user32.dll")] private static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumProc lpfnEnum, IntPtr dwData);
|
||||||
// WinAPI 함수
|
[DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")] private static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
private static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumProc lpfnEnum, IntPtr dwData);
|
[DllImport("gdi32.dll")] private static extern IntPtr CreateCompatibleDC(IntPtr hdc);
|
||||||
|
[DllImport("gdi32.dll")] private static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int height);
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("gdi32.dll")] private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
|
||||||
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
|
[DllImport("gdi32.dll")] private static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
|
||||||
|
[DllImport("gdi32.dll")] private static extern bool DeleteObject(IntPtr hObject);
|
||||||
[DllImport("user32.dll")]
|
[DllImport("gdi32.dll")] private static extern bool DeleteDC(IntPtr hdc);
|
||||||
private static extern IntPtr GetDC(IntPtr hWnd);
|
[DllImport("user32.dll")] private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
MONITORINFO selectMonitor;
|
||||||
private static extern IntPtr CreateCompatibleDC(IntPtr hdc);
|
int selectWidth;
|
||||||
|
int selectHeight;
|
||||||
[DllImport("gdi32.dll")]
|
int monitorIndex = 0;
|
||||||
private static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int height);
|
#endif
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
|
||||||
private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
|
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
|
||||||
private static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
|
|
||||||
IntPtr hdcSrc, int nXSrc, int nYSrc, CopyPixelOperation dwRop);
|
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
|
||||||
private static extern bool DeleteObject(IntPtr hObject);
|
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
|
||||||
private static extern bool DeleteDC(IntPtr hdc);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
|
||||||
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Debug.Log("=== 모든 모니터 정보 ===");
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, MonitorCallback, IntPtr.Zero);
|
EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, MonitorCallback, IntPtr.Zero);
|
||||||
|
#else
|
||||||
|
Debug.Log("macOS 환경입니다. 시스템 기본 스크린샷 기능을 사용합니다.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
private bool MonitorCallback(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData)
|
private bool MonitorCallback(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = new MONITORINFO();
|
MONITORINFO mi = new MONITORINFO();
|
||||||
mi.cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
mi.cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
||||||
monitorIndex++;
|
monitorIndex++;
|
||||||
|
|
||||||
if (GetMonitorInfo(hMonitor, ref mi) && monitorIndex == selectMonitorIndex)
|
if (GetMonitorInfo(hMonitor, ref mi) && monitorIndex == selectMonitorIndex)
|
||||||
{
|
{
|
||||||
int width = mi.rcMonitor.right - mi.rcMonitor.left;
|
|
||||||
int height = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
|
||||||
bool isPrimary = (mi.dwFlags & 1) != 0;
|
|
||||||
|
|
||||||
Debug.Log(
|
|
||||||
$"{mi.szDevice} 모니터 \n" +
|
|
||||||
$" - 해상도 : {width} x {height}\n" +
|
|
||||||
$" - 위치 : x = {mi.rcMonitor.left}, y = {mi.rcMonitor.top}\n" +
|
|
||||||
$" - 주 모니터 여부 : {isPrimary}\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
selectMonitor = mi;
|
selectMonitor = mi;
|
||||||
selectWidth = width;
|
selectWidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
||||||
selectHeight = height;
|
selectHeight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
return true; // 계속 나머지 모니터 순회
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void Take()
|
public void Take()
|
||||||
{
|
{
|
||||||
string fileName = $"{inputPrefix.text}_{string.Format("{0:D2}", takeNumber)}.png";
|
string fileName = $"{inputPrefix.text}_{takeNumber:D2}.png";
|
||||||
string savePath = Path.Combine(directorySelector.selectedFolderPath, fileName);
|
string savePath = Path.Combine(directorySelector.selectedFolderPath, fileName);
|
||||||
|
|
||||||
Shot(selectMonitor.rcMonitor.left, selectMonitor.rcMonitor.top, selectWidth, selectHeight, savePath);
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
|
ShotWin(selectMonitor.rcMonitor.left, selectMonitor.rcMonitor.top, selectWidth, selectHeight, savePath);
|
||||||
|
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
||||||
|
ShotMac(savePath);
|
||||||
|
#endif
|
||||||
|
inputResult.text = savePath;
|
||||||
|
takeNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shot(int x, int y, int width, int height, string savePath)
|
// Windows 캡처 로직
|
||||||
|
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||||
|
void ShotWin(int x, int y, int width, int height, string savePath)
|
||||||
{
|
{
|
||||||
IntPtr desktopDC = GetDC(IntPtr.Zero);
|
IntPtr desktopDC = GetDC(IntPtr.Zero);
|
||||||
IntPtr memoryDC = CreateCompatibleDC(desktopDC);
|
IntPtr memoryDC = CreateCompatibleDC(desktopDC);
|
||||||
IntPtr bitmap = CreateCompatibleBitmap(desktopDC, width, height);
|
IntPtr bitmap = CreateCompatibleBitmap(desktopDC, width, height);
|
||||||
IntPtr oldBitmap = SelectObject(memoryDC, bitmap);
|
IntPtr oldBitmap = SelectObject(memoryDC, bitmap);
|
||||||
|
|
||||||
BitBlt(memoryDC, 0, 0, width, height, desktopDC, x, y, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt);
|
// 0x00CC0020 = SRCCOPY, 0x40000000 = CAPTUREBLT
|
||||||
|
BitBlt(memoryDC, 0, 0, width, height, desktopDC, x, y, 0x00CC0020 | 0x40000000);
|
||||||
|
|
||||||
using (Bitmap bmp = Image.FromHbitmap(bitmap))
|
using (Bitmap bmp = Image.FromHbitmap(bitmap))
|
||||||
{
|
{
|
||||||
bmp.Save(savePath, ImageFormat.Png);
|
bmp.Save(savePath, ImageFormat.Png);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 정리
|
|
||||||
SelectObject(memoryDC, oldBitmap);
|
SelectObject(memoryDC, oldBitmap);
|
||||||
DeleteObject(bitmap);
|
DeleteObject(bitmap);
|
||||||
DeleteDC(memoryDC);
|
DeleteDC(memoryDC);
|
||||||
ReleaseDC(desktopDC, memoryDC);
|
ReleaseDC(IntPtr.Zero, desktopDC);
|
||||||
|
|
||||||
inputResult.text = savePath;
|
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
// macOS 캡처 로직
|
||||||
|
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
||||||
|
void ShotMac(string savePath)
|
||||||
|
{
|
||||||
|
// macOS는 시스템 명령어를 통해 스크린샷을 찍는 것이 가장 안정적입니다.
|
||||||
|
// -x: 소리 없음, -C: 커서 포함(선택)
|
||||||
|
// 만약 특정 모니터만 찍어야 한다면 -D 옵션을 사용합니다 (예: -D 1)
|
||||||
|
string args = $"-x \"{savePath}\"";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Diagnostics.Process.Start("screencapture", args);
|
||||||
|
Debug.Log($"macOS 스크린샷 저장 완료: {savePath}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"macOS 스크린샷 실패: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ EditorBuildSettings:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
- enabled: 0
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: Assets/Scenes/SampleScene.unity
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
guid: 8c9cfa26abfee488c85f1582747f6a02
|
||||||
m_configObjects:
|
m_configObjects:
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ PlayerSettings:
|
|||||||
targetDevice: 2
|
targetDevice: 2
|
||||||
useOnDemandResources: 0
|
useOnDemandResources: 0
|
||||||
accelerometerFrequency: 60
|
accelerometerFrequency: 60
|
||||||
companyName: DefaultCompany
|
companyName: Cooney Studio
|
||||||
productName: ScreenCapture
|
productName: Screen Capture
|
||||||
defaultCursor: {fileID: 0}
|
defaultCursor: {fileID: 0}
|
||||||
cursorHotspot: {x: 0, y: 0}
|
cursorHotspot: {x: 0, y: 0}
|
||||||
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
|
m_SplashScreenBackgroundColor: {r: 0.8, g: 0.8, b: 0.8, a: 1}
|
||||||
m_ShowUnitySplashScreen: 1
|
m_ShowUnitySplashScreen: 1
|
||||||
m_ShowUnitySplashLogo: 1
|
m_ShowUnitySplashLogo: 1
|
||||||
m_SplashScreenOverlayOpacity: 1
|
m_SplashScreenOverlayOpacity: 1
|
||||||
m_SplashScreenAnimation: 1
|
m_SplashScreenAnimation: 1
|
||||||
m_SplashScreenLogoStyle: 1
|
m_SplashScreenLogoStyle: 0
|
||||||
m_SplashScreenDrawMode: 0
|
m_SplashScreenDrawMode: 0
|
||||||
m_SplashScreenBackgroundAnimationZoom: 1
|
m_SplashScreenBackgroundAnimationZoom: 1
|
||||||
m_SplashScreenLogoAnimationZoom: 1
|
m_SplashScreenLogoAnimationZoom: 1
|
||||||
@@ -42,8 +42,8 @@ PlayerSettings:
|
|||||||
m_SplashScreenLogos: []
|
m_SplashScreenLogos: []
|
||||||
m_VirtualRealitySplashScreen: {fileID: 0}
|
m_VirtualRealitySplashScreen: {fileID: 0}
|
||||||
m_HolographicTrackingLossScreen: {fileID: 0}
|
m_HolographicTrackingLossScreen: {fileID: 0}
|
||||||
defaultScreenWidth: 1920
|
defaultScreenWidth: 480
|
||||||
defaultScreenHeight: 1080
|
defaultScreenHeight: 320
|
||||||
defaultScreenWidthWeb: 960
|
defaultScreenWidthWeb: 960
|
||||||
defaultScreenHeightWeb: 600
|
defaultScreenHeightWeb: 600
|
||||||
m_StereoRenderingPath: 0
|
m_StereoRenderingPath: 0
|
||||||
@@ -83,7 +83,7 @@ PlayerSettings:
|
|||||||
androidApplicationEntry: 2
|
androidApplicationEntry: 2
|
||||||
defaultIsNativeResolution: 1
|
defaultIsNativeResolution: 1
|
||||||
macRetinaSupport: 1
|
macRetinaSupport: 1
|
||||||
runInBackground: 0
|
runInBackground: 1
|
||||||
muteOtherAudioSources: 0
|
muteOtherAudioSources: 0
|
||||||
Prepare IOS For Recording: 0
|
Prepare IOS For Recording: 0
|
||||||
Force IOS Speakers When Recording: 0
|
Force IOS Speakers When Recording: 0
|
||||||
@@ -91,7 +91,7 @@ PlayerSettings:
|
|||||||
deferSystemGesturesMode: 0
|
deferSystemGesturesMode: 0
|
||||||
hideHomeButton: 0
|
hideHomeButton: 0
|
||||||
submitAnalytics: 1
|
submitAnalytics: 1
|
||||||
usePlayerLog: 1
|
usePlayerLog: 0
|
||||||
dedicatedServerOptimizations: 1
|
dedicatedServerOptimizations: 1
|
||||||
bakeCollisionMeshes: 0
|
bakeCollisionMeshes: 0
|
||||||
forceSingleInstance: 0
|
forceSingleInstance: 0
|
||||||
@@ -107,8 +107,8 @@ PlayerSettings:
|
|||||||
xboxEnableKinectAutoTracking: 0
|
xboxEnableKinectAutoTracking: 0
|
||||||
xboxEnableFitness: 0
|
xboxEnableFitness: 0
|
||||||
visibleInBackground: 1
|
visibleInBackground: 1
|
||||||
allowFullscreenSwitch: 1
|
allowFullscreenSwitch: 0
|
||||||
fullscreenMode: 1
|
fullscreenMode: 3
|
||||||
xboxSpeechDB: 0
|
xboxSpeechDB: 0
|
||||||
xboxEnableHeadOrientation: 0
|
xboxEnableHeadOrientation: 0
|
||||||
xboxEnableGuest: 0
|
xboxEnableGuest: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user