Feedback-fixes.
This commit is contained in:
parent
f26dd14108
commit
d465293ad7
@ -9,6 +9,7 @@ public class DiceView : MonoBehaviour, IBase
|
||||
|
||||
[SerializeField] private DiceSide[] diceSides;
|
||||
[SerializeField] private float sideValueTime = 1.2f;
|
||||
[SerializeField] private Vector3 startPos = new Vector3(0, 20, 0);
|
||||
|
||||
[Header("Physics Randomness")]
|
||||
[SerializeField] private float baseSpinForce = 900f;
|
||||
@ -22,7 +23,7 @@ public class DiceView : MonoBehaviour, IBase
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
rb.useGravity = false;
|
||||
transform.localPosition = new Vector3(0, 20, 0);
|
||||
transform.localPosition = startPos;
|
||||
}
|
||||
|
||||
public void Roll(Action<int> onComplete, bool isBot)
|
||||
@ -96,7 +97,7 @@ public class DiceView : MonoBehaviour, IBase
|
||||
rb.useGravity = false;
|
||||
rb.velocity = Vector3.zero;
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
transform.localPosition = new Vector3(0, 20, 0);
|
||||
transform.localPosition = startPos;
|
||||
rolling = false;
|
||||
|
||||
// Invoke(nameof(ResetEvent), 0.1f);
|
||||
|
||||
@ -16,13 +16,16 @@ public enum BotMove
|
||||
|
||||
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
[SerializeField] private bool isDebugTest = false;
|
||||
[SerializeField] private bool isDebugAITest = false;
|
||||
[SerializeField] private bool isDebugPlayerTest = false;
|
||||
|
||||
public bool IsDebugTest => isDebugTest;
|
||||
public bool IsDebugAITest => isDebugAITest;
|
||||
public bool IsDebugPlayerTest => isDebugPlayerTest;
|
||||
|
||||
[SerializeField] DiceRollHandler diceRollHandler;
|
||||
|
||||
[SerializeField] private int diceValue = 0;
|
||||
[SerializeField] private float botDiceRollDelay = 0.25f;
|
||||
[SerializeField] private int maxDiceSixRollCounter = 2;
|
||||
[SerializeField] private int totalStepsForCharacter = 57;
|
||||
|
||||
@ -151,7 +154,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
SetCanRollDiceForUser(!botTypesInGame.Contains(allPlayerTypes[0]));
|
||||
if (botTypesInGame.Contains(allPlayerTypes[0]))
|
||||
Invoke(nameof(HandleDiceRoll), 1f);
|
||||
HandleDiceRollWithDelay();
|
||||
}
|
||||
|
||||
private void HandleDiceRollWithDelay()
|
||||
{
|
||||
Invoke(nameof(HandleDiceRoll), botDiceRollDelay);
|
||||
}
|
||||
|
||||
private void InitBotRuntimeData()
|
||||
@ -509,6 +517,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
diceText.text = $"{diceRolledValue}";
|
||||
availPlayers = new List<PlayerPawn>();
|
||||
|
||||
if (!CanRollDiceAgain)
|
||||
UpdateActivePlayersAndSetDisplay(true);
|
||||
|
||||
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
||||
{
|
||||
canSwitchPlayer = false;
|
||||
@ -540,7 +551,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
else // if there are any other pawns that are in safe or moving state
|
||||
{
|
||||
// for player's logic
|
||||
UpdateActivePlayersAndSetDisplay(true);
|
||||
|
||||
int customAvailPlayers = availPlayers.Count();
|
||||
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
|
||||
@ -630,7 +640,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
private void HandleDiceRoll()
|
||||
{
|
||||
if (isDebugTest)
|
||||
if (isDebugAITest)
|
||||
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
|
||||
else
|
||||
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal));
|
||||
@ -702,25 +712,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Tile currentSittingTile = TilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex);
|
||||
if (currentSittingTile.IsSafeZone)
|
||||
{
|
||||
SafeTile safeTile = (SafeTile)currentSittingTile;
|
||||
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, selectedPawn);
|
||||
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
|
||||
SafeTile currentSittingSafeTile = (SafeTile)currentSittingTile;
|
||||
currentSittingSafeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, selectedPawn);
|
||||
|
||||
if (currentSittingSafeTile.PlayerTypesCount == 1) // && currentSittingSafeTile.ContainsPlayerType(selectedPawn.PlayerType))
|
||||
{
|
||||
var playerPawns = safeTile.GetPlayerPawns(selectedPawn.PlayerType);
|
||||
|
||||
if (safeTile.PlayerTypesCount == 1)
|
||||
{
|
||||
PlayerType playerType = safeTile.GetFirstPlayerType();
|
||||
|
||||
foreach (var pawn in playerPawns)
|
||||
pawn.MoveToCustomTilePosition(safeTile.CenterPlacementPosition);
|
||||
}
|
||||
|
||||
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
|
||||
{
|
||||
foreach (var pawn in playerPawns)
|
||||
ShowUpdatedPlayerCountOnTile(pawn);
|
||||
}
|
||||
var playerPawnsTest = currentSittingSafeTile.GetFirstPlayerPawns();
|
||||
foreach (var pawn in playerPawnsTest)
|
||||
pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -793,8 +792,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
diceSixRollCounter = 0;
|
||||
diceText.text = $"{0}";
|
||||
|
||||
UpdateActivePlayersAndSetDisplay(true);
|
||||
}
|
||||
|
||||
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
|
||||
@ -812,7 +809,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
||||
{
|
||||
Debug.Log($"Invoking RollDiceForBot");
|
||||
Invoke(nameof(HandleDiceRoll), 1f);
|
||||
HandleDiceRollWithDelay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ public class DiceRollHandler : MonoBehaviour
|
||||
SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>();
|
||||
soundManager?.PlayGameSoundClip(SoundType.Dice);
|
||||
|
||||
if (inputManager.GameplayManager.IsDebugTest)
|
||||
if (inputManager.GameplayManager.IsDebugPlayerTest)
|
||||
OnUserDiceRollComplete(GetDiceTestVal());
|
||||
else
|
||||
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
|
||||
|
||||
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
public class GameBootLoader : BootLoader
|
||||
{
|
||||
[SerializeField] private GameObject[] baseObjects;
|
||||
// [SerializeField] private BaseSO[] scriptables;
|
||||
[SerializeField] private bool enableLogs = false;
|
||||
|
||||
private bool hasInitializedScriptables = false;
|
||||
|
||||
@ -21,6 +21,7 @@ public class GameBootLoader : BootLoader
|
||||
}
|
||||
protected override void InitializeData()
|
||||
{
|
||||
Debug.unityLogger.logEnabled = enableLogs;
|
||||
Debug.Log($"InitializeData: for loaders");
|
||||
InitializeScriptablesData();
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ public class SafeTile : Tile
|
||||
public int PlayerTypesCount => playerTypesDict.Count;
|
||||
public bool HasMoreThanOnePlayerType => playerTypesDict.Count > 1;
|
||||
public List<PlayerPawn> GetPlayerPawns(PlayerType playerType) => playerTypesDict[playerType].playerPawns.Values.ToList();
|
||||
public List<PlayerPawn> GetFirstPlayerPawns() => playerTypesDict.FirstOrDefault().Value.playerPawns.Values.ToList();
|
||||
|
||||
public bool ContainsPlayerType(PlayerType playerType) => playerTypesDict.ContainsKey(playerType);
|
||||
|
||||
|
||||
@ -109,15 +109,24 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
||||
PlayerType initialPlayerType = targetSafeTile.GetFirstPlayerType();
|
||||
|
||||
// rearrange already existing player from center position to it's saved transform
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone initialPlayerType: {initialPlayerType}");
|
||||
var playerPawns = targetSafeTile.GetPlayerPawns(initialPlayerType);
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone playerPawns: {playerPawns.Count}");
|
||||
|
||||
foreach (var pawn in playerPawns)
|
||||
{
|
||||
var placementPoint = targetSafeTile.GetPlacementPoint(initialPlayerType);
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone placementPoint: {placementPoint.position}");
|
||||
pawn.MoveToCustomTilePosition(placementPoint.position);
|
||||
}
|
||||
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone playerPawn: {playerPawn.name}, {playerPawn.PlayerType}");
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
||||
|
||||
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
|
||||
|
||||
Debug.Log($"### GetAndInitPositionInsideSafeZone targetPosition: {targetPosition}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user