30 lines
910 B
C#
30 lines
910 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Sun : MonoBehaviour
|
|
{
|
|
// Assuming 60fps, have to reduce tickspeed of the sun
|
|
int counter = 0;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
counter++;
|
|
if(counter >= 60){
|
|
counter = 0;
|
|
//0.01f/s / 180f = 18000s -> 300m -> 5h ()
|
|
gameObject.transform.eulerAngles = new Vector3(gameObject.transform.eulerAngles.x+0.01f,gameObject.transform.eulerAngles.y,gameObject.transform.eulerAngles.z);
|
|
//Reset rotation to 0
|
|
if(gameObject.transform.eulerAngles.x >= 360){
|
|
gameObject.transform.eulerAngles = new Vector3(0,gameObject.transform.eulerAngles.y,gameObject.transform.eulerAngles.z);
|
|
}
|
|
}
|
|
}
|
|
}
|