【占领】 修改事件

main
刘涛 2024-06-26 14:13:13 +08:00
parent f7938697f7
commit c39365742f
2 changed files with 21 additions and 2 deletions

View File

@ -108,6 +108,8 @@
INFIGHT_BEPROTECT_UNIT_DEAD, // 被保护单位死亡
INFIGHT_CAPTURE_PROGRESS, // 占领进度
INFIGHT_CAPTURE_START, // 开始占领
INFIGHT_CAPTURE_STOP, // 结束占领
INFIGHT_CAPTURE_FINSIHED, // 占领目标区域完成
INFIGHT_FLAG_COLLECTED, // 旗子被收集

View File

@ -18,6 +18,8 @@ namespace Gameplay.Fight.Capture
public List<GameUnit> inAreaUnits;
public float captureProgress;
private bool _lastIsInArea;
public bool isCaptured { get; private set; }
@ -34,6 +36,7 @@ namespace Gameplay.Fight.Capture
_displayObj = Object.Instantiate(sampleObj);
var worldPos = AreaManager.instance.GetCellPosByIndex(cellIndex);
_displayObj.transform.position = worldPos;
_lastIsInArea = false;
}
public void UpdateInAreaUnits(List<GameUnit> checkUnits)
@ -65,9 +68,23 @@ namespace Gameplay.Fight.Capture
_CreateNoticeOnGround();
}
else
// else
// {
// EventManager.Instance.Send(EventManager.EventName.INFIGHT_CAPTURE_PROGRESS, this);
// }
if (!_lastIsInArea)
{
EventManager.Instance.Send(EventManager.EventName.INFIGHT_CAPTURE_PROGRESS, this);
_lastIsInArea = true;
EventManager.Instance.Send(EventManager.EventName.INFIGHT_CAPTURE_START, this);
}
}
else
{
if (_lastIsInArea)
{
_lastIsInArea = false;
EventManager.Instance.Send(EventManager.EventName.INFIGHT_CAPTURE_STOP, this);
}
}