26 lines
636 B
C#
26 lines
636 B
C#
using System;
|
|
using UnityEngine;
|
|
using Random = UnityEngine.Random;
|
|
|
|
public class RotateMovement : MonoBehaviour
|
|
{
|
|
public float rotateSpeed;
|
|
|
|
public Vector2 randomOffsetRange;
|
|
public Vector2 randomSpeedRange;
|
|
|
|
private float randomSpeed;
|
|
// Update is called once per frame
|
|
|
|
private void Start(){
|
|
randomSpeed = Random.Range(randomSpeedRange.x, randomSpeedRange.y);
|
|
|
|
transform.Rotate(Vector3.forward * Random.Range(randomOffsetRange.x, randomOffsetRange.y));
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
transform.Rotate(Vector3.forward * ((rotateSpeed + randomSpeed )* Time.deltaTime) );
|
|
}
|
|
}
|