diff --git a/Assets/Player/Player.prefab b/Assets/Player/Player.prefab index bc08a48..fa7f9b0 100644 --- a/Assets/Player/Player.prefab +++ b/Assets/Player/Player.prefab @@ -1038,9 +1038,9 @@ CharacterController: serializedVersion: 2 m_Height: 3 m_Radius: 1 - m_SlopeLimit: 75.01 - m_StepOffset: 1.5 - m_SkinWidth: 0.08 + m_SlopeLimit: 75 + m_StepOffset: 1 + m_SkinWidth: 0.1 m_MinMoveDistance: 0 m_Center: {x: 0, y: 0, z: 0} --- !u!95 &8519787470769432157 diff --git a/Assets/Scenes/Mountain.unity b/Assets/Scenes/Mountain.unity index 350db66..4b6b7c9 100644 --- a/Assets/Scenes/Mountain.unity +++ b/Assets/Scenes/Mountain.unity @@ -3322,7 +3322,7 @@ MeshRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1620235925} - m_Enabled: 1 + m_Enabled: 0 m_CastShadows: 1 m_ReceiveShadows: 1 m_DynamicOccludee: 1 diff --git a/Assets/Scenes/Temple.unity b/Assets/Scenes/Temple.unity index e6ae26d..d1c0da7 100644 --- a/Assets/Scenes/Temple.unity +++ b/Assets/Scenes/Temple.unity @@ -579,9 +579,9 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 211154251} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 + m_LocalPosition: {x: 95.537, y: 6.483, z: 11.919} + m_LocalScale: {x: 0.4818, y: 0.4818, z: 0.4818} + m_ConstrainProportionsScale: 1 m_Children: - {fileID: 347813199} - {fileID: 1529204643} @@ -1884,9 +1884,9 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 547273015} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 + m_LocalPosition: {x: 95.537, y: 6.483, z: 11.919} + m_LocalScale: {x: 0.4818, y: 0.4818, z: 0.4818} + m_ConstrainProportionsScale: 1 m_Children: - {fileID: 545401561} - {fileID: 555652473} @@ -3299,8 +3299,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 887465837} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 198, y: 12.510616, z: 23} - m_LocalScale: {x: 347.2, y: 347.2, z: 347.2} + m_LocalPosition: {x: 190.93, y: 12.511, z: 23} + m_LocalScale: {x: 167.28096, y: 167.28096, z: 167.28096} m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 2100809275} @@ -3979,17 +3979,29 @@ PrefabInstance: propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} + propertyPath: m_LocalScale.x + value: 0.4818 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} + propertyPath: m_LocalScale.y + value: 0.4818 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} + propertyPath: m_LocalScale.z + value: 0.4818 + objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: 95.537 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} propertyPath: m_LocalPosition.y - value: 0 + value: 6.483 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} propertyPath: m_LocalPosition.z - value: 0 + value: 11.919 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} propertyPath: m_LocalRotation.w @@ -4019,6 +4031,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} - target: {fileID: -1853094968961178454, guid: 0e34d8d9e7b9fd646b2bfb477f56d3af, type: 3} propertyPath: m_ClearFlags value: 3 @@ -5310,6 +5326,18 @@ PrefabInstance: propertyPath: m_Enabled value: 1 objectReference: {fileID: 0} + - target: {fileID: -7493596028755563170, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.x + value: -80.4 + objectReference: {fileID: 0} + - target: {fileID: -7493596028755563170, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.y + value: 14.4 + objectReference: {fileID: 0} + - target: {fileID: -7493596028755563170, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.z + value: 38.6 + objectReference: {fileID: 0} - target: {fileID: -1853094968961178454, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} propertyPath: m_Enabled value: 1 @@ -5326,6 +5354,18 @@ PrefabInstance: propertyPath: m_Enabled value: 1 objectReference: {fileID: 0} + - target: {fileID: 53111293769073355, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.x + value: 30.31 + objectReference: {fileID: 0} + - target: {fileID: 53111293769073355, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.y + value: 14.16 + objectReference: {fileID: 0} + - target: {fileID: 53111293769073355, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} + propertyPath: m_LocalPosition.z + value: -4.27 + objectReference: {fileID: 0} - target: {fileID: 65702495048144492, guid: 325339469f6b77d4a8f54684fbc34abc, type: 3} propertyPath: m_IsActive value: 1 diff --git a/Assets/Scripts/Input/CharacterInputController.cs b/Assets/Scripts/Input/CharacterInputController.cs index c16e6bb..da2d4fa 100644 --- a/Assets/Scripts/Input/CharacterInputController.cs +++ b/Assets/Scripts/Input/CharacterInputController.cs @@ -1,5 +1,4 @@ -using Scampz.GameJam.Assets.Scripts.Player; -using UnityEngine; +using UnityEngine; namespace Scampz.GameJam.Assets.Scripts { @@ -8,29 +7,60 @@ namespace Scampz.GameJam.Assets.Scripts private CharacterController _controller; public float Speed = 10f; public float RotateSpeed = 720.0f; - private PlayerState _playerState; + private float _ySpeed = 0f; private void Start() { _controller = GetComponent(); - _playerState = GetComponent(); } void Update() { - //Physics.Raycast(transform.position, -transform.up, out var hit, 10f); - //var slope = hit.normal.y; - var direction = new Vector3(Input.GetAxisRaw(InputOptions.Horizontal), 0, Input.GetAxisRaw(InputOptions.Vertical)).normalized; + Move(); + } - if (_playerState.CanMove) - _controller.SimpleMove(-direction * Speed); + void Move() + { + var horizontalMovement = Input.GetAxisRaw(InputOptions.Horizontal); + var verticalMovement = Input.GetAxisRaw(InputOptions.Vertical); - if (direction != Vector3.zero) + var movementDirection = new Vector3(-horizontalMovement, 0, -verticalMovement); + var magnitude = Mathf.Clamp01(movementDirection.magnitude) * Speed; + movementDirection.Normalize(); + _ySpeed += Physics.gravity.y * Time.deltaTime; + + if (_controller.isGrounded) + _ySpeed -= 0.5f; + + var velocity = movementDirection * magnitude; + velocity = AdjustVelocityToSlope(velocity); + velocity.y += _ySpeed; + + _controller.Move(velocity * Time.deltaTime); + + if (movementDirection != Vector3.zero) { - var toRotation = Quaternion.LookRotation(-direction, Vector3.up); - - transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, RotateSpeed); + var ray = new Ray(transform.position, Vector3.down); + Physics.Raycast(ray, out var hitInfo, 5f); + var toRotation = Quaternion.LookRotation(movementDirection, Vector3.up); + toRotation.x = Quaternion.LookRotation(Vector3.Cross(transform.right, hitInfo.normal)).x; + transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, RotateSpeed * Time.deltaTime); } } + + private Vector3 AdjustVelocityToSlope(Vector3 velocity) + { + var ray = new Ray(transform.position, Vector3.down); + + if (Physics.Raycast(ray, out var hitInfo, 5f)) + { + var slopeRotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal); + var adjustedVelocity = slopeRotation * velocity; + if (adjustedVelocity.y < 0) + return adjustedVelocity; + } + + return velocity; + } } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 8404503..9fb0cfb 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -269,7 +269,104 @@ PlayerSettings: AndroidValidateAppBundleSize: 1 AndroidAppBundleSizeToValidate: 150 m_BuildTargetIcons: [] - m_BuildTargetPlatformIcons: [] + m_BuildTargetPlatformIcons: + - m_BuildTarget: iPhone + m_Icons: + - m_Textures: [] + m_Width: 180 + m_Height: 180 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 167 + m_Height: 167 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 152 + m_Height: 152 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 76 + m_Height: 76 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 87 + m_Height: 87 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 60 + m_Height: 60 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 20 + m_Height: 20 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 1024 + m_Height: 1024 + m_Kind: 4 + m_SubKind: App Store m_BuildTargetBatching: - m_BuildTarget: Standalone m_StaticBatching: 1