diff --git a/.gitignore b/.gitignore index 09c6a29..23df8f6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ _DOTween.Assembly/.git *.Unity*/*.user *.Unity*/*.suo *.Unity*/*.userprefs -*.Unity*/Assets/Demigiant/DOTweenPro* \ No newline at end of file +*.Unity*/Assets/Demigiant/DOTweenPro* +*.Unity*/Assets/TK2D* \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Examples.meta b/UnityTests.Unity5/Assets/_Examples.meta new file mode 100644 index 0000000..27e0c30 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 280bf20ecd575254fba340e4e3856d72 +folderAsset: yes +timeCreated: 1426794518 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs new file mode 100644 index 0000000..1fa9a59 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using System.Collections; + +public class FollowCamTopDown : MonoBehaviour +{ + public Transform player; + public Transform cam; + // Speed of the player + public float speedXSecond = 4; + // Camera offset when moving + public float camOffset = 2; + // Speed when animating camera offset + public float camOffsetSpeed = 2; + // Speed when returning camera to original position (when player is not moving). + // You will want to keep this lower than the camOffsetSpeed to allow for better game feel ;) + public float camResetSpeed = 1; + + Vector3 _moveDirection; + + void Update() + { + _moveDirection = Vector3.zero; + if (Input.GetKey(KeyCode.UpArrow)) _moveDirection.z = 1; + else if (Input.GetKey(KeyCode.DownArrow)) _moveDirection.z = -1; + if (Input.GetKey(KeyCode.RightArrow)) _moveDirection.x = 1; + else if (Input.GetKey(KeyCode.LeftArrow)) _moveDirection.x = -1; + + if (_moveDirection.sqrMagnitude > 0) { + // The player is moving + player.position += _moveDirection * speedXSecond * Time.deltaTime; + // Determine camera's ideal position and lerp there + Vector3 optimalCamPos = _moveDirection * camOffset; + optimalCamPos.y = cam.localPosition.y; + cam.localPosition = Vector3.Slerp(cam.localPosition, optimalCamPos, Time.deltaTime * camOffsetSpeed); + } else { + // Not moving. Just control camera + Vector3 optimalCamPos = Vector3.zero; + optimalCamPos.y = cam.localPosition.y; + cam.localPosition = Vector3.Slerp(cam.localPosition, optimalCamPos, Time.deltaTime * camResetSpeed); + } + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs.meta b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs.meta new file mode 100644 index 0000000..4ec4116 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3b1a189ccc97afa4386658071d4bd1ea +timeCreated: 1426794581 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity new file mode 100644 index 0000000..7e523e0 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity.meta similarity index 63% rename from UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta rename to UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity.meta index 238209b..d998d11 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.pdb.meta +++ b/UnityTests.Unity5/Assets/_Examples/FollowCamTopDown.unity.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: d28015e4a90913243b173a19a95ff801 -timeCreated: 1426173527 +guid: 57daabe2d253e7c409afa534c4c73dca +timeCreated: 1426794575 licenseType: Pro DefaultImporter: userData: diff --git a/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat b/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat new file mode 100644 index 0000000..574c3f7 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat differ diff --git a/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat.meta b/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat.meta new file mode 100644 index 0000000..10a85a4 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples/MAT Blue.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22585a6a62c5cc141839e92eb9b44ca9 +timeCreated: 1426795079 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat b/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat new file mode 100644 index 0000000..37e5788 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat differ diff --git a/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat.meta b/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat.meta new file mode 100644 index 0000000..31d11a8 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples/MAT Ground.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c2489bebda761d42b618e0830bf96ea +timeCreated: 1426795108 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg b/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg new file mode 100644 index 0000000..82a5b85 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg differ diff --git a/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg.meta b/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg.meta new file mode 100644 index 0000000..2483f88 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Examples/TEX Ground.jpg.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 39e84471082f8714b8db74e8541bd2f7 +timeCreated: 1426795305 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 512 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset b/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset index 31c920c..e469ea7 100644 Binary files a/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset and b/UnityTests.Unity5/ProjectSettings/EditorBuildSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset index 40d5f74..5c626c5 100644 Binary files a/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset and b/UnityTests.Unity5/ProjectSettings/ProjectSettings.asset differ diff --git a/UnityTests.Unity5/ProjectSettings/QualitySettings.asset b/UnityTests.Unity5/ProjectSettings/QualitySettings.asset index 7720878..d9e79ac 100644 Binary files a/UnityTests.Unity5/ProjectSettings/QualitySettings.asset and b/UnityTests.Unity5/ProjectSettings/QualitySettings.asset differ