diff --git a/Assets/Plugins/IngameDebugConsole.meta b/Assets/Plugins/IngameDebugConsole.meta deleted file mode 100644 index 36375af..0000000 --- a/Assets/Plugins/IngameDebugConsole.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5f8eae876be4b03438375a82d2c69b4d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index ca5ff5d..638b84e 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -7,7 +7,7 @@ using Networking.Server; public class Character : MonoBehaviour { - public enum Animation {Walk,Jump,Slide} + public enum Animation {Walk,Run,Jump,Slide} public string nextScene; Animator characterAnimator; @@ -106,7 +106,60 @@ public class Character : MonoBehaviour return new Vector3(0, y, 0); } - public IEnumerator MoveToBlock(Block Target, Animation animation, float time) + public IEnumerator MoveToBlock(Block target, Animation animation, float time) + { + + switch (animation) + { + case Animation.Walk: + characterAnimator.SetBool("isWalking", true); + break; + case Animation.Run: + characterAnimator.SetBool("isRunning", true); + break; + case Animation.Jump: + characterAnimator.SetTrigger("Jump"); + break; + default: + break; + } + + + + + + yield return null; + + } + + public IEnumerator LerpToBlock(Block target,float time, System.Func heightOffset) + { + + Vector3 _startPos = transform.position; + Vector3 _endPos = target.VisualPosition; + + Vector3 _newPos; + + float elapsedTime = 0; + while(elapsedTime/time < 1) + { + + _newPos = Vector3.Lerp(_startPos, _endPos, (elapsedTime / time)); + _newPos.y += heightOffset(elapsedTime / time); + + transform.position = _newPos; + + yield return new WaitForEndOfFrame(); + + elapsedTime += Time.deltaTime; + } + + _newPos = _endPos; + _newPos.y += heightOffset(elapsedTime / time); + + transform.position = _newPos; + } + IEnumerator JumpCoroutine(Block Target, Transform Current, float time, float heightMax) { diff --git a/Assets/Scripts/Components.meta b/Assets/Scripts/Components.meta deleted file mode 100644 index 5a95b09..0000000 --- a/Assets/Scripts/Components.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8d7394d70ec233849a60a26da5f23b75 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: