Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Planet : MonoBehaviour {
- public Transform sun;
- public float speed;
- public void Init(Transform _sun)
- {
- sun = _sun;
- if (Random.Range(1, 10) >= 5)
- {
- speed = Random.Range(-30, -0.000001f);
- }
- else
- {
- speed = Random.Range(30, 0.000001f);
- }
- transform.GetComponent<Renderer>().material.color = new Color((int)Random.Range(0, 255), (int)Random.Range(0, 255), (int)Random.Range(0, 255));
- }
- // Update is called once per frame
- void Update () {
- transform.RotateAround(sun.position, Vector3.up, speed * Time.deltaTime);
- }
- }
Add Comment
Please, Sign In to add comment