Santi
170d11aa4d
ColourSorting: Removed completed tasks from Colours, added Bug comment to pickup script
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
//* General Comments or Finished Tasks
|
|
//TODO Tasks left to be done for game
|
|
//! Bugs or Issues
|
|
//? Questions or Suggestions
|
|
|
|
//TODO As the timer goes down, the containers have a chance to switch renders/colours
|
|
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
|
|
|
public class Colours : MonoBehaviour
|
|
{
|
|
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
|
|
void Start()
|
|
{
|
|
//* Instantiate 8 containers with random colours at the start of the game
|
|
for (int i = 0; i < containers.Length; i++)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|