30 lines
645 B
C#
30 lines
645 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using Unity.VisualScripting;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class Colours : MonoBehaviour
|
||
|
{
|
||
|
public bool done = false;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
private void OnTriggerEnter(Collider other)
|
||
|
{
|
||
|
if(other.gameObject.GetComponent<Renderer>().material.name == gameObject.GetComponentInParent<Renderer>().material.name && !done)
|
||
|
{
|
||
|
Debug.Log("YUM! Red is my favourite colour!");
|
||
|
done = true;
|
||
|
}
|
||
|
}
|
||
|
}
|