lucid-super-dream/Assets/Scripts/SlideSideways.cs

24 lines
540 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class SlideSideways : MonoBehaviour
{
[SerializeField] private Vector2 _speedRange;
private float _speed;
private void Start()
{
var r = new Unity.Mathematics.Random((uint)(Time.time*1000f));
_speed = r.NextFloat(_speedRange.x, _speedRange.y);
}
private void LateUpdate()
{
transform.Translate(Vector3.right * _speed * Time.deltaTime);
}
}