Compare commits
No commits in common. "bac165c28d8bacad0b8dc186dbb81beaa8ea4598" and "2563f36e7d01acfe424f62d955f6806d55d7249b" have entirely different histories.
bac165c28d
...
2563f36e7d
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 MiB |
@ -1,169 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ba663284666654b1abb477ac5ccb8f3d
|
|
||||||
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: 2
|
|
||||||
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:
|
|
||||||
- serializedVersion: 2
|
|
||||||
name: Logo_GO88 1_0
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 88
|
|
||||||
y: 152
|
|
||||||
width: 2444
|
|
||||||
height: 1104
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: 0, y: 0}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
tessellationDetail: 0
|
|
||||||
bones: []
|
|
||||||
spriteID: 281a1393ddc5148d79a719ca7cd0f112
|
|
||||||
internalID: 2023667419
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID: 5e97eb03825dee720800000000000000
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
nameFileIdTable:
|
|
||||||
Logo_GO88 1_0: 2023667419
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 MiB |
@ -1,147 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1cfb151daad2e4e719892a83a58ce545
|
|
||||||
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:
|
|
||||||
@ -29,11 +29,9 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
[SerializeField] private Image diceImage;
|
[SerializeField] private Image diceImage;
|
||||||
[SerializeField] private Sprite defaultSprite;
|
[SerializeField] private Sprite defaultSprite;
|
||||||
[SerializeField] private Button diceButton;
|
[SerializeField] private Button diceButton;
|
||||||
[SerializeField] private RectTransform diceRectTransform;
|
|
||||||
[SerializeField] private int diceVal;
|
|
||||||
|
|
||||||
private Animator animator;
|
private Animator animator;
|
||||||
private List<int> probabilityValues = new List<int>() { 2, 3, 4 };
|
private List<int> probabilityValues = new List<int>() { 3, 4, 5 };
|
||||||
private Action<int> onRollingComplete = null;
|
private Action<int> onRollingComplete = null;
|
||||||
|
|
||||||
private IRollBase rollBase = null;
|
private IRollBase rollBase = null;
|
||||||
@ -45,6 +43,7 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
|
Debug.Log($"Dice roll test: StartRollingAction: animator: {animator}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Roll(Action<int> onComplete, bool isBot)
|
public void Roll(Action<int> onComplete, bool isBot)
|
||||||
@ -62,6 +61,7 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
|
|
||||||
private void StartRollingAction()
|
private void StartRollingAction()
|
||||||
{
|
{
|
||||||
|
Debug.Log($"Dice roll test: StartRollingAction: animator: {animator}, {gameObject.name}");
|
||||||
rolling = true;
|
rolling = true;
|
||||||
rolledVal = 0;
|
rolledVal = 0;
|
||||||
// start animation
|
// start animation
|
||||||
@ -81,8 +81,6 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
{
|
{
|
||||||
rolledVal = GetDiceValue();
|
rolledVal = GetDiceValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diceVal != 0) rolledVal = diceVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -92,27 +90,30 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
public void OnDiceRollingCompleted()
|
public void OnDiceRollingCompleted()
|
||||||
{
|
{
|
||||||
animator.ResetTrigger(Ludo_3D_Constants.RollDiceTriggerString);
|
animator.ResetTrigger(Ludo_3D_Constants.RollDiceTriggerString);
|
||||||
|
Debug.Log($"Dice roll test: OnDiceRollingCompleted");
|
||||||
|
|
||||||
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
||||||
ResetRollData();
|
ResetRollData();
|
||||||
|
|
||||||
ResetData();
|
ResetData();
|
||||||
|
Debug.Log($"Dice roll test: Dice rolled: {rolledVal}");
|
||||||
onRollingComplete?.Invoke(rolledVal);
|
onRollingComplete?.Invoke(rolledVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnReturnedToIdle()
|
public void OnReturnedToIdle()
|
||||||
{
|
{
|
||||||
Debug.Log($"DiceView :: OnReturnedToIdle: {rolledVal}");
|
Debug.Log($"Dice roll test: OnReturnedToIdle: rolled: {rolledVal}");
|
||||||
|
|
||||||
animator.enabled = false;
|
animator.enabled = false;
|
||||||
if (rolledVal == 0)
|
if (rolledVal == 0)
|
||||||
{
|
{
|
||||||
ShowDefaultSprite();
|
diceImage.sprite = defaultSprite;
|
||||||
|
Debug.Log($"Dice roll test: OnReturnedToIdle: setting default sprite");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
diceImage.sprite = diceSideDatas[rolledVal - 1].sprite;
|
diceImage.sprite = diceSideDatas[rolledVal - 1].sprite;
|
||||||
}
|
}
|
||||||
|
Debug.Log($"Dice roll test: OnReturnedToIdle: diceImage.sprite: {diceImage.sprite.name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetDiceValue()
|
private int GetDiceValue()
|
||||||
@ -134,17 +135,12 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
public void SetDiceButtonInteraction(bool status)
|
public void SetDiceButtonInteraction(bool status)
|
||||||
{
|
{
|
||||||
diceButton.interactable = status;
|
diceButton.interactable = status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetOnSessionEnd()
|
public void ResetOnSessionEnd()
|
||||||
{
|
{
|
||||||
ResetData();
|
ResetData();
|
||||||
|
|
||||||
rolledVal = 0;
|
|
||||||
OnReturnedToIdle();
|
|
||||||
|
|
||||||
diceRectTransform.rotation = Quaternion.identity;
|
|
||||||
diceRectTransform.localScale = Vector3.one;
|
|
||||||
onRollingComplete = null;
|
onRollingComplete = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,10 +152,4 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
|
|
||||||
this.rollBase = rollBase;
|
this.rollBase = rollBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowDefaultSprite()
|
|
||||||
{
|
|
||||||
Debug.Log($"DiceView :: ShowDefaultSprite");
|
|
||||||
diceImage.sprite = defaultSprite;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -629,7 +629,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 5526766409186502679}
|
animator: {fileID: 5526766409186502679}
|
||||||
playerIndicatorCanvas: {fileID: 5728752331380905399}
|
playerCountCanvas: {fileID: 5728752331380905399}
|
||||||
--- !u!1 &4818123989977612668
|
--- !u!1 &4818123989977612668
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -629,7 +629,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 5274388487207906813}
|
animator: {fileID: 5274388487207906813}
|
||||||
playerIndicatorCanvas: {fileID: 7923051124467737897}
|
playerCountCanvas: {fileID: 7923051124467737897}
|
||||||
--- !u!1 &5059623752267150313
|
--- !u!1 &5059623752267150313
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -201,7 +201,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 232863433340697214}
|
animator: {fileID: 232863433340697214}
|
||||||
playerIndicatorCanvas: {fileID: 1920934309388072333}
|
playerCountCanvas: {fileID: 1920934309388072333}
|
||||||
--- !u!136 &1627116187348267135
|
--- !u!136 &1627116187348267135
|
||||||
CapsuleCollider:
|
CapsuleCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -1258,7 +1258,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 7800412279828783518}
|
animator: {fileID: 7800412279828783518}
|
||||||
playerIndicatorCanvas: {fileID: 941219433310479660}
|
playerCountCanvas: {fileID: 941219433310479660}
|
||||||
--- !u!1 &7074820051352815849
|
--- !u!1 &7074820051352815849
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -248,6 +248,3 @@ MonoBehaviour:
|
|||||||
sprite: {fileID: -387705599, guid: bbe0ebcb7b6854733a0dd63492c4d57d, type: 3}
|
sprite: {fileID: -387705599, guid: bbe0ebcb7b6854733a0dd63492c4d57d, type: 3}
|
||||||
diceImage: {fileID: 3592825875980183606}
|
diceImage: {fileID: 3592825875980183606}
|
||||||
defaultSprite: {fileID: 1572130339, guid: 2c0526d99bc3843a4b73e6eb2f3b1376, type: 3}
|
defaultSprite: {fileID: 1572130339, guid: 2c0526d99bc3843a4b73e6eb2f3b1376, type: 3}
|
||||||
diceButton: {fileID: 1882416428171655661}
|
|
||||||
diceRectTransform: {fileID: 4547155689416384467}
|
|
||||||
diceVal: 0
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,6 @@ using System.Linq;
|
|||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
public enum BotMove
|
public enum BotMove
|
||||||
{
|
{
|
||||||
@ -27,12 +25,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
[SerializeField] DiceRollHandler diceRollHandler;
|
[SerializeField] DiceRollHandler diceRollHandler;
|
||||||
|
|
||||||
[SerializeField] private int diceValue = 0;
|
[SerializeField] private int diceValue = 0;
|
||||||
[SerializeField] private float diceRollDelayForBot = 0.5f;
|
[SerializeField] private float botDiceRollDelay = 0.25f;
|
||||||
[SerializeField] private float diceRollDelayForUser = 0.5f;
|
|
||||||
[SerializeField] private int maxDiceSixRollCounter = 2;
|
[SerializeField] private int maxDiceSixRollCounter = 2;
|
||||||
[SerializeField] private int totalStepsForCharacter = 57;
|
[SerializeField] private int totalStepsForCharacter = 57;
|
||||||
[SerializeField] private int currentPlayerTurnMaxTime = 5;
|
[SerializeField] private int currentPlayerTurnMaxTime = 5;
|
||||||
[SerializeField] private int currentPlayerSelectionMaxTime = 5;
|
|
||||||
|
|
||||||
[SerializeField] private TextMeshProUGUI diceText;
|
[SerializeField] private TextMeshProUGUI diceText;
|
||||||
|
|
||||||
@ -46,6 +42,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
[SerializeField] private PlayerGameData[] playerGameDatas;
|
[SerializeField] private PlayerGameData[] playerGameDatas;
|
||||||
[SerializeField] private PlayerBaseHandler playerBaseHandler;
|
[SerializeField] private PlayerBaseHandler playerBaseHandler;
|
||||||
|
|
||||||
|
public PlayerType CurrentPlayerTypeTurn => currentPlayerTypeTurn;
|
||||||
public PlayerBaseHandler PlayerBaseHandler => playerBaseHandler;
|
public PlayerBaseHandler PlayerBaseHandler => playerBaseHandler;
|
||||||
|
|
||||||
private PlayerType currentPlayerTypeTurn;
|
private PlayerType currentPlayerTypeTurn;
|
||||||
@ -132,6 +129,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
||||||
InitCurrentGamePlayerInfo();
|
InitCurrentGamePlayerInfo();
|
||||||
|
|
||||||
|
// SetCanRollDiceForUser(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitPlayerTypesForBotMatch(PlayerData selectedPlayerData, int botCount)
|
public void InitPlayerTypesForBotMatch(PlayerData selectedPlayerData, int botCount)
|
||||||
@ -170,7 +169,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void HandleDiceRollWithDelay()
|
private void HandleDiceRollWithDelay()
|
||||||
{
|
{
|
||||||
Invoke(nameof(RollDiceForBot), diceRollDelayForBot);
|
Invoke(nameof(RollDiceForBot), botDiceRollDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitBotRuntimeData()
|
private void InitBotRuntimeData()
|
||||||
@ -241,49 +240,38 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, false);
|
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, false);
|
||||||
currentPlayerTypeTurn = playerType;
|
currentPlayerTypeTurn = playerType;
|
||||||
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, true);
|
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, true);
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateDiceView()
|
|
||||||
{
|
|
||||||
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
|
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
|
||||||
diceRollHandler.DiceView.ShowDefaultSprite();
|
|
||||||
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
UpdateTurnTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateDiceViewForBot()
|
private void UpdateTurnTimer()
|
||||||
{
|
|
||||||
UpdateDiceView();
|
|
||||||
HandleDiceRollWithDelay();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateResponseTimerForUser(int currentPlayerMaxTime, Action onComplete)
|
|
||||||
{
|
{
|
||||||
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot)
|
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot)
|
||||||
{
|
{
|
||||||
bool isBotTurn = botTypesInGame.Contains(currentPlayerTypeTurn);
|
bool isBotTurn = botTypesInGame.Contains(currentPlayerTypeTurn);
|
||||||
// SetCanRollDiceForUser(!isBotTurn); // TODO :: Need to change
|
SetCanRollDiceForUser(!isBotTurn);
|
||||||
if (isBotTurn)
|
if (isBotTurn)
|
||||||
{
|
{
|
||||||
currentPlayerTurnTimer.KillTimer();
|
|
||||||
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
|
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else
|
else
|
||||||
// SetCanRollDiceForUser(true); // TODO :: Need to change
|
SetCanRollDiceForUser(true);
|
||||||
|
|
||||||
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerMaxTime);
|
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerTurnMaxTime);
|
||||||
|
|
||||||
if (currentPlayerTurnTimer == null)
|
if (currentPlayerTurnTimer == null)
|
||||||
currentPlayerTurnTimer = new TimerSystem();
|
currentPlayerTurnTimer = new TimerSystem();
|
||||||
|
|
||||||
currentPlayerTurnTimer.Init(currentPlayerMaxTime, onComplete: () =>
|
currentPlayerTurnTimer.Init(currentPlayerTurnMaxTime, onComplete: () =>
|
||||||
{
|
{
|
||||||
Debug.Log($"currentPlayerTurnTimer: HandleDiceViewForUser");
|
Debug.Log($"currentPlayerTurnTimer: HandleDiceViewForUser");
|
||||||
onComplete?.Invoke();
|
RollDiceForUser();
|
||||||
}, inProgress: (remTime) =>
|
}, inProgress: (remTime) =>
|
||||||
{
|
{
|
||||||
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerMaxTime - (int)remTime);
|
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn, currentPlayerTurnMaxTime - (int)remTime);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,8 +296,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
public void InitCurrentGamePlayerInfo()
|
public void InitCurrentGamePlayerInfo()
|
||||||
{
|
{
|
||||||
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
|
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
|
||||||
SetCanRollDiceForUser(IsUsersTurn());
|
|
||||||
UpdateDiceView();
|
|
||||||
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@ -351,15 +337,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPlayerSelectionStates(bool state, Predicate<PlayerState> skipPredicate = null)
|
public void EnablePlayerSelectionStates(bool state)
|
||||||
{
|
{
|
||||||
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
|
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
|
||||||
{
|
{
|
||||||
if (skipPredicate != null && skipPredicate.Invoke(playerPawn.Value.GetPlayerState()))
|
if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath) continue;
|
||||||
{
|
|
||||||
playerPawn.Value.SetPlayerSelectionState(false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerPawn.Value.SetPlayerSelectionState(state);
|
playerPawn.Value.SetPlayerSelectionState(state);
|
||||||
}
|
}
|
||||||
@ -367,6 +349,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
public void OnDiceInteracted()
|
public void OnDiceInteracted()
|
||||||
{
|
{
|
||||||
|
ResetCurrentPlayerTurnTimer();
|
||||||
RollDiceForUser();
|
RollDiceForUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,13 +411,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
Debug.Log($"SelectPawnFromBotBase: availPlayers.Count(): {availPlayersToMove.Count()}, CanRollDiceAgain: {CanRollDiceAgain}");
|
Debug.Log($"SelectPawnFromBotBase: availPlayers.Count(): {availPlayersToMove.Count()}, CanRollDiceAgain: {CanRollDiceAgain}");
|
||||||
|
|
||||||
InitActivePlayers();
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
||||||
{
|
{
|
||||||
SetDisplayCountForAllAvailPlayers(true);
|
UpdateActivePlayersAndSetDisplay(true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (CanRollDiceAgain) // got a 6 roll value
|
if (CanRollDiceAgain) // got a 6 roll value
|
||||||
{
|
{
|
||||||
@ -536,9 +516,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
if (CanRollDiceAgain)
|
||||||
{
|
|
||||||
RollDiceForBot();
|
RollDiceForBot();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SwitchPlayer();
|
SwitchPlayer();
|
||||||
}
|
}
|
||||||
@ -595,26 +573,21 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private bool HasNoPlayersTravelling() => Mathf.Abs(availPlayersToMove.Count - playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath) < 1;
|
private bool HasNoPlayersTravelling() => Mathf.Abs(availPlayersToMove.Count - playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath) < 1;
|
||||||
|
|
||||||
private bool IsUsersTurn() => gameModeHandler.CurrentGameModeType != GameModeType.Bot ||
|
|
||||||
!botTypesInGame.Contains(currentPlayerTypeTurn);
|
|
||||||
|
|
||||||
public void OnDiceRolled(int rolledVal)
|
public void OnDiceRolled(int rolledVal)
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(false);
|
SetCanRollDiceForUser(false);
|
||||||
|
diceRollHandler.DiceView.SetDiceButtonInteraction(false);
|
||||||
|
|
||||||
// add core dice logic here
|
// add core dice logic here
|
||||||
Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}");
|
Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}");
|
||||||
diceRolledValue = rolledVal;
|
diceRolledValue = rolledVal;
|
||||||
diceText.text = $"{diceRolledValue}";
|
diceText.text = $"{diceRolledValue}";
|
||||||
|
|
||||||
if (!CanRollDiceAgain) // remove this check for showing arrow logic
|
if (!CanRollDiceAgain)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
SetDisplayCountForAllAvailPlayers(true);
|
SetDisplayCountForAllAvailPlayers(true);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterAvailablePlayersToMove();
|
|
||||||
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
||||||
{
|
{
|
||||||
canSwitchPlayer = false;
|
canSwitchPlayer = false;
|
||||||
@ -623,9 +596,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
CanRollDiceAgain = true;
|
CanRollDiceAgain = true;
|
||||||
diceSixRollCounter++;
|
diceSixRollCounter++;
|
||||||
|
|
||||||
if (IsUsersTurn())
|
if (botTypesInGame != null && !botTypesInGame.Contains(currentPlayerTypeTurn))
|
||||||
{
|
{
|
||||||
Debug.Log($"availPlayersToMove.Count < 1: {availPlayersToMove.Count < 1} || HasNoPlayersTravelling(): {HasNoPlayersTravelling()}");
|
|
||||||
if (availPlayersToMove.Count < 1 || HasNoPlayersTravelling())
|
if (availPlayersToMove.Count < 1 || HasNoPlayersTravelling())
|
||||||
{
|
{
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
|
||||||
@ -638,108 +610,78 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome < 1 && CanMoveSoloPlayer())
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome < 1 && CanMoveSoloPlayer())
|
||||||
{
|
|
||||||
SetPlayerSelectionStates(false);
|
|
||||||
OnPawnSelected(availPlayersToMove[0]);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
pointerMeshRend.material = selectMat;
|
pointerMeshRend.material = selectMat;
|
||||||
#endif
|
#endif
|
||||||
|
foreach (var playerPawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict)
|
||||||
|
if (playerPawn.Value.GetPlayerState() == PlayerState.InFinishingPath)
|
||||||
|
playerPawn.Value.SetPlayerSelectionState(false);
|
||||||
|
|
||||||
Debug.Log($"### AreAllPawnsInFinishingPath");
|
Debug.Log($"### AreAllPawnsInFinishingPath");
|
||||||
if (AreAllPawnsInFinishingPath())
|
if (AreAllPawnsInFinishingPath())
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(IsUsersTurn());
|
SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn));
|
||||||
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => RollDiceForUser());
|
|
||||||
CheckForMaxDiceRollAttempt();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPlayerSelectionStates(true, (state) => state == PlayerState.InFinishingPath || state == PlayerState.HasFinished);
|
Debug.Log($"### EnablePlayerSelectionStates");
|
||||||
|
|
||||||
|
EnablePlayerSelectionStates(true);
|
||||||
|
// pointerMeshRend.materials[0] = selectMat;
|
||||||
}
|
}
|
||||||
else
|
else // if there are any other pawns that are in safe or moving state
|
||||||
{
|
{
|
||||||
Debug.Log($"before CustomAvailablePlayers: {availPlayersToMove.Count}");
|
Debug.Log($"before CustomAvailablePlayers: {availPlayersToMove.Count}");
|
||||||
|
List<int> indexesToRemove = new List<int>();
|
||||||
|
|
||||||
|
for (int i = 0; i < availPlayersToMove.Count; i++)
|
||||||
|
{
|
||||||
|
Debug.Log($"## playerPawn.GetPlayerState(): {availPlayersToMove[i].GetPlayerState()}");
|
||||||
|
|
||||||
|
if (availPlayersToMove[i].GetPlayerState() == PlayerState.InFinishingPath)
|
||||||
|
{
|
||||||
|
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayersToMove[i].CurrentTileIndex}");
|
||||||
|
if (diceRolledValue <= TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayersToMove[i].CurrentTileIndex + 1))
|
||||||
|
{
|
||||||
|
availPlayersToMove[i].SetPlayerSelectionState(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
indexesToRemove.Add(i);
|
||||||
|
availPlayersToMove[i].SetPlayerSelectionState(false);
|
||||||
|
availPlayersToMove[i].ShowPlayerCountCanvas(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
availPlayersToMove[i].SetPlayerSelectionState(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int idx = indexesToRemove.Count - 1; idx >= 0; idx--)
|
||||||
|
availPlayersToMove.RemoveAt(idx);
|
||||||
|
|
||||||
Debug.Log($"CustomAvailablePlayers: {availPlayersToMove.Count}");
|
Debug.Log($"CustomAvailablePlayers: {availPlayersToMove.Count}");
|
||||||
canSwitchPlayer = availPlayersToMove.Count < 1;
|
canSwitchPlayer = availPlayersToMove.Count < 1;
|
||||||
CanRollDiceAgain = false;
|
CanRollDiceAgain = false;
|
||||||
}
|
|
||||||
|
|
||||||
diceRollHandler.DiceView.SetDiceButtonInteraction(CanRollDiceAgain);
|
if (botTypesInGame != null && !botTypesInGame.Contains(currentPlayerTypeTurn) &&
|
||||||
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
availPlayersToMove.Count > 0)
|
||||||
|
|
||||||
if (IsUsersTurn())
|
|
||||||
{
|
|
||||||
Action onComplete = null;
|
|
||||||
if (CanRollDiceAgain && availPlayersToMove.Count < 1 &&
|
|
||||||
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
|
|
||||||
{
|
{
|
||||||
onComplete = () => OnPawnSelected(playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values
|
|
||||||
.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome));
|
|
||||||
|
|
||||||
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
|
|
||||||
}
|
|
||||||
else if (availPlayersToMove.Count > 0)
|
|
||||||
{
|
|
||||||
if (CanRollDiceAgain && playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome > 0)
|
|
||||||
{
|
|
||||||
onComplete = () => OnPawnSelected(playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values
|
|
||||||
.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome));
|
|
||||||
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CanMoveSoloPlayer())
|
if (CanMoveSoloPlayer())
|
||||||
{
|
{
|
||||||
SetPlayerSelectionStates(false);
|
EnablePlayerSelectionStates(false);
|
||||||
OnPawnSelected(availPlayersToMove[0]);
|
OnPawnSelected(availPlayersToMove[0]);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete = () => OnPawnSelected(availPlayersToMove.OrderByDescending(pawn => pawn.StepsTaken).FirstOrDefault());
|
|
||||||
UpdateResponseTimerForUser(currentPlayerSelectionMaxTime, () => onComplete?.Invoke());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void FilterAvailablePlayersToMove()
|
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
||||||
{
|
|
||||||
List<int> indexesToRemove = new List<int>();
|
|
||||||
|
|
||||||
for (int i = 0; i < availPlayersToMove.Count; i++)
|
|
||||||
{
|
|
||||||
Debug.Log($"## playerPawn.GetPlayerState(): {availPlayersToMove[i].GetPlayerState()}");
|
|
||||||
|
|
||||||
if (availPlayersToMove[i].GetPlayerState() == PlayerState.InFinishingPath)
|
|
||||||
{
|
|
||||||
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {availPlayersToMove[i].CurrentTileIndex}");
|
|
||||||
if (diceRolledValue <= TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (availPlayersToMove[i].CurrentTileIndex + 1))
|
|
||||||
{
|
|
||||||
availPlayersToMove[i].SetPlayerSelectionState(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
indexesToRemove.Add(i);
|
|
||||||
availPlayersToMove[i].SetPlayerSelectionState(false);
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
availPlayersToMove[i].ShowPlayerCountCanvas(false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
availPlayersToMove[i].SetPlayerSelectionState(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int idx = indexesToRemove.Count - 1; idx >= 0; idx--)
|
|
||||||
availPlayersToMove.RemoveAt(idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanMoveSoloPlayer()
|
private bool CanMoveSoloPlayer()
|
||||||
@ -757,6 +699,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateActivePlayersAndSetDisplay(bool state)
|
||||||
|
{
|
||||||
|
InitActivePlayers();
|
||||||
|
SetDisplayCountForAllAvailPlayers(state);
|
||||||
|
}
|
||||||
|
|
||||||
private void InitActivePlayers()
|
private void InitActivePlayers()
|
||||||
{
|
{
|
||||||
availPlayersToMove = new List<PlayerPawn>();
|
availPlayersToMove = new List<PlayerPawn>();
|
||||||
@ -788,12 +736,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void UpdatePlayerState(PlayerPawn playerPawn, PlayerState playerState)
|
private void UpdatePlayerState(PlayerPawn playerPawn, PlayerState playerState)
|
||||||
{
|
{
|
||||||
if (!playerPawn)
|
|
||||||
{
|
|
||||||
// Debug.LogError($"Player pawn is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"#### UpdatePlayerState ");
|
Debug.Log($"#### UpdatePlayerState ");
|
||||||
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId] = playerPawn;
|
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId] = playerPawn;
|
||||||
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].SetPlayerState(playerState);
|
playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].SetPlayerState(playerState);
|
||||||
@ -810,7 +752,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void RollDiceForUser()
|
private void RollDiceForUser()
|
||||||
{
|
{
|
||||||
ResetCurrentPlayerTurnTimer();
|
|
||||||
InitActivePlayers();
|
InitActivePlayers();
|
||||||
bool canUsePawnsFromHome = CanUsePawnsFromHome();
|
bool canUsePawnsFromHome = CanUsePawnsFromHome();
|
||||||
diceRollHandler.HandleDiceViewForUser(
|
diceRollHandler.HandleDiceViewForUser(
|
||||||
@ -820,7 +761,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void RollDiceForBot()
|
private void RollDiceForBot()
|
||||||
{
|
{
|
||||||
ResetCurrentPlayerTurnTimer();
|
|
||||||
InitActivePlayers();
|
InitActivePlayers();
|
||||||
HandleDiceRollForBot();
|
HandleDiceRollForBot();
|
||||||
}
|
}
|
||||||
@ -852,29 +792,23 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
public void OnPawnSelected(PlayerPawn selectedPawn)
|
public void OnPawnSelected(PlayerPawn selectedPawn)
|
||||||
{
|
{
|
||||||
// TODO :: Hide the selectable characters indicator here
|
EnablePlayerSelectionStates(false);
|
||||||
SetPlayerSelectionStates(false);
|
|
||||||
if (IsUsersTurn()) currentPlayerTurnTimer.KillTimer();
|
|
||||||
|
|
||||||
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
|
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
|
||||||
Debug.Log($"playerPawn.GetPlayerState(): {selectedPawn.GetPlayerState()}");
|
Debug.Log($"playerPawn.GetPlayerState(): {selectedPawn.GetPlayerState()}");
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
selectedPawn.ShowPlayerCountCanvas(false);
|
|
||||||
#endif
|
|
||||||
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.MoveToTile(
|
selectedPawn.MoveToTile(
|
||||||
TilesManager.GetAndInitPositionInsideSafeZone(selectedPawn, targetTile, currentPlayerTypeTurn),
|
TilesManager.GetAndInitPositionInsideSafeZone(selectedPawn, targetTile, currentPlayerTypeTurn),
|
||||||
onComplete: () =>
|
onComplete: () =>
|
||||||
{
|
{
|
||||||
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
|
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
|
||||||
UpdatePlayerState(selectedPawn, PlayerState.InSafeZone);
|
UpdatePlayerState(selectedPawn, PlayerState.InSafeZone);
|
||||||
#if UNITY_EDITOR
|
|
||||||
ShowUpdatedPlayerCountOnTile(selectedPawn);
|
ShowUpdatedPlayerCountOnTile(selectedPawn);
|
||||||
#endif
|
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -883,10 +817,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
if (selectedPawn.IsBotPlayer)
|
if (selectedPawn.IsBotPlayer)
|
||||||
CheckDiceRollForBot();
|
CheckDiceRollForBot();
|
||||||
else
|
else
|
||||||
{
|
UpdateTurnTimer();
|
||||||
SetCanRollDiceForUser(IsUsersTurn());
|
|
||||||
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, playerGameData.startIndex);
|
}, playerGameData.startIndex);
|
||||||
|
|
||||||
@ -897,14 +828,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Tile currentSittingTile = TilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex);
|
Tile currentSittingTile = TilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex);
|
||||||
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (currentSittingTile.HasPawnsAvailable)
|
if (currentSittingTile.HasPawnsAvailable)
|
||||||
{
|
{
|
||||||
var playerPawns = currentSittingTile.GetPlayerPawns();
|
var playerPawns = currentSittingTile.GetPlayerPawns();
|
||||||
foreach (var pawn in playerPawns)
|
foreach (var pawn in playerPawns)
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
ShowUpdatedPlayerCountOnTile(pawn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ApplyFinishingPathLogic(selectedPawn);
|
ApplyFinishingPathLogic(selectedPawn);
|
||||||
}
|
}
|
||||||
@ -937,26 +866,22 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
|
pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (currentSittingSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
|
if (currentSittingSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
|
||||||
{
|
{
|
||||||
var playerPawns = currentSittingSafeTile.GetPlayerPawns(currentPlayerTypeTurn);
|
var playerPawns = currentSittingSafeTile.GetPlayerPawns(currentPlayerTypeTurn);
|
||||||
foreach (var pawn in playerPawns)
|
foreach (var pawn in playerPawns)
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
ShowUpdatedPlayerCountOnTile(pawn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (currentSittingTile.HasPawnsAvailable)
|
if (currentSittingTile.HasPawnsAvailable)
|
||||||
{
|
{
|
||||||
var playerPawns = currentSittingTile.GetPlayerPawns();
|
var playerPawns = currentSittingTile.GetPlayerPawns();
|
||||||
foreach (var pawn in playerPawns)
|
foreach (var pawn in playerPawns)
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
ShowUpdatedPlayerCountOnTile(pawn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveThroughTiles(selectedPawn, nextTileIdx, targetIndex: targetIdx);
|
MoveThroughTiles(selectedPawn, nextTileIdx, targetIndex: targetIdx);
|
||||||
@ -971,6 +896,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
||||||
|
|
||||||
|
playerPawn.ShowPlayerCountCanvas(false);
|
||||||
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,10 +916,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
Debug.Log($"before SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"before SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
|
||||||
|
|
||||||
InitActivePlayers();
|
UpdateActivePlayersAndSetDisplay(false);
|
||||||
#if UNITY_EDITOR
|
|
||||||
SetDisplayCountForAllAvailPlayers(false);
|
|
||||||
#endif
|
|
||||||
Debug.Log($"after SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"after SwitchPlayer availPlayers: {availPlayersToMove.Count}, playerPawn: {playerPawn}");
|
||||||
Debug.Log($"after allPlayerTypes.Count: {allPlayerTypes.Count}");
|
Debug.Log($"after allPlayerTypes.Count: {allPlayerTypes.Count}");
|
||||||
|
|
||||||
@ -1016,32 +939,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
soundManager.PlayGameSoundClip(SoundType.Turn);
|
soundManager.PlayGameSoundClip(SoundType.Turn);
|
||||||
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
|
UpdateCurrentPlayerTurn(allPlayerTypes[currentPlayerTurnIndex]);
|
||||||
|
|
||||||
Debug.Log($"IsUsersTurn: {IsUsersTurn()}");
|
|
||||||
if (IsUsersTurn())
|
|
||||||
{
|
|
||||||
SetCanRollDiceForUser(true);
|
|
||||||
Invoke(nameof(UpdateDiceView), diceRollDelayForUser);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetCanRollDiceForUser(false);
|
|
||||||
currentPlayerTurnTimer.KillTimer();
|
|
||||||
Invoke(nameof(UpdateDiceViewForBot), diceRollDelayForBot);
|
|
||||||
}
|
|
||||||
|
|
||||||
diceSixRollCounter = 0;
|
diceSixRollCounter = 0;
|
||||||
diceText.text = $"{0}";
|
diceText.text = $"{0}";
|
||||||
}
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
UpdateTurnTimer();
|
||||||
//
|
}
|
||||||
// if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
|
||||||
// {
|
|
||||||
// Debug.Log($"Invoking RollDiceForBot");
|
|
||||||
// HandleDiceRollWithDelay();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
|
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
|
||||||
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
||||||
@ -1051,14 +955,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
pointerMeshRend.material = turnMat;
|
pointerMeshRend.material = turnMat;
|
||||||
// pointerMeshRend.materials[0] = turnMat;
|
// pointerMeshRend.materials[0] = turnMat;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCanRollDiceAgain(PlayerPawn playerPawn = null)
|
// Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
|
||||||
{
|
|
||||||
if (playerPawn)
|
|
||||||
UpdatePlayerState(playerPawn, TilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).IsSafeZone ? PlayerState.InSafeZone : PlayerState.Moving);
|
|
||||||
|
|
||||||
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
|
||||||
|
|
||||||
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
||||||
{
|
{
|
||||||
@ -1067,6 +965,26 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
private void SetCurrentSelectedPointer()
|
||||||
|
{
|
||||||
|
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
|
||||||
|
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public void SetDisplayCountForAllAvailPlayers(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
availPlayersToMove.ForEach(pawn => ShowUpdatedPlayerCountOnTile(pawn));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
availPlayersToMove.ForEach(pawn => pawn.ShowPlayerCountCanvas(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void MoveThroughTiles(PlayerPawn playerPawn, int index, int targetIndex)
|
private void MoveThroughTiles(PlayerPawn playerPawn, int index, int targetIndex)
|
||||||
{
|
{
|
||||||
Tile nextTile = TilesManager.RetrieveTileBasedOnIndex(index);
|
Tile nextTile = TilesManager.RetrieveTileBasedOnIndex(index);
|
||||||
@ -1084,9 +1002,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"tile targetPosition: {targetPosition}");
|
Debug.Log($"tile targetPosition: {targetPosition}");
|
||||||
#if UNITY_EDITOR
|
playerPawn.ShowPlayerCountCanvas(false);
|
||||||
playerPawn.ShowPlayerCountCanvas(false); // TODO :: Check if call can be removed
|
|
||||||
#endif
|
|
||||||
|
|
||||||
playerPawn.MoveToTile(
|
playerPawn.MoveToTile(
|
||||||
targetPosition,
|
targetPosition,
|
||||||
@ -1122,11 +1038,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
|
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
if (CanRollDiceAgain)
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
ShowUpdatedPlayerCountOnTile(playerPawn);
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nextTile.IsSafeZone)
|
if (!nextTile.IsSafeZone)
|
||||||
{
|
{
|
||||||
@ -1155,12 +1067,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
CanRollDiceAgain = true;
|
CanRollDiceAgain = true;
|
||||||
|
if (!playerPawn.IsBotPlayer)
|
||||||
|
{
|
||||||
|
UpdateTurnTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||||
#if UNITY_EDITOR
|
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
ShowUpdatedPlayerCountOnTile(playerPawn);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
@ -1175,18 +1089,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CanRollDiceAgain) SwitchPlayer(playerPawn);
|
SwitchPlayer(playerPawn);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (IsUsersTurn())
|
|
||||||
{
|
|
||||||
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
|
||||||
SetCanRollDiceForUser(IsUsersTurn());
|
|
||||||
}
|
|
||||||
|
|
||||||
OnCanRollDiceAgain(playerPawn);
|
|
||||||
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
index);
|
index);
|
||||||
@ -1195,8 +1098,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
public void CheckForGamePause(Action onComplete)
|
public void CheckForGamePause(Action onComplete)
|
||||||
{
|
{
|
||||||
Debug.Log($"CheckForGamePause: {GameManager.CurrentGameState == GameState.IsPaused}");
|
Debug.Log($"CheckForGamePause: {GameManager.CurrentGameState == GameState.IsPaused}");
|
||||||
if ((botTypesInGame == null || !botTypesInGame.Contains(currentPlayerTypeTurn)) &&
|
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && !botTypesInGame.Contains(currentPlayerTypeTurn)
|
||||||
GameManager.CurrentGameState == GameState.IsPaused)
|
&& GameManager.CurrentGameState == GameState.IsPaused)
|
||||||
{
|
{
|
||||||
OnGameResumed = onComplete;
|
OnGameResumed = onComplete;
|
||||||
}
|
}
|
||||||
@ -1236,7 +1139,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
// ShowUpdatedPlayerCountOnTile(playerPawn);
|
// ShowUpdatedPlayerCountOnTile(playerPawn);
|
||||||
|
|
||||||
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
|
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
|
||||||
playerPawn.SetPlayerSelectionState(false);
|
|
||||||
|
|
||||||
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
|
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
|
||||||
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath--;
|
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInFinishingPath--;
|
||||||
@ -1278,11 +1180,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
CheckDiceRollForBot();
|
CheckDiceRollForBot();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(true);
|
UpdateTurnTimer();
|
||||||
UpdateResponseTimerForUser(currentPlayerMaxTime: currentPlayerTurnMaxTime, () => RollDiceForUser());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
diceRollHandler.DiceView.SetDiceButtonInteraction(CanRollDiceAgain);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1296,15 +1195,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
if (CanRollDiceAgain)
|
||||||
{
|
|
||||||
SetCanRollDiceForUser(IsUsersTurn());
|
|
||||||
OnCanRollDiceAgain();
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
ShowUpdatedPlayerCountOnTile(playerPawn);
|
||||||
#endif
|
|
||||||
}
|
SwitchPlayer();
|
||||||
else
|
|
||||||
SwitchPlayer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1317,7 +1210,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn)
|
private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn)
|
||||||
{
|
{
|
||||||
Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ?
|
Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ?
|
||||||
@ -1338,44 +1230,22 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
Debug.Log($"ShowUpdatedPlayerCountOnTile: {count}");
|
Debug.Log($"ShowUpdatedPlayerCountOnTile: {count}");
|
||||||
|
|
||||||
playerPawn.PlayerIndicatorCanvas.SetPlayerCount(count);
|
playerPawn.PlayerCountCanvas.SetPlayerCount(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCurrentSelectedPointer()
|
|
||||||
{
|
|
||||||
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
|
|
||||||
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetDisplayCountForAllAvailPlayers(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
availPlayersToMove.ForEach(pawn => ShowUpdatedPlayerCountOnTile(pawn));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
availPlayersToMove.ForEach(pawn => pawn.ShowPlayerCountCanvas(false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public void ResetTileDatasForPlayers()
|
public void ResetTileDatasForPlayers()
|
||||||
{
|
{
|
||||||
// causes null ref cast exception while player is moving.
|
foreach (PlayerData data in playerDatas)
|
||||||
// foreach (PlayerData data in playerDatas)
|
{
|
||||||
// {
|
var pawns = playerGameDatasDict[data.playerType].playerPawnsDict.Values;
|
||||||
// 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());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
TilesManager.ResetTileDatas();
|
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()
|
||||||
@ -1385,8 +1255,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
ResetGameRestartData();
|
ResetGameRestartData();
|
||||||
|
|
||||||
currentPlayerTurnTimer.KillTimer();
|
|
||||||
currentPlayerTurnTimer = null;
|
|
||||||
OnGameResumed = null;
|
OnGameResumed = null;
|
||||||
playerDatas = null;
|
playerDatas = null;
|
||||||
allPlayerTypes = null;
|
allPlayerTypes = null;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
public enum PlayerState
|
public enum PlayerState
|
||||||
{
|
{
|
||||||
@ -22,12 +21,12 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
{
|
{
|
||||||
[SerializeField] private PlayerState playerState;
|
[SerializeField] private PlayerState playerState;
|
||||||
[SerializeField] private Animator animator;
|
[SerializeField] private Animator animator;
|
||||||
[SerializeField] private PlayerIndicatorCanvas playerIndicatorCanvas;
|
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
||||||
|
|
||||||
private PlayerBase playerBase;
|
private PlayerBase playerBase;
|
||||||
private GameplayManager gameplayManager;
|
private GameplayManager gameplayManager;
|
||||||
|
|
||||||
public PlayerIndicatorCanvas PlayerIndicatorCanvas => playerIndicatorCanvas;
|
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||||
|
|
||||||
public int PlayerId { get; private set; }
|
public int PlayerId { get; private set; }
|
||||||
public int StepsTaken { get; private set; }
|
public int StepsTaken { get; private set; }
|
||||||
@ -44,8 +43,6 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
public void SetPlayerSelectionState(bool state)
|
public void SetPlayerSelectionState(bool state)
|
||||||
{
|
{
|
||||||
CanSelectPlayer = state;
|
CanSelectPlayer = state;
|
||||||
Debug.Log($"### SetPlayerSelectionState: {name} :: {state}, ");
|
|
||||||
ShowPlayerSelCanvas(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveToTile(Vector3 startingPoint, Action onComplete, int tileIndex)
|
public void MoveToTile(Vector3 startingPoint, Action onComplete, int tileIndex)
|
||||||
@ -64,7 +61,7 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
|
|
||||||
// Rotate Player
|
// Rotate Player
|
||||||
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||||
SetGameplayManager();
|
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||||
|
|
||||||
Vector3 lookDirection = Vector3.zero;
|
Vector3 lookDirection = Vector3.zero;
|
||||||
|
|
||||||
@ -124,7 +121,7 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
transform.position = transformData.position;
|
transform.position = transformData.position;
|
||||||
transform.rotation = transformData.rotation;
|
transform.rotation = transformData.rotation;
|
||||||
SetPlayerState(PlayerState.InHome);
|
SetPlayerState(PlayerState.InHome);
|
||||||
ShowPlayerSelCanvas(false);
|
ShowPlayerCountCanvas(false);
|
||||||
StepsTaken = 0;
|
StepsTaken = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,13 +156,7 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
|
|
||||||
public void ShowPlayerCountCanvas(bool show)
|
public void ShowPlayerCountCanvas(bool show)
|
||||||
{
|
{
|
||||||
// add the player count canvas to the object and show from here.
|
playerCountCanvas.gameObject.SetActive(show);
|
||||||
// playerIndicatorCanvas.gameObject.SetActive(show);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowPlayerSelCanvas(bool show)
|
|
||||||
{
|
|
||||||
playerIndicatorCanvas.gameObject.SetActive(show);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetData()
|
public void ResetData()
|
||||||
@ -173,7 +164,8 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
SetPlayerState(PlayerState.InHome);
|
SetPlayerState(PlayerState.InHome);
|
||||||
StepsTaken = 0;
|
StepsTaken = 0;
|
||||||
PlayerId = 0;
|
PlayerId = 0;
|
||||||
if (playerIndicatorCanvas.gameObject.activeInHierarchy)
|
if (playerCountCanvas.gameObject.activeInHierarchy)
|
||||||
ShowPlayerSelCanvas(false);
|
ShowPlayerCountCanvas(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,6 @@ public class SafeTile : Tile
|
|||||||
|
|
||||||
public override void ResetTileData()
|
public override void ResetTileData()
|
||||||
{
|
{
|
||||||
Debug.Log($"Resetting tile in safe tile {name}");
|
|
||||||
if (playerTypesDict != null && playerTypesDict.Count > 0)
|
if (playerTypesDict != null && playerTypesDict.Count > 0)
|
||||||
{
|
{
|
||||||
playerTypesDict.Clear();
|
playerTypesDict.Clear();
|
||||||
|
|||||||
@ -56,7 +56,6 @@ public class Tile : MonoBehaviour
|
|||||||
|
|
||||||
public virtual void ResetTileData()
|
public virtual void ResetTileData()
|
||||||
{
|
{
|
||||||
Debug.Log($"Resetting tile in parent tile {name}");
|
|
||||||
if (HasPawnsAvailable)
|
if (HasPawnsAvailable)
|
||||||
PlayerPawns.Clear();
|
PlayerPawns.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,8 +77,6 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
finishingTileDataPairs.Clear();
|
finishingTileDataPairs.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// causes null ref cast exception while player is moving.
|
|
||||||
/*
|
|
||||||
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
|
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
|
||||||
{
|
{
|
||||||
if (playerState == PlayerState.InFinishingPath || playerState == PlayerState.HasFinished)
|
if (playerState == PlayerState.InFinishingPath || playerState == PlayerState.HasFinished)
|
||||||
@ -97,21 +95,6 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
tile.ResetTileData();
|
tile.ResetTileData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public void ResetTileDatas()
|
|
||||||
{
|
|
||||||
foreach (var tile in generalTiles)
|
|
||||||
tile.ResetTileData();
|
|
||||||
|
|
||||||
foreach (var pair in finishingTileDataPairs)
|
|
||||||
{
|
|
||||||
foreach (var tile in finishingTileDataPairs[pair.Key])
|
|
||||||
{
|
|
||||||
tile.ResetTileData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile, PlayerType currentPlayerTypeTurn)
|
public Vector3 GetAndInitPositionInsideSafeZone(PlayerPawn playerPawn, Tile targetTile, PlayerType currentPlayerTypeTurn)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,12 +46,12 @@ public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
public void UpdatePlayerTurnText(PlayerType type, int remSec)
|
public void UpdatePlayerTurnText(PlayerType type, int remSec)
|
||||||
{
|
{
|
||||||
screenManager.GetScreen<GameHUDScreen>(ScreenType.InGameHUDScreen).UpdatePlayerTurnText(type, remSec);
|
screenManager.GetScreen<GameHUDS>(ScreenType.InGameHUDScreen).UpdatePlayerTurnText(type, remSec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePlayerTurnText(PlayerType type)
|
public void UpdatePlayerTurnText(PlayerType type)
|
||||||
{
|
{
|
||||||
screenManager.GetScreen<GameHUDScreen>(ScreenType.InGameHUDScreen).UpdateBotTurnText(type);
|
screenManager.GetScreen<GameHUDS>(ScreenType.InGameHUDScreen).UpdateBotTurnText(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGameOver()
|
public void OnGameOver()
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
public class GameHUDScreen : ScreenBase
|
public class GameHUDS : ScreenBase
|
||||||
{
|
{
|
||||||
[Header("Buttons")]
|
|
||||||
[SerializeField] private Button diceBtn;
|
[SerializeField] private Button diceBtn;
|
||||||
[SerializeField] private Button pauseBtn;
|
[SerializeField] private Button pauseBtn;
|
||||||
|
|
||||||
@ -55,13 +55,13 @@ public class GameHUDScreen : ScreenBase
|
|||||||
|
|
||||||
public void UpdatePlayerTurnText(PlayerType playerType, int remSec)
|
public void UpdatePlayerTurnText(PlayerType playerType, int remSec)
|
||||||
{
|
{
|
||||||
Debug.Log($"UpdateTurnText: Player Turn :: {(PlayerColorType)((int)playerType)} ({remSec})");
|
Debug.Log($"GameHUDS: UpdatePlayerTurnText: {playerType}");
|
||||||
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)} ({remSec})";
|
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)} ({remSec})";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateBotTurnText(PlayerType playerType)
|
public void UpdateBotTurnText(PlayerType playerType)
|
||||||
{
|
{
|
||||||
Debug.Log($"UpdateTurnText: Bot Turn :: {(PlayerColorType)((int)playerType)}");
|
Debug.Log($"GameHUDS: UpdatePlayerTurnText: {playerType}");
|
||||||
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)}";
|
playerTurnText.text = $"Turn : {(PlayerColorType)((int)playerType)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class PlayerIndicatorCanvas : MonoBehaviour
|
public class PlayerCountCanvas : MonoBehaviour
|
||||||
{
|
{
|
||||||
Transform cam;
|
Transform cam;
|
||||||
[SerializeField] private TMP_Text playerCountText;
|
[SerializeField] private TMP_Text playerCountText;
|
||||||
@ -21,22 +21,18 @@ public class PlayerIndicatorCanvas : MonoBehaviour
|
|||||||
indicatorBtn.onClick.RemoveListener(() => OnClickPlayer());
|
indicatorBtn.onClick.RemoveListener(() => OnClickPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
cam = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
cam = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
||||||
}
|
}
|
||||||
|
void LateUpdate()
|
||||||
private void LateUpdate()
|
|
||||||
{
|
{
|
||||||
transform.LookAt(cam.forward + transform.position);
|
transform.LookAt(cam.forward + transform.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
public void SetPlayerCount(int count)
|
public void SetPlayerCount(int count)
|
||||||
{
|
{
|
||||||
playerCountText.text = count.ToString();
|
playerCountText.text = count.ToString();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public void OnClickPlayer()
|
public void OnClickPlayer()
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@ PlayerSettings:
|
|||||||
m_SplashScreenLogos:
|
m_SplashScreenLogos:
|
||||||
- logo: {fileID: 10404, guid: 0000000000000000e000000000000000, type: 0}
|
- logo: {fileID: 10404, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
duration: 2
|
duration: 2
|
||||||
- logo: {fileID: 21300000, guid: 1cfb151daad2e4e719892a83a58ce545, type: 3}
|
- logo: {fileID: 21300000, guid: e84386e1891df488bae582876f896a36, type: 3}
|
||||||
duration: 2
|
duration: 2
|
||||||
m_VirtualRealitySplashScreen: {fileID: 2800000, guid: e84386e1891df488bae582876f896a36, type: 3}
|
m_VirtualRealitySplashScreen: {fileID: 2800000, guid: e84386e1891df488bae582876f896a36, type: 3}
|
||||||
m_HolographicTrackingLossScreen: {fileID: 0}
|
m_HolographicTrackingLossScreen: {fileID: 0}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user