加入武器 tag 的羁绊效果
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using SepCore.Battle;
|
||||
using SepCore.Definition;
|
||||
using SepCore.Entity;
|
||||
using UnityEngine;
|
||||
@@ -27,6 +28,11 @@ namespace SepCore.Components
|
||||
/// </summary>
|
||||
private StatComponent _statComponent;
|
||||
|
||||
/// <summary>
|
||||
/// 武器标签羁绊管理器。
|
||||
/// </summary>
|
||||
private readonly WeaponSynergyManager _synergyManager = new();
|
||||
|
||||
/// <summary>
|
||||
/// 武器装备槽,在 Editor 中进行配置,表示武器在世界中的显示位置。
|
||||
/// </summary>
|
||||
@@ -35,6 +41,7 @@ namespace SepCore.Components
|
||||
public IReadOnlyList<WeaponBase> Weapons => _weapons;
|
||||
public IReadOnlyList<PropItem> Props => _props;
|
||||
public int WeaponCapacity => GameEntry.Luban.Global.WeaponCapacity;
|
||||
public WeaponSynergyManager SynergyManager => _synergyManager;
|
||||
|
||||
public void OnInit(Player player)
|
||||
{
|
||||
@@ -43,12 +50,14 @@ namespace SepCore.Components
|
||||
_weapons = new List<WeaponBase>(WeaponCapacity);
|
||||
_props = new List<PropItem>();
|
||||
_statComponent = GetComponent<StatComponent>();
|
||||
_synergyManager.Initialize();
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_weapons.Clear();
|
||||
_props.Clear();
|
||||
_synergyManager.RefreshSynergies(_weapons, _statComponent.Pipeline);
|
||||
}
|
||||
|
||||
public bool AttachWeapon(WeaponBase weapon)
|
||||
@@ -57,6 +66,7 @@ namespace SepCore.Components
|
||||
GameEntry.Entity.AttachEntity(weapon.Id, _player.Id, _weaponSlots[_weapons.Count]);
|
||||
_weapons.Add(weapon);
|
||||
weapon.SetEnabled(true);
|
||||
_synergyManager.RefreshSynergies(_weapons, _statComponent.Pipeline);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,6 +76,7 @@ namespace SepCore.Components
|
||||
if (result)
|
||||
{
|
||||
GameEntry.Entity.DetachEntity(weapon.Id, _player.Id);
|
||||
_synergyManager.RefreshSynergies(_weapons, _statComponent.Pipeline);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user