Compare commits

...

13 Commits

19 changed files with 540 additions and 248 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

View File

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

@ -9,6 +9,7 @@ public class DiceView : MonoBehaviour, IBase
[SerializeField] private DiceSide[] diceSides; [SerializeField] private DiceSide[] diceSides;
[SerializeField] private float sideValueTime = 1.2f; [SerializeField] private float sideValueTime = 1.2f;
[SerializeField] private Vector3 startPos = new Vector3(0, 20, 0);
[Header("Physics Randomness")] [Header("Physics Randomness")]
[SerializeField] private float baseSpinForce = 900f; [SerializeField] private float baseSpinForce = 900f;
@ -22,7 +23,7 @@ public class DiceView : MonoBehaviour, IBase
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
rb.useGravity = false; rb.useGravity = false;
transform.localPosition = new Vector3(0, 20, 0); transform.localPosition = startPos;
} }
public void Roll(Action<int> onComplete, bool isBot) public void Roll(Action<int> onComplete, bool isBot)
@ -96,7 +97,7 @@ public class DiceView : MonoBehaviour, IBase
rb.useGravity = false; rb.useGravity = false;
rb.velocity = Vector3.zero; rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero; rb.angularVelocity = Vector3.zero;
transform.localPosition = new Vector3(0, 20, 0); transform.localPosition = startPos;
rolling = false; rolling = false;
// Invoke(nameof(ResetEvent), 0.1f); // Invoke(nameof(ResetEvent), 0.1f);

View File

@ -870,7 +870,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -180} m_AnchoredPosition: {x: 0, y: -180}
m_SizeDelta: {x: 250, y: 40} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4851974413369432202 --- !u!114 &4851974413369432202
MonoBehaviour: MonoBehaviour:
@ -936,7 +936,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 40} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4851974413496445146 --- !u!222 &4851974413496445146
CanvasRenderer: CanvasRenderer:
@ -1109,8 +1109,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4851974413524974102 --- !u!222 &4851974413524974102
CanvasRenderer: CanvasRenderer:
@ -1142,8 +1142,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: "\u200B" m_text: "\u200B"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 0482bbb9a4bbf48bdbd050f3c6b94af0, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 5260989334135036006, guid: 0482bbb9a4bbf48bdbd050f3c6b94af0, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -1245,8 +1245,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -5.457, y: -4} m_AnchoredPosition: {x: -7.3499, y: -6.271304}
m_SizeDelta: {x: -55.863, y: -13} m_SizeDelta: {x: -62.677, y: -29.6562}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4851974413693272400 --- !u!114 &4851974413693272400
MonoBehaviour: MonoBehaviour:
@ -1419,8 +1419,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4851974414219947399 --- !u!222 &4851974414219947399
CanvasRenderer: CanvasRenderer:
@ -1452,8 +1452,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Player 1 m_text: Player 1
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 0482bbb9a4bbf48bdbd050f3c6b94af0, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 5260989334135036006, guid: 0482bbb9a4bbf48bdbd050f3c6b94af0, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -1948,7 +1948,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4851974414659941538} m_GameObject: {fileID: 4851974414659941538}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -1996,6 +1996,8 @@ MonoBehaviour:
popupScalerType: 1 popupScalerType: 1
canvasGroup: {fileID: 0} canvasGroup: {fileID: 0}
fadeDuration: 0 fadeDuration: 0
playerBtnNormalColor: {r: 1, g: 1, b: 1, a: 0.78431374}
playerBtnSelectedColor: {r: 1, g: 1, b: 1, a: 1}
twoPlayerBtn: {fileID: 4851974412826801781} twoPlayerBtn: {fileID: 4851974412826801781}
threePlayerBtn: {fileID: 4851974413821998362} threePlayerBtn: {fileID: 4851974413821998362}
fourPlayerBtn: {fileID: 4851974412818057105} fourPlayerBtn: {fileID: 4851974412818057105}

View File

