F3DNebula.cs 616 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using System.Collections;
  3. public class F3DNebula : MonoBehaviour {
  4. // Use this for initialization
  5. void Start () {
  6. }
  7. // Update is called once per frame
  8. void Update () {
  9. transform.position -= Vector3.forward * Time.deltaTime * 1000;
  10. if (transform.position.z < -2150)
  11. {
  12. Vector3 newPos = transform.position;
  13. newPos.z = 2150;
  14. transform.position = newPos;
  15. transform.rotation = Random.rotation;
  16. transform.localScale = new Vector3(1, 1, 1) * Random.Range(200, 800);
  17. }
  18. }
  19. }