public void Siege(BaseUnit unit) { if (unit == null) { return; } var castle = unit as TCastle; if (castle == null) { CLog.Error("Siege:castle == null)"); return; } if (IsInDefend()) { return; } if (IsInSiege()) { return; } if (!SelfUnit.IsEnemy(castle)) { return; } PreSiegeCastle = SiegeCastle; SiegeCastle = castle; castle.CastleStationedMgr.OnBeSiege(SelfUnit); OnSiege(); Callback_OnSiegeChanged?.Invoke(PreSiegeCastle, SiegeCastle); }
public void LeaveSiege(bool isForce = false) { if (IsInDefend()) { return; } if (!IsInSiege()) { return; } PreSiegeCastle = SiegeCastle; SiegeCastle = null; PreSiegeCastle.CastleStationedMgr.OnUnSiege(SelfUnit); OnLeaveSiege(isForce); Callback_OnSiegeChanged?.Invoke(PreSiegeCastle, null); }