You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using UnityEngine;
|
|
using D2D.Core;
|
|
using D2D.Utilities;
|
|
|
|
namespace D2D
|
|
{
|
|
public class SetActivityOnGameState : GameStateMachineUser
|
|
{
|
|
[SerializeField] private bool _toggleToActive = true;
|
|
[SerializeField] private float _delay;
|
|
|
|
public GameObject[] _onRunning;
|
|
public GameObject[] _onWin;
|
|
public GameObject[] _onLose;
|
|
public GameObject[] _onGameFinish;
|
|
public GameObject[] _onReviveOption;
|
|
|
|
protected override void OnGameRun() => Show(_onRunning);
|
|
|
|
protected override void OnGameFinish() => Show(_onGameFinish);
|
|
|
|
protected override void OnGameLose() => Show(_onLose);
|
|
|
|
protected override void OnGameWin() => Show(_onWin);
|
|
protected override void OnRevivalState() => Show(_onReviveOption);
|
|
|
|
private void Show(GameObject[] parent)
|
|
{
|
|
Debug.Log("CheckAli");
|
|
if (parent.IsNullOrEmpty())
|
|
return;
|
|
|
|
foreach (GameObject o in parent)
|
|
{
|
|
float delay = _delay;
|
|
|
|
if (o == null)
|
|
continue;
|
|
|
|
var window = o.GetComponent<Window>();
|
|
|
|
if (window != null)
|
|
delay = window.OpenDelay;
|
|
|
|
if (_toggleToActive)
|
|
o.On(delay);
|
|
else
|
|
o.Off(delay);
|
|
}
|
|
}
|
|
}
|
|
} |