无限循环地图和转圈圈兼容

This commit is contained in:
fatiao 2025-05-19 15:12:48 +08:00
parent 735d133664
commit 4e6c2d1be9
5 changed files with 41 additions and 30 deletions

View File

@ -45,6 +45,12 @@ public class BattleMgr : SingletonMono<BattleMgr>
get { return mLuaBattleMgr; }
}
private bool _mIsLoopMapMode = true;
public bool IsLoopMapMode
{
set { _mIsLoopMapMode = value; }
get { return _mIsLoopMapMode; }
}
private LuaTable mLuaVersusMgr;
public LuaTable LuaTowerMgr

View File

@ -17,7 +17,6 @@ public class LogicBattleFieldStateSearch : LogicBattleFieldState
bool hasSpawnedBoss = false;
bool bMoveTo = false;
float changeCamDist = 20;
private bool m_autoRotateCamera = true;
public LogicBattleFieldStateSearch(LogicBattleField field)
: base(field, LogicBattleFieldStateType.Search)
@ -45,7 +44,7 @@ public class LogicBattleFieldStateSearch : LogicBattleFieldState
mField.RecordSpawnCfg();
}
if (m_autoRotateCamera == false)
if (BattleMgr.Instance.IsLoopMapMode == false)
{
var mainRoleFighter = mField.Battle.FighterMgr.GetMainRole();
BattleCamera.Instance.SetAFKCameraTarget(mainRoleFighter);
@ -90,7 +89,7 @@ public class LogicBattleFieldStateSearch : LogicBattleFieldState
{
if(!bMoveTo)
{
mField.Battle.MoveToNextBattleField(false, m_autoRotateCamera==true);
mField.Battle.MoveToNextBattleField(false, BattleMgr.Instance.IsLoopMapMode==true);
bMoveTo = true;
}

View File

@ -89,7 +89,7 @@ public class LogicBattleField : BattleField
private void Init(LogicBattle battle, LevelItem bi)
{
Debug.Log("TAG-LogicBattleField: Create");
//Debug.Log("TAG-LogicBattleField: Create");
mBattle = battle;
mBattleInfo = bi;
mHalfHeight = Size.y * 0.5f;

View File

@ -194,32 +194,38 @@ public class LogicBattleScene : BaseBattleScene
{
if (mMonsterSpawnPointList == null) return;
// int idx = pathList[mCurMonsterSpawnPointIdx++];
// if (mCurMonsterSpawnPointIdx >= pathList.Length)
// mCurMonsterSpawnPointIdx = 0;
//
// if(idx < 0)
// {
// DebugHelper.LogError("mCurMonsterSpawnPointIdx 从pathList中获取的下表小于0"+ mCurMonsterSpawnPointIdx);
// idx = 0;
// }
Debug.Log($"_SelectSpawnPointCount: {_SelectMonsterSpawnPointCount}");
var idx = _SelectMonsterSpawnPointCount;
idx = idx % mMonsterSpawnPointList.Count;
mCurrentMonsterSpawnPoint = mMonsterSpawnPointList[idx];
if (BattleMgr.Instance.IsLoopMapMode == true)
{
int idx = pathList[mCurMonsterSpawnPointIdx++];
if (mCurMonsterSpawnPointIdx >= pathList.Length)
mCurMonsterSpawnPointIdx = 0;
if(idx < 0)
{
DebugHelper.LogError("mCurMonsterSpawnPointIdx 从pathList中获取的下表小于0"+ mCurMonsterSpawnPointIdx);
idx = 0;
}
mCurrentMonsterSpawnPoint = mMonsterSpawnPointList[idx];
}
else
{
Debug.Log($"_SelectSpawnPointCount: {_SelectMonsterSpawnPointCount}");
var idx = _SelectMonsterSpawnPointCount;
idx = idx % mMonsterSpawnPointList.Count;
mCurrentMonsterSpawnPoint = mMonsterSpawnPointList[idx];
var offset = new Vector3(0, 0, 0);
if ((int)(_SelectMonsterSpawnPointCount/5) > 0)
{
offset = new Vector3(0, 0, 100);
var offset = new Vector3(0, 0, 0);
if ((int)(_SelectMonsterSpawnPointCount/5) > 0)
{
offset = new Vector3(0, 0, 100);
}
mCurrentMonsterSpawnPoint.Pos += offset;
foreach (var spawnPos in mCurrentMonsterSpawnPoint.PointList)
{
spawnPos.pos += offset;
}
_SelectMonsterSpawnPointCount++;
EventMgr.DispatchEvent(new CoreEvent<int>(ECoreEventType.EID_SELECT_MONSTER_SPAWN_POINT_COUNT_NTF, _SelectMonsterSpawnPointCount));
}
mCurrentMonsterSpawnPoint.Pos += offset;
foreach (var spawnPos in mCurrentMonsterSpawnPoint.PointList)
{
spawnPos.pos += offset;
}
_SelectMonsterSpawnPointCount++;
EventMgr.DispatchEvent(new CoreEvent<int>(ECoreEventType.EID_SELECT_MONSTER_SPAWN_POINT_COUNT_NTF, _SelectMonsterSpawnPointCount));
}
public void SetEffectVisible(bool bossBattle)

View File

@ -234,8 +234,8 @@ public class GameMgr : SingletonMono<GameMgr>
{
#if UNITY_EDITOR
// test weixin minigame openid:
onComplete.Invoke("{\n\"openid\":\"oUEz364FbD3Qtus574MJ_KA7vCaA\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
//onComplete.Invoke("{\n\"openid\":\"pc-100002\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
//onComplete.Invoke("{\n\"openid\":\"oUEz364FbD3Qtus574MJ_KA7vCaA\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
onComplete.Invoke("{\n\"openid\":\"pc-100004\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
yield break;
#else
#if PLATFORM_WEIXINMINIGAME