Compare commits

...

7 Commits

Author SHA1 Message Date
9c650a348b Scene changes for properties. 2026-02-13 18:20:29 +05:30
8be8ffae15 Major Refactoring + fixes for new feedback logic + tiny visual fixes with dice logic. 2026-02-13 18:17:23 +05:30
b41e2990fc Updated with all the feedback fixes. 2026-02-12 21:34:08 +05:30
2563f36e7d Player Indication arrow added 2026-02-12 18:07:21 +05:30
b3a05ea6c3 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay
# Conflicts:
#	Assets/External-Assets/packages/Project/Scripts/Gameplay/Snake and Ladder/DiceView.cs
2026-02-12 14:57:31 +05:30
9db1a39af7 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay
# Conflicts:
#	Assets/External-Assets/packages/Project/Scripts/Gameplay/Snake and Ladder/DiceView.cs
2026-02-12 14:48:15 +05:30
3f68064a5f Restrict Dice roll interaction 2026-02-12 14:38:40 +05:30
27 changed files with 1062 additions and 202 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0017474de88684d92b1a05a4000550ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-2545934288178809719
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlayerIndication_anim
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 51b02f31ecde547eebbafa571745a246, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &-672237964412992765
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -2545934288178809719}
m_Position: {x: 200, y: 0, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -2545934288178809719}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Player Count
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -672237964412992765}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 75a4679d0223349d280cb4d1c51de929
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: e9d88b101d2ed46bd877d1bcb5ea1160
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 1d36c9b9ea1804a01987f56b706af9af
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,205 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlayerIndication_anim
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.33333334
value: {x: 1.3, y: 1.3, z: 1.3}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.6666667
value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path:
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 3
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.6666667
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.33333334
value: 1.3
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.6666667
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.x
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.33333334
value: 1.3
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.6666667
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.y
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.33333334
value: 1.3
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.6666667
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.z
path:
classID: 224
script: {fileID: 0}
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 51b02f31ecde547eebbafa571745a246
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -28,9 +28,12 @@ public class DiceView : MonoBehaviour, IBase
[SerializeField] private DiceSideData[] diceSideDatas;
[SerializeField] private Image diceImage;
[SerializeField] private Sprite defaultSprite;
[SerializeField] private Button diceButton;
[SerializeField] private RectTransform diceRectTransform;
[SerializeField] private int diceVal;
private Animator animator;
private List<int> probabilityValues = new List<int>() { 3, 4, 5 };
private List<int> probabilityValues = new List<int>() { 2, 3, 4 };
private Action<int> onRollingComplete = null;
private IRollBase rollBase = null;
@ -42,7 +45,6 @@ public class DiceView : MonoBehaviour, IBase
private void Awake()
{
animator = GetComponent<Animator>();
Debug.Log($"Dice roll test: StartRollingAction: animator: {animator}");
}
public void Roll(Action<int> onComplete, bool isBot)
@ -60,7 +62,6 @@ public class DiceView : MonoBehaviour, IBase
private void StartRollingAction()
{
Debug.Log($"Dice roll test: StartRollingAction: animator: {animator}, {gameObject.name}");
rolling = true;
rolledVal = 0;
// start animation
@ -80,6 +81,8 @@ public class DiceView : MonoBehaviour, IBase
{
rolledVal = GetDiceValue();
}
if (diceVal != 0) rolledVal = diceVal;
}
/*
@ -89,30 +92,27 @@ public class DiceView : MonoBehaviour, IBase
public void OnDiceRollingCompleted()
{
animator.ResetTrigger(Ludo_3D_Constants.RollDiceTriggerString);
Debug.Log($"Dice roll test: OnDiceRollingCompleted");
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
ResetRollData();
ResetData();
Debug.Log($"Dice roll test: Dice rolled: {rolledVal}");
onRollingComplete?.Invoke(rolledVal);
}
public void OnReturnedToIdle()
{
Debug.Log($"Dice roll test: OnReturnedToIdle: rolled: {rolledVal}");
Debug.Log($"DiceView :: OnReturnedToIdle: {rolledVal}");
animator.enabled = false;
if (rolledVal == 0)
{
diceImage.sprite = defaultSprite;
Debug.Log($"Dice roll test: OnReturnedToIdle: setting default sprite");
ShowDefaultSprite();
}
else
{
diceImage.sprite = diceSideDatas[rolledVal - 1].sprite;
}
Debug.Log($"Dice roll test: OnReturnedToIdle: diceImage.sprite: {diceImage.sprite.name}");
}
private int GetDiceValue()
@ -131,9 +131,20 @@ public class DiceView : MonoBehaviour, IBase
rolling = false;
}
public void SetDiceButtonInteraction(bool status)
{
diceButton.interactable = status;
}
public void ResetOnSessionEnd()
{
ResetData();
rolledVal = 0;
OnReturnedToIdle();
diceRectTransform.rotation = Quaternion.identity;
diceRectTransform.localScale = Vector3.one;
onRollingComplete = null;
}
@ -145,4 +156,10 @@ public class DiceView : MonoBehaviour, IBase
this.rollBase = rollBase;
}
public void ShowDefaultSprite()
{
Debug.Log($"DiceView :: ShowDefaultSprite");
diceImage.sprite = defaultSprite;
}
}

View File

@ -629,7 +629,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5526766409186502679}
playerCountCanvas: {fileID: 5728752331380905399}
playerIndicatorCanvas: {fileID: 5728752331380905399}
--- !u!1 &4818123989977612668
GameObject:
m_ObjectHideFlags: 0
@ -1593,7 +1593,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
value: 2.6
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -1607,6 +1607,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1334714064113256010, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1708578341718423809, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_TargetGraphic
value:

View File

@ -629,7 +629,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5274388487207906813}
playerCountCanvas: {fileID: 7923051124467737897}
playerIndicatorCanvas: {fileID: 7923051124467737897}
--- !u!1 &5059623752267150313
GameObject:
m_ObjectHideFlags: 0
@ -1579,18 +1579,6 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -1625,7 +1613,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
value: 2.6
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -1639,6 +1627,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1334714064113256010, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1708578341718423809, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_TargetGraphic
value:

View File

@ -201,7 +201,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 232863433340697214}
playerCountCanvas: {fileID: 1920934309388072333}
playerIndicatorCanvas: {fileID: 1920934309388072333}
--- !u!136 &1627116187348267135
CapsuleCollider:
m_ObjectHideFlags: 0
@ -1579,18 +1579,6 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -1625,7 +1613,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
value: 2.6
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -1639,6 +1627,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1334714064113256010, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1708578341718423809, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_TargetGraphic
value:

View File

@ -1258,7 +1258,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 7800412279828783518}
playerCountCanvas: {fileID: 941219433310479660}
playerIndicatorCanvas: {fileID: 941219433310479660}
--- !u!1 &7074820051352815849
GameObject:
m_ObjectHideFlags: 0
@ -1593,7 +1593,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
value: 2.6
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -1607,6 +1607,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1334714064113256010, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1708578341718423809, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_TargetGraphic
value:

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 65645560966781747}
- component: {fileID: 2858063052804912079}
- component: {fileID: 8752947010238866161}
- component: {fileID: 130026720339915370}
m_Layer: 5
m_Name: Player Count
m_TagString: Untagged
@ -28,7 +29,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 8089047016482236660}
- {fileID: 6813413954384782979}
@ -37,8 +38,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0.1}
m_SizeDelta: {x: -0.40000004, y: -0.2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2858063052804912079
CanvasRenderer:
@ -68,7 +69,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: d683a4be9f87743d3b78b0b8761f8f1a, type: 3}
m_Sprite: {fileID: 21300000, guid: 1d36c9b9ea1804a01987f56b706af9af, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -78,6 +79,27 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!95 &130026720339915370
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1950433650452808236}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 75a4679d0223349d280cb4d1c51de929, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1 &3121570579764810185
GameObject:
m_ObjectHideFlags: 0
@ -113,8 +135,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.014999993}
m_SizeDelta: {x: 0.030000001, y: 0.000000013969839}
m_AnchoredPosition: {x: 0, y: -0.006000042}
m_SizeDelta: {x: 0, y: 0.012}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6912280764899309526
CanvasRenderer:
@ -144,7 +166,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: af3141ba5ffc841798e2e04325a2bc4a, type: 3}
m_Sprite: {fileID: 21300000, guid: e9d88b101d2ed46bd877d1bcb5ea1160, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -176,7 +198,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &953143927943285832
RectTransform:
m_ObjectHideFlags: 0
@ -186,7 +208,7 @@ RectTransform:
m_GameObject: {fileID: 4879164135252893718}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1.3, y: 1.7, z: 2}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 65645560966781747}
@ -195,7 +217,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 8.79}
m_AnchoredPosition: {x: 0, y: 9}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &5587250865659051320
@ -242,7 +264,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &2739169735767897497
MonoBehaviour:
m_ObjectHideFlags: 0
@ -323,7 +345,7 @@ MonoBehaviour:
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_TargetGraphic: {fileID: 6293990703772930473}
m_OnClick:
m_PersistentCalls:
m_Calls: []
@ -374,7 +396,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &6813413954384782979
RectTransform:
m_ObjectHideFlags: 0

View File

@ -248,3 +248,6 @@ MonoBehaviour:
sprite: {fileID: -387705599, guid: bbe0ebcb7b6854733a0dd63492c4d57d, type: 3}
diceImage: {fileID: 3592825875980183606}
defaultSprite: {fileID: 1572130339, guid: 2c0526d99bc3843a4b73e6eb2f3b1376, type: 3}
diceButton: {fileID: 1882416428171655661}
diceRectTransform: {fileID: 4547155689416384467}
diceVal: 0

View File

@ -1264,6 +1264,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7994886322184003359, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8499714619200364116, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 12.69047
@ -1603,6 +1607,10 @@ PrefabInstance:
propertyPath: m_Name
value: Pirate (Grey) (4)
objectReference: {fileID: 0}
- target: {fileID: 8742875858490740670, guid: d26746f94e9bc44998992db177b0926d, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d26746f94e9bc44998992db177b0926d, type: 3}
--- !u!1 &86529552
@ -1933,6 +1941,10 @@ PrefabInstance:
propertyPath: m_Name
value: Pirate (Grey) (2)
objectReference: {fileID: 0}
- target: {fileID: 8742875858490740670, guid: d26746f94e9bc44998992db177b0926d, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d26746f94e9bc44998992db177b0926d, type: 3}
--- !u!1 &136321829
@ -3577,6 +3589,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1841959051}
m_Modifications:
- target: {fileID: 3205706632183164804, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4643894104949937496, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_Name
value: Pirate (Blue) (2)
@ -5049,6 +5065,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1094154913}
m_Modifications:
- target: {fileID: 1011126093537271578, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5040387473618948274, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_Name
value: Pirate (Green) (2)
@ -5308,6 +5328,10 @@ PrefabInstance:
propertyPath: m_Name
value: Pirate (Grey) (3)
objectReference: {fileID: 0}
- target: {fileID: 8742875858490740670, guid: d26746f94e9bc44998992db177b0926d, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d26746f94e9bc44998992db177b0926d, type: 3}
--- !u!1 &543219273
@ -5467,6 +5491,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1841959051}
m_Modifications:
- target: {fileID: 3205706632183164804, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4643894104949937496, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_Name
value: Pirate (Blue) (4)
@ -7792,6 +7820,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7994886322184003359, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
--- !u!1 &833894784
@ -8460,10 +8492,12 @@ MonoBehaviour:
isDebugPlayerTest: 0
diceRollHandler: {fileID: 1013177415}
diceValue: 0
botDiceRollDelay: 0.25
diceRollDelayForBot: 0.5
diceRollDelayForUser: 0.5
maxDiceSixRollCounter: 2
totalStepsForCharacter: 57
currentPlayerTurnMaxTime: 4
currentPlayerSelectionMaxTime: 4
diceText: {fileID: 953941044}
pointerDebug: {fileID: 102349503}
pointerMeshRend: {fileID: 102349501}
@ -8690,6 +8724,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: -0.022962524
objectReference: {fileID: 0}
- target: {fileID: 3205706632183164804, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3355085080137322900, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 72.00588
@ -11098,6 +11136,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7994886322184003359, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8499714619200364116, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 3.9168587
@ -13218,6 +13260,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1094154913}
m_Modifications:
- target: {fileID: 1011126093537271578, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5040387473618948274, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_Name
value: Pirate (Green) (4)
@ -14382,7 +14428,7 @@ MonoBehaviour:
- {fileID: 1107252688}
- {fileID: 1406544794}
- {fileID: 884011400}
enableLogs: 1
enableLogs: 0
--- !u!4 &1335794571
Transform:
m_ObjectHideFlags: 0
@ -15003,6 +15049,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1841959051}
m_Modifications:
- target: {fileID: 3205706632183164804, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4643894104949937496, guid: d464472cfaa7a45ca9d11bc25d05e025, type: 3}
propertyPath: m_Name
value: Pirate (Blue) (3)
@ -15793,6 +15843,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1094154913}
m_Modifications:
- target: {fileID: 1011126093537271578, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5040387473618948274, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_Name
value: Pirate (Green) (3)
@ -17588,6 +17642,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7994886322184003359, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b90e5cd95dff44f94b9151a2e535a0f8, type: 3}
--- !u!1001 &1763545631
@ -21716,6 +21774,10 @@ PrefabInstance:
propertyPath: m_Name
value: Pirate (Grey) (1)
objectReference: {fileID: 0}
- target: {fileID: 8742875858490740670, guid: d26746f94e9bc44998992db177b0926d, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d26746f94e9bc44998992db177b0926d, type: 3}
--- !u!1 &1835930482367990250
@ -27747,6 +27809,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1094154913}
m_Modifications:
- target: {fileID: 1011126093537271578, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5040387473618948274, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
propertyPath: m_Name
value: Pirate (Green) (1)

View File

@ -4,6 +4,8 @@ using System.Linq;
using DG.Tweening;
using UnityEngine;
using System.Collections.Generic;
using System.Threading;
using UnityEngine.Serialization;
public enum BotMove
{
@ -25,10 +27,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
[SerializeField] DiceRollHandler diceRollHandler;
[SerializeField] private int diceValue = 0;
[SerializeField] private float botDiceRollDelay = 0.25f;
[SerializeField] private float diceRollDelayForBot = 0.5f;
[SerializeField] private float diceRollDelayForUser = 0.5f;
[SerializeField] private int maxDiceSixRollCounter = 2;
[SerializeField] private int totalStepsForCharacter = 57;
[SerializeField] private int currentPlayerTurnMaxTime = 5;
[SerializeField] private int currentPlayerSelectionMaxTime = 5;
[SerializeField] private TextMeshProUGUI diceText;
@ -42,7 +46,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
[SerializeField] private PlayerGameData[] playerGameDatas;
[SerializeField] private PlayerBaseHandler playerBaseHandler;
public PlayerType CurrentPlayerTypeTurn => currentPlayerTypeTurn;
public PlayerBaseHandler PlayerBaseHandler => playerBaseHandler;
private PlayerType currentPlayerTypeTurn;
@ -129,8 +132,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
InitCurrentGamePlayerInfo();
// SetCanRollDiceForUser(true);
}
public void InitPlayerTypesForBotMatch(PlayerData selectedPlayerData, int botCount)
@ -169,7 +170,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void HandleDiceRollWithDelay()
{
Invoke(nameof(RollDiceForBot), botDiceRollDelay);
Invoke(nameof(RollDiceForBot), diceRollDelayForBot);
}
private void InitBotRuntimeData()
@ -240,37 +241,49 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, false);
currentPlayerTypeTurn = playerType;
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, true);
UpdateTurnTimer();
}
private void UpdateTurnTimer()
private void UpdateDiceView()
{
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
diceRollHandler.DiceView.ShowDefaultSprite();
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
}
private void UpdateDiceViewForBot()
{
UpdateDiceView();
HandleDiceRollWithDelay();
}
private void UpdateResponseTimerForUser(int currentPlayerMaxTime, Action onComplete)
{
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot)
{
bool isBotTurn = botTypesInGame.Contains(currentPlayerTypeTurn);
SetCanRollDiceForUser(!isBotTurn);
// SetCanRollDiceForUser(!isBotTurn); // TODO :: Need to change
if (isBotTurn)
{
currentPlayerTurnTimer.KillTimer();
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
return;
}
}
else
SetCanRollDiceForUser(true);
// else
// SetCanRollDiceForUser(true); // TODO :: Need to change
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerTurnMaxTime);
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerMaxTime);
if (currentPlayerTurnTimer == null)
currentPlayerTurnTimer = new TimerSystem();
currentPlayerTurnTimer.Init(currentPlayerTurnMaxTime, onComplete: () =>
currentPlayerTurnTimer.Init(currentPlayerMaxTime, onComplete: () =>
{
Debug.Log($"currentPlayerTurnTimer: HandleDiceViewForUser");
RollDiceForUser();
onComplete?.Invoke();
}, inProgress: (remTime) =>
{
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerTurnMaxTime - (int)remTime);
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerMaxTime - (int)remTime);
});
}
@ -295,6 +308,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void InitCurrentGamePlayerInfo()
{
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
SetCanRollDiceForUser(IsUsersTurn());
UpdateDiceView();
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
#if UNITY_EDITOR
@ -336,11 +351,15 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
}
public void EnablePlayerSelectionStates(bool state)
public void SetPlayerSelectionStates(bool state, Predicate<PlayerState> skipPredicate = null)
{
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
{
if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath) continue;
if (skipPredicate != null && skipPredicate.Invoke(playerPawn.Value.GetPlayerState()))
{
playerPawn.Value.SetPlayerSelectionState(false);
continue;
}
playerPawn.Value.SetPlayerSelectionState(state);
}
@ -348,7 +367,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnDiceInteracted()
{
ResetCurrentPlayerTurnTimer();
RollDiceForUser();
}
@ -410,10 +428,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"SelectPawnFromBotBase: availPlayers.Count(): {availPlayersToMove.Count()}, CanRollDiceAgain: {CanRollDiceAgain}");
InitActivePlayers();
#if UNITY_EDITOR
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
{
UpdateActivePlayersAndSetDisplay(true);
SetDisplayCountForAllAvailPlayers(true);
}
#endif
if (CanRollDiceAgain) // got a 6 roll value
{
@ -513,9 +534,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
return;
}
if (CanRollDiceAgain)
{
RollDiceForBot();
}
else
SwitchPlayer();
}
@ -571,6 +594,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
private bool HasNoPlayersTravelling() => Mathf.Abs(availPlayersToMove.Count - playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath) < 1;
private bool IsUsersTurn() => gameModeHandler.CurrentGameModeType != GameModeType.Bot ||
!botTypesInGame.Contains(currentPlayerTypeTurn);
public void OnDiceRolled(int rolledVal)
{
@ -581,11 +607,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceRolledValue = rolledVal;
diceText.text = $"{diceRolledValue}";
if (!CanRollDiceAgain)
if (!CanRollDiceAgain) // remove this check for showing arrow logic
{
#if UNITY_EDITOR
SetDisplayCountForAllAvailPlayers(true);
#endif
}
FilterAvailablePlayersToMove();
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
{
canSwitchPlayer = false;
@ -594,8 +623,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
CanRollDiceAgain = true;
diceSixRollCounter++;
if (botTypesInGame != null && !botTypesInGame.Contains(currentPlayerTypeTurn))
if (IsUsersTurn())
{
Debug.Log($"availPlayersToMove.Count < 1: {availPlayersToMove.Count < 1} || HasNoPlayersTravelling(): {HasNoPlayersTravelling()}");
if (availPlayersToMove.Count < 1 || HasNoPlayersTravelling())
{
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
@ -608,78 +638,108 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
else
{
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome < 1 && CanMoveSoloPlayer())
{
SetPlayerSelectionStates(false);
OnPawnSelected(availPlayersToMove[0]);
return;
}
}
}
#if UNITY_EDITOR
pointerMeshRend.material = selectMat;
#endif
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath)
playerPawn.Value.SetPlayerSelectionState(false);
Debug.Log($"### AreAllPawnsInFinishingPath");
if (AreAllPawnsInFinishingPath())
{
SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn));
SetCanRollDiceForUser(IsUsersTurn());
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => RollDiceForUser());
CheckForMaxDiceRollAttempt();
return;
}
Debug.Log($"### EnablePlayerSelectionStates");
EnablePlayerSelectionStates(true);
// pointerMeshRend.materials[0] = selectMat;
SetPlayerSelectionStates(true, (state) => state == PlayerState.InFinishingPath || state == PlayerState.HasFinished);
}
else // if there are any other pawns that are in safe or moving state
else
{
Debug.Log($"before CustomAvailablePlayers: {availPlayersToMove.Count}");
List<int> indexesToRemove = new List<int>();
for (int i = 0; i < availPlayersToMove.Count; i++)
{
Debug.Log($"## playerPawn.GetPlayerState(): {availPlayersToMove[i].GetPlayerState()}");
if (availPlayersToMove[i].GetPlayerState() == PlayerState.InFinishingPath)
{
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayersToMove[i].CurrentTileIndex}");
if (diceRolledValue <= TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayersToMove[i].CurrentTileIndex + 1))
{
availPlayersToMove[i].SetPlayerSelectionState(true);
}
else
{
indexesToRemove.Add(i);
availPlayersToMove[i].SetPlayerSelectionState(false);
availPlayersToMove[i].ShowPlayerCountCanvas(false);
}
continue;
}
availPlayersToMove[i].SetPlayerSelectionState(true);
}
for (int idx = indexesToRemove.Count - 1; idx >= 0; idx--)
availPlayersToMove.RemoveAt(idx);
Debug.Log($"CustomAvailablePlayers: {availPlayersToMove.Count}");
canSwitchPlayer = availPlayersToMove.Count < 1;
CanRollDiceAgain = false;
if (botTypesInGame != null && !botTypesInGame.Contains(currentPlayerTypeTurn) &&
availPlayersToMove.Count > 0)
}
diceRollHandler.DiceView.SetDiceButtonInteraction(CanRollDiceAgain);
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
if (IsUsersTurn())
{
Action onComplete = null;
if (CanRollDiceAgain && availPlayersToMove.Count < 1 &&
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
{
onComplete = () => OnPawnSelected(playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values
.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome));
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
}
else if (availPlayersToMove.Count > 0)
{
if (CanRollDiceAgain && playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
{
onComplete = () => OnPawnSelected(playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values
.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome));
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
return;
}
if (CanMoveSoloPlayer())
{
EnablePlayerSelectionStates(false);
SetPlayerSelectionStates(false);
OnPawnSelected(availPlayersToMove[0]);
return;
}
onComplete = () => OnPawnSelected(availPlayersToMove.OrderByDescending(pawn => pawn.StepsTaken).FirstOrDefault());
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
}
}
}
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
private void FilterAvailablePlayersToMove()
{
List<int> indexesToRemove = new List<int>();
for (int i = 0; i < availPlayersToMove.Count; i++)
{
Debug.Log($"## playerPawn.GetPlayerState(): {availPlayersToMove[i].GetPlayerState()}");
if (availPlayersToMove[i].GetPlayerState() == PlayerState.InFinishingPath)
{
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayersToMove[i].CurrentTileIndex}");
if (diceRolledValue <= TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayersToMove[i].CurrentTileIndex + 1))
{
availPlayersToMove[i].SetPlayerSelectionState(true);
}
else
{
indexesToRemove.Add(i);
availPlayersToMove[i].SetPlayerSelectionState(false);
#if UNITY_EDITOR
availPlayersToMove[i].ShowPlayerCountCanvas(false);
#endif
}
continue;
}
availPlayersToMove[i].SetPlayerSelectionState(true);
}
for (int idx = indexesToRemove.Count - 1; idx >= 0; idx--)
availPlayersToMove.RemoveAt(idx);
}
private bool CanMoveSoloPlayer()
@ -697,12 +757,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
return false;
}
private void UpdateActivePlayersAndSetDisplay(bool state)
{
InitActivePlayers();
SetDisplayCountForAllAvailPlayers(state);
}
private void InitActivePlayers()
{
availPlayersToMove = new List<PlayerPawn>();
@ -734,6 +788,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void UpdatePlayerState(PlayerPawn playerPawn, PlayerState playerState)
{
if (!playerPawn)
{
// Debug.LogError($"Player pawn is null");
return;
}
Debug.Log($"#### UpdatePlayerState ");
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId] = playerPawn;
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].SetPlayerState(playerState);
@ -750,6 +810,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void RollDiceForUser()
{
ResetCurrentPlayerTurnTimer();
InitActivePlayers();
bool canUsePawnsFromHome = CanUsePawnsFromHome();
diceRollHandler.HandleDiceViewForUser(
@ -759,6 +820,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void RollDiceForBot()
{
ResetCurrentPlayerTurnTimer();
InitActivePlayers();
HandleDiceRollForBot();
}
@ -790,33 +852,42 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnPawnSelected(PlayerPawn selectedPawn)
{
EnablePlayerSelectionStates(false);
// TODO :: Hide the selectable characters indicator here
SetPlayerSelectionStates(false);
if (IsUsersTurn()) currentPlayerTurnTimer.KillTimer();
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
Debug.Log($"playerPawn.GetPlayerState(): {selectedPawn.GetPlayerState()}");
#if UNITY_EDITOR
selectedPawn.ShowPlayerCountCanvas(false);
#endif
if (selectedPawn.GetPlayerState() == PlayerState.InHome)
{
Tile targetTile = TilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
selectedPawn.ShowPlayerCountCanvas(false);
selectedPawn.MoveToTile(
TilesManager.GetAndInitPositionInsideSafeZone(selectedPawn, targetTile, currentPlayerTypeTurn),
onComplete: () =>
{
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
UpdatePlayerState(selectedPawn, PlayerState.InSafeZone);
#if UNITY_EDITOR
ShowUpdatedPlayerCountOnTile(selectedPawn);
#endif
if (CheckForMaxDiceRollAttempt())
{
return;
}
if (selectedPawn.IsBotPlayer)
CheckDiceRollForBot();
else
UpdateTurnTimer();
{
SetCanRollDiceForUser(IsUsersTurn());
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
}
}, playerGameData.startIndex);
return;
@ -826,12 +897,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Tile currentSittingTile = TilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex);
currentSittingTile.ResetPlayerPawn(selectedPawn);
#if UNITY_EDITOR
if (currentSittingTile.HasPawnsAvailable)
{
var playerPawns = currentSittingTile.GetPlayerPawns();
foreach (var pawn in playerPawns)
ShowUpdatedPlayerCountOnTile(pawn);
}
#endif
ApplyFinishingPathLogic(selectedPawn);
}
@ -864,22 +937,26 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
}
#if UNITY_EDITOR
if (currentSittingSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
{
var playerPawns = currentSittingSafeTile.GetPlayerPawns(currentPlayerTypeTurn);
foreach (var pawn in playerPawns)
ShowUpdatedPlayerCountOnTile(pawn);
}
#endif
}
else
{
currentSittingTile.ResetPlayerPawn(selectedPawn);
#if UNITY_EDITOR
if (currentSittingTile.HasPawnsAvailable)
{
var playerPawns = currentSittingTile.GetPlayerPawns();
foreach (var pawn in playerPawns)
ShowUpdatedPlayerCountOnTile(pawn);
}
#endif
}
MoveThroughTiles(selectedPawn, nextTileIdx, targetIndex: targetIdx);
@ -894,7 +971,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
playerPawn.ShowPlayerCountCanvas(false);
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
}
@ -914,7 +990,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"before SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
UpdateActivePlayersAndSetDisplay(false);
InitActivePlayers();
#if UNITY_EDITOR
SetDisplayCountForAllAvailPlayers(false);
#endif
Debug.Log($"after SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
Debug.Log($"after allPlayerTypes.Count: {allPlayerTypes.Count}");
@ -936,14 +1015,33 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
soundManager.PlayGameSoundClip(SoundType.Turn);
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
Debug.Log($"IsUsersTurn: {IsUsersTurn()}");
if (IsUsersTurn())
{
SetCanRollDiceForUser(true);
Invoke(nameof(UpdateDiceView), diceRollDelayForUser);
}
else
{
SetCanRollDiceForUser(false);
currentPlayerTurnTimer.KillTimer();
Invoke(nameof(UpdateDiceViewForBot), diceRollDelayForBot);
}
diceSixRollCounter = 0;
diceText.text = $"{0}";
}
else
{
UpdateTurnTimer();
}
// else
// {
// UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
//
// if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
// {
// Debug.Log($"Invoking RollDiceForBot");
// HandleDiceRollWithDelay();
// }
// }
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
@ -953,36 +1051,22 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
pointerMeshRend.material = turnMat;
// pointerMeshRend.materials[0] = turnMat;
#endif
}
// Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
private void OnCanRollDiceAgain(PlayerPawn playerPawn = null)
{
if (playerPawn)
UpdatePlayerState(playerPawn, TilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving);
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
{
Debug.Log($"Invoking RollDiceForBot");
HandleDiceRollWithDelay();
}
}
#if UNITY_EDITOR
private void SetCurrentSelectedPointer()
{
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
}
#endif
public void SetDisplayCountForAllAvailPlayers(bool state)
{
if (state)
{
availPlayersToMove.ForEach(pawn => ShowUpdatedPlayerCountOnTile(pawn));
}
else
{
availPlayersToMove.ForEach(pawn => pawn.ShowPlayerCountCanvas(false));
}
}
private void MoveThroughTiles(PlayerPawn playerPawn, int index, int targetIndex)
{
Tile nextTile = TilesManager.RetrieveTileBasedOnIndex(index);
@ -1000,7 +1084,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
Debug.Log($"tile targetPosition: {targetPosition}");
playerPawn.ShowPlayerCountCanvas(false);
#if UNITY_EDITOR
playerPawn.ShowPlayerCountCanvas(false); // TODO :: Check if call can be removed
#endif
playerPawn.MoveToTile(
targetPosition,
@ -1036,7 +1122,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
if (CanRollDiceAgain)
{
#if UNITY_EDITOR
ShowUpdatedPlayerCountOnTile(playerPawn);
#endif
}
if (!nextTile.IsSafeZone)
{
@ -1065,14 +1155,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
CanRollDiceAgain = true;
if (!playerPawn.IsBotPlayer)
{
UpdateTurnTimer();
}
}
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
#if UNITY_EDITOR
ShowUpdatedPlayerCountOnTile(playerPawn);
#endif
if (CheckForMaxDiceRollAttempt())
{
@ -1086,8 +1174,19 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
return;
}
}
if (!CanRollDiceAgain) SwitchPlayer(playerPawn);
else
{
if (IsUsersTurn())
{
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
SetCanRollDiceForUser(IsUsersTurn());
}
SwitchPlayer(playerPawn);
OnCanRollDiceAgain(playerPawn);
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
}
}
},
index);
@ -1096,8 +1195,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void CheckForGamePause(Action onComplete)
{
Debug.Log($"CheckForGamePause: {GameManager.CurrentGameState == GameState.IsPaused}");
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && !botTypesInGame.Contains(currentPlayerTypeTurn)
&& GameManager.CurrentGameState == GameState.IsPaused)
if ((botTypesInGame == null || !botTypesInGame.Contains(currentPlayerTypeTurn)) &&
GameManager.CurrentGameState == GameState.IsPaused)
{
OnGameResumed = onComplete;
}
@ -1137,6 +1236,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// ShowUpdatedPlayerCountOnTile(playerPawn);
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
playerPawn.SetPlayerSelectionState(false);
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath--;
@ -1178,8 +1278,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
CheckDiceRollForBot();
else
{
UpdateTurnTimer();
SetCanRollDiceForUser(true);
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
}
diceRollHandler.DiceView.SetDiceButtonInteraction(CanRollDiceAgain);
}
}
else
@ -1193,9 +1296,15 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
if (CanRollDiceAgain)
{
SetCanRollDiceForUser(IsUsersTurn());
OnCanRollDiceAgain();
#if UNITY_EDITOR
ShowUpdatedPlayerCountOnTile(playerPawn);
SwitchPlayer();
#endif
}
else
SwitchPlayer();
}
}
},
@ -1208,6 +1317,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
}
#if UNITY_EDITOR
private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn)
{
Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ?
@ -1228,22 +1338,44 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"ShowUpdatedPlayerCountOnTile: {count}");
playerPawn.PlayerCountCanvas.SetPlayerCount(count);
playerPawn.PlayerIndicatorCanvas.SetPlayerCount(count);
}
private void SetCurrentSelectedPointer()
{
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
}
public void SetDisplayCountForAllAvailPlayers(bool state)
{
if (state)
{
availPlayersToMove.ForEach(pawn => ShowUpdatedPlayerCountOnTile(pawn));
}
else
{
availPlayersToMove.ForEach(pawn => pawn.ShowPlayerCountCanvas(false));
}
}
#endif
public void ResetTileDatasForPlayers()
{
foreach (PlayerData data in playerDatas)
{
var pawns = playerGameDatasDict[data.playerType].playerPawnsDict.Values;
// causes null ref cast exception while player is moving.
// foreach (PlayerData data in playerDatas)
// {
// var pawns = playerGameDatasDict[data.playerType].playerPawnsDict.Values;
//
// foreach (var pawn in pawns)
// {
// if (pawn.GetPlayerState() == PlayerState.InHome) continue;
//
// TilesManager.ResetTileData(pawn.PlayerType, pawn.CurrentTileIndex, pawn.GetPlayerState());
// }
// }
foreach (var pawn in pawns)
{
if (pawn.GetPlayerState() == PlayerState.InHome) continue;
TilesManager.ResetTileData(pawn.PlayerType, pawn.CurrentTileIndex, pawn.GetPlayerState());
}
}
TilesManager.ResetTileDatas();
}
public void ResetData()
@ -1252,7 +1384,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceRollHandler.DiceView.ResetOnSessionEnd();
ResetGameRestartData();
currentPlayerTurnTimer.KillTimer();
currentPlayerTurnTimer = null;
OnGameResumed = null;
playerDatas = null;
allPlayerTypes = null;

View File

@ -1,6 +1,7 @@
using System;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Serialization;
public enum PlayerState
{
@ -21,12 +22,12 @@ public class PlayerPawn : MonoBehaviour
{
[SerializeField] private PlayerState playerState;
[SerializeField] private Animator animator;
[SerializeField] private PlayerCountCanvas playerCountCanvas;
[SerializeField] private PlayerIndicatorCanvas playerIndicatorCanvas;
private PlayerBase playerBase;
private GameplayManager gameplayManager;
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
public PlayerIndicatorCanvas PlayerIndicatorCanvas => playerIndicatorCanvas;
public int PlayerId { get; private set; }
public int StepsTaken { get; private set; }
@ -43,6 +44,8 @@ public class PlayerPawn : MonoBehaviour
public void SetPlayerSelectionState(bool state)
{
CanSelectPlayer = state;
Debug.Log($"### SetPlayerSelectionState: {name} :: {state}, ");
ShowPlayerSelCanvas(state);
}
public void MoveToTile(Vector3 startingPoint, Action onComplete, int tileIndex)
@ -61,7 +64,7 @@ public class PlayerPawn : MonoBehaviour
// Rotate Player
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
SetGameplayManager();
Vector3 lookDirection = Vector3.zero;
@ -121,7 +124,7 @@ public class PlayerPawn : MonoBehaviour
transform.position = transformData.position;
transform.rotation = transformData.rotation;
SetPlayerState(PlayerState.InHome);
ShowPlayerCountCanvas(false);
ShowPlayerSelCanvas(false);
StepsTaken = 0;
}
@ -156,7 +159,13 @@ public class PlayerPawn : MonoBehaviour
public void ShowPlayerCountCanvas(bool show)
{
playerCountCanvas.gameObject.SetActive(show);
// add the player count canvas to the object and show from here.
// playerIndicatorCanvas.gameObject.SetActive(show);
}
public void ShowPlayerSelCanvas(bool show)
{
playerIndicatorCanvas.gameObject.SetActive(show);
}
public void ResetData()
@ -164,8 +173,7 @@ public class PlayerPawn : MonoBehaviour
SetPlayerState(PlayerState.InHome);
StepsTaken = 0;
PlayerId = 0;
if (playerCountCanvas.gameObject.activeInHierarchy)
ShowPlayerCountCanvas(false);
if (playerIndicatorCanvas.gameObject.activeInHierarchy)
ShowPlayerSelCanvas(false);
}
}

View File

@ -90,6 +90,7 @@ public class SafeTile : Tile
public override void ResetTileData()
{
Debug.Log($"Resetting tile in safe tile {name}");
if (playerTypesDict != null && playerTypesDict.Count > 0)
{
playerTypesDict.Clear();

View File

@ -56,6 +56,7 @@ public class Tile : MonoBehaviour
public virtual void ResetTileData()
{
Debug.Log($"Resetting tile in parent tile {name}");
if (HasPawnsAvailable)
PlayerPawns.Clear();
}

View File

@ -77,6 +77,8 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
finishingTileDataPairs.Clear();
}
// causes null ref cast exception while player is moving.
/*
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
{
if (playerState == PlayerState.InFinishingPath || playerState == PlayerState.HasFinished)
@ -95,6 +97,21 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
tile.ResetTileData();
}
}
*/
public void ResetTileDatas()
{
foreach (var tile in generalTiles)
tile.ResetTileData();
foreach (var pair in finishingTileDataPairs)
{
foreach (var tile in finishingTileDataPairs[pair.Key])
{
tile.ResetTileData();
}
}
}
public Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile, PlayerType currentPlayerTypeTurn)
{

View File

@ -46,12 +46,12 @@ public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void UpdatePlayerTurnText(PlayerType type, int remSec)
{
screenManager.GetScreen<GameHUDS>(ScreenType.InGameHUDScreen).UpdatePlayerTurnText(type, remSec);
screenManager.GetScreen<GameHUDScreen>(ScreenType.InGameHUDScreen).UpdatePlayerTurnText(type, remSec);
}
public void UpdatePlayerTurnText(PlayerType type)
{
screenManager.GetScreen<GameHUDS>(ScreenType.InGameHUDScreen).UpdateBotTurnText(type);
screenManager.GetScreen<GameHUDScreen>(ScreenType.InGameHUDScreen).UpdateBotTurnText(type);
}
public void OnGameOver()

View File

@ -1,10 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System.Collections;
public class GameHUDS : ScreenBase
public class GameHUDScreen : ScreenBase
{
[Header("Buttons")]
[SerializeField] private Button diceBtn;
[SerializeField] private Button pauseBtn;
@ -55,13 +55,13 @@ public class GameHUDS : ScreenBase
public void UpdatePlayerTurnText(PlayerType playerType, int remSec)
{
Debug.Log($"GameHUDS: UpdatePlayerTurnText: {playerType}");
Debug.Log($"UpdateTurnText: Player Turn :: {(PlayerColorType)((int)playerType)} ({remSec})");
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)} ({remSec})";
}
public void UpdateBotTurnText(PlayerType playerType)
{
Debug.Log($"GameHUDS: UpdatePlayerTurnText: {playerType}");
Debug.Log($"UpdateTurnText: Bot Turn :: {(PlayerColorType)((int)playerType)}");
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)}";
}
}

View File

@ -2,7 +2,7 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PlayerCountCanvas : MonoBehaviour
public class PlayerIndicatorCanvas : MonoBehaviour
{
Transform cam;
[SerializeField] private TMP_Text playerCountText;
@ -21,18 +21,22 @@ public class PlayerCountCanvas : MonoBehaviour
indicatorBtn.onClick.RemoveListener(() => OnClickPlayer());
}
void Start()
private void Start()
{
cam = GameObject.FindGameObjectWithTag("MainCamera").transform;
}
void LateUpdate()
private void LateUpdate()
{
transform.LookAt(cam.forward + transform.position);
}
#if UNITY_EDITOR
public void SetPlayerCount(int count)
{
playerCountText.text = count.ToString();
}
#endif
public void OnClickPlayer()
{