Global Game Jam 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
775 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformMover : MonoBehaviour
{
[SerializeField] private Transform m_StartPos;
[SerializeField] private Transform m_EndPos;
[SerializeField] private float m_Duration = 2f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = Vector2.Lerp(m_StartPos.position, m_EndPos.position, Mathf.PingPong(Time.deltaTime * m_Duration, 1.0f));
}
#if UNITY_EDITOR
private void OnDrawGizmos()
{
Gizmos.color = Color.green;
Gizmos.DrawLine(m_StartPos.position, m_EndPos.position);
}
#endif
}