Compare commits

..

14 Commits

Author SHA1 Message Date
f2d9a7f7cc Merge remote-tracking branch 'origin/UI/main-ui' into UI/siva-ui
# Conflicts:
#	Assets/Prefabs/UI/Player V AI Popup .prefab
#	Assets/Scripts/UI/Pages/PopUp/PvAIModePopup.cs
2026-01-30 21:47:28 +05:30
41c2fdbee5 PvP & PvBot changes. 2026-01-30 19:14:08 +05:30
d20503fd9b Added player count visual updates 2026-01-30 19:04:14 +05:30
9afdacde72 Added color selection to P v AI mode. 2026-01-30 14:13:52 +05:30
45699adcc8 Added additional safe tile logic. 2026-01-30 13:54:19 +05:30
f7c2f4c612 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-30 13:33:07 +05:30
9eef3eb04c Merge branch 'Gameplay/ashby-gameplay' into Gameplay/main-gameplay
# Conflicts:
#	Assets/External-Assets/packages/Project/Scripts/Gameplay/Snake and Ladder/DiceView.cs
#	Assets/Scripts/Gameplay/GameplayManager.cs
#	Assets/Scripts/Input/DiceRollHandler.cs
2026-01-30 12:57:17 +05:30
14d4a562a4 New dice logic + fixes. 2026-01-30 12:54:43 +05:30
c42db86e28 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-30 11:36:37 +05:30
253b5affc3 Merge branch 'UI/ashby-ui' into UI/main-ui
# Conflicts:
#	Assets/Scripts/UI/Pages/PopUp/PvPModePopup.cs
2026-01-30 11:32:51 +05:30
6f374f0d21 Added logic for connecting pvp and bot ui with gameplay. 2026-01-30 11:30:40 +05:30
224c29f19d Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-29 22:18:02 +05:30
d2cfc4ad4a Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-29 21:37:32 +05:30
78fce93bec Added Game Icon 2026-01-29 21:21:05 +05:30
24 changed files with 3351 additions and 7164 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: f6f7cf722ebaa46bdab456d7c3009064
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: Android
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
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

@ -1,7 +1,8 @@
using System;
using System.Collections;
using UnityEngine;
public class DiceView : MonoBehaviour, IBase, IBootLoader
public class DiceView : MonoBehaviour, IBase
{
private Rigidbody rb;
private bool rolling;
@ -15,21 +16,23 @@ public class DiceView : MonoBehaviour, IBase, IBootLoader
[SerializeField] private float liftForce = 0.1f;
private Action<int> onRollingComplete = null;
void Awake()
{
rb = GetComponent<Rigidbody>();
rb.useGravity = false;
}
public void Initialize()
{
InterfaceManager.Instance?.RegisterInterface<DiceView>(this);
transform.localPosition = new Vector3(0, 20, 0);
}
public void Roll()
public void Roll(Action<int> onComplete, bool isBot)
{
if (!rolling)
{
Debug.Log($"isBot: {isBot}");
onRollingComplete = onComplete;
StartCoroutine(RollRoutine());
}
}
IEnumerator RollRoutine()
@ -37,26 +40,26 @@ public class DiceView : MonoBehaviour, IBase, IBootLoader
rolling = true;
// MICRO DELAY → breaks physics sync between dice
yield return new WaitForSeconds(Random.Range(0.01f, 0.06f));
yield return new WaitForSeconds(UnityEngine.Random.Range(0.01f, 0.06f));
rb.useGravity = true;
// PER-DICE FORCE MULTIPLIER
float spinMultiplier = Random.Range(0.8f, 1.25f);
float spinMultiplier = UnityEngine.Random.Range(0.8f, 1.25f);
// RANDOM TORQUE
rb.AddTorque(
Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
UnityEngine.Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
UnityEngine.Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
UnityEngine.Random.Range(-baseSpinForce, baseSpinForce) * spinMultiplier,
ForceMode.Impulse
);
// RANDOM SIDE FORCE
Vector3 sideDir = new Vector3(
Random.Range(-1f, 1f),
UnityEngine.Random.Range(-1f, 1f),
0f,
Random.Range(-1f, 1f)
UnityEngine.Random.Range(-1f, 1f)
).normalized;
rb.AddForce(sideDir * sideForce, ForceMode.Impulse);
@ -71,6 +74,8 @@ public class DiceView : MonoBehaviour, IBase, IBootLoader
//TODO: Use the dice value as needed
Debug.Log($"Dice rolled: {value}");
onRollingComplete?.Invoke(value);
ResetDice();
}
@ -92,5 +97,12 @@ public class DiceView : MonoBehaviour, IBase, IBootLoader
rb.angularVelocity = Vector3.zero;
transform.localPosition = new Vector3(0, 20, 0);
rolling = false;
Invoke(nameof(ResetEvent), 0.5f);
}
private void ResetEvent()
{
onRollingComplete = null;
}
}

View File

