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

View File

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

View File

@ -27,8 +27,8 @@ public class DiceRoller : MonoBehaviour
private void OnDiceRolled()
{
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);
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);
inputManager.SetDiceRollValue(currentRolledVal);
}
}

View File

@ -34,17 +34,17 @@ public class SafeTile : Tile
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].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
{
Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
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);
}
}
@ -55,16 +55,16 @@ public class SafeTile : Tile
{
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--;
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);
if (playerTypesDict[playerType].playerCount == 0)
{
placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform);
playerTypesDict.Remove(playerType);
Debug.Log($"targetSafeTile. Removing player {playerType}");
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType}");
lastOccupiedIndex--;
}
}