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

46 lines
1.3 KiB
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class SetIntegerEffect : EffectBase
{
2026-03-14 03:13:10 -04:00
#region [] Effect Parameters
2025-06-03 02:42:28 -04:00
public string targetVariableName;
public int targetValue;
public bool isRandom;
public int minValue;
public int maxValue;
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 SetIntegerEffect(string targetVariableName, int targetValue, bool isRandom, int minValue, int maxValue)
{
this.effectTime = 0;
this.targetVariableName = targetVariableName;
this.targetValue = targetValue;
this.isRandom = isRandom;
this.minValue = minValue;
this.maxValue = maxValue;
}
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()
{
2026-03-14 03:13:10 -04:00
GameManager.Instance.variablesContainer.RevertVariable(targetVariableName);
2025-06-03 02:42:28 -04:00
}
public override void Adjust()
{
2026-03-14 03:13:10 -04:00
GameManager.Instance.variablesContainer.SetVariable(targetVariableName, isRandom ? Random.Range(minValue, maxValue + 1) : targetValue);
2025-06-03 02:42:28 -04:00
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
}
}