@ -576,6 +576,7 @@ Transform:
m_Children:
- {fileID: 4424967554755073335}
- {fileID: 534221319385673590}
- {fileID: 3729843840315893126}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -628,6 +629,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5526766409186502679}
playerCountCanvasPrefab: {fileID: 9029553984926861784}
--- !u!1 &4818123989977612668
GameObject:
m_ObjectHideFlags: 0
@ -1514,3 +1516,114 @@ Transform:
m_Father: {fileID: 724652835177063243}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &4537709141704337870
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 5420572229297639394}
m_Modifications:
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_SizeDelta.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Name
value: Canvas - World
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
--- !u!224 &3729843840315893126 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 4537709141704337870}
m_PrefabAsset: {fileID: 0}
--- !u!1 &9029553984926861784 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 4537709141704337870}
m_PrefabAsset: {fileID: 0}

View File

@ -576,6 +576,7 @@ Transform:
m_Children:
- {fileID: 4101024636752269533}
- {fileID: 209575521726294684}
- {fileID: 1276728539856229656}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -628,6 +629,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5274388487207906813}
playerCountCanvasPrefab: {fileID: 6862258105288866118}
--- !u!1 &5059623752267150313
GameObject:
m_ObjectHideFlags: 0
@ -1514,3 +1516,158 @@ Transform:
m_Father: {fileID: 1832908541896867547}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2057554100330600784
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 5672526856521419272}
m_Modifications:
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
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
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Name
value: Canvas - World
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.b
value: 0.1882353
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.g
value: 0.52156866
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.r
value: 0.13333334
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
--- !u!224 &1276728539856229656 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 2057554100330600784}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6862258105288866118 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 2057554100330600784}
m_PrefabAsset: {fileID: 0}

View File

@ -162,6 +162,7 @@ Transform:
m_Children:
- {fileID: 8277875877323360066}
- {fileID: 5251663078533119235}
- {fileID: 7416033585674372540}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -200,6 +201,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 232863433340697214}
playerCountCanvasPrefab: {fileID: 2911420982173280738}
--- !u!136 &1627116187348267135
CapsuleCollider:
m_ObjectHideFlags: 0
@ -1514,3 +1516,158 @@ Transform:
m_Father: {fileID: 8503180080140070530}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &7769048123306772980
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 338321318880370071}
m_Modifications:
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
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
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Name
value: Canvas - World
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.b
value: 0.7294118
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.g
value: 0.6666667
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.r
value: 0.6313726
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
--- !u!1 &2911420982173280738 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 7769048123306772980}
m_PrefabAsset: {fileID: 0}
--- !u!224 &7416033585674372540 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 7769048123306772980}
m_PrefabAsset: {fileID: 0}

View File

@ -1205,6 +1205,7 @@ Transform:
m_Children:
- {fileID: 2133300963410926754}
- {fileID: 2853674755695388387}
- {fileID: 8164022016059970845}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1257,6 +1258,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 7800412279828783518}
playerCountCanvasPrefab: {fileID: 4593694095142779203}
--- !u!1 &7074820051352815849
GameObject:
m_ObjectHideFlags: 0
@ -1514,3 +1516,158 @@ Transform:
m_Father: {fileID: 5537228651064754093}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &8968445451050703189
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7767047851774264951}
m_Modifications:
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65645560966781747, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
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
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 2.239
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Name
value: Canvas - World
objectReference: {fileID: 0}
- target: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.b
value: 0.19607843
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.g
value: 0.17254902
objectReference: {fileID: 0}
- target: {fileID: 8752947010238866161, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
propertyPath: m_Color.r
value: 0.46666667
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
--- !u!1 &4593694095142779203 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 8968445451050703189}
m_PrefabAsset: {fileID: 0}
--- !u!224 &8164022016059970845 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
m_PrefabInstance: {fileID: 8968445451050703189}
m_PrefabAsset: {fileID: 0}

View File

@ -237,6 +237,18 @@ PrefabInstance:
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 1804238606659730488, guid: 7a038d77e6ef54ce4b627bc5bf3ed17d, type: 3}
propertyPath: liftForce
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 1804238606659730488, guid: 7a038d77e6ef54ce4b627bc5bf3ed17d, type: 3}
propertyPath: sideForce
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1804238606659730488, guid: 7a038d77e6ef54ce4b627bc5bf3ed17d, type: 3}
propertyPath: baseSpinForce
value: 2000
objectReference: {fileID: 0}
- target: {fileID: 1804238606659730489, guid: 7a038d77e6ef54ce4b627bc5bf3ed17d, type: 3}
propertyPath: m_RootOrder
value: 0

View File

@ -111,15 +111,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.x
value: 0.14
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.y
value: 0.14
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.z
value: 0.14
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalPosition.x

View File

