2024-04-30 19:45:02 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2024-06-13 01:52:43 +01:00
|
|
|
using System.Linq;
|
2024-06-07 14:37:52 +01:00
|
|
|
using System.Runtime.Serialization;
|
2024-04-30 19:45:02 +01:00
|
|
|
using Unity.VisualScripting;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2024-06-13 01:52:43 +01:00
|
|
|
//* General Comments or Finished Tasks
|
|
|
|
//TODO Tasks left to be done for game
|
|
|
|
//! Bugs or Issues
|
|
|
|
//? Questions or Suggestions
|
|
|
|
|
2024-06-07 14:37:52 +01:00
|
|
|
//TODO As the timer goes down, the containers have a chance to switch renders/colours
|
2024-06-13 01:52:43 +01:00
|
|
|
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
|
|
|
|
2024-04-30 19:45:02 +01:00
|
|
|
public class Colours : MonoBehaviour
|
|
|
|
{
|
2024-06-13 01:52:43 +01:00
|
|
|
public GameObject Box;
|
|
|
|
public GameObject[] containers;
|
|
|
|
public List<Material> materials = new List<Material>();
|
|
|
|
private GameObject currentBox;
|
|
|
|
private int num;
|
|
|
|
//* Start is called before the first frame update
|
2024-04-30 19:45:02 +01:00
|
|
|
void Start()
|
|
|
|
{
|
2024-06-13 01:52:43 +01:00
|
|
|
//* Instantiate 8 containers with random colours at the start of the game
|
|
|
|
for (int i = 0; i < containers.Length; i++)
|
2024-06-07 14:37:52 +01:00
|
|
|
{
|
2024-06-13 01:52:43 +01:00
|
|
|
currentBox = Instantiate(Box, new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10)), Quaternion.identity);
|
|
|
|
num = Random.Range(0, materials.Count);
|
|
|
|
currentBox.GetComponent<Renderer>().material = materials[num];
|
|
|
|
containers[i].GetComponent<Renderer>().material = materials[num];
|
|
|
|
materials.RemoveAt(num);
|
2024-06-07 14:37:52 +01:00
|
|
|
}
|
|
|
|
}
|
2024-04-30 19:45:02 +01:00
|
|
|
}
|