Files
pgs/Assets/ProCamera2D/Examples/TopDownShooter/Scripts/ObjectMove.cs

23 lines
574 B
C#
Raw Normal View History

2026-02-21 16:58:22 -08:00
using UnityEngine;
using System.Collections;
namespace Com.LuisPedroFonseca.ProCamera2D.TopDownShooter
{
public class ObjectMove : MonoBehaviour
{
public float Amplitude = 1;
public float Frequency = 1;
Transform _transform;
void Awake()
{
_transform = transform;
}
void LateUpdate()
{
_transform.position += Amplitude * (Mathf.Sin(2 * Mathf.PI * Frequency * Time.time) - Mathf.Sin(2 * Mathf.PI * Frequency * (Time.time - Time.deltaTime))) * Vector3.up;
}
}
}