Added functionality for the gun

This commit is contained in:
2026-01-19 10:44:15 +00:00
parent b00a72e75e
commit a9dfc40efb
5 changed files with 559 additions and 75 deletions

View File

@@ -7,7 +7,14 @@ namespace InterfaceOff.WorldScene
{
private static PlayerController Instance;
private PlayerFrameInfo[] Frames;
private int FrameIndex = 0;
[Header("Bullet Tracer Info")]
[SerializeField] private LineRenderer BulletTracerRenderer;
[SerializeField] private Transform BulletTracerStart;
[SerializeField] private Transform BulletTracerEnd;
[Header("Dev View")]
[SerializeField] private int FrameIndex;
private float LerpValue;
@@ -24,6 +31,7 @@ namespace InterfaceOff.WorldScene
private void Update()
{
/* Updates the position according to the lerp */
LerpValue = (LerpValue + Time.deltaTime * 20f) % 1f;
PlayerFrameInfo frameA = Frames[FrameIndex + 0];
@@ -33,6 +41,13 @@ namespace InterfaceOff.WorldScene
Vector2 rotation = Vector2.Lerp(frameA.Rotation, frameB.Rotation, LerpValue);
transform.rotation = Quaternion.Euler(rotation.x, rotation.y, 0);
/* Updates the gun state */
BulletTracerRenderer.positionCount = 2;
BulletTracerRenderer.SetPosition(index: 0, BulletTracerStart.position);
BulletTracerRenderer.SetPosition(index: 1, BulletTracerEnd.position);
//BulletTracerRenderer.enabled = Frames[FrameIndex].ShootGun;
}
}
}