75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Ichni.RhythmGame.Beatmap;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Ichni.RhythmGame
|
||
|
|
{
|
||
|
|
public class SetIntegerEffect : EffectBase
|
||
|
|
{
|
||
|
|
public string targetVariableName;
|
||
|
|
|
||
|
|
public int targetValue;
|
||
|
|
|
||
|
|
public bool isRandom;
|
||
|
|
public int minValue;
|
||
|
|
public int maxValue;
|
||
|
|
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Recover()
|
||
|
|
{
|
||
|
|
GameManager.instance.variablesContainer.RevertVariable(targetVariableName);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Adjust()
|
||
|
|
{
|
||
|
|
GameManager.instance.variablesContainer.SetVariable(targetVariableName, isRandom ? Random.Range(minValue, maxValue + 1) : targetValue);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override EffectBase_BM ConvertToBM()
|
||
|
|
{
|
||
|
|
return new SetIntegerEffect_BM(targetVariableName, targetValue, isRandom, minValue, maxValue);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
namespace Beatmap
|
||
|
|
{
|
||
|
|
public class SetIntegerEffect_BM : EffectBase_BM
|
||
|
|
{
|
||
|
|
public string targetVariableName;
|
||
|
|
public int targetValue;
|
||
|
|
public bool isRandom;
|
||
|
|
public int minValue;
|
||
|
|
public int maxValue;
|
||
|
|
|
||
|
|
public SetIntegerEffect_BM()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public SetIntegerEffect_BM(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;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||
|
|
{
|
||
|
|
return new SetIntegerEffect(targetVariableName, targetValue, isRandom, minValue, maxValue);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|