Rework constructors to remove the Create pattern.

This commit is contained in:
2020-08-08 13:57:54 +02:00
parent 1b025ea3cf
commit e0f4a38309
22 changed files with 148 additions and 147 deletions

View File

@@ -13,7 +13,7 @@ namespace PkmnLibSharp.Library.GrowthRates
{
}
public static ExternGrowthRate Create(CalculateLevelDelegate levelFunc,
public ExternGrowthRate(CalculateLevelDelegate levelFunc,
CalculateExperienceDelegate experienceFunc)
{
var ptr = IntPtr.Zero;
@@ -21,7 +21,7 @@ namespace PkmnLibSharp.Library.GrowthRates
Marshal.GetFunctionPointerForDelegate(levelFunc),
Marshal.GetFunctionPointerForDelegate(experienceFunc)
);
return new ExternGrowthRate(ptr);
Initialize(ptr);
}
protected override void DeletePtr()

View File

@@ -8,6 +8,8 @@ namespace PkmnLibSharp.Library.GrowthRates
internal GrowthRate(IntPtr ptr) : base(ptr)
{
}
protected GrowthRate(){}
public byte CalculateLevel(uint experience)
{