@ -25,7 +25,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1950433650452808236}
m_LocalRotation: {x: -0, y: -0.40670383, z: -0, w: 0.91356015}
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
@ -34,7 +34,7 @@ RectTransform:
- {fileID: 6813413954384782979}
m_Father: {fileID: 953143927943285832}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: -47.996, z: 0}
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}
@ -61,7 +61,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 0.1254902, g: 0.42352942, b: 0.75686276, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -166,6 +166,7 @@ GameObject:
- component: {fileID: 5587250865659051320}
- component: {fileID: 1334714064113256010}
- component: {fileID: 2739169735767897497}
- component: {fileID: 8176763997504289913}
m_Layer: 5
m_Name: Canvas - World
m_TagString: Untagged
@ -182,7 +183,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: 3, y: 3, z: 3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 65645560966781747}
@ -238,7 +239,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &2739169735767897497
MonoBehaviour:
m_ObjectHideFlags: 0
@ -256,6 +257,19 @@ MonoBehaviour:
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &8176763997504289913
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4879164135252893718}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 12325a6692b2349b5992ec00a2cf8162, type: 3}
m_Name:
m_EditorClassIdentifier:
playerCountText: {fileID: 5414082930131347236}
--- !u!1 &8183529856602442984
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
using System.Collections.Generic;
using UnityEngine;
public enum GameModeType
{
PVP,
Bot,
}
public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
private GameplayManager gameplayManager;
public GameModeType GameModeType
{
get; private set;
}
public void Initialize()
{
InterfaceManager.Instance.RegisterInterface<GameModeHandler>(this);
}
public void InitializeData()
{
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
}
public void InitPVPModeData(List<PlayerType> types)
{
GameModeType = GameModeType.PVP;
gameplayManager.InitPlayerTypesForPVP(types);
}
public void InitBotModeData(PlayerType selectedPlayer, int botCount)
{
GameModeType = GameModeType.Bot;
gameplayManager.InitPlayerTypesForBotMatch(selectedPlayer, botCount);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d8a94cfc31bb45f9a403db0c1f4c116
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -68,7 +68,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private Dictionary<PlayerType, PlayerGameData> playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>();
// botRuntimeMovementData: where can the bot move if a particular dice value is thrown, and based on the value set the bot move for each using a predictive approach and select based on the the priority
private Dictionary<PlayerType, Dictionary<int, BotMove>> botRuntimeMovementData = new Dictionary<PlayerType, Dictionary<int, BotMove>>();
private Dictionary<PlayerType, Dictionary<int, BotMove>> botRuntimeMovementData = new Dictionary<PlayerType, Dictionary<int, BotMove>>();
private TilesManager tilesManager;
@ -80,12 +80,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private List<PlayerPawn> availPlayers = new List<PlayerPawn>();
private bool canSwitchPlayer = false;
public bool CanRollDice
public bool CanRollDiceForUser
{
get; private set;
}
public List<PlayerType> PlayerTypesCollection => allPlayerTypes;
public void Initialize()
{
InterfaceManager.Instance?.RegisterInterface<GameplayManager>(this);
@ -96,23 +96,20 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
CanRollDice = true;
// initialize the player list from UI.
// InitPlayerTypesForLAN(null);
InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
// InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
// InitPlayerTypesForPVP(new List<PlayerType> { PlayerType.Player1, PlayerType.Player2})
}
// TODO :: Call when the UI selection is made and game starts
public void InitPlayerTypesForLAN(List<PlayerType> types)
public void InitPlayerTypesForPVP(List<PlayerType> types)
{
// TODO :: 2P, 3P, 4P
allPlayerTypes = new List<PlayerType> { PlayerType.Player1, PlayerType.Player2, PlayerType.Player3, PlayerType.Player4 };
// allPlayerTypes = new List<PlayerType> { PlayerType.Player1, PlayerType.Player3 };
allPlayerTypes = new List<PlayerType>(types);
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
InitCurrentGamePlayerInfo();
SetCanRollDiceForUser(true);
}
public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount)
@ -121,6 +118,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
allPlayerTypes.Clear();
AssignBotTypes(selectedPlayerType, botCount);
allPlayerTypes.Add(selectedPlayerType);
allPlayerTypes.AddRange(botTypesInGame);
@ -128,6 +126,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
InitCurrentGamePlayerInfo();
InitBotRuntimeData();
AssignPlayerAndBotStates(selectedPlayerType);
SetCanRollDiceForUser(!botTypesInGame.Contains(selectedPlayerType));
}
private void InitBotRuntimeData()
@ -205,13 +205,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
continue;
Debug.Log($"playerGameData.playerType: {playerGameData.playerType}");
playerGameDatasDict.Add(playerGameData.playerType, playerGameData);
playerGameDatasDict[playerGameData.playerType].playerPawnsDict = new Dictionary<int, PlayerPawn>();
foreach (Transform playerPawnChild in playerGameData.playersParent)
{
if (!playerPawnChild.gameObject.activeInHierarchy) continue;
var pawn = playerPawnChild.GetComponent<PlayerPawn>();
playerGameDatasDict[playerGameData.playerType].playerPawnsDict.Add(pawn.PlayerId, pawn);
}
@ -232,7 +233,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnDiceInteracted()
{
diceRollHandler.HandleDiceView();
diceRollHandler.HandleDiceViewForUser();
}
public void RollDiceForPlayer(int rolledVal)
@ -248,7 +249,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
Debug.Log($"Switching player");
SwitchPlayer();
SetCanRollDiceForUser(true);
}
}
@ -264,12 +264,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
return false;
}
private void RollDiceForBot()
private void RollDiceForBot(int rolledVal)
{
Debug.Log($"CallTest: RollDiceForBot");
// OnDiceRolled(diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
OnDiceRolled(diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
OnDiceRolled(rolledVal);
SelectPawnFromBotBase();
@ -280,11 +280,15 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// What happens when you get a 6
private void SelectPawnFromBotBase()
{
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return; // Have a better check here
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn))
{
Debug.Log($"returning from SelectPawnFromBotBase");
return; // Have a better check here
}
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
// check the data from the playerGameDataDict
// change playerPawnsDict to list
@ -309,7 +313,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
return;
}
// TODO :: Double check
foreach (var key in botPawnsDictForCurrentPlayer.Keys)
{
@ -439,7 +443,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceRolledValue = rolledVal;
diceText.text = $"{diceRolledValue}";
availPlayers.Clear();
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
{
canSwitchPlayer = false;
@ -456,7 +460,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"### AreAllPawnsInFinishingPath");
if (AreAllPawnsInFinishingPath())
{
SetCanRollDiceForUser(true);
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
return;
}
@ -517,6 +521,16 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
pawn.GetPlayerState() == PlayerState.Moving ||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
Debug.Log($"#### UpdatePlayerState in InitActivePlayers ");
foreach (var pawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values)
{
Debug.Log($"pawn: {pawn.name}, state: {pawn.GetPlayerState()}");
}
foreach (var player in availPlayers) // TODO :: Move from here
{
DisplayPlayerCountOnTile(player, true);
}
}
private bool AreAllPawnsInFinishingPath()
@ -541,6 +555,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void UpdatePlayerState(PlayerPawn playerPawn, PlayerState playerState)
{
Debug.Log($"#### UpdatePlayerState ");
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId] = playerPawn;
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].SetPlayerState(playerState);
playerPawn.SetPlayerState(playerState);
@ -549,7 +564,15 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void CheckDiceRollForBot(PlayerPawn playerPawn)
{
if (CanRollDiceAgain)
RollDiceForBot();
{
HandleDiceRoll();
}
}
private void HandleDiceRoll()
{
// diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal));
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
}
public void OnPawnSelected(PlayerPawn playerPawn)
@ -559,16 +582,19 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
Debug.Log($"playerPawn.GetPlayerState(): {playerPawn.GetPlayerState()}");
if (playerPawn.GetPlayerState() == PlayerState.InHome)
{
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
DisplayPlayerCountOnTile(playerPawn, false);
playerPawn.MoveToTile(
GetAndInitPositionInsideSafeZone(playerPawn, targetTile),
onComplete: () =>
{
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
UpdatePlayerState(playerPawn, PlayerState.InSafeZone);
DisplayPlayerCountOnTile(playerPawn, true);
if (CheckForMaxDiceRollAttempt())
{
return;
@ -601,12 +627,19 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (nextTileIdx == 0)
targetIdx = (targetIdx - playerPawn.CurrentTileIndex) - 1;
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
if (currentSittingTile.IsSafeZone)
{
SafeTile safeTile = (SafeTile)currentSittingTile;
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, playerPawn);
// DisplayPlayerCountOnTile(playerPawn, false);
// if (safeTile.PlayerTypesCount > 0)
// {
// var pawns = safeTile.GetPlayerPawns(playerPawn.PlayerType);
// foreach (var pawn in pawns)
// DisplayPlayerCountOnTile(pawn, true);
// }
if (safeTile.PlayerTypesCount == 1)
{
@ -650,12 +683,24 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void SwitchPlayer(PlayerPawn playerPawn = null)
{
Debug.Log($"CallTest: SwitchPlayer");
if (playerPawn)
UpdatePlayerState(playerPawn, tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving);
if (!CanRollDiceAgain)
{
Debug.Log($"currentPlayerTurn: {currentPlayerTypeTurn}");
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
if (availPlayers.Count < 1)
InitActivePlayers();
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
foreach (var pawn in availPlayers)
{
DisplayPlayerCountOnTile(pawn, false);
}
if (allPlayerTypes.Count == 1)
{
Debug.LogError($"GAME IS OVER");
@ -675,6 +720,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceSixRollCounter = 0;
diceText.text = $"{0}";
InitActivePlayers();
foreach (var pawn in availPlayers)
{
DisplayPlayerCountOnTile(pawn, true);
}
}
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
@ -685,15 +736,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
pointerMeshRend.material = turnMat;
// pointerMeshRend.materials[0] = turnMat;
if (playerPawn)
UpdatePlayerState(playerPawn, tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving);
Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
if (botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
{
Debug.Log($"Invoking RollDiceForBot");
Invoke(nameof(RollDiceForBot), 1f);
Invoke(nameof(HandleDiceRoll), 1f);
}
}
@ -714,6 +762,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
Debug.Log($"tile targetPosition: {targetPosition}");
DisplayPlayerCountOnTile(playerPawn, false);
playerPawn.MoveToTile(
targetPosition,
@ -742,8 +791,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
else
{
// TODO :: Improve this logic, use a collection
// TODO :: Improve this logic, use a collection
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
if (CanRollDiceAgain)
DisplayPlayerCountOnTile(playerPawn, true);
if (!nextTile.IsSafeZone)
{
Debug.Log($"nextTile.HasPawnsAvailable: {nextTile.HasPawnsAvailable}");
@ -760,7 +813,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
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}");
@ -797,12 +850,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
SwitchPlayer(playerPawn);
if (!CanRollDiceAgain)
{
SetCanRollDiceForUser(true);
}
}
},
},
index);
}
@ -841,7 +890,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
{
Debug.Log($"targetSafeTile.PlayerTypesCount: {targetSafeTile.PlayerTypesCount}");
Debug.Log($"targetSafeTile.PlayerTypesCount: {targetSafeTile.PlayerTypesCount}");
if (targetSafeTile.PlayerTypesCount < 1) // he is the only player that is being added to the safe zone
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
@ -866,6 +915,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void MoveThroughFinishingPath(PlayerPawn playerPawn, int index, int targetIndex)
{
UpdatePlayerState(playerPawn, PlayerState.InFinishingPath);
playerPawn.MoveToTile(
tilesManager.RetrievePositionForFinishingTile(currentPlayerTypeTurn, index).position,
onComplete: () =>
@ -885,6 +936,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
else
{
Debug.Log($"CurrentTileIndex: {playerPawn.CurrentTileIndex} == lastIndex: {tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1}");
if (playerPawn.CurrentTileIndex == tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
{
@ -921,30 +973,51 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
CanRollDiceAgain = true;
if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn);
CheckDiceRollForBot(playerPawn);
else
SetCanRollDiceForUser(true);
}
}
else
{
// activate here
if (CheckForMaxDiceRollAttempt())
{
SetCanRollDiceForUser(true);
return;
}
SwitchPlayer();
}
SetCanRollDiceForUser(true);
}
},
},
index);
}
private void SetCanRollDiceForUser(bool state)
{
// if (botTypesInGame.Contains(playerType)) return;
CanRollDice = state;
CanRollDiceForUser = state;
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
}
private void DisplayPlayerCountOnTile(PlayerPawn playerPawn, bool show)
{
Tile tile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
Debug.Log($"Displaycount: {playerPawn.name} on tile: {tile.name}, show: {show}");
playerPawn.ShowPlayerCountCanvas(show);
if (!show) return;
int count = 0;
if (tile.IsSafeZone)
{
count = (tile as SafeTile).GetPlayerPawnsCountInTile(playerPawn.PlayerType);
}
else
{
count = tile.TotalPawnsInTile;
}
playerPawn.GetComponentInChildren<PlayerCountCanvas>().SetPlayerCount(count);
}
}

View File

@ -21,6 +21,10 @@ public class PlayerPawn : MonoBehaviour
{
[SerializeField] private PlayerState playerState;
[SerializeField] private Animator animator;
[SerializeField] private GameObject playerCountCanvasPrefab;
[SerializeField] private PlayerCountCanvas playerCountCanvas;
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
public bool CanSelectPlayer
{
@ -136,4 +140,11 @@ public class PlayerPawn : MonoBehaviour
PlayerId = id;
PlayerType = playerType;
}
public void ShowPlayerCountCanvas(bool show)
{
if (playerCountCanvasPrefab == null) return;
playerCountCanvasPrefab.SetActive(show);
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -8,36 +9,44 @@ public class DiceRollHandler : MonoBehaviour
[SerializeField] private int diceTestValue = 0;
private InputManager inputManager;
private void OnMouseDown()
{
inputManager = inputManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<InputManager>() : inputManager;
if (!inputManager.GameplayManager.CanRollDice) return;
RollDiceOnClick();
// RollDiceOnClick();
}
private void Update()
{
inputManager = inputManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<InputManager>() : inputManager;
if (!inputManager.GameplayManager.CanRollDice) return;
if (Input.GetKeyDown(KeyCode.Space))
RollDiceOnClick();
}
private void RollDiceOnClick()
public void OnUserDiceRollComplete(int rolledVal)
{
inputManager.SetDiceRollValue(rolledVal);
}
public void HandleDiceViewForUser()
{
if (!inputManager.GameplayManager.CanRollDiceForUser) return;
SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>();
soundManager?.PlayGameSoundClip(SoundType.Dice);
int currentRolledVal = // Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
diceTestValue != 0 ? diceTestValue : Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
inputManager.SetDiceRollValue(currentRolledVal);
OnUserDiceRollComplete(GetDiceTestVal());
// diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
}
public void HandleDiceView()
public void HandleDiceViewForBot(Action<int> onComplete)
{
diceView.Roll();
diceView.Roll(onComplete: (val) => onComplete?.Invoke(val), true);
}
public void HandleDiceViewForBot(Action<int> onComplete, int val)
{
onComplete?.Invoke(val);
}
private int GetDiceTestVal() => diceTestValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceTestValue;
}

View File

@ -5,7 +5,6 @@ using UnityEngine;
public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
private GameplayManager gameplayManager;
private PopupManager popupManager;
private ScreenManager screenManager;
public void Initialize()
@ -16,8 +15,6 @@ public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void InitializeData()
{
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
popupManager = InterfaceManager.Instance.GetInterfaceInstance<PopupManager>();
}
public void OnDiceViewInteracted()
@ -38,7 +35,7 @@ public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
screenManager.ShowScreen(ScreenType.InGameHUDScreen);
}
public void OnPlayButtonClicked()
public void UpdateSelectedPlayerCount(int playersCount)
{
}

View File

@ -1,13 +1,25 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PvAIModePopup : PopupBase
{
[Header("Buttons")]
[SerializeField] private Color playerBtnNormalColor;
[SerializeField] private Color playerBtnSelectedColor;
[Header("Bot Selection Buttons")]
[SerializeField] private Button twoPlayerBtn;
[SerializeField] private Button threePlayerBtn;
[SerializeField] private Button fourPlayerBtn;
[Header("Color Selection Buttons")]
[SerializeField] private Button redBtn;
[SerializeField] private Button blueBtn;
[SerializeField] private Button greyBtn;
[SerializeField] private Button greenBtn;
[Header("Action Buttons")]
[SerializeField] private Button playBtn;
[SerializeField] private Button closeBtn;
@ -20,18 +32,32 @@ public class PvAIModePopup : PopupBase
private ScreenManager screenManager;
private SoundManager soundManager;
private GameModeHandler gameModeHandler;
private int selectedPlayerCount;
public int SelectedPlayerCount => selectedPlayerCount;
private PlayerType playerType;
private Button currPlayerCountBtn, prevPlayerCountBtn;
private Button currPlayerTypeBtn, prePlayerTypeBtn;
private void OnEnable()
{
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2));
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3));
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4));
playBtn.onClick.AddListener(OnClick_playBtn);
closeBtn.onClick.AddListener(OnClick_closeBtn);
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2, twoPlayerBtn));
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3, threePlayerBtn));
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4, fourPlayerBtn));
twoPlayerBtn.Select();
playBtn.onClick.AddListener(OnClick_PlayButton);
closeBtn.onClick.AddListener(OnClick_CloseButton);
redBtn.onClick.AddListener(() => OnColorSelected(PlayerType.Player1, redBtn));
blueBtn.onClick.AddListener(() => OnColorSelected(PlayerType.Player2, blueBtn));
greyBtn.onClick.AddListener(() => OnColorSelected(PlayerType.Player3, greyBtn));
greenBtn.onClick.AddListener(() => OnColorSelected(PlayerType.Player4, greenBtn));
}
private void Start()
{
OnPlayerCountSelected(2, twoPlayerBtn);
}
private void OnDisable()
@ -39,17 +65,34 @@ public class PvAIModePopup : PopupBase
twoPlayerBtn.onClick.RemoveAllListeners();
threePlayerBtn.onClick.RemoveAllListeners();
fourPlayerBtn.onClick.RemoveAllListeners();
playBtn.onClick.RemoveAllListeners();
closeBtn.onClick.RemoveAllListeners();
}
private void OnPlayerCountSelected(int count)
private void OnPlayerCountSelected(int count, Button button)
{
selectedPlayerCount = count;
prevPlayerCountBtn = currPlayerCountBtn;
currPlayerCountBtn = button;
ColorBlock colorBlock;
if (prevPlayerCountBtn)
{
colorBlock = prevPlayerCountBtn.colors;
colorBlock.normalColor = playerBtnNormalColor;
prevPlayerCountBtn.colors = colorBlock;
}
colorBlock = currPlayerCountBtn.colors;
colorBlock.normalColor = playerBtnSelectedColor;
currPlayerCountBtn.colors = colorBlock;
}
private void OnClick_playBtn()
private void OnClick_PlayButton()
{
playerName = playerNameInput.text;
playerName = string.IsNullOrWhiteSpace(playerNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerNameInput.text;
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
@ -59,10 +102,13 @@ public class PvAIModePopup : PopupBase
Debug.Log($"Starting PVP Mode with {selectedPlayerCount} players:");
Debug.Log($"Player 1: {playerName}");
popupManager.HidePopup(popupType);
gameModeHandler = gameModeHandler == null ? InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>() : gameModeHandler;
gameModeHandler.InitBotModeData(playerType, selectedPlayerCount - 1);
}
private void OnClick_closeBtn()
private void OnClick_CloseButton()
{
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
screenManager.ShowScreen(ScreenType.MenuScreen);
@ -71,4 +117,24 @@ public class PvAIModePopup : PopupBase
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
Hide();
}
private void OnColorSelected(PlayerType type, Button button)
{
playerType = type;
prePlayerTypeBtn = currPlayerTypeBtn;
currPlayerTypeBtn = button;
ColorBlock colorBlock;
if (prePlayerTypeBtn)
{
colorBlock = prePlayerTypeBtn.colors;
colorBlock.normalColor = playerBtnNormalColor;
prePlayerTypeBtn.colors = colorBlock;
}
colorBlock = currPlayerTypeBtn.colors;
colorBlock.normalColor = playerBtnSelectedColor;
currPlayerTypeBtn.colors = colorBlock;
}
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@ -19,12 +20,6 @@ public class PvPModePopup : PopupBase
[SerializeField] private TMP_InputField playerThreeNameInput;
[SerializeField] private TMP_InputField playerFourNameInput;
[Header("Player Names")]
private string playerOneName;
private string playerTwoName;
private string playerThreeName;
private string playerFourName;
[Header("References")]
[SerializeField] private GameObject playerNameInputParent1;
[SerializeField] private GameObject playerNameInputParent2;
@ -34,27 +29,44 @@ public class PvPModePopup : PopupBase
[SerializeField] private TMP_Text playerTwoPlaceholder;
[SerializeField] private TMP_Text playerThreePlaceholder;
[SerializeField] private TMP_Text playerFourPlaceholder;
[SerializeField] private List<TMP_InputField> inputFields = new List<TMP_InputField>();
[Header("Player Names")]
private string playerOneName;
private string playerTwoName;
private string playerThreeName;
private string playerFourName;
private ScreenManager screenManager;
private GameManager gameManager;
private SoundManager soundManager;
private GameModeHandler gameModeHandler;
private int selectedPlayerCount;
public int SelectedPlayerCount => selectedPlayerCount;
[Header("Horizontal Rows (P1P4)")]
public List<GameObject> rows;
private int hiddenIndex = 0;
Dictionary<PlayerType, string> playerNameMap = new();
private List<int> hiddenIndexes = new List<int>();
private Dictionary<PlayerType, string> playerNameMap = new();
private void OnEnable()
{
twoPlayerBtn.onClick.AddListener(OnClick_TwoPlayerBtn);
threePlayerBtn.onClick.AddListener(OnClick_ThreePlayerBtn);
fourPlayerBtn.onClick.AddListener(OnClick_FourPlayerBtn);
playBtn.onClick.AddListener(OnClick_PlayBtn);
closeBtn.onClick.AddListener(OnClick_CloseBtn);
switchBtn.onClick.AddListener(OnClick_SwitchBtn);
playBtn.onClick.AddListener(OnClick_PlayButton);
closeBtn.onClick.AddListener(OnClick_CloseButton);
switchBtn.onClick.AddListener(OnClick_SwitchButton);
}
private void Start()
{
OnClick_FourPlayerBtn();
}
private void OnDisable()
@ -62,33 +74,44 @@ public class PvPModePopup : PopupBase
twoPlayerBtn.onClick.RemoveListener(OnClick_TwoPlayerBtn);
threePlayerBtn.onClick.RemoveListener(OnClick_ThreePlayerBtn);
fourPlayerBtn.onClick.RemoveAllListeners();
playBtn.onClick.RemoveListener(OnClick_PlayBtn);
closeBtn.onClick.RemoveListener(OnClick_CloseBtn);
switchBtn.onClick.RemoveListener(OnClick_SwitchBtn);
playBtn.onClick.RemoveListener(OnClick_PlayButton);
closeBtn.onClick.RemoveListener(OnClick_CloseButton);
switchBtn.onClick.RemoveListener(OnClick_SwitchButton);
}
private void OnClick_TwoPlayerBtn()
{
switchBtn.gameObject.SetActive(true);
selectedPlayerCount = 2;
OnPlayerCountsSwitched();
switchBtn.gameObject.SetActive(true);
playerNameInputParent2.SetActive(false);
}
private void OnClick_ThreePlayerBtn()
{
switchBtn.gameObject.SetActive(true);
selectedPlayerCount = 3;
OnPlayerCountsSwitched();
switchBtn.gameObject.SetActive(true);
playerNameInputParent1.SetActive(true);
playerNameInputParent2.SetActive(true);
UpdateInputFieldsVisibility();
}
private void OnClick_FourPlayerBtn()
{
switchBtn.gameObject.SetActive(false);
selectedPlayerCount = 4;
switchBtn.gameObject.SetActive(false);
playerNameInputParent1.SetActive(true);
playerNameInputParent2.SetActive(true);
UpdateInputFieldsVisibility();
}
@ -100,61 +123,51 @@ public class PvPModePopup : PopupBase
playerFourNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 4);
}
private void OnClick_PlayBtn()
private void OnClick_PlayButton()
{
int logicalIndex = 0;
foreach (GameObject row in rows)
playerNameMap.Clear();
for (int idx = 0; idx < inputFields.Count; idx++)
{
if (!row.activeSelf)
PlayerType playerType = (PlayerType)idx;
if (!inputFields[idx].transform.parent.gameObject.activeInHierarchy)
{
continue;
}
TMP_InputField input = row.GetComponentInChildren<TMP_InputField>();
PlayerType playerType = (PlayerType)logicalIndex;
string playerName = string.IsNullOrWhiteSpace(input.text)
? playerType.ToString()
: input.text;
playerNameMap[playerType] = playerName;
logicalIndex++;
playerNameMap.Add(playerType, string.IsNullOrWhiteSpace(inputFields[idx].text) ? $"{playerType}" : inputFields[idx].text);
}
// playerOneName = string.IsNullOrWhiteSpace(playerOneNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerOneNameInput.text;
// playerTwoName = string.IsNullOrWhiteSpace(playerTwoNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerTwoNameInput.text;
// playerThreeName = string.IsNullOrWhiteSpace(playerThreeNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerThreeNameInput.text;
// playerFourName = string.IsNullOrWhiteSpace(playerFourNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerFourNameInput.text;
playerOneName = playerNameMap.GetValueOrDefault(PlayerType.Player1, Ludo_3D_Constants.Player1_Name);
playerTwoName = playerNameMap.GetValueOrDefault(PlayerType.Player2, Ludo_3D_Constants.Player2_Name);
playerThreeName = playerNameMap.GetValueOrDefault(PlayerType.Player3, Ludo_3D_Constants.Player3_Name);
playerFourName = playerNameMap.GetValueOrDefault(PlayerType.Player4, Ludo_3D_Constants.Player4_Name);
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
//TODO: Start PVP Game with the selected player count and names
Debug.Log($"Starting PVP Mode with {selectedPlayerCount} players:");
Debug.Log($"Player 1: {playerOneName}");
Debug.Log($"Player 2: {playerTwoName}");
if (selectedPlayerCount >= 3)
Debug.Log($"Player 3: {playerThreeName}");
if (selectedPlayerCount == 4)
Debug.Log($"Player 4: {playerFourName}");
popupManager.HidePopup(popupType);
gameModeHandler = gameModeHandler == null ? InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>() : gameModeHandler;
gameModeHandler.InitPVPModeData(playerNameMap.Keys.ToList());
}
private void OnClick_SwitchBtn()
private void OnClick_SwitchButton()
{
hiddenIndexes.Clear();
if (SelectedPlayerCount == 2)
{
if (playerNameInputParent1.activeSelf)
if (playerNameInputParent1.activeInHierarchy)
{
playerNameInputParent1.SetActive(false);
playerNameInputParent2.SetActive(true);
playerOnePlaceholder.text = "Player 1";
playerThreePlaceholder.text = "Player 2";
hiddenIndexes.Add((int)PlayerType.Player1);
hiddenIndexes.Add((int)PlayerType.Player3);
}
else
{
@ -162,30 +175,63 @@ public class PvPModePopup : PopupBase
playerNameInputParent2.SetActive(false);
playerTwoPlaceholder.text = "Player 1";
playerFourPlaceholder.text = "Player 2";
hiddenIndexes.Add((int)PlayerType.Player2);
hiddenIndexes.Add((int)PlayerType.Player4);
}
}
else if (SelectedPlayerCount == 3)
{
hiddenIndex = (hiddenIndex + 1) % rows.Count;
UpdateRows();
hiddenIndex = (hiddenIndex + 1) % inputFields.Count;
hiddenIndexes.Add(hiddenIndex);
}
UpdateRows();
}
private void OnPlayerCountsSwitched()
{
hiddenIndexes.Clear();
if (SelectedPlayerCount == 2)
{
if (playerNameInputParent1.activeInHierarchy)
{
playerOnePlaceholder.text = "Player 1";
playerThreePlaceholder.text = "Player 2";
hiddenIndexes.Add((int)PlayerType.Player2);
hiddenIndexes.Add((int)PlayerType.Player4);
}
else if (playerNameInputParent2.activeInHierarchy)
{
playerTwoPlaceholder.text = "Player 1";
playerFourPlaceholder.text = "Player 2";
hiddenIndexes.Add((int)PlayerType.Player1);
hiddenIndexes.Add((int)PlayerType.Player3);
}
}
else if (SelectedPlayerCount == 3)
{
hiddenIndex = (hiddenIndex + 1) % inputFields.Count;
hiddenIndexes.Add(hiddenIndex);
}
UpdateRows();
}
private void UpdateRows()
{
int visiblePlayerIndex = 1;
for (int i = 0; i < rows.Count; i++)
for (int i = 0; i < inputFields.Count; i++)
{
bool isHidden = (i == hiddenIndex);
rows[i].SetActive(!isHidden);
bool isHidden = hiddenIndexes.Contains(i);
inputFields[i].transform.parent.gameObject.SetActive(!isHidden);
if (!isHidden)
{
TMP_InputField input =
rows[i].GetComponentInChildren<TMP_InputField>();
TMP_Text placeholder = input.placeholder as TMP_Text;
TMP_Text placeholder = inputFields[i].placeholder as TMP_Text;
if (placeholder != null)
{
placeholder.text = $"Player {visiblePlayerIndex}";
@ -195,7 +241,7 @@ public class PvPModePopup : PopupBase
}
}
private void OnClick_CloseBtn()
private void OnClick_CloseButton()
{
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
screenManager.ShowScreen(ScreenType.MenuScreen);

View File

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

View File

@ -0,0 +1,21 @@
using TMPro;
using UnityEngine;
public class PlayerCountCanvas : MonoBehaviour
{
Transform cam;
[SerializeField] private TMP_Text playerCountText;
void Start()
{
cam = GameObject.FindGameObjectWithTag("MainCamera").transform;
}
void LateUpdate()
{
transform.LookAt(cam.forward + transform.position);
}
public void SetPlayerCount(int count)
{
playerCountText.text = count.ToString();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 12325a6692b2349b5992ec00a2cf8162
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -157,7 +157,9 @@ PlayerSettings:
resetResolutionOnWindowResize: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
applicationIdentifier:
Android: com.DefaultCompany.Ludo3D
Standalone: com.DefaultCompany.Ludo-3D
buildNumber:
Standalone: 0
iPhone: 0
@ -271,7 +273,14 @@ PlayerSettings:
AndroidMinifyDebug: 0
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetIcons:
- m_BuildTarget:
m_Icons:
- serializedVersion: 2
m_Icon: {fileID: 2800000, guid: f6f7cf722ebaa46bdab456d7c3009064, type: 3}
m_Width: 128
m_Height: 128
m_Kind: 0
m_BuildTargetPlatformIcons:
- m_BuildTarget: iPhone
m_Icons: