Fix: AI's not aligning properly in safe zone.

This commit is contained in:
Ashby Issac 2026-01-28 22:00:39 +05:30
parent 5a90b0961c
commit d93ffe6fad
4 changed files with 15 additions and 10 deletions

View File

@ -7801,6 +7801,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3} m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
diceValue: 0
diceText: {fileID: 953941044} diceText: {fileID: 953941044}
pointerDebug: {fileID: 102349503} pointerDebug: {fileID: 102349503}
pointerMeshRend: {fileID: 102349501} pointerMeshRend: {fileID: 102349501}
@ -7811,21 +7812,25 @@ MonoBehaviour:
startIndex: 0 startIndex: 0
endIndex: 50 endIndex: 50
playersParent: {fileID: 1373272158} playersParent: {fileID: 1373272158}
totalPawnsInHome: 0
totalPawnsFinished: 0 totalPawnsFinished: 0
- playerType: 1 - playerType: 1
startIndex: 13 startIndex: 13
endIndex: 11 endIndex: 11
playersParent: {fileID: 1841959051} playersParent: {fileID: 1841959051}
totalPawnsInHome: 0
totalPawnsFinished: 0 totalPawnsFinished: 0
- playerType: 2 - playerType: 2
startIndex: 26 startIndex: 26
endIndex: 24 endIndex: 24
playersParent: {fileID: 1934858463} playersParent: {fileID: 1934858463}
totalPawnsInHome: 0
totalPawnsFinished: 0 totalPawnsFinished: 0
- playerType: 3 - playerType: 3
startIndex: 39 startIndex: 39
endIndex: 37 endIndex: 37
playersParent: {fileID: 1094154913} playersParent: {fileID: 1094154913}
totalPawnsInHome: 0
totalPawnsFinished: 0 totalPawnsFinished: 0
playerBaseHandler: {fileID: 433034051} playerBaseHandler: {fileID: 433034051}
--- !u!1 &912029031 --- !u!1 &912029031
@ -9810,7 +9815,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f06aabb5d8a9f441e99482ccf020f10c, type: 3} m_Script: {fileID: 11500000, guid: f06aabb5d8a9f441e99482ccf020f10c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
diceTestValue: 0 diceTestValue: 1
--- !u!1001 &1041187863 --- !u!1001 &1041187863
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -543,7 +543,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
int targetIdx = playerPawn.CurrentTileIndex + diceRolledValue; int targetIdx = playerPawn.CurrentTileIndex + diceRolledValue;
if (nextTileIdx == 0) if (nextTileIdx == 0)
targetIdx = targetIdx - playerPawn.CurrentTileIndex; targetIdx = (targetIdx - playerPawn.CurrentTileIndex) - 1;
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex); Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
if (currentSittingTile.IsSafeZone) if (currentSittingTile.IsSafeZone)

View File

@ -27,8 +27,8 @@ public class DiceRoller : MonoBehaviour
private void OnDiceRolled() private void OnDiceRolled()
{ {
int currentRolledVal = Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1); int currentRolledVal = // Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
// diceTestValue != 0 ? diceTestValue : Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1); diceTestValue != 0 ? diceTestValue : Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
inputManager.SetDiceRollValue(currentRolledVal); inputManager.SetDiceRollValue(currentRolledVal);
} }
} }

View File

@ -34,17 +34,17 @@ public class SafeTile : Tile
playerPawns = new Dictionary<int, PlayerPawn>() playerPawns = new Dictionary<int, PlayerPawn>()
}); });
Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}"); Debug.Log($"targetSafeTile. tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn); playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn);
playerTypesDict[playerType].commonPlacementTransform = placementQueue.Dequeue(); playerTypesDict[playerType].commonPlacementTransform = placementQueue.Dequeue();
Debug.Log($"targetSafeTile. Adding player {playerType} {playerTypesDict[playerType].playerCount} tileName: {name}"); Debug.Log($"targetSafeTile. tileName: {name} Adding player {playerType} {playerTypesDict[playerType].playerCount} tileName: {name}");
} }
else else
{ {
Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}"); Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
playerTypesDict[playerType].playerCount++; playerTypesDict[playerType].playerCount++;
Debug.Log($"targetSafeTile. Adding player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}"); Debug.Log($"targetSafeTile. tileName: {name} Adding player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn); playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn);
} }
} }
@ -55,16 +55,16 @@ public class SafeTile : Tile
{ {
if (playerTypesDict[playerType].playerCount > 0) if (playerTypesDict[playerType].playerCount > 0)
{ {
Debug.Log($"targetSafeTile. Removing player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}"); Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
playerTypesDict[playerType].playerCount--; playerTypesDict[playerType].playerCount--;
Debug.Log($"targetSafeTile. Removing player {playerType} after: {playerTypesDict[playerType].playerCount}"); Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType} after: {playerTypesDict[playerType].playerCount}");
playerTypesDict[playerType].playerPawns.Remove(playerPawn.PlayerId); playerTypesDict[playerType].playerPawns.Remove(playerPawn.PlayerId);
if (playerTypesDict[playerType].playerCount == 0) if (playerTypesDict[playerType].playerCount == 0)
{ {
placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform); placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform);
playerTypesDict.Remove(playerType); playerTypesDict.Remove(playerType);
Debug.Log($"targetSafeTile. Removing player {playerType}"); Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType}");
lastOccupiedIndex--; lastOccupiedIndex--;
} }
} }