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.
113 lines
4.2 KiB
113 lines
4.2 KiB
using System;
|
|
using System.IO;
|
|
using AOT;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
|
|
|
|
public static class BlackboardSrv
|
|
{
|
|
public static void SetAttackCount(int eid)
|
|
{
|
|
var ent = (CombatEntity)Contexts.Combat.GetEntity(eid);
|
|
if (ent == null) return;
|
|
if (ent.hasSummon)
|
|
{
|
|
if (ent.summon.survivalType == SummonSurvivalType.AttackCount)
|
|
{
|
|
ent.summon.survivalParam1 -= 1f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static string GetBehaviourTreePath(int eid)
|
|
{
|
|
var ent = Contexts.Combat.GetEntity(eid);
|
|
if (ent?.blackboard == null)
|
|
return null;
|
|
string btTree;
|
|
switch (ent.blackboard.cfgType)
|
|
{
|
|
case CfgType.HeroCfg:
|
|
btTree = BattleConst.HeroBTTree;
|
|
break;
|
|
case CfgType.MonsterCfg:
|
|
var tbMonster = MonsterPropDescMgr.Instance.GetConfig(ent.blackboard.unitCfgId);
|
|
btTree = tbMonster.btTree;
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
return btTree;
|
|
}
|
|
|
|
//没有equipComponent的单位是否有可旋转的炮台
|
|
public static bool GetHasRotatableGun(int eid)
|
|
{
|
|
var ent = Contexts.Combat.GetEntity(eid);
|
|
if (ent?.blackboard == null)
|
|
return false;
|
|
switch (ent.blackboard.cfgType)
|
|
{
|
|
case CfgType.HeroCfg:
|
|
return false;
|
|
case CfgType.MonsterCfg:
|
|
var tbMonster = MonsterPropDescMgr.Instance.GetConfig(ent.blackboard.unitCfgId);
|
|
return tbMonster.hasRotatableGun == Bool.TRUE;
|
|
default:
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
}
|
|
|
|
public static bool GetPartSkinParam(int showCfgId, out SkinParam skinParam)
|
|
{
|
|
skinParam = default;
|
|
skinParam.bpType = BindPointType.Main;
|
|
var showCfg = RoleModelDescMgr.Instance.GetConfig(showCfgId);
|
|
if (showCfg == null)
|
|
return false;
|
|
skinParam.path = UnrealNames.GetFName(showCfg.folderPath);
|
|
skinParam.animPrefix = UnrealNames.GetFName(showCfg.prefabAnim);
|
|
return true;
|
|
}
|
|
|
|
public static void GetMainSkinParam(int eid, out SkinParam skinParam)
|
|
{
|
|
skinParam = default;
|
|
var ent = Contexts.Combat.GetEntity(eid);
|
|
if (!ent.IsValid() || !ent.hasBlackboard)
|
|
return;
|
|
skinParam.bpType = BindPointType.Main;
|
|
|
|
switch (ent.blackboard.cfgType)
|
|
{
|
|
case CfgType.HeroCfg:
|
|
var showCfg = RoleModelDescMgr.Instance.GetConfig(ent.blackboard.showCfgIds[0]);
|
|
skinParam.path = UnrealNames.GetFName(showCfg.folderPath);
|
|
skinParam.animPrefix = UnrealNames.GetFName(showCfg.prefabAnim);
|
|
break;
|
|
case CfgType.MonsterCfg:
|
|
var showCfg2 = MonsterPropDescMgr.Instance.GetConfig(ent.blackboard.unitCfgId);
|
|
if (showCfg2.type == MonsterType.Intruder)
|
|
{
|
|
var showCfg3 = RoleModelDescMgr.Instance.GetConfig(ent.blackboard.showCfgIds[0]);
|
|
skinParam.path = UnrealNames.GetFName(showCfg3.folderPath);
|
|
skinParam.animPrefix = UnrealNames.GetFName(showCfg3.prefabAnim);
|
|
}
|
|
else
|
|
{
|
|
var fileName = Path.GetFileName(showCfg2.prefab);
|
|
skinParam.animPrefix = UnrealNames.GetFName(fileName.Substring(0, fileName.LastIndexOf('.')));
|
|
if (showCfg2.prefab != null)
|
|
skinParam.path =
|
|
UnrealNames.GetFName(showCfg2.prefab.Substring(0,
|
|
showCfg2.prefab.Length - fileName.Length - 1));
|
|
}
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|