@ -154,10 +154,10 @@ RectTransform:
m_Father: {fileID: 8065952317557671492} m_Father: {fileID: 8065952317557671492}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316381639394 --- !u!222 &8065952316381639394
CanvasRenderer: CanvasRenderer:
@ -222,7 +222,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -290,10 +290,10 @@ RectTransform:
m_Father: {fileID: 8065952318230211716} m_Father: {fileID: 8065952318230211716}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316393416988 --- !u!222 &8065952316393416988
CanvasRenderer: CanvasRenderer:
@ -358,7 +358,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -448,8 +448,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -152} m_AnchoredPosition: {x: 0, y: -136.96222}
m_SizeDelta: {x: 560, y: 90.7286} m_SizeDelta: {x: 560, y: 120.8041}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952316424197285 --- !u!114 &8065952316424197285
MonoBehaviour: MonoBehaviour:
@ -566,11 +566,11 @@ MonoBehaviour:
playerTwoPlaceholder: {fileID: 8065952316393416991} playerTwoPlaceholder: {fileID: 8065952316393416991}
playerThreePlaceholder: {fileID: 8065952317200164017} playerThreePlaceholder: {fileID: 8065952317200164017}
playerFourPlaceholder: {fileID: 8065952318180437444} playerFourPlaceholder: {fileID: 8065952318180437444}
rows: inputFields:
- {fileID: 8065952316585861709} - {fileID: 8065952316677608095}
- {fileID: 8065952316852223932} - {fileID: 8065952316882128052}
- {fileID: 8065952317184179899} - {fileID: 8065952317181319405}
- {fileID: 8065952318019617086} - {fileID: 8065952316906327149}
--- !u!1 &8065952316512053289 --- !u!1 &8065952316512053289
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -684,8 +684,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.5} m_AnchoredPosition: {x: -6.435402, y: -5.587503}
m_SizeDelta: {x: -20, y: -13} m_SizeDelta: {x: -52.5552, y: -29.2317}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952316553408492 --- !u!114 &8065952316553408492
MonoBehaviour: MonoBehaviour:
@ -738,7 +738,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 30} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952316585861699 --- !u!114 &8065952316585861699
MonoBehaviour: MonoBehaviour:
@ -925,7 +925,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 210, y: 40} m_SizeDelta: {x: 210, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316677608093 --- !u!222 &8065952316677608093
CanvasRenderer: CanvasRenderer:
@ -1099,7 +1099,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30} m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316688146259 --- !u!222 &8065952316688146259
CanvasRenderer: CanvasRenderer:
@ -1175,7 +1175,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30} m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316742462309 --- !u!222 &8065952316742462309
CanvasRenderer: CanvasRenderer:
@ -1373,7 +1373,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 30} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952316852223922 --- !u!114 &8065952316852223922
MonoBehaviour: MonoBehaviour:
@ -1439,7 +1439,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 210, y: 40} m_SizeDelta: {x: 210, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316882128042 --- !u!222 &8065952316882128042
CanvasRenderer: CanvasRenderer:
@ -1615,7 +1615,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 210, y: 40} m_SizeDelta: {x: 210, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952316906327139 --- !u!222 &8065952316906327139
CanvasRenderer: CanvasRenderer:
@ -1934,7 +1934,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 210, y: 40} m_SizeDelta: {x: 210, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952317181319395 --- !u!222 &8065952317181319395
CanvasRenderer: CanvasRenderer:
@ -2109,7 +2109,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 30} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952317184179897 --- !u!114 &8065952317184179897
MonoBehaviour: MonoBehaviour:
@ -2248,10 +2248,10 @@ RectTransform:
m_Father: {fileID: 8065952317367001092} m_Father: {fileID: 8065952317367001092}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952317200164022 --- !u!222 &8065952317200164022
CanvasRenderer: CanvasRenderer:
@ -2316,7 +2316,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -2543,8 +2543,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.5} m_AnchoredPosition: {x: -5.2997, y: -5.6334}
m_SizeDelta: {x: -20, y: -13} m_SizeDelta: {x: -50.2838, y: -28.4746}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952317367001093 --- !u!114 &8065952317367001093
MonoBehaviour: MonoBehaviour:
@ -2790,10 +2790,10 @@ RectTransform:
m_Father: {fileID: 8065952318230211716} m_Father: {fileID: 8065952318230211716}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952317479054003 --- !u!222 &8065952317479054003
CanvasRenderer: CanvasRenderer:
@ -2858,7 +2858,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -2929,7 +2929,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 560, y: 30} m_SizeDelta: {x: 560, y: 50.40205}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952317550618935 --- !u!114 &8065952317550618935
MonoBehaviour: MonoBehaviour:
@ -2993,8 +2993,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.5} m_AnchoredPosition: {x: -7.1925, y: -6.390499}
m_SizeDelta: {x: -20, y: -13} m_SizeDelta: {x: -51.041, y: -26.9604}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952317557671493 --- !u!114 &8065952317557671493
MonoBehaviour: MonoBehaviour:
@ -3046,7 +3046,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30} m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952317611268384 --- !u!222 &8065952317611268384
CanvasRenderer: CanvasRenderer:
@ -3257,7 +3257,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30} m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952317875960123 --- !u!222 &8065952317875960123
CanvasRenderer: CanvasRenderer:
@ -3590,7 +3590,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 30} m_SizeDelta: {x: 250, y: 60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952318019617084 --- !u!114 &8065952318019617084
MonoBehaviour: MonoBehaviour:
@ -3651,10 +3651,10 @@ RectTransform:
m_Father: {fileID: 8065952316553408495} m_Father: {fileID: 8065952316553408495}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952318084561725 --- !u!222 &8065952318084561725
CanvasRenderer: CanvasRenderer:
@ -3719,7 +3719,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -3786,10 +3786,10 @@ RectTransform:
m_Father: {fileID: 8065952317367001092} m_Father: {fileID: 8065952317367001092}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952318100279455 --- !u!222 &8065952318100279455
CanvasRenderer: CanvasRenderer:
@ -3854,7 +3854,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -3922,10 +3922,10 @@ RectTransform:
m_Father: {fileID: 8065952316553408495} m_Father: {fileID: 8065952316553408495}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952318180437445 --- !u!222 &8065952318180437445
CanvasRenderer: CanvasRenderer:
@ -3990,7 +3990,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5
@ -4080,8 +4080,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.5} m_AnchoredPosition: {x: -6.814, y: -6.3446016}
m_SizeDelta: {x: -20, y: -13} m_SizeDelta: {x: -53.3123, y: -27.7175}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952318230211717 --- !u!114 &8065952318230211717
MonoBehaviour: MonoBehaviour:
@ -4134,7 +4134,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 560, y: 30} m_SizeDelta: {x: 560, y: 70.402054}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8065952318264672222 --- !u!114 &8065952318264672222
MonoBehaviour: MonoBehaviour:
@ -4196,10 +4196,10 @@ RectTransform:
m_Father: {fileID: 8065952317557671492} m_Father: {fileID: 8065952317557671492}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.075, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.8895791, y: 0.74074084} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 7.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: -15, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8065952318280379820 --- !u!222 &8065952318280379820
CanvasRenderer: CanvasRenderer:
@ -4264,7 +4264,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 10 m_characterSpacing: 10
m_wordSpacing: 5 m_wordSpacing: 5

View File

@ -1756,7 +1756,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!136 &102349500 --- !u!136 &102349500
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -8460,7 +8460,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3} m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isDebugTest: 1 isDebugTest: 0
diceRollHandler: {fileID: 1013177415} diceRollHandler: {fileID: 1013177415}
diceValue: 0 diceValue: 0
maxDiceSixRollCounter: 2 maxDiceSixRollCounter: 2
@ -15149,6 +15149,7 @@ MonoBehaviour:
- {fileID: 5608193482197189505} - {fileID: 5608193482197189505}
- {fileID: 5608193481571390227} - {fileID: 5608193481571390227}
baseObjects: baseObjects:
- {fileID: 1949792867}
- {fileID: 2095159703} - {fileID: 2095159703}
- {fileID: 247469677} - {fileID: 247469677}
- {fileID: 875086323} - {fileID: 875086323}
@ -15157,7 +15158,6 @@ MonoBehaviour:
- {fileID: 1954289399} - {fileID: 1954289399}
- {fileID: 1107252688} - {fileID: 1107252688}
- {fileID: 1406544794} - {fileID: 1406544794}
- {fileID: 1949792867}
- {fileID: 884011400} - {fileID: 884011400}
--- !u!4 &1335794571 --- !u!4 &1335794571
Transform: Transform:
@ -20274,7 +20274,7 @@ AudioSource:
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 1
Mute: 0 Mute: 0
Spatialize: 0 Spatialize: 0
SpatializePostEffects: 0 SpatializePostEffects: 0
@ -24609,8 +24609,6 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
screenType: 6 screenType: 6
shouldFade: 0 shouldFade: 0
playBtn: {fileID: 0}
closeBtn: {fileID: 0}
--- !u!224 &5608193481924487018 --- !u!224 &5608193481924487018
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -60,6 +60,9 @@ public class MusicManager : MonoBehaviour, IBootLoader, IBase, IDataLoader
audioSource.priority = musicData.priority; audioSource.priority = musicData.priority;
audioSource.clip = musicData.musicClip; audioSource.clip = musicData.musicClip;
if (audioSource.isPlaying) audioSource.Stop();
audioSource.Play(); audioSource.Play();
} }
} }

View File

@ -75,7 +75,8 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnGameRestarted() public void OnGameRestarted()
{ {
GameManager.OnGameStateChanged(GameState.InGame); GameManager.OnGameStateChanged(GameState.InGame);
gameplayManager.ResetGameRestartData(); GameManager.ResetGameDatas();
switch (CurrentGameModeType) switch (CurrentGameModeType)
{ {
case GameModeType.PVP: case GameModeType.PVP:

View File

@ -16,28 +16,35 @@ public enum BotMove
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
[SerializeField] private bool isDebugTest = false; [SerializeField] private bool isDebugAITest = false;
[SerializeField] private bool isDebugPlayerTest = false;
public bool IsDebugTest => isDebugTest; public bool IsDebugAITest => isDebugAITest;
public bool IsDebugPlayerTest => isDebugPlayerTest;
[SerializeField] DiceRollHandler diceRollHandler; [SerializeField] DiceRollHandler diceRollHandler;
[SerializeField] private int diceValue = 0; [SerializeField] private int diceValue = 0;
[SerializeField] private float botDiceRollDelay = 0.25f;
[SerializeField] private int maxDiceSixRollCounter = 2; [SerializeField] private int maxDiceSixRollCounter = 2;
[SerializeField] private int totalStepsForCharacter = 57; [SerializeField] private int totalStepsForCharacter = 57;
[SerializeField] private TextMeshProUGUI diceText; [SerializeField] private TextMeshProUGUI diceText;
#if UNITY_EDITOR
[SerializeField] private Transform pointerDebug; [SerializeField] private Transform pointerDebug;
[SerializeField] private MeshRenderer pointerMeshRend; [SerializeField] private MeshRenderer pointerMeshRend;
[SerializeField] private Material turnMat; [SerializeField] private Material turnMat;
[SerializeField] private Material selectMat; [SerializeField] private Material selectMat;
#endif
[SerializeField] private PlayerGameData[] playerGameDatas; [SerializeField] private PlayerGameData[] playerGameDatas;
[SerializeField] private PlayerBaseHandler playerBaseHandler; [SerializeField] private PlayerBaseHandler playerBaseHandler;
private PlayerType currentPlayerTypeTurn;
public PlayerType CurrentPlayerTypeTurn => currentPlayerTypeTurn; public PlayerType CurrentPlayerTypeTurn => currentPlayerTypeTurn;
public PlayerBaseHandler PlayerBaseHandler => playerBaseHandler;
private PlayerType currentPlayerTypeTurn;
private int currentPlayerTurnIndex = 0; private int currentPlayerTurnIndex = 0;
private List<PlayerType> allPlayerTypes = new List<PlayerType>(); private List<PlayerType> allPlayerTypes = new List<PlayerType>();
@ -49,7 +56,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private Dictionary<PlayerType, PlayerGameData> playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>(); private Dictionary<PlayerType, PlayerGameData> playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>();
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; public TilesManager TilesManager
{
get; private set;
}
private UIManager uIManager; private UIManager uIManager;
private GameManager gameManager; private GameManager gameManager;
private GameModeHandler gameModeHandler; private GameModeHandler gameModeHandler;
@ -83,7 +93,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void InitializeData() public void InitializeData()
{ {
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>(); TilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
uIManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>(); uIManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>(); gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
gameModeHandler = InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>(); gameModeHandler = InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>();
@ -105,7 +115,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}); });
} }
tilesManager.InitTilesData(); TilesManager.InitTilesData();
playerBaseHandler.InitPlayerTypes(allPlayerTypes); playerBaseHandler.InitPlayerTypes(allPlayerTypes);
InitCurrentGamePlayerInfo(); InitCurrentGamePlayerInfo();
@ -136,7 +146,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
} }
} }
tilesManager.InitTilesData(); TilesManager.InitTilesData();
playerBaseHandler.InitPlayerTypes(allPlayerTypes); playerBaseHandler.InitPlayerTypes(allPlayerTypes);
InitCurrentGamePlayerInfo(); InitCurrentGamePlayerInfo();
InitBotRuntimeData(); InitBotRuntimeData();
@ -144,7 +154,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
SetCanRollDiceForUser(!botTypesInGame.Contains(allPlayerTypes[0])); SetCanRollDiceForUser(!botTypesInGame.Contains(allPlayerTypes[0]));
if (botTypesInGame.Contains(allPlayerTypes[0])) if (botTypesInGame.Contains(allPlayerTypes[0]))
Invoke(nameof(HandleDiceRoll), 1f); HandleDiceRollWithDelay();
}
private void HandleDiceRollWithDelay()
{
Invoke(nameof(HandleDiceRoll), botDiceRollDelay);
} }
private void InitBotRuntimeData() private void InitBotRuntimeData()
@ -215,7 +230,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex]; currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}"); Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
#if UNITY_EDITOR
SetCurrentSelectedPointer(); SetCurrentSelectedPointer();
#endif
// initialize the board based on the player types // initialize the board based on the player types
playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>(); playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>();
@ -227,8 +244,18 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"playerGameData.playerType: {playerGameData.playerType}"); Debug.Log($"playerGameData.playerType: {playerGameData.playerType}");
playerGameDatasDict.Add(playerGameData.playerType, playerGameData); playerGameDatasDict.Add(
playerGameDatasDict[playerGameData.playerType].playerPawnsDict = new Dictionary<int, PlayerPawn>(); playerGameData.playerType,
new PlayerGameData
{
playerType = playerGameData.playerType,
startIndex = playerGameData.startIndex,
endIndex = playerGameData.endIndex,
playersParent = playerGameData.playersParent,
playerPawnsDict = new Dictionary<int, PlayerPawn>(),
totalPawnsInHome = playerGameData.totalPawnsInHome,
totalPawnsFinished = playerGameData.totalPawnsFinished
});
foreach (Transform playerPawnChild in playerGameData.playersParent) foreach (Transform playerPawnChild in playerGameData.playersParent)
{ {
@ -317,7 +344,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0) if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
{ {
UpdateActivePlayersAndSetDisplay(); UpdateActivePlayersAndSetDisplay(true);
} }
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
@ -460,10 +487,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void FindPossibleTileData(PlayerPawn playerPawn, out int possibleSteps, out Tile possibleTileData) private void FindPossibleTileData(PlayerPawn playerPawn, out int possibleSteps, out Tile possibleTileData)
{ {
int lastStepGenTile = totalStepsForCharacter - tilesManager.GetFinishingTileDataLength(playerPawn.PlayerType);//playerGameDatasDict[playerPawn.PlayerType].endIndex; int lastStepGenTile = totalStepsForCharacter - TilesManager.GetFinishingTileDataLength(playerPawn.PlayerType);//playerGameDatasDict[playerPawn.PlayerType].endIndex;
int possibleTileIndex = playerPawn.CurrentTileIndex + diceRolledValue; int possibleTileIndex = playerPawn.CurrentTileIndex + diceRolledValue;
int lastTileIndex = tilesManager.GetGeneralTilesLength() - 1; int lastTileIndex = TilesManager.GetGeneralTilesLength() - 1;
bool canGoingInsideFinishingPath = IsGoingInsideFinishingPath(playerPawn, out possibleSteps); bool canGoingInsideFinishingPath = IsGoingInsideFinishingPath(playerPawn, out possibleSteps);
int index = canGoingInsideFinishingPath ? possibleSteps - lastStepGenTile - 1 int index = canGoingInsideFinishingPath ? possibleSteps - lastStepGenTile - 1
@ -471,13 +498,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"possibleTileIndex: {possibleTileIndex}, lastStepGenTileIdx: {lastStepGenTile}"); Debug.Log($"possibleTileIndex: {possibleTileIndex}, lastStepGenTileIdx: {lastStepGenTile}");
Debug.Log($"index: {index}"); Debug.Log($"index: {index}");
possibleTileData = canGoingInsideFinishingPath ? tilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, index) : tilesManager.RetrieveTileBasedOnIndex(index); possibleTileData = canGoingInsideFinishingPath ? TilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, index) : TilesManager.RetrieveTileBasedOnIndex(index);
} }
public bool IsGoingInsideFinishingPath(PlayerPawn playerPawn, out int possibleSteps) public bool IsGoingInsideFinishingPath(PlayerPawn playerPawn, out int possibleSteps)
{ {
possibleSteps = playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].StepsTaken + diceRolledValue; possibleSteps = playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].StepsTaken + diceRolledValue;
return possibleSteps > tilesManager.GetGeneralTilesLength() - 1; return possibleSteps > TilesManager.GetGeneralTilesLength() - 1;
} }
public void OnDiceRolled(int rolledVal) public void OnDiceRolled(int rolledVal)
@ -490,6 +517,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceText.text = $"{diceRolledValue}"; diceText.text = $"{diceRolledValue}";
availPlayers = new List<PlayerPawn>(); availPlayers = new List<PlayerPawn>();
if (!CanRollDiceAgain)
UpdateActivePlayersAndSetDisplay(true);
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls) if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
{ {
canSwitchPlayer = false; canSwitchPlayer = false;
@ -497,8 +527,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// also play a simple animation before selecting // also play a simple animation before selecting
CanRollDiceAgain = true; CanRollDiceAgain = true;
diceSixRollCounter++; diceSixRollCounter++;
#if UNITY_EDITOR
pointerMeshRend.material = selectMat; pointerMeshRend.material = selectMat;
#endif
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict) foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath) if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath)
playerPawn.Value.SetPlayerSelectionState(false); playerPawn.Value.SetPlayerSelectionState(false);
@ -520,7 +551,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
else // if there are any other pawns that are in safe or moving state else // if there are any other pawns that are in safe or moving state
{ {
// for player's logic // for player's logic
UpdateActivePlayersAndSetDisplay();
int customAvailPlayers = availPlayers.Count(); int customAvailPlayers = availPlayers.Count();
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}"); Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
@ -532,8 +562,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (availPlayers[i].GetPlayerState() == PlayerState.InFinishingPath) if (availPlayers[i].GetPlayerState() == PlayerState.InFinishingPath)
{ {
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayers[i].CurrentTileIndex}"); Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayers[i].CurrentTileIndex}");
if (diceRolledValue <= tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayers[i].CurrentTileIndex + 1)) if (diceRolledValue <= TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayers[i].CurrentTileIndex + 1))
{ {
availPlayers[i].SetPlayerSelectionState(true); availPlayers[i].SetPlayerSelectionState(true);
} }
@ -562,14 +592,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}"); Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
} }
private void UpdateActivePlayersAndSetDisplay() private void UpdateActivePlayersAndSetDisplay(bool state)
{ {
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn) availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone || .Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
pawn.GetPlayerState() == PlayerState.Moving || pawn.GetPlayerState() == PlayerState.Moving ||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList(); pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
SetDisplayCountForAllAvailPlayers(true); SetDisplayCountForAllAvailPlayers(state);
} }
private bool AreAllPawnsInFinishingPath() private bool AreAllPawnsInFinishingPath()
@ -610,7 +640,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void HandleDiceRoll() private void HandleDiceRoll()
{ {
if (isDebugTest) if (isDebugAITest)
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue); diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
else else
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal)); diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal));
@ -626,11 +656,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (selectedPawn.GetPlayerState() == PlayerState.InHome) if (selectedPawn.GetPlayerState() == PlayerState.InHome)
{ {
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex); Tile targetTile = TilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
selectedPawn.ShowPlayerCountCanvas(false); selectedPawn.ShowPlayerCountCanvas(false);
selectedPawn.MoveToTile( selectedPawn.MoveToTile(
GetAndInitPositionInsideSafeZone(selectedPawn, targetTile), TilesManager.GetAndInitPositionInsideSafeZone(selectedPawn, targetTile, currentPlayerTypeTurn),
onComplete: () => onComplete: () =>
{ {
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--; playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
@ -652,7 +682,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
} }
else if (selectedPawn.GetPlayerState() == PlayerState.InFinishingPath) else if (selectedPawn.GetPlayerState() == PlayerState.InFinishingPath)
{ {
Tile currentSittingTile = tilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex); Tile currentSittingTile = TilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex);
currentSittingTile.ResetPlayerPawn(selectedPawn); currentSittingTile.ResetPlayerPawn(selectedPawn);
if (currentSittingTile.HasPawnsAvailable) if (currentSittingTile.HasPawnsAvailable)
@ -666,41 +696,30 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
} }
else if (selectedPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex) else if (selectedPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
{ {
tilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex).ResetPlayerPawn(selectedPawn); TilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex).ResetPlayerPawn(selectedPawn);
ApplyFinishingPathLogic(selectedPawn); ApplyFinishingPathLogic(selectedPawn);
} }
else if (selectedPawn.GetPlayerState() == PlayerState.InSafeZone || selectedPawn.GetPlayerState() == PlayerState.Moving) else if (selectedPawn.GetPlayerState() == PlayerState.InSafeZone || selectedPawn.GetPlayerState() == PlayerState.Moving)
{ {
// move based on the dice value // move based on the dice value
Debug.Log($"Tile Index :: currentTileIndex: {selectedPawn.CurrentTileIndex}"); Debug.Log($"Tile Index :: currentTileIndex: {selectedPawn.CurrentTileIndex}");
int nextTileIdx = GetNextGeneralTileIndex(selectedPawn); int nextTileIdx = TilesManager.GetNextGeneralTileIndex(selectedPawn.CurrentTileIndex);
int targetIdx = selectedPawn.CurrentTileIndex + diceRolledValue; int targetIdx = selectedPawn.CurrentTileIndex + diceRolledValue;
if (nextTileIdx == 0) if (nextTileIdx == 0)
targetIdx = (targetIdx - selectedPawn.CurrentTileIndex) - 1; targetIdx = (targetIdx - selectedPawn.CurrentTileIndex) - 1;
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex); Tile currentSittingTile = TilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex);
if (currentSittingTile.IsSafeZone) if (currentSittingTile.IsSafeZone)
{ {
SafeTile safeTile = (SafeTile)currentSittingTile; SafeTile currentSittingSafeTile = (SafeTile)currentSittingTile;
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, selectedPawn); currentSittingSafeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, selectedPawn);
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
{
var playerPawns = safeTile.GetPlayerPawns(selectedPawn.PlayerType);
if (safeTile.PlayerTypesCount == 1) if (currentSittingSafeTile.PlayerTypesCount == 1) // && currentSittingSafeTile.ContainsPlayerType(selectedPawn.PlayerType))
{ {
PlayerType playerType = safeTile.GetFirstPlayerType(); var playerPawnsTest = currentSittingSafeTile.GetFirstPlayerPawns();
foreach (var pawn in playerPawnsTest)
foreach (var pawn in playerPawns) pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
pawn.MoveToCustomTilePosition(safeTile.CenterPlacementPosition);
}
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
{
foreach (var pawn in playerPawns)
ShowUpdatedPlayerCountOnTile(pawn);
}
} }
} }
else else
@ -720,9 +739,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void ApplyFinishingPathLogic(PlayerPawn playerPawn) private void ApplyFinishingPathLogic(PlayerPawn playerPawn)
{ {
int finishingPathIndex = GetNextFinishingTileIndex(playerPawn); int finishingPathIndex = TilesManager.GetNextFinishingTileIndex(playerPawn.CurrentTileIndex, playerPawn.PlayerType);
int targetIdx = finishingPathIndex + diceRolledValue > tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ? int targetIdx = finishingPathIndex + diceRolledValue > TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ?
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue; TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}"); Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
@ -730,22 +749,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx); MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
} }
// TODO :: move to tiles manager
public int GetNextGeneralTileIndex(PlayerPawn playerPawn)
{
return playerPawn.CurrentTileIndex == tilesManager.GetGeneralTilesLength() - 1 ? 0 : playerPawn.CurrentTileIndex + 1;
}
private int GetNextFinishingTileIndex(PlayerPawn playerPawn)
{
return playerPawn.CurrentTileIndex > tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ? 0 : playerPawn.CurrentTileIndex + 1;
}
private void SwitchPlayer(PlayerPawn playerPawn = null) private void SwitchPlayer(PlayerPawn playerPawn = null)
{ {
Debug.Log($"CallTest: SwitchPlayer"); Debug.Log($"CallTest: SwitchPlayer");
if (playerPawn) if (playerPawn)
UpdatePlayerState(playerPawn, tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving); UpdatePlayerState(playerPawn, TilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving);
if (!CanRollDiceAgain) if (!CanRollDiceAgain)
{ {
@ -754,11 +765,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}"); Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
UpdateActivePlayersAndSetDisplay(); UpdateActivePlayersAndSetDisplay(false);
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}"); Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
SetDisplayCountForAllAvailPlayers(false); Debug.Log($"after allPlayerTypes.Count: {allPlayerTypes.Count}");
if (allPlayerTypes.Count == 1) if (allPlayerTypes.Count == 0)
{ {
Debug.LogError($"GAME IS OVER"); Debug.LogError($"GAME IS OVER");
return; return;
@ -781,31 +792,34 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceSixRollCounter = 0; diceSixRollCounter = 0;
diceText.text = $"{0}"; diceText.text = $"{0}";
UpdateActivePlayersAndSetDisplay();
} }
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}"); Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn)); SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn));
SetCurrentSelectedPointer();
#if UNITY_EDITOR
SetCurrentSelectedPointer();
pointerMeshRend.material = turnMat; pointerMeshRend.material = turnMat;
// pointerMeshRend.materials[0] = turnMat; // pointerMeshRend.materials[0] = turnMat;
#endif
// Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}"); // Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
{ {
Debug.Log($"Invoking RollDiceForBot"); Debug.Log($"Invoking RollDiceForBot");
Invoke(nameof(HandleDiceRoll), 1f); HandleDiceRollWithDelay();
} }
} }
#if UNITY_EDITOR
private void SetCurrentSelectedPointer() private void SetCurrentSelectedPointer()
{ {
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position; var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z); pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
} }
#endif
public void SetDisplayCountForAllAvailPlayers(bool state) public void SetDisplayCountForAllAvailPlayers(bool state)
{ {
@ -821,17 +835,17 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void MoveThroughTiles(PlayerPawn playerPawn, int index, int targetIndex) private void MoveThroughTiles(PlayerPawn playerPawn, int index, int targetIndex)
{ {
Tile nextTile = tilesManager.RetrieveTileBasedOnIndex(index); Tile nextTile = TilesManager.RetrieveTileBasedOnIndex(index);
Vector3 targetPosition = nextTile.CenterPlacementPosition; Vector3 targetPosition = nextTile.CenterPlacementPosition;
Debug.Log($"Tile Index :: nextIndex: {index}, targetIndex: {targetIndex}, nextTileName: {nextTile.name}"); Debug.Log($"Tile Index :: nextIndex: {index}, targetIndex: {targetIndex}, nextTileName: {nextTile.name}");
if (index == targetIndex) // if the target index is the safe zone only then apply the logic for rearranging pawns if (index == targetIndex) // if the target index is the safe zone only then apply the logic for rearranging pawns
{ {
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(targetIndex); Tile targetTile = TilesManager.RetrieveTileBasedOnIndex(targetIndex);
if (targetTile.IsSafeZone) if (targetTile.IsSafeZone)
{ {
targetPosition = GetAndInitPositionInsideSafeZone(playerPawn, targetTile); targetPosition = TilesManager.GetAndInitPositionInsideSafeZone(playerPawn, targetTile, currentPlayerTypeTurn);
} }
} }
@ -846,7 +860,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"DiceRolledValue: {diceRolledValue}"); Debug.Log($"DiceRolledValue: {diceRolledValue}");
if (diceRolledValue > 0) if (diceRolledValue > 0)
{ {
int nextTileIndex = GetNextGeneralTileIndex(playerPawn); int nextTileIndex = TilesManager.GetNextGeneralTileIndex(playerPawn.CurrentTileIndex);
Debug.Log($"currentTileIndex: {playerPawn.CurrentTileIndex}, nextTileIndex: {nextTileIndex}, targetIndex: {targetIndex}"); Debug.Log($"currentTileIndex: {playerPawn.CurrentTileIndex}, nextTileIndex: {nextTileIndex}, targetIndex: {targetIndex}");
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || index == playerGameDatasDict[currentPlayerTypeTurn].endIndex) if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || index == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
@ -885,14 +899,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
for (int i = counter; i > 0; i--) for (int i = counter; i > 0; i--)
{ {
var pawn = nextTile.GetPlayerPawn(); var pawn = nextTile.GetPlayerPawn();
Debug.Log($"pawn: {pawn}");
Debug.Log($"playerBase: {playerBaseHandler}");
var playerBasePos = playerBaseHandler.GetPlayerBase(pawn.PlayerType).GetBasePlacementDataPosition(pawn.PlayerId - 1);
Debug.Log($"playerBasePos: {playerBasePos}");
playerGameDatasDict[pawn.PlayerType].totalPawnsInHome++; playerGameDatasDict[pawn.PlayerType].totalPawnsInHome++;
pawn.MoveBackToHome(playerBasePos); playerBaseHandler.SendPlayerToHome(pawn);
} }
if (CheckForMaxDiceRollAttempt()) if (CheckForMaxDiceRollAttempt())
@ -930,69 +938,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
index); index);
} }
private Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile)
{
Vector3 targetPosition;
SafeTile targetSafeTile = (SafeTile)targetTile;
Debug.Log($"targetSafeTile.PlayerTypesCount: {targetSafeTile.PlayerTypesCount}");
if (targetSafeTile.PlayerTypesCount == 1)
{
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)) // means it is a new player type, the second one
{
PlayerType initialPlayerType = targetSafeTile.GetFirstPlayerType();
// rearrange already existing player from center position to it's saved transform
var playerPawns = targetSafeTile.GetPlayerPawns(initialPlayerType);
foreach (var pawn in playerPawns)
{
var placementPoint = targetSafeTile.GetPlacementPoint(initialPlayerType);
pawn.MoveToCustomTilePosition(placementPoint.position);
}
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetTile.CenterPlacementPosition;
}
}
else
{
// TODO :: Check the data if it's consistent
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
{
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);
targetPosition = targetTile.CenterPlacementPosition;
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
}
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
}
}
return targetPosition;
}
private void MoveThroughFinishingPath(PlayerPawn playerPawn, int index, int targetIndex) private void MoveThroughFinishingPath(PlayerPawn playerPawn, int index, int targetIndex)
{ {
UpdatePlayerState(playerPawn, PlayerState.InFinishingPath); UpdatePlayerState(playerPawn, PlayerState.InFinishingPath);
playerPawn.MoveToTile( playerPawn.MoveToTile(
tilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, index).transform.position, TilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, index).transform.position,
onComplete: () => onComplete: () =>
{ {
diceRolledValue--; diceRolledValue--;
@ -1000,7 +951,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"DiceRolledValue: {diceRolledValue}"); Debug.Log($"DiceRolledValue: {diceRolledValue}");
if (diceRolledValue > 0) if (diceRolledValue > 0)
{ {
int tileIndex = GetNextFinishingTileIndex(playerPawn); int tileIndex = TilesManager.GetNextFinishingTileIndex(playerPawn.CurrentTileIndex, playerPawn.PlayerType);
Debug.Log($"tileIndex: {tileIndex}, targetIndex: {targetIndex}"); Debug.Log($"tileIndex: {tileIndex}, targetIndex: {targetIndex}");
if (tileIndex <= targetIndex) if (tileIndex <= targetIndex)
{ {
@ -1010,18 +961,25 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
} }
else else
{ {
if (playerPawn.CurrentTileIndex == tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1) if (playerPawn.CurrentTileIndex == TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
{ {
playerPawn.ShowPlayerCountCanvas(false); Tile tile = TilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, playerPawn.CurrentTileIndex);
tile.InitPlayerPawn(playerPawn, playerPawn.PlayerType);
// ShowUpdatedPlayerCountOnTile(playerPawn);
UpdatePlayerState(playerPawn, PlayerState.HasFinished); UpdatePlayerState(playerPawn, PlayerState.HasFinished);
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++; playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
Debug.Log($"playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished: {playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished}");
Debug.Log($"playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count: {playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count}");
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished == playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count) if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished == playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count)
{ {
CanRollDiceAgain = false; CanRollDiceAgain = false;
var playerTypeToRemove = currentPlayerTypeTurn; var playerTypeToRemove = currentPlayerTypeTurn;
allPlayerTypes.ForEach(type => Debug.Log($"before allPlayerTypes: {type}"));
SwitchPlayer(); SwitchPlayer();
allPlayerTypes.ForEach(type => Debug.Log($"after allPlayerTypes: {type}"));
if (allPlayerTypes.Contains(playerTypeToRemove)) if (allPlayerTypes.Contains(playerTypeToRemove))
{ {
@ -1054,7 +1012,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
else else
{ {
// activate here // activate here
tilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, playerPawn.CurrentTileIndex).InitPlayerPawn(playerPawn, currentPlayerTypeTurn); TilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, playerPawn.CurrentTileIndex).InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
if (CheckForMaxDiceRollAttempt()) if (CheckForMaxDiceRollAttempt())
{ {
@ -1080,8 +1038,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn) private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn)
{ {
Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ? Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ?
tilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, playerPawn.CurrentTileIndex) TilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, playerPawn.CurrentTileIndex)
: tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex); : TilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
playerPawn.ShowPlayerCountCanvas(true); playerPawn.ShowPlayerCountCanvas(true);
@ -1100,6 +1058,21 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerPawn.PlayerCountCanvas.SetPlayerCount(count); playerPawn.PlayerCountCanvas.SetPlayerCount(count);
} }
public void ResetTileDatasForPlayers()
{
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());
}
}
}
public void ResetData() public void ResetData()
{ {
ResetGameRestartData(); ResetGameRestartData();

View File

@ -42,4 +42,12 @@ public class PlayerBase : MonoBehaviour
Debug.Log($"Index: {idx}, basePlacementDatas[idx]: {basePlacementDatas[idx]}"); Debug.Log($"Index: {idx}, basePlacementDatas[idx]: {basePlacementDatas[idx]}");
return basePlacementDatas[idx].placementTransform; return basePlacementDatas[idx].placementTransform;
} }
public void ResetPlayerDatas()
{
for (int idx = 0; idx < playerPawns.Length; idx++)
{
playerPawns[idx].ResetData();
}
}
} }

View File

@ -40,4 +40,18 @@ public class PlayerBaseHandler : MonoBehaviour
{ {
return playerBasesDict[playerType]; return playerBasesDict[playerType];
} }
public void ResetPlayerBaseData()
{
foreach (var playerBasePair in playerBasesDict)
{
playerBasePair.Value.ResetPlayerDatas();
}
}
public void SendPlayerToHome(PlayerPawn pawn)
{
var playerBasePos = GetPlayerBase(pawn.PlayerType).GetBasePlacementDataPosition(pawn.PlayerId - 1);
pawn.MoveBackToHome(playerBasePos);
}
} }

View File

@ -65,10 +65,6 @@ public class PlayerPawn : MonoBehaviour
public void SetPlayerSelectionState(bool state) public void SetPlayerSelectionState(bool state)
{ {
CanSelectPlayer = state; CanSelectPlayer = state;
if (CanSelectPlayer)
{
// TODO :: Play animation for selecting any of the players
}
} }
public void MoveToTile(Vector3 startingPoint, Action onComplete, int tileIndex) public void MoveToTile(Vector3 startingPoint, Action onComplete, int tileIndex)
@ -91,6 +87,7 @@ public class PlayerPawn : MonoBehaviour
Vector3 lookDirection = Vector3.zero; Vector3 lookDirection = Vector3.zero;
Debug.Log($"nextIndex :: playerState: {playerState}");
if (playerState == PlayerState.InFinishingPath) if (playerState == PlayerState.InFinishingPath)
{ {
int nextIndex = CurrentTileIndex + 1; int nextIndex = CurrentTileIndex + 1;
@ -109,14 +106,18 @@ public class PlayerPawn : MonoBehaviour
} }
else else
{ {
int nextIndex = gameplayManager.GetNextGeneralTileIndex(this); int nextIndex = gameplayManager.TilesManager.GetNextGeneralTileIndex(CurrentTileIndex);
Debug.Log($"nextIndex :: {nextIndex}, currentIndex: {CurrentTileIndex}");
lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextIndex).transform.position - transform.position; lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextIndex).transform.position - transform.position;
} }
} }
lookDirection = lookDirection.normalized;
lookDirection.y = 0; lookDirection.y = 0;
if (lookDirection != Vector3.zero) if (lookDirection != Vector3.zero)
{ {
// transform.LookAt(transform.position + lookDirection);
transform.DOLookAt(transform.position + lookDirection, 0.2f); transform.DOLookAt(transform.position + lookDirection, 0.2f);
} }
@ -171,4 +172,14 @@ public class PlayerPawn : MonoBehaviour
{ {
playerCountCanvas.gameObject.SetActive(show); playerCountCanvas.gameObject.SetActive(show);
} }
public void ResetData()
{
SetPlayerState(PlayerState.InHome);
StepsTaken = 0;
PlayerId = 0;
if (playerCountCanvas.gameObject.activeInHierarchy)
ShowPlayerCountCanvas(false);
}
} }

View File

@ -34,7 +34,7 @@ public class DiceRollHandler : MonoBehaviour
SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>(); SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>();
soundManager?.PlayGameSoundClip(SoundType.Dice); soundManager?.PlayGameSoundClip(SoundType.Dice);
if (inputManager.GameplayManager.IsDebugTest) if (inputManager.GameplayManager.IsDebugPlayerTest)
OnUserDiceRollComplete(GetDiceTestVal()); OnUserDiceRollComplete(GetDiceTestVal());
else else
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false); diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);

View File

@ -3,7 +3,7 @@ using UnityEngine;
public class GameBootLoader : BootLoader public class GameBootLoader : BootLoader
{ {
[SerializeField] private GameObject[] baseObjects; [SerializeField] private GameObject[] baseObjects;
// [SerializeField] private BaseSO[] scriptables; [SerializeField] private bool enableLogs = false;
private bool hasInitializedScriptables = false; private bool hasInitializedScriptables = false;
@ -21,6 +21,7 @@ public class GameBootLoader : BootLoader
} }
protected override void InitializeData() protected override void InitializeData()
{ {
Debug.unityLogger.logEnabled = enableLogs;
Debug.Log($"InitializeData: for loaders"); Debug.Log($"InitializeData: for loaders");
InitializeScriptablesData(); InitializeScriptablesData();

View File

@ -11,6 +11,7 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
private UIManager uiManager; private UIManager uiManager;
private TilesManager tilesManager; private TilesManager tilesManager;
private MusicManager musicManager;
private GameplayManager gameplayManager; private GameplayManager gameplayManager;
public GameState GameState public GameState GameState
@ -18,6 +19,8 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
get; private set; get; private set;
} }
private GameState PrevGameState;
public void Initialize() public void Initialize()
{ {
InterfaceManager.Instance.RegisterInterface<GameManager>(this); InterfaceManager.Instance.RegisterInterface<GameManager>(this);
@ -28,27 +31,47 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
uiManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>(); uiManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>(); tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>(); gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
musicManager = InterfaceManager.Instance.GetInterfaceInstance<MusicManager>();
OnGameStateChanged(GameState.InMenu); OnGameStateChanged(GameState.InMenu);
} }
public void OnGameStateChanged(GameState gameState) public void OnGameStateChanged(GameState gameState)
{ {
PrevGameState = GameState;
GameState = gameState; GameState = gameState;
Debug.Log($"OnGameStateChanged: {gameState}"); Debug.Log($"OnGameStateChanged: {gameState}");
switch (gameState) switch (gameState)
{ {
case GameState.InMenu: case GameState.InMenu:
gameplayManager.ResetData(); musicManager.PlayMusicClip(MusicType.HomeMusic);
tilesManager.ResetData(); CheckPrevGameState();
uiManager.OnInMenuScreen(); uiManager.OnInMenuScreen();
break; break;
case GameState.InGame: case GameState.InGame:
musicManager.PlayMusicClip(MusicType.GameMusic);
uiManager.OnInGameScreen(); uiManager.OnInGameScreen();
break; break;
case GameState.GameOver: case GameState.GameOver:
musicManager.PlayMusicClip(MusicType.GameOverMusic);
uiManager.OnGameOver(); uiManager.OnGameOver();
break; break;
} }
} }
private void CheckPrevGameState()
{
if (PrevGameState == GameState.InGame) // returning to menu from in-game
{
ResetGameDatas();
}
}
public void ResetGameDatas()
{
gameplayManager.ResetTileDatasForPlayers();
gameplayManager.ResetData();
tilesManager.ResetData();
gameplayManager.PlayerBaseHandler.ResetPlayerBaseData();
}
} }

