using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class collectable : MonoBehaviour {
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
float rand = Random.Range (0, 7);
|
|
int randColour = Mathf.FloorToInt (rand);
|
|
|
|
switch (randColour) {
|
|
case 0:
|
|
renderer.material.color = Color.cyan;
|
|
break;
|
|
case 1:
|
|
renderer.material.color = Color.red;
|
|
break;
|
|
case 2:
|
|
renderer.material.color = Color.blue;
|
|
break;
|
|
case 3:
|
|
renderer.material.color = Color.green;
|
|
break;
|
|
case 4:
|
|
renderer.material.color = Color.yellow;
|
|
break;
|
|
case 5:
|
|
renderer.material.color = Color.magenta;
|
|
break;
|
|
default:
|
|
renderer.material.color = Color.black;
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime);
|
|
}
|
|
}
|