1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-04 14:24:55 +08:00

Ignoring 2D Toolkit library

This commit is contained in:
Daniele Giardini 2015-03-20 18:39:44 +01:00
parent 486bfbfefc
commit 36cffc480e
15 changed files with 138 additions and 3 deletions

3
.gitignore vendored
View File

@ -15,4 +15,5 @@ _DOTween.Assembly/.git
*.Unity*/*.user
*.Unity*/*.suo
*.Unity*/*.userprefs
*.Unity*/Assets/Demigiant/DOTweenPro*
*.Unity*/Assets/Demigiant/DOTweenPro*
*.Unity*/Assets/TK2D*

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 280bf20ecd575254fba340e4e3856d72
folderAsset: yes
timeCreated: 1426794518
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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);
}
}
}

View File

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

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: d28015e4a90913243b173a19a95ff801
timeCreated: 1426173527
guid: 57daabe2d253e7c409afa534c4c73dca
timeCreated: 1426794575
licenseType: Pro
DefaultImporter:
userData:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 22585a6a62c5cc141839e92eb9b44ca9
timeCreated: 1426795079
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3c2489bebda761d42b618e0830bf96ea
timeCreated: 1426795108
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@ -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: