chore: Project Restructuring & Theatre
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unheimlich.Features.Items
|
||||
{
|
||||
public class LevitatingObject : MonoBehaviour
|
||||
{
|
||||
[Header("Levitation Settings")]
|
||||
[SerializeField] private float _levitationHeight = 0.5f;
|
||||
[SerializeField] private float _levitationSpeed = 1f;
|
||||
|
||||
[Header("Rotation Settings")]
|
||||
[SerializeField] private float _rotationSpeed = 30f;
|
||||
[SerializeField] private Vector3 _rotationAxis = Vector3.up;
|
||||
|
||||
private Vector3 _startLocalPosition;
|
||||
private float _timeOffset;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_startLocalPosition = transform.localPosition;
|
||||
_timeOffset = Random.Range(0f, Mathf.PI * 2f);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float yOffset = Mathf.Sin((Time.time + _timeOffset) * _levitationSpeed) * _levitationHeight;
|
||||
transform.localPosition = _startLocalPosition + new Vector3(0f, yOffset, 0f);
|
||||
|
||||
transform.Rotate(_rotationAxis.normalized, _rotationSpeed * Time.deltaTime, Space.World);
|
||||
}
|
||||
|
||||
public void UpdateBasePosition()
|
||||
{
|
||||
_startLocalPosition = transform.localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user