make Attribute a struct again
This commit is contained in:
parent
d8d3a69c36
commit
3b1b4a90b7
@ -1,10 +1,14 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Attribute : ScriptableObject
|
[Serializable]
|
||||||
|
public struct Attribute
|
||||||
{
|
{
|
||||||
public long Base { get; set; }
|
public long Base;
|
||||||
|
|
||||||
|
public Attribute(long stat) { Base = stat; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculates the stat value with accumulated buff and debuff modifiers.
|
/// Calculates the stat value with accumulated buff and debuff modifiers.
|
||||||
|
@ -17,8 +17,7 @@ public class AttributeTest
|
|||||||
[TestCase(1000000, 0, -20000, 0, ExpectedResult = 0)]
|
[TestCase(1000000, 0, -20000, 0, ExpectedResult = 0)]
|
||||||
public long Value(long startStat, long baseBonus, long permyriadBonus, long flatBonus)
|
public long Value(long startStat, long baseBonus, long permyriadBonus, long flatBonus)
|
||||||
{
|
{
|
||||||
var attr = ScriptableObject.CreateInstance<Attribute>();
|
var attr = new Attribute(startStat);
|
||||||
attr.Base = startStat;
|
|
||||||
var effect = EffectSO.New(baseBonus, permyriadBonus, flatBonus);
|
var effect = EffectSO.New(baseBonus, permyriadBonus, flatBonus);
|
||||||
return attr.Calc(effect);
|
return attr.Calc(effect);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user