Files
ichni_Official/Assets/Scripts/Game/GameElements/GeneralEffects/EnableControlEffect.cs

57 lines
1.7 KiB
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using System;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class EnableControlEffect : EffectBase
{
2026-03-14 03:13:10 -04:00
#region [] Effect Parameters
2025-06-03 02:42:28 -04:00
public GameElement connectedGameElement;
public string connectedVariableName;
public int enableValue;
public bool useExpression;
public string expression;
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Initialization
2025-06-03 02:42:28 -04:00
public EnableControlEffect(GameElement connectedGameElement, string connectedVariableName,
int enableValue, bool useExpression, string expression)
{
this.effectTime = 0;
this.connectedGameElement = connectedGameElement;
this.connectedVariableName = connectedVariableName;
this.enableValue = enableValue;
this.useExpression = useExpression;
this.expression = expression;
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Effect Pattern Overrides
2025-06-03 02:42:28 -04:00
public override void Recover()
{
if (connectedGameElement == null) return;
connectedGameElement.gameObject.SetActive(false);
}
public override void Adjust()
{
if (connectedGameElement == null) return;
if (!useExpression)
{
2026-03-14 03:13:10 -04:00
int value = GameManager.Instance.variablesContainer.GetVariable(connectedVariableName);
2025-06-03 02:42:28 -04:00
connectedGameElement.gameObject.SetActive(value == enableValue);
}
else
{
}
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
}
}