Made player "move"

This commit is contained in:
2026-01-15 18:49:00 +00:00
parent 18c19c7c14
commit 179a4bcfe0
2 changed files with 151 additions and 1 deletions

View File

@@ -1,14 +1,31 @@
using UnityEngine;
using UnityEngine.Serialization;
namespace InterfaceOff.WorldScene
{
public class PlayerController : MonoBehaviour
{
private static PlayerController Instance;
[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;
transform.position = Vector3.Lerp(a, b, sectionLerp);
}
}
}