diff --git a/Assets/Scenes/TuteLevelFive.unity b/Assets/Scenes/TuteLevelFive.unity index ec542c5..62cec62 100644 --- a/Assets/Scenes/TuteLevelFive.unity +++ b/Assets/Scenes/TuteLevelFive.unity @@ -840,7 +840,7 @@ PrefabInstance: - target: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} @@ -990,12 +990,12 @@ PrefabInstance: - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0.00012783865 + value: -0.000061035156 objectReference: {fileID: 0} - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: -101.69998 objectReference: {fileID: 0} - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} @@ -1081,7 +1081,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &204689276 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4086,7 +4086,7 @@ PrefabInstance: - target: {fileID: 7103365430685043221, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} @@ -5990,7 +5990,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!65 &1691679947 BoxCollider: m_ObjectHideFlags: 0 @@ -6348,7 +6348,7 @@ PrefabInstance: - target: {fileID: 6379596649083080720, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 263d003..1ee532f 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -52,7 +52,7 @@ public class Character : MonoBehaviour } - IEnumerator MoveCoroutine(Block Target, Transform Current, float time) + IEnumerator MoveCoroutine(Block Target, Transform Current, float time, float heightMax) { float elapsedTime = 0; Vector3 startPosition = Current.position; @@ -60,14 +60,14 @@ public class Character : MonoBehaviour while (elapsedTime < time) { transform.position = Vector3.Lerp(startPosition, Target.VisualPosition, (elapsedTime / time)); - transform.position += yValue((elapsedTime / time), 0.3f); + transform.position += yValue((elapsedTime / time), heightMax); yield return new WaitForEndOfFrame(); elapsedTime += Time.deltaTime; } transform.position = Target.VisualPosition; } - IEnumerator rotateCoroutine(Direction direction, Transform Current, float time) + IEnumerator rotateCoroutine(Direction direction, Transform Current, float time, float heightMax) { float elapsedTime = 0; time *= 0.8f; @@ -77,7 +77,7 @@ public class Character : MonoBehaviour while (elapsedTime < time) { transform.forward = Vector3.Slerp(startDirection, endDirection, (elapsedTime / time)); - transform.position = startPosition +yValue((elapsedTime / time), 0.15f); + transform.position = startPosition +yValue((elapsedTime / time), heightMax); yield return new WaitForEndOfFrame(); elapsedTime += Time.deltaTime; } @@ -111,7 +111,7 @@ public class Character : MonoBehaviour //set current block && move CurrentBlock = moveTo; - StartCoroutine(MoveCoroutine(CurrentBlock, transform, speed)); + StartCoroutine(MoveCoroutine(CurrentBlock, transform, speed, 0.3f)); //transform.position = CurrentBlock.VisualPosition; } @@ -141,7 +141,7 @@ public class Character : MonoBehaviour /// Local direction to point public void Rotate(Direction direction, float speed) { - StartCoroutine(rotateCoroutine(direction, transform, speed)); + StartCoroutine(rotateCoroutine(direction, transform, speed, 0.15f)); //transform.forward = direction.ToVector(transform); } @@ -149,13 +149,13 @@ public class Character : MonoBehaviour /// Jumps in specefied direction, picks between Long Jump and Jumping up /// /// Direction to Jump - public void Jump(Direction direction) + public void Jump(Direction direction, float speed) { //if there is a block infront JumpUp else LongJump if (Block.isBlockAtPosition(CurrentBlock.position + direction.ToVector(transform) + Vector3.up, 1, ~Ignore)) - JumpUp(direction); + JumpUp(direction, speed); else - JumpLong(direction); + JumpLong(direction, speed); } #endregion Class Implementation @@ -167,7 +167,7 @@ public class Character : MonoBehaviour /// /// Direction of obstacle /// max height - private void JumpUp(Direction direction, int height = 1) + private void JumpUp(Direction direction, float speed, int height = 1) { //setting up variables Vector3 position; // position wanted @@ -187,7 +187,8 @@ public class Character : MonoBehaviour //set current block && move CurrentBlock = moveTo; - transform.position = CurrentBlock.VisualPosition; + StartCoroutine(MoveCoroutine(CurrentBlock, transform, speed, 0.5f)); + //transform.position = CurrentBlock.VisualPosition; } /// @@ -195,7 +196,7 @@ public class Character : MonoBehaviour /// /// Direction to Jump /// Max distance - private void JumpLong(Direction direction, int Distance = 2) + private void JumpLong(Direction direction, float speed, int Distance = 2) { //setting up variables Vector3 position; // position wanted @@ -224,7 +225,8 @@ public class Character : MonoBehaviour //Set Current Block and move CurrentBlock = moveTo; - transform.position = CurrentBlock.VisualPosition; + StartCoroutine(MoveCoroutine(CurrentBlock, transform, speed, 0.5f)); + //transform.position = CurrentBlock.VisualPosition; } #endregion Private Functions diff --git a/Assets/Scripts/KeyboardInput.cs b/Assets/Scripts/KeyboardInput.cs index 54246bd..607e951 100644 --- a/Assets/Scripts/KeyboardInput.cs +++ b/Assets/Scripts/KeyboardInput.cs @@ -37,7 +37,7 @@ public class KeyboardInput : MonoBehaviour } if (Input.GetKeyDown(KeyCode.Space)) { - character.Jump(Direction.Forward); + character.Jump(Direction.Forward, characterSpeed); } } diff --git a/Assets/Scripts/Logic/Blocks/Jump.cs b/Assets/Scripts/Logic/Blocks/Jump.cs index 7fd5a89..25edc93 100644 --- a/Assets/Scripts/Logic/Blocks/Jump.cs +++ b/Assets/Scripts/Logic/Blocks/Jump.cs @@ -21,7 +21,7 @@ public class Jump : LogicBlock /// Player to move protected override void BlockLogic(Character player, float animationTime) { - player.Jump(direction); + player.Jump(direction, animationTime); } #endregion Class Functions