Add CollectCoins
This commit is contained in:
1 parent
15fe1e4ce1
commit
d8731c1c23
91 files changed
+241
-38
No files matched your search
@@ -5,13 +5,24 @@ public class CoinScript : MonoBehaviour {
|
||||
|
||||
public float rotationSpeed = 100.0f;
|
||||
GameObject player;
|
||||
public float rotationCenterSpeed = 50f;
|
||||
public Vector3 centerPosition;
|
||||
private Color startColor;
|
||||
public float colorChangeSpeed = 0.1f;
|
||||
|
||||
void Start () {
|
||||
player = GameObject.Find("First Person Controller");
|
||||
startColor = renderer.material.color;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
transform.Rotate(0, 0, rotationSpeed * Time.deltaTime);
|
||||
|
||||
transform.RotateAround(centerPosition, Vector3.up, Time.deltaTime * rotationCenterSpeed);
|
||||
|
||||
float change = Mathf.PingPong(colorChangeSpeed * Time.time, 1f);
|
||||
Color newColor = Color.Lerp(startColor, Color.red, change);
|
||||
renderer.material.color = newColor;
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
|
||||
Reference in new issue
Block a user