Created
December 8, 2019 11:42
-
-
Save Happsson/7613db137057fbe1debfe1f0c7b06a4c to your computer and use it in GitHub Desktop.
part of day 6 of AoC 2019 in unity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereRotate : MonoBehaviour | |
{ | |
float speed = 5; | |
Vector3 euls; | |
// Update is called once per frame | |
private void Start() | |
{ | |
euls = transform.localEulerAngles; | |
speed = 0.5f; | |
} | |
public void SetColor(Color c) | |
{ | |
GetComponent<Renderer>().material.color = c; | |
GetComponent<TrailRenderer>().startColor = c; | |
GetComponent<TrailRenderer>().startWidth = 1f; | |
} | |
void Update() | |
{ | |
euls.z += Time.deltaTime * speed; | |
transform.localEulerAngles = euls; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment