迁移数据表到 Luban,移除 JsonNet、EnumUtility
This commit is contained in:
@@ -19,7 +19,7 @@ namespace SepCore.Components
|
||||
private Collider[] _buffer;
|
||||
|
||||
private StatProperty _absorbRangeStat;
|
||||
private Action<StatModifier, bool> _absorbRangeStatCallback;
|
||||
private Action<modifier, bool> _absorbRangeStatCallback;
|
||||
|
||||
private float AbsorbRange => Mathf.Max(0f, (_absorbRangeBase + _absorbRangeStat.Value) * _absorbRangeStat.Percent);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SepCore.Components
|
||||
public class BackpackComponent : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 武器槽容量,由DRRole决定。
|
||||
/// 武器槽容量,由 RoleConfig 决定。
|
||||
/// </summary>
|
||||
private int _weaponCapacity;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using SepCore.Event;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
@@ -14,15 +14,15 @@ namespace SepCore.Components
|
||||
private StatComponent _statComponent;
|
||||
|
||||
private StatProperty _maxHealthStat;
|
||||
private Action<StatModifier, bool> _maxHealthStatCallback;
|
||||
private Action<modifier, bool> _maxHealthStatCallback;
|
||||
public StatProperty MaxHealthStat => _maxHealthStat;
|
||||
|
||||
private StatProperty _defenseStat;
|
||||
private Action<StatModifier, bool> _defenseStatCallback;
|
||||
private Action<modifier, bool> _defenseStatCallback;
|
||||
public StatProperty DefenseStat => _defenseStat;
|
||||
|
||||
private StatProperty _dodgeStat;
|
||||
private Action<StatModifier, bool> _dodgeStatCallback;
|
||||
private Action<modifier, bool> _dodgeStatCallback;
|
||||
public StatProperty DodgeStat => _dodgeStat;
|
||||
|
||||
private bool _isPlayer => _statComponent != null;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace SepCore.Components
|
||||
private StatComponent _statComponent;
|
||||
|
||||
private StatProperty _movementStat;
|
||||
private Action<StatModifier, bool> _movementStatCallback;
|
||||
private Action<modifier, bool> _movementStatCallback;
|
||||
|
||||
public void OnInit(float speed, Transform target, StatComponent statComponent = null,
|
||||
bool avoidEnemyOverlap = false, float enemyBodyRadius = 0.45f, int separationIterations = 2)
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace SepCore.Components
|
||||
{
|
||||
public class StatComponent : MonoBehaviour
|
||||
{
|
||||
private Dictionary<StatType, List<StatModifier>> _statModifiers;
|
||||
private Dictionary<StatType, Action<StatModifier, bool>> _statModifierCallbacks;
|
||||
private Dictionary<StatType, List<modifier>> _statModifiers;
|
||||
private Dictionary<StatType, Action<modifier, bool>> _statModifierCallbacks;
|
||||
|
||||
public void OnInit()
|
||||
{
|
||||
_statModifiers = new Dictionary<StatType, List<StatModifier>>();
|
||||
_statModifierCallbacks = new Dictionary<StatType, Action<StatModifier, bool>>();
|
||||
_statModifiers = new Dictionary<StatType, List<modifier>>();
|
||||
_statModifierCallbacks = new Dictionary<StatType, Action<modifier, bool>>();
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
@@ -22,11 +22,11 @@ namespace SepCore.Components
|
||||
_statModifierCallbacks.Clear();
|
||||
}
|
||||
|
||||
public void AddModifier(StatModifier modifier)
|
||||
public void AddModifier(modifier modifier)
|
||||
{
|
||||
if (!_statModifiers.TryGetValue(modifier.StatType, out var modifiers))
|
||||
{
|
||||
_statModifiers.Add(modifier.StatType, modifiers = new List<StatModifier>());
|
||||
_statModifiers.Add(modifier.StatType, modifiers = new List<modifier>());
|
||||
modifiers.Add(modifier);
|
||||
}
|
||||
else
|
||||
@@ -38,7 +38,7 @@ namespace SepCore.Components
|
||||
callbacks?.Invoke(modifier, true);
|
||||
}
|
||||
|
||||
public void RemoveModifier(StatModifier modifier)
|
||||
public void RemoveModifier(modifier modifier)
|
||||
{
|
||||
if (_statModifiers.TryGetValue(modifier.StatType, out var modifiers))
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace SepCore.Components
|
||||
callbacks?.Invoke(modifier, false);
|
||||
}
|
||||
|
||||
public void Subscribe(StatType statType, Action<StatModifier, bool> callback)
|
||||
public void Subscribe(StatType statType, Action<modifier, bool> callback)
|
||||
{
|
||||
if (!_statModifierCallbacks.TryAdd(statType, callback))
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace SepCore.Components
|
||||
}
|
||||
}
|
||||
|
||||
public void Unsubscribe(StatType statType, Action<StatModifier, bool> callback)
|
||||
public void Unsubscribe(StatType statType, Action<modifier, bool> callback)
|
||||
{
|
||||
if (!_statModifierCallbacks.TryGetValue(statType, out var callbacks))
|
||||
{
|
||||
@@ -79,23 +79,23 @@ namespace SepCore.Components
|
||||
|
||||
foreach (var modifier in modifiers)
|
||||
{
|
||||
if (modifier.IsPercent) result.Percent += modifier.Value;
|
||||
else result.Value += modifier.Value;
|
||||
if (modifier.IsPercent) result.Percent += modifier.RealValue;
|
||||
else result.Value += modifier.RealValue;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UpdateStat(StatProperty stat, StatModifier modifier, bool isApply)
|
||||
public void UpdateStat(StatProperty stat, modifier modifier, bool isApply)
|
||||
{
|
||||
float coef = isApply ? 1f : -1f;
|
||||
if (modifier.IsPercent)
|
||||
{
|
||||
stat.Percent += modifier.Value * coef;
|
||||
stat.Percent += modifier.RealValue * coef;
|
||||
}
|
||||
else
|
||||
{
|
||||
stat.Value += modifier.Value * coef;
|
||||
stat.Value += modifier.RealValue * coef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user