View File

@ -12,6 +12,7 @@ public class SafeTile : Tile
public int PlayerTypesCount => playerTypesDict.Count; public int PlayerTypesCount => playerTypesDict.Count;
public bool HasMoreThanOnePlayerType => playerTypesDict.Count > 1; public bool HasMoreThanOnePlayerType => playerTypesDict.Count > 1;
public List<PlayerPawn> GetPlayerPawns(PlayerType playerType) => playerTypesDict[playerType].playerPawns.Values.ToList(); public List<PlayerPawn> GetPlayerPawns(PlayerType playerType) => playerTypesDict[playerType].playerPawns.Values.ToList();
public List<PlayerPawn> GetFirstPlayerPawns() => playerTypesDict.FirstOrDefault().Value.playerPawns.Values.ToList();
public bool ContainsPlayerType(PlayerType playerType) => playerTypesDict.ContainsKey(playerType); public bool ContainsPlayerType(PlayerType playerType) => playerTypesDict.ContainsKey(playerType);
@ -86,4 +87,12 @@ public class SafeTile : Tile
{ {
return playerTypesDict[playerType].commonPlacementTransform; return playerTypesDict[playerType].commonPlacementTransform;
} }
public override void ResetTileData()
{
if (playerTypesDict != null && playerTypesDict.Count > 0)
{
playerTypesDict.Clear();
}
}
} }

