Realised we don't actually need portals

This commit is contained in:
2026-01-15 21:02:52 +00:00
parent 179a4bcfe0
commit 5700109318
11 changed files with 1090 additions and 1632 deletions

View File

@@ -1,5 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using UnityEngine;
namespace InterfaceOff.WorldScene
{
@@ -7,24 +7,20 @@ namespace InterfaceOff.WorldScene
{
private static PlayerController Instance;
[field: SerializeField] private float PlayerSpeed { get; set; }
[field: SerializeField] private Transform[] LerpPositions;
private float LerpValue;
public static void SetPos(Vector3 pos)
{
Instance.transform.position = pos;
}
private void Update()
{
LerpValue = (LerpValue + Time.deltaTime) % 3f;
int section = Mathf.FloorToInt(LerpValue);
float sectionLerp = LerpValue % 1f;
Vector3 a = LerpPositions[section + 0].position;
Vector3 b = LerpPositions[section + 1].position;
LerpValue += PlayerSpeed / Vector3.Distance(a, b) * Time.deltaTime;
LerpValue %= LerpPositions.Length - 1; // Makes lerp value wrap around
float sectionLerp = Math.Clamp(LerpValue, section, section + 1) - section;
transform.position = Vector3.Lerp(a, b, sectionLerp);
}
}