From c5df4c69ef8cd3fed1028fa8d7e0850af3fd7520 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 23 Feb 2023 22:12:32 -0500 Subject: [PATCH] scoring feedback --- namedropper/Assets/Plugins.meta | 8 + .../Assets/Plugins/Pixelplacement.meta | 8 + .../Assets/Plugins/Pixelplacement/iTween.meta | 8 + .../Plugins/Pixelplacement/iTween/Images.meta | 10 + .../iTween/Images/iTweenNews.png | Bin 0 -> 22219 bytes .../iTween/Images/iTweenNews.png.meta | 145 + .../Pixelplacement/iTween/ReadMe!.meta | 9 + .../Pixelplacement/iTween/ReadMe!/ReadMe!.txt | 3 + .../iTween/ReadMe!/ReadMe!.txt.meta | 4 + .../Plugins/Pixelplacement/iTween/Sample.meta | 5 + .../iTween/Sample/MoveSample.cs | 10 + .../iTween/Sample/MoveSample.cs.meta | 8 + .../iTween/Sample/RotateSample.cs | 10 + .../iTween/Sample/RotateSample.cs.meta | 8 + .../Pixelplacement/iTween/Sample/Sample.unity | 445 + .../iTween/Sample/Sample.unity.meta | 4 + .../iTween/Sample/SampleInfo.cs | 16 + .../iTween/Sample/SampleInfo.cs.meta | 8 + .../Plugins/Pixelplacement/iTween/iTween.cs | 7194 +++++++++++++++++ .../Pixelplacement/iTween/iTween.cs.meta | 8 + namedropper/Assets/Resources/categories.yaml | 2 +- namedropper/Assets/ScoreStack.cs | 4 +- namedropper/Assets/Scripts/GameManager.cs | 2 + 23 files changed, 7917 insertions(+), 2 deletions(-) create mode 100644 namedropper/Assets/Plugins.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Images.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs.meta create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs create mode 100644 namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta diff --git a/namedropper/Assets/Plugins.meta b/namedropper/Assets/Plugins.meta new file mode 100644 index 0000000..47113fe --- /dev/null +++ b/namedropper/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7c7244a977b184e488e3f8001cbcf337 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement.meta b/namedropper/Assets/Plugins/Pixelplacement.meta new file mode 100644 index 0000000..5bb803f --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 987beb3810c5bd648bd4c05ca4cce336 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween.meta new file mode 100644 index 0000000..ea6b332 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e30766fb7402d4c4f9e172ca01321b28 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Images.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Images.meta new file mode 100644 index 0000000..f0843cf --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Images.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 20f5496af0a1a4ac1bcc8850db15c00a +folderAsset: yes +timeCreated: 1516932782 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png b/namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png new file mode 100644 index 0000000000000000000000000000000000000000..5388a54cef62938c4584625d49732b1fd5db0d3d GIT binary patch literal 22219 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 literal 0 HcmV?d00001 diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png.meta new file mode 100644 index 0000000..8b6f1d7 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Images/iTweenNews.png.meta @@ -0,0 +1,145 @@ +fileFormatVersion: 2 +guid: 70ae88ee4c1a745d0819de61ec68af19 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!.meta new file mode 100644 index 0000000..64d1649 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2d2cb0af9aa924b12bd57127320643a3 +folderAsset: yes +timeCreated: 1504197499 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt new file mode 100644 index 0000000..7cb81d6 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt @@ -0,0 +1,3 @@ +iTween can be used with all scripting languages that Unity supports including JavaScript, C# and Boo. To install iTween create a folder named "Plugins" in your project's assets (if you are using C# the location of iTween does not matter as long as it is inside your assets folder). + +For complete documentation, examples and information visit: http://itween.pixelplacement.com \ No newline at end of file diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt.meta new file mode 100644 index 0000000..e27a250 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/ReadMe!/ReadMe!.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b68b11cac1ab04f95985e32ea67b8435 +TextScriptImporter: + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample.meta new file mode 100644 index 0000000..03fa169 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2b4957ecfb9d44cb59b99d2305c1848c +folderAsset: yes +DefaultImporter: + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs new file mode 100644 index 0000000..d51fa8e --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using System.Collections; + +public class MoveSample : MonoBehaviour +{ + void Start(){ + iTween.MoveBy(gameObject, iTween.Hash("x", 2, "easeType", "easeInOutExpo", "loopType", "pingPong", "delay", .1)); + } +} + diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs.meta new file mode 100644 index 0000000..53997e5 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/MoveSample.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 93cb45d44c16f45a4bbd5099fe096c20 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs new file mode 100644 index 0000000..068eb45 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using System.Collections; + +public class RotateSample : MonoBehaviour +{ + void Start(){ + iTween.RotateBy(gameObject, iTween.Hash("x", .25, "easeType", "easeInOutBack", "loopType", "pingPong", "delay", .4)); + } +} + diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs.meta new file mode 100644 index 0000000..e579dc4 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/RotateSample.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d6bc01eb564f142a1ada6ced5215636a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity new file mode 100644 index 0000000..2651bea --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity @@ -0,0 +1,445 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 9 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 1 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &795364717 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 795364718} + - component: {fileID: 795364719} + - component: {fileID: 795364721} + - component: {fileID: 795364722} + - component: {fileID: 795364720} + - component: {fileID: 795364723} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &795364718 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -4.489832} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &795364719 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.28235295, g: 0.28235295, b: 0.28235295, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!81 &795364720 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_Enabled: 1 +--- !u!92 &795364721 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_Enabled: 1 +--- !u!124 &795364722 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_Enabled: 1 +--- !u!114 &795364723 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 795364717} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5273cf41de20842a5917d8346dffe707, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &807515953 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 807515954} + - component: {fileID: 807515955} + m_Layer: 0 + m_Name: Directional light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &807515954 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 807515953} + m_LocalRotation: {x: 0.310826, y: 0.19056995, z: 0.060003437, w: 0.92923087} + m_LocalPosition: {x: -8.505982, y: 0.6730433, z: -8.146198} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &807515955 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 807515953} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 1 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &829696789 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 829696790} + - component: {fileID: 829696792} + - component: {fileID: 829696791} + - component: {fileID: 829696793} + m_Layer: 0 + m_Name: RotateSample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &829696790 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 829696789} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1.319066, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &829696791 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 829696789} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &829696792 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 829696789} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &829696793 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 829696789} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d6bc01eb564f142a1ada6ced5215636a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1595025699 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1595025700} + - component: {fileID: 1595025702} + - component: {fileID: 1595025701} + - component: {fileID: 1595025703} + m_Layer: 0 + m_Name: MoveSample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1595025700 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1595025699} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1595025701 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1595025699} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1595025702 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1595025699} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &1595025703 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1595025699} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93cb45d44c16f45a4bbd5099fe096c20, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity.meta new file mode 100644 index 0000000..b0b3741 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/Sample.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 17c6d1d46ed4a4cd19bb7f7a231386ba +DefaultImporter: + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs new file mode 100644 index 0000000..e0c9107 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections; + +public class SampleInfo : MonoBehaviour +{ +void OnGUI(){ + GUILayout.Label("iTween can spin, shake, punch, move, handle audio, fade color and transparency \nand much more with each task needing only one line of code."); + GUILayout.BeginHorizontal(); + GUILayout.Label("iTween works with C#, JavaScript and Boo. For full documentation and examples visit:"); + if(GUILayout.Button("http://itween.pixelplacement.com")){ + Application.OpenURL("http://itween.pixelplacement.com"); + } + GUILayout.EndHorizontal(); + } +} + diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs.meta new file mode 100644 index 0000000..f3b5700 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/Sample/SampleInfo.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5273cf41de20842a5917d8346dffe707 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs b/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs new file mode 100644 index 0000000..4c03361 --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs @@ -0,0 +1,7194 @@ +// Copyright (c) 2011 - 2018 Bob Berkebile (pixelplacment) +// Please direct any bugs/comments/suggestions to http://pixelplacement.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* +TERMS OF USE - EASING EQUATIONS +Open source under the BSD License. +Copyright (c)2001 Robert Penner +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#region Namespaces +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +#endregion + +/// +/// Version: 2.0.8 +/// Author: Bob Berkebile (http://pixelplacement.com) +/// Support: http://itween.pixelplacement.com +/// +public class iTween : MonoBehaviour +{ + #region Variables + + //repository of all living iTweens: + public static List tweens = new List(); + + //status members (made public for visual troubleshooting in the inspector): + public string id, type, method; + public iTween.EaseType easeType; + public float time, delay; + public LoopType loopType; + public bool isRunning,isPaused; + /* GFX47 MOD START */ + public string _name; + /* GFX47 MOD END */ + + //private members: + private float runningTime, percentage; + private float delayStarted; //probably not neccesary that this be protected but it shuts Unity's compiler up about this being "never used" + private bool kinematic, isLocal, loop, reverse, wasPaused, physics; + private Hashtable tweenArguments; + private Space space; + private delegate float EasingFunction(float start, float end, float Value); + private delegate void ApplyTween(); + private EasingFunction ease; + private ApplyTween apply; + private AudioSource audioSource; + private Vector3[] vector3s; + private Vector2[] vector2s; + private Color[,] colors; + private float[] floats; + private Rect[] rects; + private CRSpline path; + private Vector3 preUpdate; + private Vector3 postUpdate; + private NamedValueColor namedcolorvalue; + + private float lastRealTime; // Added by PressPlay + private bool useRealTime; // Added by PressPlay + + private Transform thisTransform; + + + /// + /// The type of easing to use based on Robert Penner's open source easing equations (http://www.robertpenner.com/easing_terms_of_use.html). + /// + public enum EaseType{ + easeInQuad, + easeOutQuad, + easeInOutQuad, + easeInCubic, + easeOutCubic, + easeInOutCubic, + easeInQuart, + easeOutQuart, + easeInOutQuart, + easeInQuint, + easeOutQuint, + easeInOutQuint, + easeInSine, + easeOutSine, + easeInOutSine, + easeInExpo, + easeOutExpo, + easeInOutExpo, + easeInCirc, + easeOutCirc, + easeInOutCirc, + linear, + spring, + /* GFX47 MOD START */ + //bounce, + easeInBounce, + easeOutBounce, + easeInOutBounce, + /* GFX47 MOD END */ + easeInBack, + easeOutBack, + easeInOutBack, + /* GFX47 MOD START */ + //elastic, + easeInElastic, + easeOutElastic, + easeInOutElastic, + /* GFX47 MOD END */ + punch + } + + /// + /// The type of loop (if any) to use. + /// + public enum LoopType{ + /// + /// Do not loop. + /// + none, + /// + /// Rewind and replay. + /// + loop, + /// + /// Ping pong the animation back and forth. + /// + pingPong + } + + /// + /// Many shaders use more than one color. Use can have iTween's Color methods operate on them by name. + /// + public enum NamedValueColor{ + /// + /// The main color of a material. Used by default and not required for Color methods to work in iTween. + /// + _Color, + /// + /// The specular color of a material (used in specular/glossy/vertexlit shaders). + /// + _SpecColor, + /// + /// The emissive color of a material (used in vertexlit shaders). + /// + _Emission, + /// + /// The reflection color of the material (used in reflective shaders). + /// + _ReflectColor + } + + #endregion + + #region Defaults + + /// + /// A collection of baseline presets that iTween needs and utilizes if certain parameters are not provided. + /// + public static class Defaults{ + //general defaults: + public static float time = 1f; + public static float delay = 0f; + public static NamedValueColor namedColorValue = NamedValueColor._Color; + public static LoopType loopType = LoopType.none; + public static EaseType easeType = iTween.EaseType.easeOutExpo; + public static float lookSpeed = 3f; + public static bool isLocal = false; + public static Space space = Space.Self; + public static bool orientToPath = false; + public static Color color = Color.white; + //update defaults: + public static float updateTimePercentage = .05f; + public static float updateTime = 1f*updateTimePercentage; + //path look ahead amount: + public static float lookAhead = .05f; + public static bool useRealTime = false; // Added by PressPlay + //look direction: + public static Vector3 up = Vector3.up; + } + + #endregion + + #region #1 Static Registers + + /// + /// Sets up a GameObject to avoid hiccups when an initial iTween is added. It's advisable to run this on every object you intend to run iTween on in its Start or Awake. + /// + /// + /// A to be the target to be initialized for iTween. + /// + public static void Init(GameObject target){ + MoveBy(target,Vector3.zero,0); + } + + + /// + /// Returns a value to an 'oncallback' method interpolated between the supplied 'from' and 'to' values for application as desired. Requires an 'onupdate' callback that accepts the same type as the supplied 'from' and 'to' properties. + /// + /// + /// A or or or or or for the starting value. + /// + /// + /// A or or or or or for the ending value. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed (only works with Vector2, Vector3, and Floats) + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ValueTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to")) { + Debug.LogError("iTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!"); + return; + }else{ + //establish iTween: + args["type"]="value"; + + if (args["from"].GetType() == typeof(Vector2)) { + args["method"]="vector2"; + }else if (args["from"].GetType() == typeof(Vector3)) { + args["method"]="vector3"; + }else if (args["from"].GetType() == typeof(Rect)) { + args["method"]="rect"; + }else if (args["from"].GetType() == typeof(Single)) { + args["method"]="float"; + }else if (args["from"].GetType() == typeof(Color)) { + args["method"]="color"; + }else{ + Debug.LogError("iTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!"); + return; + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + Launch(target,args); + } + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with MINIMUM customization options. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeFrom(GameObject target, float alpha, float time){ + FadeFrom(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value instantly then returns it to the provided alpha over time with FULL customization options. Identical to using ColorFrom and using the "a" parameter. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A or for the initial alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeFrom(GameObject target, Hashtable args){ + ColorFrom(target,args); + } + + /// + /// Changes a GameObject's alpha value over time with MINIMUM customization options. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeTo(GameObject target, float alpha, float time){ + FadeTo(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Changes a GameObject's alpha value over time with FULL customization options. Identical to using ColorTo and using the "a" parameter. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void FadeTo(GameObject target, Hashtable args){ + ColorTo(target,args); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorFrom(GameObject target, Color color, float time){ + ColorFrom(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values instantly then returns them to the provided properties over time with FULL customization options. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorFrom(GameObject target, Hashtable args){ + Color fromColor = new Color(); + Color tempColor = new Color(); + + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorFrom(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //set tempColor and base fromColor: + if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().material.color; + }else if(target.GetComponent()){ + tempColor=fromColor=target.GetComponent().color; + } + + //set augmented fromColor: + if(args.Contains("color")){ + fromColor=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + fromColor.r=(float)args["r"]; + } + if (args.Contains("g")) { + fromColor.g=(float)args["g"]; + } + if (args.Contains("b")) { + fromColor.b=(float)args["b"]; + } + if (args.Contains("a")) { + fromColor.a=(float)args["a"]; + } + } + + //alpha or amount? + if(args.Contains("amount")){ + fromColor.a=(float)args["amount"]; + args.Remove("amount"); + }else if(args.Contains("alpha")){ + fromColor.a=(float)args["alpha"]; + args.Remove("alpha"); + } + + //apply fromColor: + if(target.GetComponent()){ + target.GetComponent().material.color=fromColor; + }else if(target.GetComponent()){ + target.GetComponent().color=fromColor; + } + + //set new color arg: + args["color"]=tempColor; + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's color values over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorTo(GameObject target, Color color, float time){ + ColorTo(target,Hash("color",color,"time",time)); + } + + /// + /// Changes a GameObject's color values over time with FULL customization options. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ColorTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + Hashtable argsCopy = (Hashtable)args.Clone(); + argsCopy["ischild"]=true; + ColorTo(child.gameObject,argsCopy); + } + } + + //set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="color"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioFrom(GameObject target, float volume, float pitch, float time){ + AudioFrom(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioFrom(GameObject target, Hashtable args){ + Vector2 tempAudioProperties; + Vector2 fromAudioProperties; + AudioSource tempAudioSource; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempAudioSource: + if(args.Contains("audiosource")){ + tempAudioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + tempAudioSource=target.GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioFrom requires an AudioSource."); + return; + } + } + + //set tempAudioProperties: + tempAudioProperties.x=fromAudioProperties.x=tempAudioSource.volume; + tempAudioProperties.y=fromAudioProperties.y=tempAudioSource.pitch; + + //set augmented fromAudioProperties: + if(args.Contains("volume")){ + fromAudioProperties.x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + fromAudioProperties.y=(float)args["pitch"]; + } + + //apply fromAudioProperties: + tempAudioSource.volume=fromAudioProperties.x; + tempAudioSource.pitch=fromAudioProperties.y; + + //set new volume and pitch args: + args["volume"]=tempAudioProperties.x; + args["pitch"]=tempAudioProperties.y; + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Fades volume and pitch of an AudioSource with MINIMUM customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be changed. + /// + /// for the target level of volume. + /// A + /// + /// for the target pitch. + /// A + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioTo(GameObject target, float volume, float pitch, float time){ + AudioTo(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Fades volume and pitch of an AudioSource with FULL customization options. Default AudioSource attached to GameObject will be used (if one exists) if not supplied. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void AudioTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //set a default easeType of linear if none is supplied since eased audio interpolation is nearly unrecognizable: + if (!args.Contains("easetype")) { + args.Add("easetype",EaseType.linear); + } + + //establish iTween: + args["type"]="audio"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with MINIMUM customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A to be the target of the animation which holds the AudioSource to be utilized. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for the time in seconds the action will wait before beginning. + /// + public static void Stab(GameObject target, AudioClip audioclip, float delay){ + Stab(target,Hash("audioclip",audioclip,"delay",delay)); + } + + /// + /// Plays an AudioClip once based on supplied volume and pitch and following any delay with FULL customization options. AudioSource is optional as iTween will provide one. + /// + /// + /// A for a reference to the AudioClip to be played. + /// + /// + /// A for which AudioSource to use + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the action will wait before beginning. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void Stab(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="stab"; + Launch(target,args); + } + + /// + /// Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookFrom(GameObject target, Vector3 looktarget, float time){ + LookFrom(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Instantly rotates a GameObject to look at a supplied Transform or Vector3 then returns it to it's starting rotation over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 tempRestriction; + + //clean args: + args = iTween.CleanArgs(args); + + //set look: + tempRotation=target.transform.eulerAngles; + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + + //axis restriction: + if(args.Contains("axis")){ + tempRestriction=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + tempRestriction.y=tempRotation.y; + tempRestriction.z=tempRotation.z; + break; + case "y": + tempRestriction.x=tempRotation.x; + tempRestriction.z=tempRotation.z; + break; + case "z": + tempRestriction.x=tempRotation.x; + tempRestriction.y=tempRotation.y; + break; + } + target.transform.eulerAngles=tempRestriction; + } + + //set new rotation: + args["rotation"] = tempRotation; + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to look at the supplied Vector3 over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to be the Vector3 that the target will look towards. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookTo(GameObject target, Vector3 looktarget, float time){ + LookTo(target,Hash("looktarget",looktarget,"time",time)); + } + + /// + /// Rotates a GameObject to look at a supplied Transform or Vector3 over time with FULL customization options. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void LookTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["looktarget"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + } + } + + //establish iTween + args["type"]="look"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveTo(GameObject target, Vector3 position, float time){ + MoveTo(target,Hash("position",position,"time",time)); + } + + /// + /// Changes a GameObject's position over time to a supplied destination with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["position"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the destination Vector3. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveFrom(GameObject target, Vector3 position, float time){ + MoveFrom(target,Hash("position",position,"time",time)); + } + + /// + /// Instantly changes a GameObject's position to a supplied destination then returns it to it's starting position over time with FULL customization options. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for a list of points to draw a Catmull-Rom through for a curved animation path. + /// + /// + /// A for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for how much of a percentage to look ahead on a path to influence how strict "orientopath" is. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveFrom(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + bool tempIsLocal; + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + if(args.Contains("path")){ + Vector3[] fromPath; + Vector3[] suppliedPath; + if(args["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])args["path"]; + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])args["path"]; + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + if(suppliedPath[suppliedPath.Length-1] != target.transform.position){ + fromPath= new Vector3[suppliedPath.Length+1]; + Array.Copy(suppliedPath,fromPath,suppliedPath.Length); + if(tempIsLocal){ + fromPath[fromPath.Length-1] = target.transform.localPosition; + target.transform.localPosition=fromPath[0]; + }else{ + fromPath[fromPath.Length-1] = target.transform.position; + target.transform.position=fromPath[0]; + } + args["path"]=fromPath; + }else{ + if(tempIsLocal){ + target.transform.localPosition=suppliedPath[0]; + }else{ + target.transform.position=suppliedPath[0]; + } + args["path"]=suppliedPath; + } + }else{ + Vector3 tempPosition; + Vector3 fromPosition; + + //set tempPosition and base fromPosition: + if(tempIsLocal){ + tempPosition=fromPosition=target.transform.localPosition; + }else{ + tempPosition=fromPosition=target.transform.position; + } + + //set augmented fromPosition: + if(args.Contains("position")){ + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + fromPosition=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + fromPosition=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + fromPosition.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromPosition.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromPosition.z=(float)args["z"]; + } + } + + //apply fromPosition: + if(tempIsLocal){ + target.transform.localPosition = fromPosition; + }else{ + target.transform.position = fromPosition; + } + + //set new position arg: + args["position"]=tempPosition; + } + + //establish iTween: + args["type"]="move"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Translates a GameObject's position over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveAdd(GameObject target, Vector3 amount, float time){ + MoveAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Translates a GameObject's position over time with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Adds the supplied coordinates to a GameObject's postion with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveBy(GameObject target, Vector3 amount, float time){ + MoveBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds the supplied coordinates to a GameObject's position with FULL customization options. + /// + /// + /// A for the amount of change in position to move the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void MoveBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="move"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Changes a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleTo(GameObject target, Vector3 scale, float time){ + ScaleTo(target,Hash("scale",scale,"time",time)); + } + + /// + /// Changes a GameObject's scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["scale"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleFrom(GameObject target, Vector3 scale, float time){ + ScaleFrom(target,Hash("scale",scale,"time",time)); + } + + /// + /// Instantly changes a GameObject's scale then returns it to it's starting scale over time with FULL customization options. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleFrom(GameObject target, Hashtable args){ + Vector3 tempScale; + Vector3 fromScale; + + //clean args: + args = iTween.CleanArgs(args); + + //set base fromScale: + tempScale=fromScale=target.transform.localScale; + + //set augmented fromScale: + if(args.Contains("scale")){ + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + fromScale=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + fromScale=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + fromScale.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromScale.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromScale.z=(float)args["z"]; + } + } + + //apply fromScale: + target.transform.localScale = fromScale; + + //set new scale arg: + args["scale"]=tempScale; + + //establish iTween: + args["type"]="scale"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be added to the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleAdd(GameObject target, Vector3 amount, float time){ + ScaleAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds to a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be added to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies a GameObject's scale over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of scale to be multiplied by the GameObject's current scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleBy(GameObject target, Vector3 amount, float time){ + ScaleBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies a GameObject's scale over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied to the GameObject's current scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ScaleBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="scale"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateTo(GameObject target, Vector3 rotation, float time){ + RotateTo(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Rotates a GameObject to the supplied Euler angles in degrees over time with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateTo(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //additional property to ensure ConflictCheck can work correctly since Transforms are refrences: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)) { + Transform transform = (Transform)args["rotation"]; + args["position"]=new Vector3(transform.position.x,transform.position.y,transform.position.z); + args["rotation"]=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z); + args["scale"]=new Vector3(transform.localScale.x,transform.localScale.y,transform.localScale.z); + } + } + + //establish iTween + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate from. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateFrom(GameObject target, Vector3 rotation, float time){ + RotateFrom(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with FULL customization options. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateFrom(GameObject target, Hashtable args){ + Vector3 tempRotation; + Vector3 fromRotation; + bool tempIsLocal; + + //clean args: + args = iTween.CleanArgs(args); + + //set tempIsLocal: + if(args.Contains("islocal")){ + tempIsLocal = (bool)args["islocal"]; + }else{ + tempIsLocal = Defaults.isLocal; + } + + //set tempRotation and base fromRotation: + if(tempIsLocal){ + tempRotation=fromRotation=target.transform.localEulerAngles; + }else{ + tempRotation=fromRotation=target.transform.eulerAngles; + } + + //set augmented fromRotation: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + fromRotation=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + fromRotation=(Vector3)args["rotation"]; + } + }else{ + if (args.Contains("x")) { + fromRotation.x=(float)args["x"]; + } + if (args.Contains("y")) { + fromRotation.y=(float)args["y"]; + } + if (args.Contains("z")) { + fromRotation.z=(float)args["z"]; + } + } + + //apply fromRotation: + if(tempIsLocal){ + target.transform.localEulerAngles = fromRotation; + }else{ + target.transform.eulerAngles = fromRotation; + } + + //set new rotation arg: + args["rotation"]=tempRotation; + + //establish iTween: + args["type"]="rotate"; + args["method"]="to"; + Launch(target,args); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateAdd(GameObject target, Vector3 amount, float time){ + RotateAdd(target,Hash("amount",amount,"time",time)); + } + + /// + /// Adds supplied Euler angles in degrees to a GameObject's rotation over time with FULL customization options. + /// + /// + /// A for the amount of Euler angles in degrees to add to the current rotation of the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateAdd(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween: + args["type"]="rotate"; + args["method"]="add"; + Launch(target,args); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateBy(GameObject target, Vector3 amount, float time){ + RotateBy(target,Hash("amount",amount,"time",time)); + } + + /// + /// Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time with FULL customization options. + /// + /// + /// A for the amount to be multiplied by 360 to rotate the GameObject. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or can be used instead of time to allow animation based on speed + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the shape of the easing curve applied to the animation. + /// + /// + /// A or for the type of loop to apply once the animation has completed. + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void RotateBy(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="rotate"; + args["method"]="by"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakePosition(GameObject target, Vector3 amount, float time){ + ShakePosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's position by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakePosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="position"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeScale(GameObject target, Vector3 amount, float time){ + ShakeScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's scale by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="scale"; + Launch(target,args); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ShakeRotation(GameObject target, Vector3 amount, float time){ + ShakeRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Randomly shakes a GameObject's rotation by a diminishing amount over time with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with shakes) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void ShakeRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="shake"; + args["method"]="rotation"; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchPosition(GameObject target, Vector3 amount, float time){ + PunchPosition(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's position and wobbles it back to its initial position with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget". + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchPosition(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="position"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchRotation(GameObject target, Vector3 amount, float time){ + PunchRotation(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchRotation(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="rotation"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with MINIMUM customization options. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the magnitude of the punch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void PunchScale(GameObject target, Vector3 amount, float time){ + PunchScale(target,Hash("amount",amount,"time",time)); + } + + /// + /// Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale with FULL customization options. + /// + /// + /// A for the magnitude of shake. + /// + /// + /// A or for the individual setting of the x magnitude. + /// + /// + /// A or for the individual setting of the y magnitude. + /// + /// + /// A or for the individual setting of the z magnitude. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A or for the time in seconds the animation will wait before beginning. + /// + /// + /// A or for the type of loop to apply once the animation has completed. (only "loop" is allowed with punches) + /// + /// + /// A for the name of a function to launch at the beginning of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onstart" method. + /// + /// + /// A for arguments to be sent to the "onstart" method. + /// + /// + /// A for the name of a function to launch on every step of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "onupdate" method. + /// + /// + /// A for arguments to be sent to the "onupdate" method. + /// + /// + /// A for the name of a function to launch at the end of the animation. + /// + /// + /// A for a reference to the GameObject that holds the "oncomplete" method. + /// + /// + /// A for arguments to be sent to the "oncomplete" method. + /// + public static void PunchScale(GameObject target, Hashtable args){ + //clean args: + args = iTween.CleanArgs(args); + + //establish iTween + args["type"]="punch"; + args["method"]="scale"; + args["easetype"]=EaseType.punch; + Launch(target,args); + } + + #endregion + + #region #2 Generate Method Targets + + //call correct set target method and set tween application delegate: + void GenerateTargets(){ + switch (type) { + case "value": + switch (method) { + case "float": + GenerateFloatTargets(); + apply = new ApplyTween(ApplyFloatTargets); + break; + case "vector2": + GenerateVector2Targets(); + apply = new ApplyTween(ApplyVector2Targets); + break; + case "vector3": + GenerateVector3Targets(); + apply = new ApplyTween(ApplyVector3Targets); + break; + case "color": + GenerateColorTargets(); + apply = new ApplyTween(ApplyColorTargets); + break; + case "rect": + GenerateRectTargets(); + apply = new ApplyTween(ApplyRectTargets); + break; + } + break; + case "color": + switch (method) { + case "to": + GenerateColorToTargets(); + apply = new ApplyTween(ApplyColorToTargets); + break; + } + break; + case "audio": + switch (method) { + case "to": + GenerateAudioToTargets(); + apply = new ApplyTween(ApplyAudioToTargets); + break; + } + break; + case "move": + switch (method) { + case "to": + //using a path? + if(tweenArguments.Contains("path")){ + GenerateMoveToPathTargets(); + apply = new ApplyTween(ApplyMoveToPathTargets); + }else{ //not using a path? + GenerateMoveToTargets(); + apply = new ApplyTween(ApplyMoveToTargets); + } + break; + case "by": + case "add": + GenerateMoveByTargets(); + apply = new ApplyTween(ApplyMoveByTargets); + break; + } + break; + case "scale": + switch (method){ + case "to": + GenerateScaleToTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "by": + GenerateScaleByTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + case "add": + GenerateScaleAddTargets(); + apply = new ApplyTween(ApplyScaleToTargets); + break; + } + break; + case "rotate": + switch (method) { + case "to": + GenerateRotateToTargets(); + apply = new ApplyTween(ApplyRotateToTargets); + break; + case "add": + GenerateRotateAddTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + case "by": + GenerateRotateByTargets(); + apply = new ApplyTween(ApplyRotateAddTargets); + break; + } + break; + case "shake": + switch (method) { + case "position": + GenerateShakePositionTargets(); + apply = new ApplyTween(ApplyShakePositionTargets); + break; + case "scale": + GenerateShakeScaleTargets(); + apply = new ApplyTween(ApplyShakeScaleTargets); + break; + case "rotation": + GenerateShakeRotationTargets(); + apply = new ApplyTween(ApplyShakeRotationTargets); + break; + } + break; + case "punch": + switch (method) { + case "position": + GeneratePunchPositionTargets(); + apply = new ApplyTween(ApplyPunchPositionTargets); + break; + case "rotation": + GeneratePunchRotationTargets(); + apply = new ApplyTween(ApplyPunchRotationTargets); + break; + case "scale": + GeneratePunchScaleTargets(); + apply = new ApplyTween(ApplyPunchScaleTargets); + break; + } + break; + case "look": + switch (method) { + case "to": + GenerateLookToTargets(); + apply = new ApplyTween(ApplyLookToTargets); + break; + } + break; + case "stab": + GenerateStabTargets(); + apply = new ApplyTween(ApplyStabTargets); + break; + } + } + + #endregion + + #region #3 Generate Specific Targets + + void GenerateRectTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + rects=new Rect[3]; + + //from and to values: + rects[0]=(Rect)tweenArguments["from"]; + rects[1]=(Rect)tweenArguments["to"]; + } + + void GenerateColorTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + colors=new Color[1,3]; + + //from and to values: + colors[0,0]=(Color)tweenArguments["from"]; + colors[0,1]=(Color)tweenArguments["to"]; + } + + void GenerateVector3Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from and to values: + vector3s[0]=(Vector3)tweenArguments["from"]; + vector3s[1]=(Vector3)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateVector2Targets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //from and to values: + vector2s[0]=(Vector2)tweenArguments["from"]; + vector2s[1]=(Vector2)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + Vector3 fromV3 = new Vector3(vector2s[0].x,vector2s[0].y,0); + Vector3 toV3 = new Vector3(vector2s[1].x,vector2s[1].y,0); + float distance = Math.Abs(Vector3.Distance(fromV3,toV3)); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateFloatTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + floats=new float[3]; + + //from and to values: + floats[0]=(float)tweenArguments["from"]; + floats[1]=(float)tweenArguments["to"]; + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(floats[0] - floats[1]); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateColorToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + //colors = new Color[3]; + + //from and init to values: + if(GetComponent()){ + colors = new Color[GetComponent().materials.Length,3]; + for (int i = 0; i < GetComponent().materials.Length; i++) { + colors[i,0]=GetComponent().materials[i].GetColor(namedcolorvalue.ToString()); + colors[i,1]=GetComponent().materials[i].GetColor(namedcolorvalue.ToString()); + } + //colors[0] = colors[1] = renderer.material.color; + }else if(GetComponent()){ + colors = new Color[1,3]; + colors[0,0] = colors[0,1] = GetComponent().color; + }else{ + colors = new Color[1,3]; //empty placeholder incase the GO is perhaps an empty holder or something similar + } + + //to values: + if (tweenArguments.Contains("color")) { + //colors[1]=(Color)tweenArguments["color"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1]=(Color)tweenArguments["color"]; + } + }else{ + if (tweenArguments.Contains("r")) { + //colors[1].r=(float)tweenArguments["r"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].r=(float)tweenArguments["r"]; + } + } + if (tweenArguments.Contains("g")) { + //colors[1].g=(float)tweenArguments["g"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].g=(float)tweenArguments["g"]; + } + } + if (tweenArguments.Contains("b")) { + //colors[1].b=(float)tweenArguments["b"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].b=(float)tweenArguments["b"]; + } + } + if (tweenArguments.Contains("a")) { + //colors[1].a=(float)tweenArguments["a"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["a"]; + } + } + } + + //alpha or amount? + if(tweenArguments.Contains("amount")){ + //colors[1].a=(float)tweenArguments["amount"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["amount"]; + } + }else if(tweenArguments.Contains("alpha")){ + //colors[1].a=(float)tweenArguments["alpha"]; + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,1].a=(float)tweenArguments["alpha"]; + } + } + } + + void GenerateAudioToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector2s=new Vector2[3]; + + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioTo requires an AudioSource."); + Dispose(); + } + } + + //from values and default to values: + vector2s[0]=vector2s[1]=new Vector2(audioSource.volume,audioSource.pitch); + + //to values: + if (tweenArguments.Contains("volume")) { + vector2s[1].x=(float)tweenArguments["volume"]; + } + if (tweenArguments.Contains("pitch")) { + vector2s[1].y=(float)tweenArguments["pitch"]; + } + } + + void GenerateStabTargets(){ + //set audioSource: + if(tweenArguments.Contains("audiosource")){ + audioSource=(AudioSource)tweenArguments["audiosource"]; + }else{ + if(GetComponent()){ + audioSource=GetComponent(); + }else{ + //add and populate AudioSource if one doesn't exist: + gameObject.AddComponent(); + audioSource=GetComponent(); + audioSource.playOnAwake=false; + + } + } + + //populate audioSource's clip: + audioSource.clip=(AudioClip)tweenArguments["audioclip"]; + + //set audio's pitch and volume if requested: + if(tweenArguments.Contains("pitch")){ + audioSource.pitch=(float)tweenArguments["pitch"]; + } + if(tweenArguments.Contains("volume")){ + audioSource.volume=(float)tweenArguments["volume"]; + } + + //set run time based on length of clip after pitch is augmented + time=audioSource.clip.length/audioSource.pitch; + } + + void GenerateLookToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + + //set look: + if(tweenArguments.Contains("looktarget")){ + if (tweenArguments["looktarget"].GetType() == typeof(Transform)) { + //transform.LookAt((Transform)tweenArguments["looktarget"]); + thisTransform.LookAt((Transform)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + }else if(tweenArguments["looktarget"].GetType() == typeof(Vector3)){ + //transform.LookAt((Vector3)tweenArguments["looktarget"]); + thisTransform.LookAt((Vector3)tweenArguments["looktarget"], (Vector3?)tweenArguments["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookTo needs a 'looktarget' property!"); + Dispose(); + } + + //to values: + vector3s[1]=thisTransform.eulerAngles; + thisTransform.eulerAngles=vector3s[0]; + + //axis restriction: + if(tweenArguments.Contains("axis")){ + switch((string)tweenArguments["axis"]){ + case "x": + vector3s[1].y=vector3s[0].y; + vector3s[1].z=vector3s[0].z; + break; + case "y": + vector3s[1].x=vector3s[0].x; + vector3s[1].z=vector3s[0].z; + break; + case "z": + vector3s[1].x=vector3s[0].x; + vector3s[1].y=vector3s[0].y; + break; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToPathTargets(){ + Vector3[] suppliedPath; + + //create and store path points: + if(tweenArguments["path"].GetType() == typeof(Vector3[])){ + Vector3[] temp = (Vector3[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath=new Vector3[temp.Length]; + Array.Copy(temp,suppliedPath, temp.Length); + }else{ + Transform[] temp = (Transform[])tweenArguments["path"]; + //if only one point is supplied fall back to MoveTo's traditional use since we can't have a curve with one value: + if(temp.Length==1){ + Debug.LogError("iTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); + Dispose(); + } + suppliedPath = new Vector3[temp.Length]; + for (int i = 0; i < temp.Length; i++) { + suppliedPath[i]=temp[i].position; + } + } + + //do we need to plot a path to get to the beginning of the supplied path? + bool plotStart; + int offset; + if(thisTransform.position != suppliedPath[0]){ + if(!tweenArguments.Contains("movetopath") || (bool)tweenArguments["movetopath"]==true){ + plotStart=true; + offset=3; + }else{ + plotStart=false; + offset=2; + } + }else{ + plotStart=false; + offset=2; + } + + //build calculated path: + vector3s = new Vector3[suppliedPath.Length+offset]; + if(plotStart){ + vector3s[1]=thisTransform.position; + offset=2; + }else{ + offset=1; + } + + //populate calculate path; + Array.Copy(suppliedPath,0,vector3s,offset,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + //create Catmull-Rom path: + path = new CRSpline(vector3s); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = PathLength(vector3s); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localPosition; + }else{ + vector3s[0]=vector3s[1]=thisTransform.position; + } + + //to values: + if (tweenArguments.Contains("position")) { + if (tweenArguments["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["position"]; + vector3s[1]=trans.position; + }else if(tweenArguments["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["position"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateMoveByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in, [5] for dial in location: + vector3s=new Vector3[6]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.position; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=vector3s[0] + (Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=vector3s[0].x + (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=vector3s[0].y +(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=vector3s[0].z + (float)tweenArguments["z"]; + } + } + + //calculation for dial in: + thisTransform.Translate(vector3s[1],space); + vector3s[5] = thisTransform.position; + thisTransform.position=vector3s[0]; + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + tweenArguments["looktarget"] = vector3s[1]; + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("scale")) { + if (tweenArguments["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["scale"]; + vector3s[1]=trans.localScale; + }else if(tweenArguments["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["scale"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=Vector3.Scale(vector3s[1],(Vector3)tweenArguments["amount"]); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x*=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y*=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z*=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateScaleAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=vector3s[1]=thisTransform.localScale; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateToTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + if (isLocal) { + vector3s[0]=vector3s[1]=thisTransform.localEulerAngles; + }else{ + vector3s[0]=vector3s[1]=thisTransform.eulerAngles; + } + + //to values: + if (tweenArguments.Contains("rotation")) { + if (tweenArguments["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)tweenArguments["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(tweenArguments["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)tweenArguments["rotation"]; + } + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + + //shortest distance: + vector3s[1]=new Vector3(clerp(vector3s[0].x,vector3s[1].x,1),clerp(vector3s[0].y,vector3s[1].y,1),clerp(vector3s[0].z,vector3s[1].z,1)); + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateAddTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[5]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=(float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateRotateByTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Rotate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=vector3s[1]=vector3s[3]=thisTransform.eulerAngles; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]+=Vector3.Scale((Vector3)tweenArguments["amount"],new Vector3(360,360,360)); + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x+=360 * (float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y+=360 * (float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z+=360 * (float)tweenArguments["z"]; + } + } + + //need for speed? + if(tweenArguments.Contains("speed")){ + float distance = Math.Abs(Vector3.Distance(vector3s[0],vector3s[1])); + time = distance/(float)tweenArguments["speed"]; + } + } + + void GenerateShakePositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[4]; + + //grab starting rotation: + vector3s[3] = thisTransform.eulerAngles; + + //root: + vector3s[0]=thisTransform.position; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeScaleTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.localScale; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GenerateShakeRotationTargets(){ + //values holder [0] root value, [1] amount, [2] generated amount: + vector3s=new Vector3[3]; + + //root: + vector3s[0]=thisTransform.eulerAngles; + + //amount: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchPositionTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization, [4] original rotation to make sure look requests don't interfere with the direction object should move in: + vector3s=new Vector3[5]; + + //grab starting rotation: + vector3s[4] = thisTransform.eulerAngles; + + //from values: + vector3s[0]=thisTransform.position; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchRotationTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation, [3] previous value for Translate usage to allow Space utilization: + vector3s=new Vector3[4]; + + //from values: + vector3s[0]=thisTransform.eulerAngles; + vector3s[1]=vector3s[3]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + void GeneratePunchScaleTargets(){ + //values holder [0] from, [1] to, [2] calculated value from ease equation: + vector3s=new Vector3[3]; + + //from values: + vector3s[0]=thisTransform.localScale; + vector3s[1]=Vector3.zero; + + //to values: + if (tweenArguments.Contains("amount")) { + vector3s[1]=(Vector3)tweenArguments["amount"]; + }else{ + if (tweenArguments.Contains("x")) { + vector3s[1].x=(float)tweenArguments["x"]; + } + if (tweenArguments.Contains("y")) { + vector3s[1].y=(float)tweenArguments["y"]; + } + if (tweenArguments.Contains("z")) { + vector3s[1].z=(float)tweenArguments["z"]; + } + } + } + + #endregion + + #region #4 Apply Targets + + void ApplyRectTargets(){ + //calculate: + rects[2].x = ease(rects[0].x,rects[1].x,percentage); + rects[2].y = ease(rects[0].y,rects[1].y,percentage); + rects[2].width = ease(rects[0].width,rects[1].width,percentage); + rects[2].height = ease(rects[0].height,rects[1].height,percentage); + + //apply: + tweenArguments["onupdateparams"]=rects[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=rects[1]; + } + } + + void ApplyColorTargets(){ + //calculate: + colors[0,2].r = ease(colors[0,0].r,colors[0,1].r,percentage); + colors[0,2].g = ease(colors[0,0].g,colors[0,1].g,percentage); + colors[0,2].b = ease(colors[0,0].b,colors[0,1].b,percentage); + colors[0,2].a = ease(colors[0,0].a,colors[0,1].a,percentage); + + //apply: + tweenArguments["onupdateparams"]=colors[0,2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=colors[0,1]; + } + } + + void ApplyVector3Targets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector3s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector3s[1]; + } + } + + void ApplyVector2Targets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + tweenArguments["onupdateparams"]=vector2s[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=vector2s[1]; + } + } + + void ApplyFloatTargets(){ + //calculate: + floats[2] = ease(floats[0],floats[1],percentage); + + //apply: + tweenArguments["onupdateparams"]=floats[2]; + + //dial in: + if(percentage==1){ + tweenArguments["onupdateparams"]=floats[1]; + } + } + + void ApplyColorToTargets(){ + //calculate: + for (int i = 0; i < colors.GetLength(0); i++) { + colors[i,2].r = ease(colors[i,0].r,colors[i,1].r,percentage); + colors[i,2].g = ease(colors[i,0].g,colors[i,1].g,percentage); + colors[i,2].b = ease(colors[i,0].b,colors[i,1].b,percentage); + colors[i,2].a = ease(colors[i,0].a,colors[i,1].a,percentage); + } + /* + colors[2].r = ease(colors[0].r,colors[1].r,percentage); + colors[2].g = ease(colors[0].g,colors[1].g,percentage); + colors[2].b = ease(colors[0].b,colors[1].b,percentage); + colors[2].a = ease(colors[0].a,colors[1].a,percentage); + */ + + //apply: + if(GetComponent()){ + //renderer.material.color=colors[2]; + for (int i = 0; i < colors.GetLength(0); i++) { + GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,2]); + } + }else if(GetComponent()){ + //light.color=colors[2]; + GetComponent().color=colors[0,2]; + } + + //dial in: + if(percentage==1){ + if(GetComponent()){ + //renderer.material.color=colors[1]; + for (int i = 0; i < colors.GetLength(0); i++) { + GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,1]); + } + }else if(GetComponent()){ + //light.color=colors[1]; + GetComponent().color=colors[0,1]; + } + } + } + + void ApplyAudioToTargets(){ + //calculate: + vector2s[2].x = ease(vector2s[0].x,vector2s[1].x,percentage); + vector2s[2].y = ease(vector2s[0].y,vector2s[1].y,percentage); + + //apply: + audioSource.volume=vector2s[2].x; + audioSource.pitch=vector2s[2].y; + + //dial in: + if(percentage==1){ + audioSource.volume=vector2s[1].x; + audioSource.pitch=vector2s[1].y; + } + } + + void ApplyStabTargets(){ + //unnecessary but here just in case + } + + void ApplyMoveToPathTargets(){ + preUpdate = thisTransform.position; + float t = ease(0,1,percentage); + float lookAheadAmount; + + //clamp easing equation results as "back" will fail since overshoots aren't handled in the Catmull-Rom interpolation: + if(isLocal){ + thisTransform.localPosition=path.Interp(Mathf.Clamp(t,0,1)); + }else{ + thisTransform.position=path.Interp(Mathf.Clamp(t,0,1)); + } + + //handle orient to path request: + if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){ + + //plot a point slightly ahead in the interpolation by pushing the percentage forward using the default lookahead value: + float tLook; + if(tweenArguments.Contains("lookahead")){ + lookAheadAmount = (float)tweenArguments["lookahead"]; + }else{ + lookAheadAmount = Defaults.lookAhead; + } + //tLook = ease(0,1,percentage+lookAheadAmount); + tLook = ease(0,1, Mathf.Min(1f, percentage+lookAheadAmount)); + + //locate new leading point with a clamp as stated above: + //Vector3 lookDistance = path.Interp(Mathf.Clamp(tLook,0,1)) - transform.position; + tweenArguments["looktarget"] = path.Interp(Mathf.Clamp(tLook,0,1)); + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + //thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyMoveToTargets(){ + //record current: + preUpdate=thisTransform.position; + + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localPosition=vector3s[2]; + }else{ + thisTransform.position=vector3s[2]; + } + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localPosition=vector3s[1]; + }else{ + thisTransform.position=vector3s[1]; + } + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + //thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyMoveByTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + /* + //dial in: + if(percentage==1){ + transform.position=vector3s[5]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + //thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyScaleToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.localScale=vector3s[2]; + + //dial in: + if(percentage==1){ + thisTransform.localScale=vector3s[1]; + } + } + + void ApplyLookToTargets(){ + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + } + + void ApplyRotateToTargets(){ + preUpdate=thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[2]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[2]); + }; + + //dial in: + if(percentage==1){ + if (isLocal) { + thisTransform.localRotation = Quaternion.Euler(vector3s[1]); + }else{ + thisTransform.rotation = Quaternion.Euler(vector3s[1]); + }; + } + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + //thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyRotateAddTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + vector3s[2].x = ease(vector3s[0].x,vector3s[1].x,percentage); + vector3s[2].y = ease(vector3s[0].y,vector3s[1].y,percentage); + vector3s[2].z = ease(vector3s[0].z,vector3s[1].z,percentage); + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + //thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyShakePositionTargets(){ + //preUpdate = transform.position; + if (isLocal) { + preUpdate = thisTransform.localPosition; + }else{ + preUpdate = thisTransform.position; + } + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[3]; + } + + //impact: + if (percentage==0) { + thisTransform.Translate(vector3s[1],space); + } + + //transform.position=vector3s[0]; + //reset: + if (isLocal) { + thisTransform.localPosition=vector3s[0]; + }else{ + thisTransform.position=vector3s[0]; + } + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + //transform.Translate(vector3s[2],space); + if (isLocal) { + thisTransform.localPosition+=vector3s[2]; + }else{ + thisTransform.position+=vector3s[2]; + } + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + //thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyShakeScaleTargets(){ + //impact: + if (percentage==0) { + thisTransform.localScale=vector3s[1]; + } + + //reset: + thisTransform.localScale=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.localScale+=vector3s[2]; + } + + void ApplyShakeRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //impact: + if (percentage==0) { + thisTransform.Rotate(vector3s[1],space); + } + + //reset: + thisTransform.eulerAngles=vector3s[0]; + + //generate: + float diminishingControl = 1-percentage; + vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl); + vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl); + vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl); + + //apply: + thisTransform.Rotate(vector3s[2],space); + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + //thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchPositionTargets(){ + preUpdate = thisTransform.position; + + //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation + Vector3 currentRotation = new Vector3(); + + if(tweenArguments.Contains("looktarget")){ + currentRotation = thisTransform.eulerAngles; + thisTransform.eulerAngles = vector3s[4]; + } + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Translate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //reset rotation: + if(tweenArguments.Contains("looktarget")){ + thisTransform.eulerAngles = currentRotation; + } + + //dial in: + /* + if(percentage==1){ + transform.position=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.position; + if(physics){ + //thisTransform.position=preUpdate; + GetComponent().MovePosition(postUpdate); + } + } + + void ApplyPunchRotationTargets(){ + preUpdate = thisTransform.eulerAngles; + + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.Rotate(vector3s[2]-vector3s[3],space); + + //record: + vector3s[3]=vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.eulerAngles=vector3s[0]; + } + */ + + //need physics? + postUpdate=thisTransform.eulerAngles; + if(physics){ + //thisTransform.eulerAngles=preUpdate; + GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + void ApplyPunchScaleTargets(){ + //calculate: + if(vector3s[1].x>0){ + vector3s[2].x = punch(vector3s[1].x,percentage); + }else if(vector3s[1].x<0){ + vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage); + } + if(vector3s[1].y>0){ + vector3s[2].y=punch(vector3s[1].y,percentage); + }else if(vector3s[1].y<0){ + vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage); + } + if(vector3s[1].z>0){ + vector3s[2].z=punch(vector3s[1].z,percentage); + }else if(vector3s[1].z<0){ + vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage); + } + + //apply: + thisTransform.localScale=vector3s[0]+vector3s[2]; + + //dial in: + /* + if(percentage==1){ + transform.localScale=vector3s[0]; + } + */ + } + + #endregion + + #region #5 Tween Steps + + IEnumerator TweenDelay(){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + if(wasPaused){ + wasPaused=false; + TweenStart(); + } + } + + void TweenStart(){ + CallBack("onstart"); + + if(!loop){//only if this is not a loop + ConflictCheck(); + GenerateTargets(); + } + + //run stab: + if(type == "stab"){ + audioSource.PlayOneShot(audioSource.clip); + } + + //toggle isKinematic for iTweens that may interfere with physics: + if (type == "move" || type=="scale" || type=="rotate" || type=="punch" || type=="shake" || type=="curve" || type=="look") { + EnableKinematic(); + } + + isRunning = true; + } + + IEnumerator TweenRestart(){ + if(delay > 0){ + delayStarted = Time.time; + yield return new WaitForSeconds (delay); + } + loop=true; + TweenStart(); + } + + void TweenUpdate(){ + apply(); + CallBack("onupdate"); + UpdatePercentage(); + } + + void TweenComplete(){ + isRunning=false; + + //dial in percentage to 1 or 0 for final run: + if(percentage>.5f){ + percentage=1f; + }else{ + percentage=0; + } + + //apply dial in and final run: + apply(); + if(type == "value"){ + CallBack("onupdate"); //CallBack run for ValueTo since it only calculates and applies in the update callback + } + + //loop or dispose? + if(loopType==LoopType.none){ + Dispose(); + }else{ + TweenLoop(); + } + + CallBack("oncomplete"); + } + + void TweenLoop(){ + DisableKinematic(); //give physics control again + switch(loopType){ + case LoopType.loop: + //rewind: + percentage=0; + runningTime=0; + apply(); + + //replay: + StartCoroutine("TweenRestart"); + break; + case LoopType.pingPong: + reverse = !reverse; + runningTime=0; + + //replay: + StartCoroutine("TweenRestart"); + break; + } + } + + #endregion + + #region #6 Update Callable + + /// + /// Returns a Rect that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed){ + Rect diff = new Rect(FloatUpdate(currentValue.x, targetValue.x, speed), FloatUpdate(currentValue.y, targetValue.y, speed), FloatUpdate(currentValue.width, targetValue.width, speed), FloatUpdate(currentValue.height, targetValue.height, speed)); + return (diff); + } + + /// + /// Returns a Vector3 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed){ + Vector3 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a Vector2 that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed){ + Vector2 diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Returns a float that is eased between a current and target value by the supplied speed. + /// + /// + /// A + /// + /// + /// A the starting or initial value + /// + /// + /// A the target value that the current value will be eased to. + /// + /// + /// A to be used as rate of speed (larger number equals faster animation) + /// + public static float FloatUpdate(float currentValue, float targetValue, float speed){ + float diff = targetValue - currentValue; + currentValue += (diff * speed) * Time.deltaTime; + return (currentValue); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final alpha value of the animation. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, Hashtable args){ + args["a"]=args["alpha"]; + ColorUpdate(target,args); + } + + /// + /// Similar to FadeTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final alpha value of the animation. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void FadeUpdate(GameObject target, float alpha, float time){ + FadeUpdate(target,Hash("alpha",alpha,"time",time)); + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A or for the individual setting of the color red. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the color green. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A or for the individual setting of the alpha. + /// + /// + /// A for whether or not to include children of this GameObject. True by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Color[] colors = new Color[4]; + + //handle children: + if(!args.Contains("includechildren") || (bool)args["includechildren"]){ + foreach(Transform child in target.transform){ + ColorUpdate(child.gameObject,args); + } + } + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().material.color; + }else if(target.GetComponent()){ + colors[0] = colors[1] = target.GetComponent().color; + } + + //to values: + if (args.Contains("color")) { + colors[1]=(Color)args["color"]; + }else{ + if (args.Contains("r")) { + colors[1].r=(float)args["r"]; + } + if (args.Contains("g")) { + colors[1].g=(float)args["g"]; + } + if (args.Contains("b")) { + colors[1].b=(float)args["b"]; + } + if (args.Contains("a")) { + colors[1].a=(float)args["a"]; + } + } + + //calculate: + colors[3].r=Mathf.SmoothDamp(colors[0].r,colors[1].r,ref colors[2].r,time); + colors[3].g=Mathf.SmoothDamp(colors[0].g,colors[1].g,ref colors[2].g,time); + colors[3].b=Mathf.SmoothDamp(colors[0].b,colors[1].b,ref colors[2].b,time); + colors[3].a=Mathf.SmoothDamp(colors[0].a,colors[1].a,ref colors[2].a,time); + + //apply: + if(target.GetComponent()){ + target.GetComponent().material.color=colors[3]; + }else if(target.GetComponent()){ + target.GetComponent().color=colors[3]; + } + } + + /// + /// Similar to ColorTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A to change the GameObject's color to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ColorUpdate(GameObject target, Color color, float time){ + ColorUpdate(target,Hash("color",color,"time",time)); + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A for which AudioSource to use. + /// + /// + /// A or for the target level of volume. + /// + /// + /// A or for the target pitch. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + AudioSource audioSource; + float time; + Vector2[] vector2s = new Vector2[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set audioSource: + if(args.Contains("audiosource")){ + audioSource=(AudioSource)args["audiosource"]; + }else{ + if(target.GetComponent()){ + audioSource=target.GetComponent(); + }else{ + //throw error if no AudioSource is available: + Debug.LogError("iTween Error: AudioUpdate requires an AudioSource."); + return; + } + } + + //from values: + vector2s[0] = vector2s[1] = new Vector2(audioSource.volume,audioSource.pitch); + + //set to: + if(args.Contains("volume")){ + vector2s[1].x=(float)args["volume"]; + } + if(args.Contains("pitch")){ + vector2s[1].y=(float)args["pitch"]; + } + + //calculate: + vector2s[3].x=Mathf.SmoothDampAngle(vector2s[0].x,vector2s[1].x,ref vector2s[2].x,time); + vector2s[3].y=Mathf.SmoothDampAngle(vector2s[0].y,vector2s[1].y,ref vector2s[2].y,time); + + //apply: + audioSource.volume=vector2s[3].x; + audioSource.pitch=vector2s[3].y; + } + + /// + /// Similar to AudioTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target level of volume. + /// + /// + /// A for the target pitch. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void AudioUpdate(GameObject target, float volume, float pitch, float time){ + AudioUpdate(target,Hash("volume",volume,"pitch",pitch,"time",time)); + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the target Euler angles in degrees to rotate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + bool isLocal; + float time; + Vector3[] vector3s = new Vector3[4]; + Vector3 preUpdate = target.transform.eulerAngles; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //from values: + if(isLocal){ + vector3s[0] = target.transform.localEulerAngles; + }else{ + vector3s[0] = target.transform.eulerAngles; + } + + //set to: + if(args.Contains("rotation")){ + if (args["rotation"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["rotation"]; + vector3s[1]=trans.eulerAngles; + }else if(args["rotation"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["rotation"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + if(isLocal){ + target.transform.localEulerAngles=vector3s[3]; + }else{ + target.transform.eulerAngles=vector3s[3]; + } + + //need physics? + if(target.GetComponent() != null){ + Vector3 postUpdate=target.transform.eulerAngles; + //target.transform.eulerAngles=preUpdate; + target.GetComponent().MoveRotation(Quaternion.Euler(postUpdate)); + } + } + + /// + /// Similar to RotateTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the target Euler angles in degrees to rotate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void RotateUpdate(GameObject target, Vector3 rotation, float time){ + RotateUpdate(target,Hash("rotation",rotation,"time",time)); + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for the final scale. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //init values: + vector3s[0] = vector3s[1] = target.transform.localScale; + + //to values: + if (args.Contains("scale")) { + if (args["scale"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["scale"]; + vector3s[1]=trans.localScale; + }else if(args["scale"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["scale"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.localScale=vector3s[3]; + } + + /// + /// Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for the final scale. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void ScaleUpdate(GameObject target, Vector3 scale, float time){ + ScaleUpdate(target,Hash("scale",scale,"time",time)); + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a point in space the GameObject will animate to. + /// + /// + /// A or for the individual setting of the x axis. + /// + /// + /// A or for the individual setting of the y axis. + /// + /// + /// A or for the individual setting of the z axis. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + /// + /// A for whether to animate in world space or relative to the parent. False by default. + /// + /// + /// A for whether or not the GameObject will orient to its direction of travel. False by default. + /// + /// + /// A or A for a target the GameObject will look at. + /// + /// + /// A or for the time in seconds the object will take to look at either the "looktarget" or "orienttopath". + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + public static void MoveUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[4]; + bool isLocal; + Vector3 preUpdate = target.transform.position; + + //set smooth time: + if(args.Contains("time")){ + time=(float)args["time"]; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //set isLocal: + if(args.Contains("islocal")){ + isLocal = (bool)args["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + //init values: + if(isLocal){ + vector3s[0] = vector3s[1] = target.transform.localPosition; + }else{ + vector3s[0] = vector3s[1] = target.transform.position; + } + + //to values: + if (args.Contains("position")) { + if (args["position"].GetType() == typeof(Transform)){ + Transform trans = (Transform)args["position"]; + vector3s[1]=trans.position; + }else if(args["position"].GetType() == typeof(Vector3)){ + vector3s[1]=(Vector3)args["position"]; + } + }else{ + if (args.Contains("x")) { + vector3s[1].x=(float)args["x"]; + } + if (args.Contains("y")) { + vector3s[1].y=(float)args["y"]; + } + if (args.Contains("z")) { + vector3s[1].z=(float)args["z"]; + } + } + + //calculate: + vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //handle orient to path: + if(args.Contains("orienttopath") && (bool)args["orienttopath"]){ + args["looktarget"] = vector3s[3]; + } + + //look applications: + if(args.Contains("looktarget")){ + iTween.LookUpdate(target,args); + } + + //apply: + if(isLocal){ + target.transform.localPosition = vector3s[3]; + }else{ + target.transform.position=vector3s[3]; + } + + //need physics? + if(target.GetComponent() != null){ + Vector3 postUpdate=target.transform.position; + //target.transform.position=preUpdate; + target.GetComponent().MovePosition(postUpdate); + } + } + + /// + /// Similar to MoveTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with MINIMUM customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a point in space the GameObject will animate to. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void MoveUpdate(GameObject target, Vector3 position, float time){ + MoveUpdate(target,Hash("position",position,"time",time)); + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A or for a target the GameObject will look at. + /// + /// + /// A . Restricts rotation to the supplied axis only. + /// + /// + /// A or for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Hashtable args){ + CleanArgs(args); + + float time; + Vector3[] vector3s = new Vector3[5]; + + //set smooth time: + if(args.Contains("looktime")){ + time=(float)args["looktime"]; + time*=Defaults.updateTimePercentage; + }else if(args.Contains("time")){ + time=(float)args["time"]*.15f; + time*=Defaults.updateTimePercentage; + }else{ + time=Defaults.updateTime; + } + + //from values: + vector3s[0] = target.transform.eulerAngles; + + //set look: + if(args.Contains("looktarget")){ + if (args["looktarget"].GetType() == typeof(Transform)) { + //target.transform.LookAt((Transform)args["looktarget"]); + target.transform.LookAt((Transform)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + }else if(args["looktarget"].GetType() == typeof(Vector3)){ + //target.transform.LookAt((Vector3)args["looktarget"]); + target.transform.LookAt((Vector3)args["looktarget"], (Vector3?)args["up"] ?? Defaults.up); + } + }else{ + Debug.LogError("iTween Error: LookUpdate needs a 'looktarget' property!"); + return; + } + + //to values and reset look: + vector3s[1]=target.transform.eulerAngles; + target.transform.eulerAngles=vector3s[0]; + + //calculate: + vector3s[3].x=Mathf.SmoothDampAngle(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time); + vector3s[3].y=Mathf.SmoothDampAngle(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time); + vector3s[3].z=Mathf.SmoothDampAngle(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time); + + //apply: + target.transform.eulerAngles=vector3s[3]; + + //axis restriction: + if(args.Contains("axis")){ + vector3s[4]=target.transform.eulerAngles; + switch((string)args["axis"]){ + case "x": + vector3s[4].y=vector3s[0].y; + vector3s[4].z=vector3s[0].z; + break; + case "y": + vector3s[4].x=vector3s[0].x; + vector3s[4].z=vector3s[0].z; + break; + case "z": + vector3s[4].x=vector3s[0].x; + vector3s[4].y=vector3s[0].y; + break; + } + + //apply axis restriction: + target.transform.eulerAngles=vector3s[4]; + } + } + + /// + /// Similar to LookTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType. + /// + /// + /// A to be the target of the animation. + /// + /// + /// A for a target the GameObject will look at. + /// + /// + /// A for the time in seconds the animation will take to complete. + /// + public static void LookUpdate(GameObject target, Vector3 looktarget, float time){ + LookUpdate(target,Hash("looktarget",looktarget,"time",time)); + } + + #endregion + + #region #7 External Utilities + + /// + /// Returns the length of a curved path drawn through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static float PathLength(Transform[] path){ + Vector3[] suppliedPath = new Vector3[path.Length]; + float pathLength = 0; + + //create and store path points: + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + Vector3[] vector3s = PathControlPointGenerator(suppliedPath); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + /// + /// Returns the length of a curved path drawn through the provided array of Vector3s. + /// + /// + /// The length. + /// + /// + /// A + /// + public static float PathLength(Vector3[] path){ + float pathLength = 0; + + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + pathLength += Vector3.Distance(prevPt,currPt); + prevPt = currPt; + } + + return pathLength; + } + + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Vector3[] path, float percent){ + target.transform.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Vector3[] path, float percent){ + target.position=Interp(PathControlPointGenerator(path),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(GameObject target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.transform.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Puts a GameObject on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static void PutOnPath(Transform target, Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + target.position=Interp(PathControlPointGenerator(suppliedPath),percent); + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Transform[] path, float percent){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + return(Interp(PathControlPointGenerator(suppliedPath),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawLine(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a line through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLine(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineGizmos(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"gizmos"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line) { + if(line.Length>0){ + DrawLineHelper(line,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Vector3[] line, Color color) { + if(line.Length>0){ + DrawLineHelper(line,color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + DrawLineHelper(suppliedLine,Defaults.color,"handles"); + } + } + + /// + /// Draws a line through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawLineHandles(Transform[] line,Color color) { + if(line.Length>0){ + //create and store line points: + Vector3[] suppliedLine = new Vector3[line.Length]; + for (int i = 0; i < line.Length; i++) { + suppliedLine[i]=line[i].position; + } + + DrawLineHelper(suppliedLine, color,"handles"); + } + } + + /// + /// Returns a Vector3 position on a path at the provided percentage + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + public static Vector3 PointOnPath(Vector3[] path, float percent){ + return(Interp(PathControlPointGenerator(path),percent)); + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Vector3s. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + public static void DrawPath(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// When called from an OnDrawGizmos() function it will draw a curved path through the provided array of Transforms. + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPath(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Gizmos.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathGizmos(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"gizmos"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path) { + if(path.Length>0){ + DrawPathHelper(path,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Vector3s with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Vector3[] path, Color color) { + if(path.Length>0){ + DrawPathHelper(path, color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath,Defaults.color,"handles"); + } + } + + /// + /// Draws a curved path through the provided array of Transforms with Handles.DrawLine(). + /// + /// + /// A + /// + /// + /// A + /// + public static void DrawPathHandles(Transform[] path,Color color) { + if(path.Length>0){ + //create and store path points: + Vector3[] suppliedPath = new Vector3[path.Length]; + for (int i = 0; i < path.Length; i++) { + suppliedPath[i]=path[i].position; + } + + DrawPathHelper(suppliedPath, color,"handles"); + } + } + + //################################# + //# RESUME UTILITIES AND OVERLOADS # + //################################# + + /// + /// Resume all iTweens on a GameObject. + /// + public static void Resume(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.enabled=true; + } + } + + /// + /// Resume all iTweens on a GameObject including its children. + /// + public static void Resume(GameObject target, bool includechildren){ + Resume(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,true); + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + } + + /// + /// Resume all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.enabled=true; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Resume(child.gameObject,type,true); + } + } + } + + /// + /// Resume all iTweens in scene. + /// + public static void Resume(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Resume(target); + } + } + + /// + /// Resume all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to resume. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Resume(string type){ + ArrayList resumeArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + resumeArray.Insert(resumeArray.Count,target); + } + + for (int i = 0; i < resumeArray.Count; i++) { + Resume((GameObject)resumeArray[i],type); + } + } + + //################################# + //# PAUSE UTILITIES AND OVERLOADS # + //################################# + + /// + /// Pause all iTweens on a GameObject. + /// + public static void Pause(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + + /// + /// Pause all iTweens on a GameObject including its children. + /// + public static void Pause(GameObject target, bool includechildren){ + Pause(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,true); + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + } + + /// + /// Pause all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + if(item.delay>0){ + item.delay-=Time.time-item.delayStarted; + item.StopCoroutine("TweenDelay"); + } + item.isPaused=true; + item.enabled=false; + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Pause(child.gameObject,type,true); + } + } + } + + /// + /// Pause all iTweens in scene. + /// + public static void Pause(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Pause(target); + } + } + + /// + /// Pause all iTweens in scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to pause. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Pause(string type){ + ArrayList pauseArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + pauseArray.Insert(pauseArray.Count,target); + } + + for (int i = 0; i < pauseArray.Count; i++) { + Pause((GameObject)pauseArray[i],type); + } + } + + //################################# + //# COUNT UTILITIES AND OVERLOADS # + //################################# + + /// + /// Count all iTweens in current scene. + /// + public static int Count(){ + return(tweens.Count); + } + + /// + /// Count all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(string type){ + int tweenCount = 0; + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + string targetType = (string)currentTween["type"]+(string)currentTween["method"]; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + + return(tweenCount); + } + + /// + /// Count all iTweens on a GameObject. + /// + public static int Count(GameObject target){ + Component[] tweens = target.GetComponents(); + return(tweens.Length); + } + + /// + /// Count all iTweens on a GameObject of a particular type. + /// + /// + /// A name of the type of iTween you would like to count. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static int Count(GameObject target, string type){ + int tweenCount = 0; + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + tweenCount++; + } + } + return(tweenCount); + } + + //################################ + //# STOP UTILITIES AND OVERLOADS # + //################################ + + /// + /// Stop and destroy all Tweens in current scene. + /// + public static void Stop(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + Stop(target); + } + tweens.Clear(); + } + + /// + /// Stop and destroy all iTweens in current scene of a particular type. + /// + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(string type){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + Stop((GameObject)stopArray[i],type); + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens in current scene of a particular name. + /// + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(string name){ + ArrayList stopArray = new ArrayList(); + + for (int i = 0; i < tweens.Count; i++) { + Hashtable currentTween = tweens[i]; + GameObject target = (GameObject)currentTween["target"]; + stopArray.Insert(stopArray.Count,target); + } + + for (int i = 0; i < stopArray.Count; i++) { + StopByName((GameObject)stopArray[i],name); + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject. + /// + public static void Stop(GameObject target){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + item.Dispose(); + } + } + + /// + /// Stop and destroy all iTweens on a GameObject including its children. + /// + public static void Stop(GameObject target, bool includechildren){ + Stop(target); + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,true); + } + } + } + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + } + /* GFX47 MOD END */ + + /// + /// Stop and destroy all iTweens on a GameObject of a particular type including its children. + /// + /// A name of the type of iTween you would like to stop. Can be written as part of a name such as "mov" for all "MoveTo" iTweens. + /// + public static void Stop(GameObject target, string type, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + Stop(child.gameObject,type,true); + } + } + } + + /* GFX47 MOD START */ + /// + /// Stop and destroy all iTweens on a GameObject of a particular name including its children. + /// + /// The name of iTween you would like to stop. + /// + public static void StopByName(GameObject target, string name, bool includechildren){ + Component[] tweens = target.GetComponents(); + foreach (iTween item in tweens){ + /*string targetType = item.type+item.method; + targetType=targetType.Substring(0,type.Length); + if(targetType.ToLower() == type.ToLower()){ + item.Dispose(); + }*/ + if(item._name == name){ + item.Dispose(); + } + } + if(includechildren){ + foreach(Transform child in target.transform){ + //Stop(child.gameObject,type,true); + StopByName(child.gameObject,name,true); + } + } + } + /* GFX47 MOD END */ + + /// + /// Universal interface to help in the creation of Hashtables. Especially useful for C# users. + /// + /// + /// A of alternating name value pairs. For example "time",1,"delay",2... + /// + /// + /// A + /// + public static Hashtable Hash(params object[] args){ + Hashtable hashTable = new Hashtable(args.Length/2); + if (args.Length %2 != 0) { + Debug.LogError("Tween Error: Hash requires an even number of arguments!"); + return null; + }else{ + int i = 0; + while(i < args.Length - 1) { + hashTable.Add(args[i], args[i+1]); + i += 2; + } + return hashTable; + } + } + + #endregion + + #region Component Segments + + private iTween(Hashtable h) { + tweenArguments = h; + } + + void Awake(){ + thisTransform = transform; + + RetrieveArgs(); + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + IEnumerator Start(){ + if(delay > 0){ + yield return StartCoroutine("TweenDelay"); + } + TweenStart(); + } + + //non-physics + void Update(){ + if(isRunning && !physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + //physics + void FixedUpdate(){ + if(isRunning && physics){ + if(!reverse){ + if(percentage<1f){ + TweenUpdate(); + }else{ + TweenComplete(); + } + }else{ + if(percentage>0){ + TweenUpdate(); + }else{ + TweenComplete(); + } + } + } + } + + void LateUpdate(){ + //look applications: + if(tweenArguments.Contains("looktarget") && isRunning){ + if(type =="move" || type =="shake" || type=="punch"){ + LookUpdate(gameObject,tweenArguments); + } + } + } + + void OnEnable(){ + if(isRunning){ + EnableKinematic(); + } + + //resume delay: + if(isPaused){ + isPaused=false; + if(delay > 0){ + wasPaused=true; + ResumeDelay(); + } + } + } + + void OnDisable(){ + DisableKinematic(); + } + + #endregion + + #region Internal Helpers + + private static void DrawLineHelper(Vector3[] line, Color color, string method){ + Gizmos.color=color; + for (int i = 0; i < line.Length-1; i++) { + if(method == "gizmos"){ + Gizmos.DrawLine(line[i], line[i+1]);; + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(line[i], line[i+1]); + } + } + } + + private static void DrawPathHelper(Vector3[] path, Color color, string method){ + Vector3[] vector3s = PathControlPointGenerator(path); + + //Line Draw: + Vector3 prevPt = Interp(vector3s,0); + Gizmos.color=color; + int SmoothAmount = path.Length*20; + for (int i = 1; i <= SmoothAmount; i++) { + float pm = (float) i / SmoothAmount; + Vector3 currPt = Interp(vector3s,pm); + if(method == "gizmos"){ + Gizmos.DrawLine(currPt, prevPt); + }else if(method == "handles"){ + Debug.LogError("iTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); + //UnityEditor.Handles.DrawLine(currPt, prevPt); + } + prevPt = currPt; + } + } + + private static Vector3[] PathControlPointGenerator(Vector3[] path){ + Vector3[] suppliedPath; + Vector3[] vector3s; + + //create and store path points: + suppliedPath = path; + + //populate calculate path; + int offset = 2; + vector3s = new Vector3[suppliedPath.Length+offset]; + Array.Copy(suppliedPath,0,vector3s,1,suppliedPath.Length); + + //populate start and end control points: + //vector3s[0] = vector3s[1] - vector3s[2]; + vector3s[0] = vector3s[1] + (vector3s[1] - vector3s[2]); + vector3s[vector3s.Length-1] = vector3s[vector3s.Length-2] + (vector3s[vector3s.Length-2] - vector3s[vector3s.Length-3]); + + //is this a closed, continuous loop? yes? well then so let's make a continuous Catmull-Rom spline! + if(vector3s[1] == vector3s[vector3s.Length-2]){ + Vector3[] tmpLoopSpline = new Vector3[vector3s.Length]; + Array.Copy(vector3s,tmpLoopSpline,vector3s.Length); + tmpLoopSpline[0]=tmpLoopSpline[tmpLoopSpline.Length-3]; + tmpLoopSpline[tmpLoopSpline.Length-1]=tmpLoopSpline[2]; + vector3s=new Vector3[tmpLoopSpline.Length]; + Array.Copy(tmpLoopSpline,vector3s,tmpLoopSpline.Length); + } + + return(vector3s); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private static Vector3 Interp(Vector3[] pts, float t){ + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + + return .5f * ( + (-a + 3f * b - 3f * c + d) * (u * u * u) + + (2f * a - 5f * b + 4f * c - d) * (u * u) + + (-a + c) * u + + 2f * b + ); + } + + //andeeee from the Unity forum's steller Catmull-Rom class ( http://forum.unity3d.com/viewtopic.php?p=218400#218400 ): + private class CRSpline { + public Vector3[] pts; + + public CRSpline(params Vector3[] pts) { + this.pts = new Vector3[pts.Length]; + Array.Copy(pts, this.pts, pts.Length); + } + + + public Vector3 Interp(float t) { + int numSections = pts.Length - 3; + int currPt = Mathf.Min(Mathf.FloorToInt(t * (float) numSections), numSections - 1); + float u = t * (float) numSections - (float) currPt; + Vector3 a = pts[currPt]; + Vector3 b = pts[currPt + 1]; + Vector3 c = pts[currPt + 2]; + Vector3 d = pts[currPt + 3]; + return .5f*((-a+3f*b-3f*c+d)*(u*u*u)+(2f*a-5f*b+4f*c-d)*(u*u)+(-a+c)*u+2f*b); + } + } + + //catalog new tween and add component phase of iTween: + static void Launch(GameObject target, Hashtable args){ + if(!args.Contains("id")){ + args["id"] = GenerateID(); + } + if(!args.Contains("target")){ + args["target"] = target; + + } + + tweens.Insert (0, args); + target.AddComponent(); + } + + //cast any accidentally supplied doubles and ints as floats as iTween only uses floats internally and unify parameter case: + static Hashtable CleanArgs(Hashtable args){ + Hashtable argsCopy = new Hashtable(args.Count); + Hashtable argsCaseUnified = new Hashtable(args.Count); + + foreach (DictionaryEntry item in args) { + argsCopy.Add(item.Key, item.Value); + } + + foreach (DictionaryEntry item in argsCopy) { + if(item.Value.GetType() == typeof(System.Int32)){ + int original = (int)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + if(item.Value.GetType() == typeof(System.Double)){ + double original = (double)item.Value; + float casted = (float)original; + args[item.Key] = casted; + } + } + + //unify parameter case: + foreach (DictionaryEntry item in args) { + argsCaseUnified.Add(item.Key.ToString().ToLower(), item.Value); + } + + //swap back case unification: + args = argsCaseUnified; + + return args; + } + + //random ID generator: + static string GenerateID(){ +// int strlen = 15; +// char[] chars = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8'}; +// int num_chars = chars.Length - 1; +// string randomChar = ""; +// for (int i = 0; i < strlen; i++) { +// randomChar += chars[(int)Mathf.Floor(UnityEngine.Random.Range(0,num_chars))]; +// } + return System.Guid.NewGuid().ToString(); + } + + //grab and set generic, neccesary iTween arguments: + void RetrieveArgs(){ + foreach (Hashtable item in tweens) { + if((GameObject)item["target"] == gameObject){ + tweenArguments=item; + break; + } + } + + id=(string)tweenArguments["id"]; + type=(string)tweenArguments["type"]; + /* GFX47 MOD START */ + _name=(string)tweenArguments["name"]; + /* GFX47 MOD END */ + method=(string)tweenArguments["method"]; + + if(tweenArguments.Contains("time")){ + time=(float)tweenArguments["time"]; + }else{ + time=Defaults.time; + } + + //do we need to use physics, is there a rigidbody? + if(GetComponent() != null){ + physics=true; + } + + if(tweenArguments.Contains("delay")){ + delay=(float)tweenArguments["delay"]; + }else{ + delay=Defaults.delay; + } + + if(tweenArguments.Contains("namedcolorvalue")){ + //allows namedcolorvalue to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["namedcolorvalue"].GetType() == typeof(NamedValueColor)){ + namedcolorvalue=(NamedValueColor)tweenArguments["namedcolorvalue"]; + }else{ + try { + namedcolorvalue=(NamedValueColor)Enum.Parse(typeof(NamedValueColor),(string)tweenArguments["namedcolorvalue"],true); + } catch { + Debug.LogWarning("iTween: Unsupported namedcolorvalue supplied! Default will be used."); + namedcolorvalue = iTween.NamedValueColor._Color; + } + } + }else{ + namedcolorvalue=Defaults.namedColorValue; + } + + if(tweenArguments.Contains("looptype")){ + //allows loopType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["looptype"].GetType() == typeof(LoopType)){ + loopType=(LoopType)tweenArguments["looptype"]; + }else{ + try { + loopType=(LoopType)Enum.Parse(typeof(LoopType),(string)tweenArguments["looptype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported loopType supplied! Default will be used."); + loopType = iTween.LoopType.none; + } + } + }else{ + loopType = iTween.LoopType.none; + } + + if(tweenArguments.Contains("easetype")){ + //allows easeType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["easetype"].GetType() == typeof(EaseType)){ + easeType=(EaseType)tweenArguments["easetype"]; + }else{ + try { + easeType=(EaseType)Enum.Parse(typeof(EaseType),(string)tweenArguments["easetype"],true); + } catch { + Debug.LogWarning("iTween: Unsupported easeType supplied! Default will be used."); + easeType=Defaults.easeType; + } + } + }else{ + easeType=Defaults.easeType; + } + + if(tweenArguments.Contains("space")){ + //allows space to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: + if(tweenArguments["space"].GetType() == typeof(Space)){ + space=(Space)tweenArguments["space"]; + }else{ + try { + space=(Space)Enum.Parse(typeof(Space),(string)tweenArguments["space"],true); + } catch { + Debug.LogWarning("iTween: Unsupported space supplied! Default will be used."); + space = Defaults.space; + } + } + }else{ + space = Defaults.space; + } + + if(tweenArguments.Contains("islocal")){ + isLocal = (bool)tweenArguments["islocal"]; + }else{ + isLocal = Defaults.isLocal; + } + + // Added by PressPlay + if (tweenArguments.Contains("ignoretimescale")) + { + useRealTime = (bool)tweenArguments["ignoretimescale"]; + } + else + { + useRealTime = Defaults.useRealTime; + } + + //instantiates a cached ease equation reference: + GetEasingFunction(); + } + + //instantiates a cached ease equation refrence: + void GetEasingFunction(){ + switch (easeType){ + case EaseType.easeInQuad: + ease = new EasingFunction(easeInQuad); + break; + case EaseType.easeOutQuad: + ease = new EasingFunction(easeOutQuad); + break; + case EaseType.easeInOutQuad: + ease = new EasingFunction(easeInOutQuad); + break; + case EaseType.easeInCubic: + ease = new EasingFunction(easeInCubic); + break; + case EaseType.easeOutCubic: + ease = new EasingFunction(easeOutCubic); + break; + case EaseType.easeInOutCubic: + ease = new EasingFunction(easeInOutCubic); + break; + case EaseType.easeInQuart: + ease = new EasingFunction(easeInQuart); + break; + case EaseType.easeOutQuart: + ease = new EasingFunction(easeOutQuart); + break; + case EaseType.easeInOutQuart: + ease = new EasingFunction(easeInOutQuart); + break; + case EaseType.easeInQuint: + ease = new EasingFunction(easeInQuint); + break; + case EaseType.easeOutQuint: + ease = new EasingFunction(easeOutQuint); + break; + case EaseType.easeInOutQuint: + ease = new EasingFunction(easeInOutQuint); + break; + case EaseType.easeInSine: + ease = new EasingFunction(easeInSine); + break; + case EaseType.easeOutSine: + ease = new EasingFunction(easeOutSine); + break; + case EaseType.easeInOutSine: + ease = new EasingFunction(easeInOutSine); + break; + case EaseType.easeInExpo: + ease = new EasingFunction(easeInExpo); + break; + case EaseType.easeOutExpo: + ease = new EasingFunction(easeOutExpo); + break; + case EaseType.easeInOutExpo: + ease = new EasingFunction(easeInOutExpo); + break; + case EaseType.easeInCirc: + ease = new EasingFunction(easeInCirc); + break; + case EaseType.easeOutCirc: + ease = new EasingFunction(easeOutCirc); + break; + case EaseType.easeInOutCirc: + ease = new EasingFunction(easeInOutCirc); + break; + case EaseType.linear: + ease = new EasingFunction(linear); + break; + case EaseType.spring: + ease = new EasingFunction(spring); + break; + /* GFX47 MOD START */ + /*case EaseType.bounce: + ease = new EasingFunction(bounce); + break;*/ + case EaseType.easeInBounce: + ease = new EasingFunction(easeInBounce); + break; + case EaseType.easeOutBounce: + ease = new EasingFunction(easeOutBounce); + break; + case EaseType.easeInOutBounce: + ease = new EasingFunction(easeInOutBounce); + break; + /* GFX47 MOD END */ + case EaseType.easeInBack: + ease = new EasingFunction(easeInBack); + break; + case EaseType.easeOutBack: + ease = new EasingFunction(easeOutBack); + break; + case EaseType.easeInOutBack: + ease = new EasingFunction(easeInOutBack); + break; + /* GFX47 MOD START */ + /*case EaseType.elastic: + ease = new EasingFunction(elastic); + break;*/ + case EaseType.easeInElastic: + ease = new EasingFunction(easeInElastic); + break; + case EaseType.easeOutElastic: + ease = new EasingFunction(easeOutElastic); + break; + case EaseType.easeInOutElastic: + ease = new EasingFunction(easeInOutElastic); + break; + /* GFX47 MOD END */ + } + } + + //calculate percentage of tween based on time: + void UpdatePercentage(){ + + // Added by PressPlay + if (useRealTime) + { + runningTime += (Time.realtimeSinceStartup - lastRealTime); + } + else + { + runningTime += Time.deltaTime; + } + + if(reverse){ + percentage = 1 - runningTime/time; + }else{ + percentage = runningTime/time; + } + + lastRealTime = Time.realtimeSinceStartup; // Added by PressPlay + } + + void CallBack(string callbackType){ + if (tweenArguments.Contains(callbackType) && !tweenArguments.Contains("ischild")) { + //establish target: + GameObject target; + if (tweenArguments.Contains(callbackType+"target")) { + target=(GameObject)tweenArguments[callbackType+"target"]; + }else{ + target=gameObject; + } + + //throw an error if a string wasn't passed for callback: + if (tweenArguments[callbackType].GetType() == typeof(System.String)) { + target.SendMessage((string)tweenArguments[callbackType],(object)tweenArguments[callbackType+"params"],SendMessageOptions.DontRequireReceiver); + }else{ + Debug.LogError("iTween Error: Callback method references must be passed as a String!"); + Destroy (this); + } + } + } + + void Dispose(){ + for (int i = 0; i < tweens.Count; i++) { + Hashtable tweenEntry = tweens[i]; + if ((string)tweenEntry["id"] == id){ + tweens.RemoveAt(i); + break; + } + } + Destroy(this); + } + + void ConflictCheck(){//if a new iTween is about to run and is of the same type as an in progress iTween this will destroy the previous if the new one is NOT identical in every way or it will destroy the new iTween if they are: + Component[] tweens = GetComponents(); + foreach (iTween item in tweens) { + if(item.type == "value"){ + return; + }else if(item.isRunning && item.type==type){ + //cancel out if this is a shake or punch variant: + if (item.method != method) { + return; + } + + //step 1: check for length first since it's the fastest: + if(item.tweenArguments.Count != tweenArguments.Count){ + item.Dispose(); + return; + } + + //step 2: side-by-side check to figure out if this is an identical tween scenario to handle Update usages of iTween: + foreach (DictionaryEntry currentProp in tweenArguments) { + if(!item.tweenArguments.Contains(currentProp.Key)){ + item.Dispose(); + return; + }else{ + if(!item.tweenArguments[currentProp.Key].Equals(tweenArguments[currentProp.Key]) && (string)currentProp.Key != "id"){//if we aren't comparing ids and something isn't exactly the same replace the running iTween: + item.Dispose(); + return; + } + } + } + + //step 3: prevent a new iTween addition if it is identical to the currently running iTween + Dispose(); + //Destroy(this); + } + } + } + + void EnableKinematic(){ + /* + if(gameObject.GetComponent(typeof(Rigidbody))){ + if(!rigidbody.isKinematic){ + kinematic=true; + rigidbody.isKinematic=true; + } + } + */ + } + + void DisableKinematic(){ + /* + if(kinematic && rigidbody.isKinematic==true){ + kinematic=false; + rigidbody.isKinematic=false; + } + */ + } + + void ResumeDelay(){ + StartCoroutine("TweenDelay"); + } + + #endregion + + #region Easing Curves + + private float linear(float start, float end, float value){ + return Mathf.Lerp(start, end, value); + } + + private float clerp(float start, float end, float value){ + float min = 0.0f; + float max = 360.0f; + float half = Mathf.Abs((max - min) * 0.5f); + float retval = 0.0f; + float diff = 0.0f; + if ((end - start) < -half){ + diff = ((max - start) + end) * value; + retval = start + diff; + }else if ((end - start) > half){ + diff = -((max - end) + start) * value; + retval = start + diff; + }else retval = start + (end - start) * value; + return retval; + } + + private float spring(float start, float end, float value){ + value = Mathf.Clamp01(value); + value = (Mathf.Sin(value * Mathf.PI * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + (1.2f * (1f - value))); + return start + (end - start) * value; + } + + private float easeInQuad(float start, float end, float value){ + end -= start; + return end * value * value + start; + } + + private float easeOutQuad(float start, float end, float value){ + end -= start; + return -end * value * (value - 2) + start; + } + + private float easeInOutQuad(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value + start; + value--; + return -end * 0.5f * (value * (value - 2) - 1) + start; + } + + private float easeInCubic(float start, float end, float value){ + end -= start; + return end * value * value * value + start; + } + + private float easeOutCubic(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value + 1) + start; + } + + private float easeInOutCubic(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value + 2) + start; + } + + private float easeInQuart(float start, float end, float value){ + end -= start; + return end * value * value * value * value + start; + } + + private float easeOutQuart(float start, float end, float value){ + value--; + end -= start; + return -end * (value * value * value * value - 1) + start; + } + + private float easeInOutQuart(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value + start; + value -= 2; + return -end * 0.5f * (value * value * value * value - 2) + start; + } + + private float easeInQuint(float start, float end, float value){ + end -= start; + return end * value * value * value * value * value + start; + } + + private float easeOutQuint(float start, float end, float value){ + value--; + end -= start; + return end * (value * value * value * value * value + 1) + start; + } + + private float easeInOutQuint(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * value * value * value * value * value + start; + value -= 2; + return end * 0.5f * (value * value * value * value * value + 2) + start; + } + + private float easeInSine(float start, float end, float value){ + end -= start; + return -end * Mathf.Cos(value * (Mathf.PI * 0.5f)) + end + start; + } + + private float easeOutSine(float start, float end, float value){ + end -= start; + return end * Mathf.Sin(value * (Mathf.PI * 0.5f)) + start; + } + + private float easeInOutSine(float start, float end, float value){ + end -= start; + return -end * 0.5f * (Mathf.Cos(Mathf.PI * value) - 1) + start; + } + + private float easeInExpo(float start, float end, float value){ + end -= start; + return end * Mathf.Pow(2, 10 * (value - 1)) + start; + } + + private float easeOutExpo(float start, float end, float value){ + end -= start; + return end * (-Mathf.Pow(2, -10 * value ) + 1) + start; + } + + private float easeInOutExpo(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return end * 0.5f * Mathf.Pow(2, 10 * (value - 1)) + start; + value--; + return end * 0.5f * (-Mathf.Pow(2, -10 * value) + 2) + start; + } + + private float easeInCirc(float start, float end, float value){ + end -= start; + return -end * (Mathf.Sqrt(1 - value * value) - 1) + start; + } + + private float easeOutCirc(float start, float end, float value){ + value--; + end -= start; + return end * Mathf.Sqrt(1 - value * value) + start; + } + + private float easeInOutCirc(float start, float end, float value){ + value /= .5f; + end -= start; + if (value < 1) return -end * 0.5f * (Mathf.Sqrt(1 - value * value) - 1) + start; + value -= 2; + return end * 0.5f * (Mathf.Sqrt(1 - value * value) + 1) + start; + } + + /* GFX47 MOD START */ + private float easeInBounce(float start, float end, float value){ + end -= start; + float d = 1f; + return end - easeOutBounce(0, end, d-value) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float bounce(float start, float end, float value){ + private float easeOutBounce(float start, float end, float value){ + value /= 1f; + end -= start; + if (value < (1 / 2.75f)){ + return end * (7.5625f * value * value) + start; + }else if (value < (2 / 2.75f)){ + value -= (1.5f / 2.75f); + return end * (7.5625f * (value) * value + .75f) + start; + }else if (value < (2.5 / 2.75)){ + value -= (2.25f / 2.75f); + return end * (7.5625f * (value) * value + .9375f) + start; + }else{ + value -= (2.625f / 2.75f); + return end * (7.5625f * (value) * value + .984375f) + start; + } + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + private float easeInOutBounce(float start, float end, float value){ + end -= start; + float d = 1f; + if (value < d* 0.5f) return easeInBounce(0, end, value*2) * 0.5f + start; + else return easeOutBounce(0, end, value*2-d) * 0.5f + end*0.5f + start; + } + /* GFX47 MOD END */ + + private float easeInBack(float start, float end, float value){ + end -= start; + value /= 1; + float s = 1.70158f; + return end * (value) * value * ((s + 1) * value - s) + start; + } + + private float easeOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value = (value) - 1; + return end * ((value) * value * ((s + 1) * value + s) + 1) + start; + } + + private float easeInOutBack(float start, float end, float value){ + float s = 1.70158f; + end -= start; + value /= .5f; + if ((value) < 1){ + s *= (1.525f); + return end * 0.5f * (value * value * (((s) + 1) * value - s)) + start; + } + value -= 2; + s *= (1.525f); + return end * 0.5f * ((value) * value * (((s) + 1) * value + s) + 2) + start; + } + + private float punch(float amplitude, float value){ + float s = 9; + if (value == 0){ + return 0; + } + else if (value == 1){ + return 0; + } + float period = 1 * 0.3f; + s = period / (2 * Mathf.PI) * Mathf.Asin(0); + return (amplitude * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * 1 - s) * (2 * Mathf.PI) / period)); + } + + /* GFX47 MOD START */ + private float easeInElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return -(a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + } + /* GFX47 MOD END */ + + /* GFX47 MOD START */ + //private float elastic(float start, float end, float value){ + private float easeOutElastic(float start, float end, float value){ + /* GFX47 MOD END */ + //Thank you to rafael.marteleto for fixing this as a port over from Pedro's UnityTween + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d) == 1) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p * 0.25f; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + return (a * Mathf.Pow(2, -10 * value) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) + end + start); + } + + /* GFX47 MOD START */ + private float easeInOutElastic(float start, float end, float value){ + end -= start; + + float d = 1f; + float p = d * .3f; + float s = 0; + float a = 0; + + if (value == 0) return start; + + if ((value /= d*0.5f) == 2) return start + end; + + if (a == 0f || a < Mathf.Abs(end)){ + a = end; + s = p / 4; + }else{ + s = p / (2 * Mathf.PI) * Mathf.Asin(end / a); + } + + if (value < 1) return -0.5f * (a * Mathf.Pow(2, 10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p)) + start; + return a * Mathf.Pow(2, -10 * (value-=1)) * Mathf.Sin((value * d - s) * (2 * Mathf.PI) / p) * 0.5f + end + start; + } + /* GFX47 MOD END */ + + #endregion + + #region Deprecated and Renamed + /* + public static void audioFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioFrom() has been renamed to AudioFrom().");} + public static void audioTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: audioTo() has been renamed to AudioTo().");} + public static void colorFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorFrom() has been renamed to ColorFrom().");} + public static void colorTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: colorTo() has been renamed to ColorTo().");} + public static void fadeFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeFrom() has been renamed to FadeFrom().");} + public static void fadeTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: fadeTo() has been renamed to FadeTo().");} + public static void lookFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFrom() has been renamed to LookFrom().");} + public static void lookFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookFromWorld() has been deprecated. Please investigate LookFrom().");} + public static void lookTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookTo() has been renamed to LookTo().");} + public static void lookToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdate() has been renamed to LookUpdate().");} + public static void lookToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: lookToUpdateWorld() has been deprecated. Please investigate LookUpdate().");} + public static void moveAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAdd() has been renamed to MoveAdd().");} + public static void moveAddWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveBy() has been renamed to MoveBy().");} + public static void moveByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveAddWorld() has been deprecated. Please investigate MoveAdd().");} + public static void moveFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFrom() has been renamed to MoveFrom().");} + public static void moveFromWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveFromWorld() has been deprecated. Please investigate MoveFrom().");} + public static void moveTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveTo() has been renamed to MoveTo().");} + public static void moveToBezier(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezier() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToBezierWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToBezierWorld() has been deprecated. Please investigate MoveTo() and the "path" property.");} + public static void moveToUpdate(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdate() has been renamed to MoveUpdate().");} + public static void moveToUpdateWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToUpdateWorld() has been deprecated. Please investigate MoveUpdate().");} + public static void moveToWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: moveToWorld() has been deprecated. Please investigate MoveTo().");} + public static void punchPosition(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchPosition().");} + public static void punchPositionWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPositionWorld() has been deprecated. Please investigate PunchPosition().");} + public static void punchRotation(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchPosition() has been renamed to PunchRotation().");} + public static void punchRotationWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchRotationWorld() has been deprecated. Please investigate PunchRotation().");} + public static void punchScale(GameObject target, Hashtable args){Debug.LogError("iTween Error: punchScale() has been renamed to PunchScale().");} + public static void rotateAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateAdd() has been renamed to RotateAdd().");} + public static void rotateBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateBy() has been renamed to RotateBy().");} + public static void rotateByWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateByWorld() has been deprecated. Please investigate RotateBy().");} + public static void rotateFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateFrom() has been renamed to RotateFrom().");} + public static void rotateTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: rotateTo() has been renamed to RotateTo().");} + public static void scaleAdd(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleAdd() has been renamed to ScaleAdd().");} + public static void scaleBy(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleBy() has been renamed to ScaleBy().");} + public static void scaleFrom(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleFrom() has been renamed to ScaleFrom().");} + public static void scaleTo(GameObject target, Hashtable args){Debug.LogError("iTween Error: scaleTo() has been renamed to ScaleTo().");} + public static void shake(GameObject target, Hashtable args){Debug.LogError("iTween Error: scale() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void shakeWorld(GameObject target, Hashtable args){Debug.LogError("iTween Error: shakeWorld() has been deprecated. Please investigate ShakePosition(), ShakeRotation() and ShakeScale().");} + public static void stab(GameObject target, Hashtable args){Debug.LogError("iTween Error: stab() has been renamed to Stab().");} + public static void stop(GameObject target, Hashtable args){Debug.LogError("iTween Error: stop() has been renamed to Stop().");} + public static void stopType(GameObject target, Hashtable args){Debug.LogError("iTween Error: stopType() has been deprecated. Please investigate Stop().");} + public static void tweenCount(GameObject target, Hashtable args){Debug.LogError("iTween Error: tweenCount() has been deprecated. Please investigate Count().");} + */ + #endregion +} diff --git a/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta b/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta new file mode 100644 index 0000000..591fd5a --- /dev/null +++ b/namedropper/Assets/Plugins/Pixelplacement/iTween/iTween.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 521257714fc9e437a9163df2d37f2ea2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/namedropper/Assets/Resources/categories.yaml b/namedropper/Assets/Resources/categories.yaml index dfdf9d1..a9db1fd 100644 --- a/namedropper/Assets/Resources/categories.yaml +++ b/namedropper/Assets/Resources/categories.yaml @@ -867,7 +867,7 @@ Topics: - Evander Holyfield - Manny Pacquiao - Sugar Ray - - Floyd Mayweather + - Floyd Mayweather - Oscar De La Hoya - George Foreman - Category: Golf diff --git a/namedropper/Assets/ScoreStack.cs b/namedropper/Assets/ScoreStack.cs index d7131a0..ae4332d 100644 --- a/namedropper/Assets/ScoreStack.cs +++ b/namedropper/Assets/ScoreStack.cs @@ -24,7 +24,9 @@ public class ScoreStack : MonoBehaviour public void AddChecker(int amount, bool dark) { GameObject checker = new GameObject("checker"); - checker.transform.parent = this.transform; + checker.transform.parent = this.transform; + checker.transform.localScale = new Vector3(2.5f, 2.5f, 1f); + iTween.ScaleTo(checker, Vector3.one, .4f); checker.transform.localPosition = Vector3.zero; SpriteRenderer sr = checker.AddComponent(); sr.sortingOrder = 4 + _numCheckers; diff --git a/namedropper/Assets/Scripts/GameManager.cs b/namedropper/Assets/Scripts/GameManager.cs index e460ee2..24e8d95 100644 --- a/namedropper/Assets/Scripts/GameManager.cs +++ b/namedropper/Assets/Scripts/GameManager.cs @@ -38,6 +38,8 @@ public class GameManager public void RestartGame() { + GameObject.Destroy(GameObject.Find("/ScoreStackBlue")); + GameObject.Destroy(GameObject.Find("/ScoreStackRed")); Reset(); GameDataManager.Instance.Reset(); SceneManager.LoadScene("Title");