mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 07:08:51 -05:00
48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityAtoms.BaseAtoms;
|
|
using UnityEngine;
|
|
|
|
namespace MAVRIC.GEEKCup
|
|
{
|
|
public class FireWorksController : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject[] winObjects;
|
|
[SerializeField] private BoolVariable winState;
|
|
[SerializeField] private VoidEvent restart;
|
|
|
|
private void OnEnable()
|
|
{
|
|
restart.Register(ToggleOffObjects);
|
|
winState.Changed.Register(TriggerFireworks);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
restart.Unregister(ToggleOffObjects);
|
|
winState.Changed.Unregister(TriggerFireworks);
|
|
}
|
|
|
|
|
|
public void TriggerFireworks()
|
|
{
|
|
if (winState)
|
|
{
|
|
foreach (var obj in winObjects)
|
|
{
|
|
obj.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ToggleOffObjects()
|
|
{
|
|
foreach (var obj in winObjects)
|
|
{
|
|
obj.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|