You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
using System.Collections.Generic;
|
|
using Entitas;
|
|
using xFrame;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
[Combat]
|
|
public class GunDataComponent : IComponent, IReset
|
|
{
|
|
public int gunCfgId;
|
|
public int slotId;
|
|
public CombatEntity gunEnt;
|
|
public ElementType elementType;
|
|
public bool isShowAttackRange;
|
|
internal float fireCdAcc;
|
|
|
|
// 攻击范围特效
|
|
internal List<int> circleVfxHandles = new();
|
|
|
|
// 重新装弹
|
|
public void ReloadAmmo(CombatEntity parent)
|
|
{
|
|
if (gunEnt.hasReload || gunEnt.isCannotReload)
|
|
return;
|
|
var tbGun = WeaponDescMgr.Instance.GetConfig(gunCfgId);
|
|
int cd = (int)(ExpressionEvaluator.CalcVal_WithProp(tbGun.ReloadTime, parent.property.container, 1) +
|
|
PropertyContainer.Epsilon);
|
|
XLog.LogDebug($"{gunCfgId} Reload Ammo cd {cd}");
|
|
parent.animationProxy?.Play(FNameLookup.Reload);
|
|
parent.DispatchEvent(ClientEvent.OnGunReloadStart, null);
|
|
GunSrv.PushAmmoBarData(parent, 0f, cd, 0f, false);
|
|
if (parent.isLocalPlayer)
|
|
{
|
|
CoreUIBridge.CoreGamePushGunReload(slotId, true);
|
|
}
|
|
gunEnt.AddReload(cd);
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
fireCdAcc = 0;
|
|
}
|
|
}
|
|
}
|