[#14] rozbudowa stats + dodanie modyfikatorów
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e8a8415cb82457080457ed37759632f
|
||||
timeCreated: 1782147041
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "RPGCore.Stats2Status.Editor",
|
||||
"rootNamespace": "RPGCore.Stats2Status.Editor",
|
||||
"references": [
|
||||
"RPGCore",
|
||||
"RPGCore.Editor",
|
||||
"RPGCore.Stats2Status",
|
||||
"RPGCoreCommon.Helpers"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fcd02a1357a446aa9f506aa36f731c6
|
||||
timeCreated: 1782147041
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ea364d5fbbb4f649d4ea50f61b060d9
|
||||
timeCreated: 1782147025
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1c1cd6791c74c87b717977a72381acc
|
||||
timeCreated: 1782151180
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using RPGCore.Stats.ObjectModules.StatsObjectModule;
|
||||
using RPGCore.StatusEffect.ObjectModules.StatusObjectModule;
|
||||
|
||||
namespace RPGCore.Stats2Status.Effects
|
||||
{
|
||||
public class ResourceChangeEffect : BaseEffect
|
||||
{
|
||||
public enum ResourceAmountType
|
||||
{
|
||||
Flat,
|
||||
PercentOfValue,
|
||||
PercentOfResource
|
||||
}
|
||||
|
||||
public StatResourceDefinitionSO resourceDefinitionSO;
|
||||
public ResourceAmountType amountType;
|
||||
public int amount;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
var resource = status.target.GetComponent<StatsModule>().Get(resourceDefinitionSO);
|
||||
var value = resource.statValue;
|
||||
|
||||
switch (amountType)
|
||||
{
|
||||
case ResourceAmountType.Flat:
|
||||
resource.ChangeResource(amount);
|
||||
break;
|
||||
case ResourceAmountType.PercentOfValue:
|
||||
resource.ChangeResource(amount * value.value / 100);
|
||||
break;
|
||||
case ResourceAmountType.PercentOfResource:
|
||||
resource.ChangeResource(amount * resource.resource / 100);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19741604c0ef4f87a5d7b27a7e62c538
|
||||
timeCreated: 1782332472
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using RPGCore.Stats.ObjectModules.StatsObjectModule;
|
||||
using RPGCore.StatusEffect.ObjectModules.StatusObjectModule;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RPGCore.Stats2Status.Effects
|
||||
{
|
||||
[Serializable]
|
||||
public class ValueChangeEffect : BaseEffect
|
||||
{
|
||||
[SerializeField] public StatValueDefinitionSO valueDefinitionSO;
|
||||
[SerializeField] public StatModifierType amountType;
|
||||
[SerializeField] public int amount;
|
||||
|
||||
private StatValue _value;
|
||||
private StatModifier _modifier;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
_value = status.target.GetComponent<StatsModule>().Get(valueDefinitionSO);
|
||||
_modifier = new StatModifier(status.target, amount, amountType);
|
||||
_value.modifiers.Add(_modifier);
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
_value.modifiers.Remove(_modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 473957f15aa24486b03bd37fa8ef922d
|
||||
timeCreated: 1782150941
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "RPGCore.Stats2Status",
|
||||
"rootNamespace": "RPGCore.Stats2Status",
|
||||
"references": [
|
||||
"RPGCore",
|
||||
"RPGCore.Stats",
|
||||
"RPGCore.StatusEffect"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b55415f0e2b4b3a9545c2390bd012f2
|
||||
timeCreated: 1782147025
|
||||
Reference in New Issue
Block a user