Hello,
So I have eight lights, what I’m trying to do is have two of them already lit as the game starts.
When one is touched, it and the 2 beside it start to flicker and then switch to the opposite of what they were.
The lights will be placed in a circle/square formation.
I have two scripts right now, one attached to the cylinders that I have over the spot light assets I have which switches colours and the other as the light manager(game manager).
What I’m not sure how to do is making when one is touched, it and the 2 beside it start ti flicker and then switch to the opposite of what they were.
public class LightScript : MonoBehaviour
{
public int LightIndex;
[SerializeField] private LightController lightCon;
[SerializeField] private Color defaultColour;
[SerializeField] private Color highlightColour;
[SerializeField] private float resetDelay = 3f;
// Start is called before the first frame update
void Start()
{
ResetButton();
}
private void OnMouseDown()
{
Debug.Log("Mouse Clicked");
PressButton();
}
public void PressButton()
{
GetComponent<MeshRenderer>().material.color = highlightColour;
Invoke("ResetButton", resetDelay);
}
void ResetButton()
{
GetComponent<MeshRenderer>().material.color = defaultColour;
}
}