21 lines
497 B
C#
21 lines
497 B
C#
using UnityEngine;
|
|
|
|
public class NpcIdleFloat : MonoBehaviour
|
|
{
|
|
[Header("Efek Idle Halus NPC")]
|
|
public float amplitude = 0.005f;
|
|
public float speed = 1.2f;
|
|
|
|
private Vector3 startPosition;
|
|
|
|
private void Start()
|
|
{
|
|
startPosition = transform.localPosition;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float yOffset = Mathf.Sin(Time.time * speed) * amplitude;
|
|
transform.localPosition = startPosition + new Vector3(0f, yOffset, 0f);
|
|
}
|
|
} |