View File

@ -53,4 +53,10 @@ public class Tile : MonoBehaviour
Debug.Log($"Resetting new PlayerPawn {movingPawn.name} {name}"); Debug.Log($"Resetting new PlayerPawn {movingPawn.name} {name}");
Debug.Log($"Resetting new PlayerPawn {PlayerPawns.Count} {name}"); Debug.Log($"Resetting new PlayerPawn {PlayerPawns.Count} {name}");
} }
public virtual void ResetTileData()
{
if (HasPawnsAvailable)
PlayerPawns.Clear();
}
} }

View File

@ -62,8 +62,103 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
return finishingTileDataPairs[playerType][index]; return finishingTileDataPairs[playerType][index];
} }
public int GetNextGeneralTileIndex(int currentTileIndex)
{
return currentTileIndex == GetGeneralTilesLength() - 1 ? 0 : currentTileIndex + 1;
}
public int GetNextFinishingTileIndex(int currentTileIndex, PlayerType currentPlayerTypeTurn)
{
return currentTileIndex > GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ? 0 : currentTileIndex + 1;
}
public void ResetData() public void ResetData()
{ {
finishingTileDataPairs.Clear(); finishingTileDataPairs.Clear();
} }
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
{
if (playerState == PlayerState.InFinishingPath || playerState == PlayerState.HasFinished)
{
Tile tile = RetrieveFinishingTileBasedOnIndex(playerType, currentTileIndex);
tile.ResetTileData();
}
else if (playerState == PlayerState.Moving)
{
Tile tile = RetrieveTileBasedOnIndex(currentTileIndex);
tile.ResetTileData();
}
else if (playerState == PlayerState.InSafeZone)
{
SafeTile tile = (SafeTile)RetrieveTileBasedOnIndex(currentTileIndex);
tile.ResetTileData();
}
}
public Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile, PlayerType currentPlayerTypeTurn)
{
Vector3 targetPosition;
SafeTile targetSafeTile = (SafeTile)targetTile;
Debug.Log($"targetSafeTile.PlayerTypesCount: {targetSafeTile.PlayerTypesCount}");
if (targetSafeTile.PlayerTypesCount == 1)
{
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)) // means it is a new player type, the second one
{
PlayerType initialPlayerType = targetSafeTile.GetFirstPlayerType();
// rearrange already existing player from center position to it's saved transform
Debug.Log($"### GetAndInitPositionInsideSafeZone initialPlayerType: {initialPlayerType}");
var playerPawns = targetSafeTile.GetPlayerPawns(initialPlayerType);
Debug.Log($"### GetAndInitPositionInsideSafeZone playerPawns: {playerPawns.Count}");
foreach (var pawn in playerPawns)
{
var placementPoint = targetSafeTile.GetPlacementPoint(initialPlayerType);
Debug.Log($"### GetAndInitPositionInsideSafeZone placementPoint: {placementPoint.position}");
pawn.MoveToCustomTilePosition(placementPoint.position);
}
Debug.Log($"### GetAndInitPositionInsideSafeZone playerPawn: {playerPawn.name}, {playerPawn.PlayerType}");
Debug.Log($"### GetAndInitPositionInsideSafeZone currentPlayerTypeTurn: {currentPlayerTypeTurn}");
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
Debug.Log($"### GetAndInitPositionInsideSafeZone targetPosition: {targetPosition}");
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetTile.CenterPlacementPosition;
}
}
else
{
// TODO :: Check the data if it's consistent
Debug.Log($"targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn): {targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn)}");
if (!targetSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
{
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);
targetPosition = targetTile.CenterPlacementPosition;
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
}
}
else
{
targetSafeTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
targetPosition = targetSafeTile.GetPlacementPoint(currentPlayerTypeTurn).position;
}
}
return targetPosition;
}
} }

View File

@ -47,7 +47,7 @@ PlayerSettings:
defaultScreenWidthWeb: 960 defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600 defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0 m_StereoRenderingPath: 0
m_ActiveColorSpace: 1 m_ActiveColorSpace: 0
unsupportedMSAAFallback: 0 unsupportedMSAAFallback: 0
m_MTRendering: 1 m_MTRendering: 1
mipStripping: 0 mipStripping: 0