64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using Gameplay.Building.Impl.Common;
|
|
using Gameplay.Building.Impl.PillBox;
|
|
using UnityEngine;
|
|
namespace Gameplay.Building.Impl
|
|
{
|
|
public class BuildPillBox : UnitBuild
|
|
{
|
|
|
|
public int bulletId;
|
|
|
|
public Transform firePoint;
|
|
|
|
public int fireLineId;
|
|
|
|
public BuildPillBox(uint id,
|
|
int troopId) : base(id, troopId)
|
|
{
|
|
}
|
|
|
|
protected override void _UpdateTargets()
|
|
{
|
|
base._UpdateTargets();
|
|
_CommonUpdateTargets();
|
|
}
|
|
|
|
protected override void _InitFsm()
|
|
{
|
|
base._InitFsm();
|
|
|
|
_fsm.Add(new PillBoxStateIdle(this));
|
|
_fsm.Add(new PillBoxStateAttack(this));
|
|
_fsm.Add(new CommonBuildStateDestroy(this));
|
|
_fsm.Add(new CommonBuildStateWaitRemove(this));
|
|
|
|
}
|
|
|
|
protected override void _AfterInitConfig()
|
|
{
|
|
base._AfterInitConfig();
|
|
|
|
fightData.normalAttackDistance = Mathf.RoundToInt(configData.rawConfig.FloatParams[0]);
|
|
fightData.baseShootCd = configData.rawConfig.FloatParams[1];
|
|
fightData.shootCd = fightData.baseShootCd;
|
|
|
|
bulletId = Mathf.RoundToInt(configData.rawConfig.FloatParams[2]);
|
|
|
|
fireLineId = Mathf.RoundToInt(configData.rawConfig.FloatParams[3]);
|
|
}
|
|
|
|
protected override void _AfterCreateView()
|
|
{
|
|
base._AfterCreateView();
|
|
|
|
var obj = _node.GameObject;
|
|
firePoint = obj.transform.Find("build_anbao/view/fire_point");
|
|
if (firePoint == null)
|
|
{
|
|
DebugUtil.LogError("找不到开火点");
|
|
firePoint = obj.transform;
|
|
}
|
|
}
|
|
}
|
|
}
|