Compare commits
6 Commits
874e44a7f7
...
a291dff121
| Author | SHA1 | Date | |
|---|---|---|---|
| a291dff121 | |||
| 384356dc51 | |||
| 1f10a0a52e | |||
| be79221cbd | |||
| 025b13a400 | |||
| 4b2720759c |
@ -319,6 +319,90 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 28556634}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &34262131
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 34262132}
|
||||
- component: {fileID: 34262133}
|
||||
m_Layer: 0
|
||||
m_Name: Safe Tile img
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &34262132
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 34262131}
|
||||
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 3.212, z: 0}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 359456887}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
|
||||
--- !u!212 &34262133
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 34262131}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d20b33310cfd64c4f84b7443a0b6245b, type: 3}
|
||||
m_Color: {r: 0.31361735, g: 0.5568628, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3.84, y: 3.84}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &34897982
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2389,6 +2473,90 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 207890302}
|
||||
m_Mesh: {fileID: 4300004, guid: 25e0b84f10949354b96b98b3742acdde, type: 3}
|
||||
--- !u!1 &208504447
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 208504448}
|
||||
- component: {fileID: 208504449}
|
||||
m_Layer: 0
|
||||
m_Name: Safe Tile img
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &208504448
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 208504447}
|
||||
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 3.212, z: 0}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 937729790}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
|
||||
--- !u!212 &208504449
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 208504447}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d20b33310cfd64c4f84b7443a0b6245b, type: 3}
|
||||
m_Color: {r: 0.31361735, g: 0.5568628, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3.84, y: 3.84}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1001 &209365733
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8876,7 +9044,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
diceValue: 0
|
||||
diceValue: 6
|
||||
diceText: {fileID: 953941044}
|
||||
pointerDebug: {fileID: 102349503}
|
||||
pointerMeshRend: {fileID: 102349501}
|
||||
@ -9751,6 +9919,90 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 114033ff484fb492290f3118615ad4d8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &948796889
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 948796890}
|
||||
- component: {fileID: 948796891}
|
||||
m_Layer: 0
|
||||
m_Name: Safe Tile img
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &948796890
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 948796889}
|
||||
m_LocalRotation: {x: -0.64085644, y: -0.29883623, z: -0.29883623, w: 0.64085644}
|
||||
m_LocalPosition: {x: 0, y: 3.212, z: 0}
|
||||
m_LocalScale: {x: 0.49999994, y: 0.49999994, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 839569478}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
|
||||
--- !u!212 &948796891
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 948796889}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d20b33310cfd64c4f84b7443a0b6245b, type: 3}
|
||||
m_Color: {r: 0.31361735, g: 0.5568628, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3.84, y: 3.84}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &949967772
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -21369,6 +21621,90 @@ Transform:
|
||||
m_Father: {fileID: 777143461}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
||||
--- !u!1 &2006742110
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2006742111}
|
||||
- component: {fileID: 2006742112}
|
||||
m_Layer: 0
|
||||
m_Name: Safe Tile img
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2006742111
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2006742110}
|
||||
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 3.212, z: 0}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1778287703}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
|
||||
--- !u!212 &2006742112
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2006742110}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d20b33310cfd64c4f84b7443a0b6245b, type: 3}
|
||||
m_Color: {r: 0.31361735, g: 0.5568628, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3.84, y: 3.84}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &2015309188
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@ -80,6 +81,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void Initialize()
|
||||
{
|
||||
InterfaceManager.Instance?.RegisterInterface<GameplayManager>(this);
|
||||
DOTween.useSafeMode = false;
|
||||
}
|
||||
|
||||
public void InitializeData()
|
||||
@ -234,7 +236,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
Debug.Log($"Switching player");
|
||||
SwitchPlayer();
|
||||
CanRollDice = true;
|
||||
SetCanRollDiceForUser(currentPlayerTypeTurn, true);
|
||||
}
|
||||
// else if (botTypesInGame.Contains(currentPlayerTypeTurn) && CanRollDiceAgain)
|
||||
// {
|
||||
@ -310,7 +312,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: state: {playerPawn.GetPlayerState()}, possibleLandingIndex: {possibleLandingIndex > playerGameDatasDict[currentPlayerTypeTurn].endIndex}");
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: possibleTileData.IsSafeZone: {possibleTileData.IsSafeZone}");
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: possibleTileData.PlayerPawn: {possibleTileData.PlayerPawn}");
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: possibleTileData.PlayerPawn: {possibleTileData.HasPawnsAvailable}");
|
||||
|
||||
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || possibleLandingIndex > playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
||||
{
|
||||
@ -331,7 +333,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: safeMove");
|
||||
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.SafeMove;
|
||||
}
|
||||
else if (possibleTileData.PlayerPawn != null)
|
||||
else if (possibleTileData.HasPawnsAvailable)
|
||||
{
|
||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: attackMove");
|
||||
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.AttackMove;
|
||||
@ -414,7 +416,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
public void OnDiceRolled(int rolledVal)
|
||||
{
|
||||
CanRollDice = false;
|
||||
SetCanRollDiceForUser(currentPlayerTypeTurn, false);
|
||||
|
||||
// add core dice logic here
|
||||
Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}");
|
||||
@ -437,7 +439,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"### AreAllPawnsInFinishingPath");
|
||||
if (AreAllPawnsInFinishingPath())
|
||||
{
|
||||
CanRollDice = true;
|
||||
SetCanRollDiceForUser(currentPlayerTypeTurn, true);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -550,7 +552,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
|
||||
|
||||
CanRollDice = true;
|
||||
SetCanRollDiceForUser(playerPawn.PlayerType, true);
|
||||
UpdatePlayerState(playerPawn, PlayerState.InSafeZone);
|
||||
if (playerPawn.IsBotPlayer)
|
||||
CheckDiceRollForBot(playerPawn);
|
||||
@ -559,15 +561,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
return;
|
||||
}
|
||||
else if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath
|
||||
|| playerPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
||||
else if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath)
|
||||
{
|
||||
int finishingPathIndex = GetNextFinishingTileIndex(playerPawn);
|
||||
int targetIdx = finishingPathIndex + diceRolledValue > tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ?
|
||||
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
|
||||
|
||||
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
||||
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
||||
ApplyFinishingPathLogic(playerPawn);
|
||||
}
|
||||
else if (playerPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
||||
{
|
||||
tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).ResetPlayerPawn(playerPawn);
|
||||
ApplyFinishingPathLogic(playerPawn);
|
||||
}
|
||||
else if (playerPawn.GetPlayerState() == PlayerState.InSafeZone || playerPawn.GetPlayerState() == PlayerState.Moving)
|
||||
{
|
||||
@ -596,13 +597,24 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSittingTile.ResetPlayerPawn();
|
||||
currentSittingTile.ResetPlayerPawn(playerPawn);
|
||||
}
|
||||
|
||||
MoveThroughTiles(playerPawn, nextTileIdx, targetIndex: targetIdx);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFinishingPathLogic(PlayerPawn playerPawn)
|
||||
{
|
||||
int finishingPathIndex = GetNextFinishingTileIndex(playerPawn);
|
||||
int targetIdx = finishingPathIndex + diceRolledValue > tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ?
|
||||
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
|
||||
|
||||
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
||||
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
||||
}
|
||||
|
||||
|
||||
public int GetNextGeneralTileIndex(PlayerPawn playerPawn)
|
||||
{
|
||||
return playerPawn.CurrentTileIndex == tilesManager.GetGeneralTilesLength() - 1 ? 0 : playerPawn.CurrentTileIndex + 1;
|
||||
@ -710,25 +722,45 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
|
||||
if (!nextTile.IsSafeZone)
|
||||
{
|
||||
Debug.Log($"nextTile.PlayerPawn: {nextTile.PlayerPawn}, {nextTile.transform.name}");
|
||||
if (nextTile.PlayerPawn != null && playerPawn.PlayerType != nextTile.PlayerPawn.PlayerType)
|
||||
Debug.Log($"nextTile.HasPawnsAvailable: {nextTile.HasPawnsAvailable}");
|
||||
if (nextTile.HasPawnsAvailable && playerPawn.PlayerType != nextTile.CurrentHoldingPlayerType)
|
||||
{
|
||||
Debug.Log($"nextTile.PlayerPawn: {nextTile.CurrentHoldingPlayerType}, {nextTile.transform.name}");
|
||||
Debug.Log($"nextTile.TotalPawnsInTile: {nextTile.TotalPawnsInTile}");
|
||||
// play animation for moving back to base.
|
||||
// TODO :: Send existing pawn back to base.
|
||||
// means there's already a pawn there, move him back to the base.
|
||||
var playerBasePos = playerBaseHandler.GetPlayerBase(nextTile.PlayerPawn.PlayerType)
|
||||
.GetBasePlacementDataPosition(nextTile.PlayerPawn.PlayerId - 1);
|
||||
int counter = nextTile.TotalPawnsInTile;
|
||||
for (int i = counter; i > 0; i--)
|
||||
{
|
||||
var pawn = nextTile.GetPlayerPawn();
|
||||
Debug.Log($"pawn: {pawn}");
|
||||
Debug.Log($"playerBase: {playerBaseHandler}");
|
||||
|
||||
var playerBasePos = playerBaseHandler.GetPlayerBase(pawn.PlayerType)
|
||||
.GetBasePlacementDataPosition(pawn.PlayerId - 1);
|
||||
Debug.Log($"playerBasePos: {playerBasePos}");
|
||||
|
||||
playerGameDatasDict[nextTile.PlayerPawn.PlayerType].totalPawnsInHome++;
|
||||
nextTile.PlayerPawn.MoveBackToHome(playerBasePos);
|
||||
playerGameDatasDict[pawn.PlayerType].totalPawnsInHome++;
|
||||
pawn.MoveBackToHome(playerBasePos);
|
||||
}
|
||||
|
||||
CanRollDiceAgain = true;
|
||||
|
||||
if (playerPawn.IsBotPlayer)
|
||||
CheckDiceRollForBot(playerPawn);
|
||||
else
|
||||
SetCanRollDiceForUser(playerPawn.PlayerType, true);
|
||||
}
|
||||
|
||||
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||
}
|
||||
|
||||
SwitchPlayer(playerPawn);
|
||||
CanRollDice = true;
|
||||
if (!CanRollDiceAgain)
|
||||
{
|
||||
SetCanRollDiceForUser(playerPawn.PlayerType, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
index);
|
||||
@ -819,14 +851,16 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
|
||||
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
|
||||
|
||||
Debug.Log($"totalPawnsFinished: {playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished}, playerPawnsDict.Count: {playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count}");
|
||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished == playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count)
|
||||
{
|
||||
CanRollDiceAgain = false;
|
||||
|
||||
SwitchPlayer();
|
||||
if (allPlayerTypes.Contains(currentPlayerTypeTurn))
|
||||
allPlayerTypes.Remove(currentPlayerTypeTurn);
|
||||
|
||||
SwitchPlayer();
|
||||
|
||||
Debug.Log($"PlayerTypes: {allPlayerTypes.Count}");
|
||||
}
|
||||
else
|
||||
@ -841,9 +875,16 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
SwitchPlayer();
|
||||
}
|
||||
|
||||
CanRollDice = true;
|
||||
SetCanRollDiceForUser(playerPawn.PlayerType, true);
|
||||
}
|
||||
},
|
||||
index);
|
||||
}
|
||||
|
||||
private void SetCanRollDiceForUser(PlayerType playerType, bool state)
|
||||
{
|
||||
if (botTypesInGame.Contains(playerType)) return;
|
||||
|
||||
CanRollDice = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ public class PlayerBase : MonoBehaviour
|
||||
|
||||
public Transform GetBasePlacementDataPosition(int idx)
|
||||
{
|
||||
Debug.Log($"Index: {idx}, basePlacementDatas[idx]: {basePlacementDatas[idx]}");
|
||||
return basePlacementDatas[idx].placementTransform;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,18 +27,30 @@ public class Tile : MonoBehaviour
|
||||
|
||||
protected int lastOccupiedIndex = 0;
|
||||
|
||||
public PlayerPawn PlayerPawn // Change implementation
|
||||
private List<PlayerPawn> PlayerPawns = new List<PlayerPawn>(); // Change implementation
|
||||
|
||||
public bool HasPawnsAvailable => PlayerPawns.Count > 0;
|
||||
public PlayerType CurrentHoldingPlayerType => PlayerPawns[0].PlayerType;
|
||||
public int TotalPawnsInTile => PlayerPawns.Count;
|
||||
|
||||
public PlayerPawn GetPlayerPawn()
|
||||
{
|
||||
get; private set;
|
||||
var pawn = PlayerPawns[0];
|
||||
PlayerPawns.RemoveAt(0);
|
||||
return pawn;
|
||||
}
|
||||
|
||||
public virtual void InitPlayerPawn(PlayerPawn playerPawn, PlayerType playerType)
|
||||
{
|
||||
PlayerPawn = playerPawn;
|
||||
PlayerPawns.Add(playerPawn);
|
||||
Debug.Log($"Adding new PlayerPawn {playerPawn.name}, playerType: {playerType} to {name}");
|
||||
Debug.Log($"Adding new PlayerPawn {PlayerPawns.Count} {name}");
|
||||
}
|
||||
|
||||
public void ResetPlayerPawn()
|
||||
public void ResetPlayerPawn(PlayerPawn movingPawn)
|
||||
{
|
||||
PlayerPawn = null;
|
||||
PlayerPawns.Remove(movingPawn);
|
||||
Debug.Log($"Resetting new PlayerPawn {movingPawn.name} {name}");
|
||||
Debug.Log($"Resetting new PlayerPawn {PlayerPawns.Count} {name}");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user