Visual gameplay bug fixes.
This commit is contained in:
parent
9b1c4f14b0
commit
151823eb36
@ -195,7 +195,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
|
||||
|
||||
playerPawn.MoveToTile(
|
||||
GetPositionInsideSafeZone(playerPawn, targetTile),
|
||||
GetAndInitPositionInsideSafeZone(playerPawn, targetTile),
|
||||
onComplete: () =>
|
||||
{
|
||||
CanRollDice = true;
|
||||
@ -227,7 +227,17 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
|
||||
if (currentSittingTile.IsSafeZone)
|
||||
{
|
||||
((SafeTile)currentSittingTile).UpdateSafeZonePlayerData(currentPlayerTypeTurn, playerPawn);
|
||||
SafeTile safeTile = (SafeTile)currentSittingTile;
|
||||
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, playerPawn);
|
||||
|
||||
if (safeTile.PlayerTypesCount == 1)
|
||||
{
|
||||
PlayerTypes playerType = safeTile.GetFirstPlayerType();
|
||||
|
||||
var playerPawns = safeTile.GetPlayerPawns(playerType);
|
||||
foreach (var pawn in playerPawns)
|
||||
pawn.MoveToCustomTilePosition(safeTile.CenterPlacementPosition);
|
||||
}
|
||||
}
|
||||
|
||||
MoveThroughTiles(playerPawn, nextTileIdx, targetIndex: targetIdx);
|
||||
@ -291,7 +301,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(targetIndex);
|
||||
if (targetTile.IsSafeZone)
|
||||
{
|
||||
targetPosition = GetPositionInsideSafeZone(playerPawn, targetTile);
|
||||
targetPosition = GetAndInitPositionInsideSafeZone(playerPawn, targetTile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,10 +345,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// ((SafeTile)nextTile).InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||
// }
|
||||
|
||||
SwitchPlayer(playerPawn);
|
||||
CanRollDice = true;
|
||||
@ -347,7 +353,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
index);
|
||||
}
|
||||
|
||||
private Vector3 GetPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile)
|
||||
private Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile)
|
||||
{
|
||||
Vector3 targetPosition;
|
||||
SafeTile targetSafeTile = (SafeTile)targetTile;
|
||||
@ -357,26 +363,15 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
|
||||
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)) // means it is a new player type, the second one
|
||||
{
|
||||
Debug.Log($"Logging data");
|
||||
PlayerTypes initialPlayerType = targetSafeTile.GetFirstPlayerType();
|
||||
Debug.Log($"initialPlayerType: {initialPlayerType}");
|
||||
int playerPawnsCount = targetSafeTile.GetPlayerPawnsCountInTile(initialPlayerType);
|
||||
Debug.Log($"playerPawnsCount: {playerPawnsCount}");
|
||||
|
||||
// rearrange already existing player from center position to it's saved transform
|
||||
var playerPawns = targetSafeTile.GetPlayerPawns(initialPlayerType);
|
||||
Debug.Log($"playerPawns: {playerPawns.Count}");
|
||||
foreach (var pawn in playerPawns)
|
||||
{
|
||||
Debug.Log($"Getting placement data");
|
||||
var placementPoint = targetSafeTile.GetPlacementPoint(initialPlayerType);
|
||||
Debug.Log($"PlacementPoint: {placementPoint.name}");
|
||||
pawn.MoveToTileSubPosition(placementPoint.position);
|
||||
pawn.MoveToCustomTilePosition(placementPoint.position);
|
||||
}
|
||||
// for (int idx = 0; idx < playerPawnsCount; idx++)
|
||||
// {
|
||||
// targetSafeTile.IterateAndGetPlayerPawn(initialPlayerType, idx).MoveToTileSubPosition(targetSafeTile.GetPlacementPoint(initialPlayerType).position);
|
||||
// }
|
||||
|
||||
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
|
||||
|
||||
@ -48,7 +48,7 @@ public class PlayerPawn : MonoBehaviour
|
||||
transform.DOMove(startingPoint, 0.1f).onComplete = () => onComplete?.Invoke();
|
||||
}
|
||||
|
||||
public void MoveToTileSubPosition(Vector3 targetPoint)
|
||||
public void MoveToCustomTilePosition(Vector3 targetPoint)
|
||||
{
|
||||
transform.DOMove(targetPoint, 0.1f);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user