PixelSphinx/Assets/Background.cs
2016-04-08 20:59:15 -04:00

26 lines
673 B
C#

using UnityEngine;
using System.Collections;
public class Background : MonoBehaviour {
public float rotationSpeed = 1.0f;
public float rotationDirection = 1.0f;
public bool RandomRotationSpeed = true;
// Use this for initialization
public void Start () {
if (RandomRotationSpeed)
rotationSpeed = 10 * UnityEngine.Random.Range(0.25f, 1f);
rotationDirection = (Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f)) * 2 - 1);
}
// Update is called once per frame
public void FixedUpdate () {
this.transform.Rotate(new Vector3(0, 0, 1.0f), rotationDirection * rotationSpeed * Time.deltaTime);
}
}