35 lines
854 B
C#
35 lines
854 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ChangeLightColourTrigger : MonoBehaviour
|
|
{
|
|
[SerializeField] private ChangeLightColour[] _changeLightColour;
|
|
private bool _HasChanged;
|
|
|
|
private void OnTriggerEnter(Collider col)
|
|
{
|
|
if (col.gameObject.tag == "Player" && !_HasChanged)
|
|
{
|
|
ChangeLightColour();
|
|
_HasChanged = true;
|
|
}
|
|
}
|
|
|
|
public void ChangeLightColour()
|
|
{
|
|
foreach (ChangeLightColour changeLightColour in _changeLightColour)
|
|
{
|
|
changeLightColour.ChangeColour();
|
|
}
|
|
}
|
|
|
|
public void ChangeLightColourBasedOnIndices()
|
|
{
|
|
foreach (ChangeLightColour changeLightColour in _changeLightColour)
|
|
{
|
|
changeLightColour.ChangeColorBasedOnIndices();
|
|
}
|
|
}
|
|
}
|