33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using UnityEngine;
|
|
using YachtDice.Modifiers.Core;
|
|
using YachtDice.Modifiers.Definition;
|
|
using YachtDice.Modifiers.Runtime;
|
|
|
|
namespace YachtDice.Modifiers.Effects
|
|
{
|
|
[CreateAssetMenu(fileName = "PostMultiplyEffect", menuName = "YachtDice/Modifiers/Effects/Post Multiply")]
|
|
public class PostMultiplyEffect : Effect
|
|
{
|
|
[SerializeField] private float postMultiplier = 1f;
|
|
|
|
public override UniTask Apply(ModifierContext context, ModifierInstance instance)
|
|
{
|
|
context.PostMultiplier *= Mathf.Pow(postMultiplier, instance.Stacks);
|
|
return UniTask.CompletedTask;
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
public static PostMultiplyEffect CreateForTest(float postMultiplier,
|
|
ModifierPhase phase = ModifierPhase.PostMultiplicative, int priority = 0)
|
|
{
|
|
var so = CreateInstance<PostMultiplyEffect>();
|
|
so.postMultiplier = postMultiplier;
|
|
so.SetPhaseForTest(phase);
|
|
so.SetPriorityForTest(priority);
|
|
return so;
|
|
}
|
|
#endif
|
|
}
|
|
}
|