2024-09-23 15:05:34 +08:00
|
|
|
using AOT.PostProcess.BlackArea;
|
2024-11-25 18:27:04 +08:00
|
|
|
using Code.Scripts.Gameplay.Fight.Evacuate;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Framework;
|
|
|
|
|
using Gameplay.Area;
|
2024-12-09 16:39:11 +08:00
|
|
|
using Gameplay.Area.Ready;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Gameplay.Buff;
|
|
|
|
|
using Gameplay.Bullet;
|
|
|
|
|
using Gameplay.Character;
|
2024-05-30 13:07:39 +08:00
|
|
|
using Gameplay.Fight.Capture;
|
2024-07-01 13:08:37 +08:00
|
|
|
using Gameplay.Guide;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Gameplay.Pause;
|
|
|
|
|
using Gameplay.Skill;
|
2023-12-13 16:20:41 +08:00
|
|
|
using Gameplay.Unit;
|
|
|
|
|
using Gameplay.Unit.Data;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Gameplay.Vehicle.Impl;
|
2024-11-14 14:22:30 +08:00
|
|
|
using LTGame;
|
2024-08-09 18:08:27 +08:00
|
|
|
using PhxhSDK;
|
2023-08-22 19:08:45 +08:00
|
|
|
using TGS;
|
|
|
|
|
using UnityEngine;
|
2023-10-19 15:00:19 +08:00
|
|
|
using Utils.Bounds;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
namespace Gameplay.Level
|
|
|
|
|
{
|
2024-11-14 14:22:30 +08:00
|
|
|
public class LevelStateBattle : BaseLevelState
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-14 14:22:30 +08:00
|
|
|
public LevelStateBattle(Level level) : base(level, ELevelState.Battle)
|
|
|
|
|
{
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
private bool _canUpdate;
|
2024-12-09 16:39:11 +08:00
|
|
|
private bool _oldPauseStatus;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
2024-11-14 14:22:30 +08:00
|
|
|
protected override void _OnEnter(NBaseState exitState,
|
|
|
|
|
object param)
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2024-11-14 14:22:30 +08:00
|
|
|
base._OnEnter(exitState, param);
|
2024-11-15 18:21:15 +08:00
|
|
|
|
2024-11-15 19:25:56 +08:00
|
|
|
if (exitState.id == ELevelState.Prepare)
|
|
|
|
|
{
|
2024-11-15 20:01:13 +08:00
|
|
|
_SetPlayerControl();
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-15 19:25:56 +08:00
|
|
|
GameUnitManager.instance.EnterBattle();
|
|
|
|
|
// 这个必须在GameUnitManager.instance.EnterBattle()之后
|
|
|
|
|
// 因为他会给unit增加buff
|
|
|
|
|
BoundsManager.instance.Init();
|
|
|
|
|
_level.LevelTime = 0;
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
_level.isInBattle = true;
|
|
|
|
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.LevelBattleBegin);
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-26 14:04:04 +08:00
|
|
|
EventManager.Instance.Register<GameUnit>(EventManager.EventName.INFIGHT_UI_CLICK_UNIT, _OnUIClickUnit);
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-08-12 13:05:22 +08:00
|
|
|
var cameraInfo = _level.Map.MapData.cameraMarginInfo;
|
2024-08-09 18:08:27 +08:00
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().rightMargin = cameraInfo.rightMarginInFight;
|
|
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().leftMargin = cameraInfo.leftMarginInFight;
|
|
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().topMargin = cameraInfo.topMarginInFight;
|
|
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().bottomMargin = cameraInfo.bottomMarginInFight;
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-08-15 18:18:12 +08:00
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().AdjustSelf();
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-09-24 12:49:44 +08:00
|
|
|
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
2024-11-21 17:39:33 +08:00
|
|
|
EventManager.Instance.Send(EventManager.EventName.FightStoryHide);
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-22 14:25:49 +08:00
|
|
|
_WaitBlackOut();
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
2024-11-14 14:22:30 +08:00
|
|
|
protected override void _OnRunning()
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2024-11-14 14:22:30 +08:00
|
|
|
base._OnRunning();
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-26 18:56:37 +08:00
|
|
|
PauseManager.instance.LogicUpdate(deltaTime);
|
2023-08-22 19:08:45 +08:00
|
|
|
SkillManager.instance.LogicUpdate(deltaTime);
|
2024-11-26 18:56:37 +08:00
|
|
|
if (AreaManager.instance.isInSkillPreview) return;
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-26 18:56:37 +08:00
|
|
|
_level.LevelTime += deltaTime;
|
2023-08-22 19:08:45 +08:00
|
|
|
BulletManager.instance.LogicUpdate(deltaTime);
|
2023-12-14 15:31:46 +08:00
|
|
|
GameUnitManager.instance.LogicUpdate(deltaTime);
|
2024-07-09 15:03:48 +08:00
|
|
|
BuffManager.instance.LogicUpdate(deltaTime);
|
2023-08-22 19:08:45 +08:00
|
|
|
AreaManager.instance.LogicUpdate(deltaTime);
|
2024-05-30 13:07:39 +08:00
|
|
|
CaptureManager.instance.LogicUpdate(deltaTime);
|
2024-07-10 19:51:24 +08:00
|
|
|
BlackAreaManager.instance.LogicUpdate(deltaTime);
|
2024-11-25 18:27:04 +08:00
|
|
|
EvacuateManager.instance.LogicUpdate();
|
2024-12-03 19:10:28 +08:00
|
|
|
EventManager.Instance.Send(EventManager.EventName.LevelTimeIncrease, deltaTime);
|
2024-11-15 18:21:15 +08:00
|
|
|
|
|
|
|
|
_level.fightStoryManager.LogicUpdate(deltaTime);
|
|
|
|
|
if (_level.fightStoryManager.CheckCanTrigger())
|
|
|
|
|
{
|
|
|
|
|
isFinished = true;
|
|
|
|
|
nextState = ELevelState.BattleStory;
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
2024-11-14 14:22:30 +08:00
|
|
|
protected override void _OnExit(NBaseState exitState,
|
|
|
|
|
object param)
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2024-11-14 14:22:30 +08:00
|
|
|
base._OnExit(exitState, param);
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-14 14:22:30 +08:00
|
|
|
_level.isInBattle = false;
|
2024-11-26 14:04:04 +08:00
|
|
|
EventManager.Instance.Unregister<GameUnit>(EventManager.EventName.INFIGHT_UI_CLICK_UNIT, _OnUIClickUnit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _OnUIClickUnit(GameUnit clickUnit)
|
2024-12-09 16:39:11 +08:00
|
|
|
{
|
|
|
|
|
if (AreaManager.instance.readyAreaManager.isShow)
|
|
|
|
|
{
|
|
|
|
|
_HandleOnReadyShow(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_HandleOnReadyNotShow(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void _HandleOnReadyShow(GameUnit clickUnit)
|
|
|
|
|
{
|
|
|
|
|
if (clickUnit == AreaManager.instance.readyAreaManager.readyUnit)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 关闭准备区域
|
|
|
|
|
AreaManager.instance.readyAreaManager.HideReadyArea();
|
|
|
|
|
_level.SetPause(_oldPauseStatus);
|
|
|
|
|
|
|
|
|
|
_HandleOnReadyNotShow(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _HandleOnReadyNotShow(GameUnit clickUnit)
|
|
|
|
|
{
|
|
|
|
|
if (clickUnit.statusData.isOnVehicle)
|
|
|
|
|
{
|
|
|
|
|
_level.UnSelectUnit();
|
|
|
|
|
_HandleOnVehicle(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_HandleNotOnVehicle(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _HandleOnVehicle(GameUnit clickUnit)
|
|
|
|
|
{
|
|
|
|
|
if (clickUnit is Character.Character unitCharacter)
|
|
|
|
|
{
|
|
|
|
|
var belongVehicle = unitCharacter.runtimeData.belongVehicle;
|
|
|
|
|
if (belongVehicle == null)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.LogError("单位没有载具");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 居中镜头
|
|
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().KeepCenter(belongVehicle.transform.position);
|
|
|
|
|
AreaManager.instance.readyAreaManager.ShowReadyArea(EReadyAreaStatus.AroundVehicle, clickUnit);
|
|
|
|
|
|
|
|
|
|
_oldPauseStatus = _level.IsPause();
|
|
|
|
|
_level.SetPause(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.LogError("在载具上的单位必须是角色");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _HandleNotOnVehicle(GameUnit clickUnit)
|
2024-11-26 14:04:04 +08:00
|
|
|
{
|
2024-11-27 16:14:44 +08:00
|
|
|
// 居中镜头
|
2024-11-28 12:10:05 +08:00
|
|
|
CameraManager.Instance.MainCamera.GetComponent<CameraController>().KeepCenter(clickUnit.transform.position);
|
|
|
|
|
|
|
|
|
|
if (_level.selectUnit == clickUnit)
|
|
|
|
|
{
|
|
|
|
|
_TryEnterSkillPreRelease(clickUnit);
|
|
|
|
|
}
|
|
|
|
|
else
|
2024-11-27 16:14:44 +08:00
|
|
|
{
|
2024-11-28 12:10:05 +08:00
|
|
|
_level.SelectUnit(clickUnit);
|
2024-11-27 16:14:44 +08:00
|
|
|
}
|
2024-11-26 14:59:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _TryEnterSkillPreRelease(GameUnit unit)
|
|
|
|
|
{
|
2024-12-02 19:33:16 +08:00
|
|
|
if (unit.statusData.isRetreat)
|
|
|
|
|
{
|
|
|
|
|
UITipsManager.ShowTips("单位处于撤退状态,无法释放技能");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (unit.statusData.isDead)
|
|
|
|
|
{
|
|
|
|
|
UITipsManager.ShowTips("单位已死亡,无法释放技能");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-26 14:59:20 +08:00
|
|
|
var unitSkillManager = SkillManager.instance.GetUnitSkillManager(unit);
|
|
|
|
|
if (unitSkillManager == null)
|
|
|
|
|
{
|
2024-12-02 19:33:16 +08:00
|
|
|
UITipsManager.ShowTips("单位无技能管理器");
|
2024-11-26 14:59:20 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var positiveSkill = unitSkillManager.positiveSkill;
|
|
|
|
|
if (positiveSkill == null)
|
|
|
|
|
{
|
2024-12-02 19:33:16 +08:00
|
|
|
UITipsManager.ShowTips("单位无主动技能");
|
2024-11-26 14:59:20 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (positiveSkill.canRelease)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.LogG("进入技能释放状态");
|
2024-11-26 18:56:37 +08:00
|
|
|
AreaManager.instance.skillAreaSelector2.EnterPreview(positiveSkill);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-12-02 19:33:16 +08:00
|
|
|
UITipsManager.ShowTips("技能未准备好");
|
2024-11-26 14:59:20 +08:00
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
2024-11-15 20:01:13 +08:00
|
|
|
private void _SetPlayerControl()
|
|
|
|
|
{
|
|
|
|
|
if (_level.fightStoryManager.hasStory
|
|
|
|
|
&& _level.fightStoryManager.fightStoryData.forceUserTeam)
|
|
|
|
|
{
|
|
|
|
|
var teamData = _level.fightStoryManager.fightStoryData.playerTeamData;
|
|
|
|
|
if (teamData == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < teamData.memberList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var memberInfo = teamData.memberList[i];
|
|
|
|
|
if (memberInfo == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (memberInfo.unitLocalId == 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
var unit = GameUnitManager.instance.infightUnits.SearchByLocalId(memberInfo.unitLocalId);
|
|
|
|
|
if (unit == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
unit.commonData.canControl = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
protected override void _OnClick(Vector2 screenPosition)
|
|
|
|
|
{
|
2024-12-03 19:10:28 +08:00
|
|
|
|
|
|
|
|
var clickCellIndex = GroundHitHelper.CalcHitCellIndex(screenPosition, _level.Map.TerrainGridSystem);
|
2023-08-22 19:08:45 +08:00
|
|
|
if (clickCellIndex < 0)
|
|
|
|
|
{
|
2024-07-03 14:07:54 +08:00
|
|
|
if (GuideManager.Instance.IsGuiding && GuideManager.Instance.IsControlFloor)
|
|
|
|
|
return;
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-11-27 12:40:46 +08:00
|
|
|
if (AreaManager.instance.isInSkillPreview)
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_UI_SKILL_CLICK_SCREEN, clickCellIndex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-07-01 13:08:37 +08:00
|
|
|
|
|
|
|
|
CheckCellClick(_level.Map.TerrainGridSystem, clickCellIndex, 0);
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void _OnCellClick(TerrainGridSystem tgs,
|
|
|
|
|
int cellIndex,
|
|
|
|
|
int buttonIndex)
|
|
|
|
|
{
|
|
|
|
|
if (InputManager.Instance.HandledThisFrame())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-09-30 18:06:04 +08:00
|
|
|
|
|
|
|
|
if (AreaManager.instance.readyAreaManager.isShow)
|
|
|
|
|
{
|
|
|
|
|
// 上阵模式
|
|
|
|
|
_HandleUpUnit(cellIndex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var selectUnit = _level.selectUnit;
|
|
|
|
|
if (selectUnit == null)
|
|
|
|
|
{
|
|
|
|
|
// 没有选中单位,进行选中操作
|
|
|
|
|
_TrySelect(cellIndex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 有选中单位,进行移动操作
|
|
|
|
|
_TryMove(cellIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _HandleUpUnit(int cellIndex)
|
|
|
|
|
{
|
|
|
|
|
// 不是准备区域
|
2024-12-09 16:39:11 +08:00
|
|
|
_GetOutVehicle(cellIndex);
|
2024-09-30 18:06:04 +08:00
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-09-30 18:06:04 +08:00
|
|
|
private void _TryMove(int cellIndex)
|
|
|
|
|
{
|
2024-12-02 19:33:16 +08:00
|
|
|
var selectUnit = _level.selectUnit;
|
|
|
|
|
if (selectUnit == null)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.LogError("没有选中单位");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selectUnit.statusData.isRetreat
|
|
|
|
|
&& selectUnit.transData.cellIndex == cellIndex)
|
|
|
|
|
{
|
|
|
|
|
// 取消选中
|
|
|
|
|
_level.UnSelectUnit();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-09-30 18:06:04 +08:00
|
|
|
if (!AreaManager.instance.moveAreaView.CheckIsInArea(cellIndex))
|
|
|
|
|
{
|
|
|
|
|
// 不在区域内,提示操作无效
|
|
|
|
|
UITipsManager.ShowTips("无法移动到该位置");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectUnit.MoveTo(cellIndex, true);
|
2024-10-08 12:06:06 +08:00
|
|
|
_CheckAfterMove(cellIndex);
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-12-02 19:33:16 +08:00
|
|
|
_level.UnSelectUnit();
|
2024-09-30 18:06:04 +08:00
|
|
|
}
|
|
|
|
|
|
2024-10-08 12:06:06 +08:00
|
|
|
private void _CheckAfterMove(int cellIndex)
|
|
|
|
|
{
|
|
|
|
|
var selectUnit = _level.selectUnit;
|
2024-10-08 19:50:22 +08:00
|
|
|
if (selectUnit.gameunitType != EGameUnitType.Character
|
|
|
|
|
&& selectUnit.gameunitType != EGameUnitType.Vehicle) return;
|
2024-12-03 19:10:28 +08:00
|
|
|
selectUnit.controlData.markVehicle = null;
|
|
|
|
|
selectUnit.controlData.markEnemy = null;
|
|
|
|
|
|
|
|
|
|
if (selectUnit.transData.cellIndex == cellIndex) return;
|
|
|
|
|
|
2024-10-08 12:06:06 +08:00
|
|
|
var units = AreaManager.instance.GetUnitsByCellIndex(cellIndex);
|
|
|
|
|
for (int i = 0; i < units.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var unit = units[i];
|
2024-12-03 19:20:36 +08:00
|
|
|
if (unit.commonData.troopId == selectUnit.commonData.troopId
|
|
|
|
|
&& unit.gameunitType == EGameUnitType.Vehicle)
|
2024-10-08 12:06:06 +08:00
|
|
|
{
|
2024-10-08 19:50:22 +08:00
|
|
|
if (selectUnit.gameunitType == EGameUnitType.Vehicle)
|
|
|
|
|
{
|
|
|
|
|
// 载具不能上载具
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-10-08 12:06:06 +08:00
|
|
|
// 点击的己方单位, 这里必然是载具
|
|
|
|
|
var vehicle = unit as NormalVehicle;
|
|
|
|
|
if (vehicle == null)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.LogError("不是载具");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (vehicle.CheckCanUp(selectUnit))
|
|
|
|
|
{
|
|
|
|
|
selectUnit.controlData.markVehicle = vehicle;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
// 如果是敌人, 则设置敌人目标
|
|
|
|
|
if (unit.statusData.CheckCanBeTarget(selectUnit, -1))
|
2024-10-08 12:06:06 +08:00
|
|
|
{
|
2024-12-03 19:10:28 +08:00
|
|
|
selectUnit.controlData.markEnemy = unit;
|
|
|
|
|
selectUnit.controlData.forceUpdateTarget = true;
|
|
|
|
|
return;
|
2024-10-08 12:06:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-12-03 19:10:28 +08:00
|
|
|
|
2024-10-08 12:06:06 +08:00
|
|
|
}
|
|
|
|
|
|
2024-09-30 18:06:04 +08:00
|
|
|
private void _TrySelect(int cellIndex)
|
|
|
|
|
{
|
2023-08-22 19:08:45 +08:00
|
|
|
var unitList = AreaManager.instance.GetUnitsByCellIndex(cellIndex);
|
2024-09-30 18:06:04 +08:00
|
|
|
if (unitList.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
// 没有单位,不做任何操作
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < unitList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var unit = unitList[i];
|
|
|
|
|
if (unit.commonData.canSelect)
|
|
|
|
|
{
|
|
|
|
|
// 只选中可控制单位
|
|
|
|
|
_level.SelectUnit(unit);
|
|
|
|
|
if (unit.debugShowInfo.cacheConfigId != 0)
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_SELECT_UNIT, unit.debugShowInfo.cacheConfigId);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
2024-12-09 16:39:11 +08:00
|
|
|
private void _GetOutVehicle(int cellIndex)
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2024-12-09 16:39:11 +08:00
|
|
|
var character = AreaManager.instance.readyAreaManager.readyUnit as Character.Character;
|
|
|
|
|
if (character == null)
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2024-12-09 16:39:11 +08:00
|
|
|
DebugUtil.LogError("不是角色");
|
2023-10-19 15:00:19 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2024-12-09 16:39:11 +08:00
|
|
|
if (character.fullFSM.currentState.id != EFullState.OnVehicle)
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2024-12-09 16:39:11 +08:00
|
|
|
DebugUtil.LogError("不在载具上");
|
2023-10-19 15:00:19 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2024-12-09 16:39:11 +08:00
|
|
|
if (AreaManager.instance.readyAreaManager.CheckIsInReadyArea(cellIndex))
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2024-12-09 16:39:11 +08:00
|
|
|
DebugUtil.Log("在准备区域内, 下车");
|
|
|
|
|
character.transData.disableEvent = true;
|
|
|
|
|
character.transData.pos =
|
|
|
|
|
LevelManager.Instance.CurrentLevel.Map.TGSCellIndex2WorldPosition(cellIndex);
|
|
|
|
|
character.transData.disableEvent = false;
|
|
|
|
|
character.DownVehicle();
|
2023-10-19 15:00:19 +08:00
|
|
|
}
|
2024-12-09 16:39:11 +08:00
|
|
|
else
|
2024-01-10 15:21:05 +08:00
|
|
|
{
|
2024-12-09 16:39:11 +08:00
|
|
|
DebugUtil.Log("不在准备区域内, 关闭准备区域");
|
|
|
|
|
AreaManager.instance.readyAreaManager.HideReadyArea();
|
2024-01-10 15:21:05 +08:00
|
|
|
}
|
2024-12-09 16:39:11 +08:00
|
|
|
|
|
|
|
|
_level.SetPause(_oldPauseStatus);
|
2024-01-04 15:32:00 +08:00
|
|
|
}
|
2024-12-09 16:39:11 +08:00
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
}
|