Made first level IG

This commit is contained in:
2025-04-25 14:46:41 +01:00
parent 06010f27ef
commit f803d0ed83
18 changed files with 6813 additions and 9 deletions

View File

@@ -23,8 +23,8 @@ public partial class PlayerMovement : MonoBehaviour
{ m_State = PlayerState.SLIDING; }
// Checks if the player is in the wall running state
else if (GetNormalOfClosestCollider(out m_WallNormal) && m_WallRunKeyPressed)
{ m_State = PlayerState.WALL_RUNNING; }
// else if (GetNormalOfClosestCollider(out m_WallNormal) && m_WallRunKeyPressed)
// { m_State = PlayerState.WALL_RUNNING; }
// Defaults to ruuning
else { m_State = PlayerState.RUNNING; }

View File

@@ -7,9 +7,11 @@ public partial class PlayerMovement : MonoBehaviour
private void UpdateInput()
{
// Calls get axis raw to ignore any uneeded scaling
m_Input.x = Input.GetAxisRaw("Horizontal");
//m_Input.x = Input.GetAxisRaw("Horizontal");
m_Input.y = Input.GetAxisRaw("Vertical");
m_Input.y = Mathf.Clamp(m_Input.y, 0, Mathf.Infinity);
// Updates key press states
m_JumpKeyPressed = Input.GetKey(m_JumpKey);
m_SlidingKeyPressed = Input.GetKey(m_SlideKey);

View File

@@ -8,8 +8,14 @@ public partial class PlayerMovement : MonoBehaviour
Collider closest = null;
foreach (Collider collision in m_WallCollisions)
{
Vector3 pos = collision.ClosestPoint(transform.position);
{
Vector3 pos = Vector3.zero;
if (collision.GetType() != typeof(MeshCollider))
{
pos = collision.ClosestPoint(transform.position);
}
Vector3 dif = transform.position - pos;
float distance = dif.magnitude;

View File

@@ -59,6 +59,9 @@ public class PortalCamera : MonoBehaviour
float angle = Quaternion.Angle(m_DisplayPortal.transform.parent.rotation, m_CapturePortal.transform.parent.rotation);
Quaternion rotDif = Quaternion.AngleAxis(angle, Vector3.up);
Vector3 newCamDir = rotDif * CameraController.Instance().transform.forward;
transform.parent.eulerAngles = Quaternion.LookRotation(newCamDir, Vector3.up).eulerAngles + m_Rot;
//Vector3 d = new(m_CapturePortal.CamDif(), 0f, 0f);
//Vector3 d = new(0f, 0f, m_CapturePortal.CamDif());
Vector3 d = new(0f, m_CapturePortal.CamDif(), 0f);
transform.parent.eulerAngles = Quaternion.LookRotation(newCamDir, Vector3.up).eulerAngles + m_Rot + d;
}
}

View File

@@ -5,6 +5,7 @@ public class PortalManager : MonoBehaviour
[Header("References")]
[SerializeField] GameObject m_OtherPortal;
[SerializeField] float m_AngleDif;
[SerializeField] float m_CamDif;
[Header("Set References")]
[SerializeField] GameObject m_CameraPrefab;
@@ -24,6 +25,8 @@ public class PortalManager : MonoBehaviour
// Gets the location of the player relative to the portal
public Vector3 PlayerOffset() => m_PlayerPoint.localPosition;
public float CamDif() => m_CamDif;
static bool s_TeleportedThisFrame = false;
// Start is called before the first frame update