Compare commits

...

8 Commits

Author SHA1 Message Date
eecba2779b Added safe zone sprite 2026-01-29 16:17:34 +05:30
eb6295bee3 Added Player Visuals
- Added character
- Linked animation
- Player rotation based on next tile
2026-01-29 15:54:13 +05:30
d93ffe6fad Fix: AI's not aligning properly in safe zone. 2026-01-28 22:00:39 +05:30
5a90b0961c Merge branch 'main' into feature/main-gameplay 2026-01-28 21:01:49 +05:30
bc552e57ff Removed project folder. 2026-01-28 20:59:08 +05:30
67b6da28c0 Bug Fixes: AI. 2026-01-28 20:57:35 +05:30
1084e5dd08 Merge branch 'main' into feature/main-gameplay 2026-01-28 17:41:09 +05:30
031b3201c6 Fixes for AI logic. 2026-01-28 17:34:06 +05:30
32 changed files with 46884 additions and 524 deletions

View File

@ -568,7 +568,7 @@ GameObject:
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 2147483647
m_IsActive: 1
--- !u!4 &6704853020313334976
Transform:
@ -578,7 +578,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2558544614274069912}
m_LocalRotation: {x: -0.50000006, y: -0.49999994, z: 0.49999994, w: 0.50000006}
m_LocalPosition: {x: 0.24394053, y: 0.3241422, z: 0.09795022}
m_LocalPosition: {x: 0.24394053, y: 0.3541, z: 0.09795022}
m_LocalScale: {x: 0.1234148, y: 0.1234148, z: 0.8597383}
m_ConstrainProportionsScale: 0
m_Children: []

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 KiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: d20b33310cfd64c4f84b7443a0b6245b
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: 500
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: a818a794565c746faaf72c0cb42b7e83
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: 500
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 00a89165d3d9b4999be2f923c979b71d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
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:

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,30 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-8290374687124494561
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Jump
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6893393781432945197}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-4386602261049339250
AnimatorStateMachine:
serializedVersion: 6
@ -11,7 +36,7 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -4082066970046094144}
m_Position: {x: 310, y: 90, z: 0}
m_Position: {x: 170, y: 60, z: 0}
- serializedVersion: 1
m_State: {fileID: 2691405124668571998}
m_Position: {x: 30, y: 200, z: 0}
@ -25,7 +50,7 @@ AnimatorStateMachine:
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 280, y: 210, z: 0}
m_ExitPosition: {x: 120, y: 420, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 2691405124668571998}
--- !u!1102 &-4082066970046094144
@ -54,31 +79,6 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-607664822650355851
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 3
m_ConditionEvent: BlendJump
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6893393781432945197}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
@ -124,7 +124,7 @@ AnimatorState:
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -607664822650355851}
- {fileID: -8290374687124494561}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -134,7 +134,7 @@ AnimatorState:
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -203655887218126122, guid: 57e26c7b6440e4ed9839c06440e70481, type: 3}
m_Motion: {fileID: 7400000, guid: fe95c7799fd3342a7a39f4ed2c5e18c8, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
@ -179,7 +179,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump
m_Speed: 1
m_Speed: 1.7
m_CycleOffset: 0
m_Transitions:
- {fileID: 8398125670744292538}
@ -192,7 +192,7 @@ AnimatorState:
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -203655887218126122, guid: 611548578fef948cda9845e8f694b086, type: 3}
m_Motion: {fileID: 7400000, guid: 08509db092fd34ddb83d985e5e38e8e4, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -553,6 +553,8 @@ GameObject:
m_Component:
- component: {fileID: 5420572229297639394}
- component: {fileID: 5526766409186502679}
- component: {fileID: 905786488}
- component: {fileID: 905786489}
m_Layer: 0
m_Name: Pirate (Blue)
m_TagString: Untagged
@ -598,6 +600,34 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!136 &905786488
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4643894104949937496}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.37326267
m_Height: 1.5875065
m_Direction: 1
m_Center: {x: 0, y: 0.71958995, z: 0}
--- !u!114 &905786489
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4643894104949937496}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da493b8dbb3aa475abf11f31549b9293, type: 3}
m_Name:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5526766409186502679}
--- !u!1 &4818123989977612668
GameObject:
m_ObjectHideFlags: 0

View File

@ -553,6 +553,8 @@ GameObject:
m_Component:
- component: {fileID: 5672526856521419272}
- component: {fileID: 5274388487207906813}
- component: {fileID: 197323787002765461}
- component: {fileID: 2411043470597465747}
m_Layer: 0
m_Name: Pirate (Green)
m_TagString: Untagged
@ -598,6 +600,34 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!136 &197323787002765461
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5040387473618948274}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.37326267
m_Height: 1.5875065
m_Direction: 1
m_Center: {x: 0, y: 0.71958995, z: 0}
--- !u!114 &2411043470597465747
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5040387473618948274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da493b8dbb3aa475abf11f31549b9293, type: 3}
m_Name:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 5274388487207906813}
--- !u!1 &5059623752267150313
GameObject:
m_ObjectHideFlags: 0

View File

@ -139,6 +139,8 @@ GameObject:
m_Component:
- component: {fileID: 338321318880370071}
- component: {fileID: 232863433340697214}
- component: {fileID: 5261245861010270014}
- component: {fileID: 1627116187348267135}
m_Layer: 0
m_Name: Pirate (Grey)
m_TagString: Untagged
@ -184,6 +186,34 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &5261245861010270014
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1151274294278227757}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da493b8dbb3aa475abf11f31549b9293, type: 3}
m_Name:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 232863433340697214}
--- !u!136 &1627116187348267135
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1151274294278227757}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.37326267
m_Height: 1.5875065
m_Direction: 1
m_Center: {x: 0, y: 0.71958995, z: 0}
--- !u!1 &1274023128019783057
GameObject:
m_ObjectHideFlags: 0

View File

@ -1182,6 +1182,8 @@ GameObject:
m_Component:
- component: {fileID: 7767047851774264951}
- component: {fileID: 7800412279828783518}
- component: {fileID: 896294590}
- component: {fileID: 896294592}
m_Layer: 0
m_Name: Pirate (Red)
m_TagString: Untagged
@ -1227,6 +1229,34 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!136 &896294590
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6954059691668741325}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.37326267
m_Height: 1.5875065
m_Direction: 1
m_Center: {x: 0, y: 0.71958995, z: 0}
--- !u!114 &896294592
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6954059691668741325}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da493b8dbb3aa475abf11f31549b9293, type: 3}
m_Name:
m_EditorClassIdentifier:
playerState: 0
animator: {fileID: 7800412279828783518}
--- !u!1 &7074820051352815849
GameObject:
m_ObjectHideFlags: 0

View File

@ -108,7 +108,7 @@ GameObject:
m_Component:
- component: {fileID: 5543862162727244199}
m_Layer: 0
m_Name: Dice
m_Name: Dice Prefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ public class PlayerGameData
public int endIndex;
public Transform playersParent;
public Dictionary<int, PlayerPawn> playerPawnsDict;
public int totalPawnsInHome = 0;
public int totalPawnsFinished = 0;
}
@ -41,6 +42,8 @@ public enum BotMove
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
[SerializeField] private int diceValue = 0;
[SerializeField] private TextMeshProUGUI diceText;
[SerializeField] private Transform pointerDebug;
@ -86,8 +89,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
CanRollDice = true;
// initialize the player list from UI.
// InitPlayerTypesForLAN(null);
InitPlayerTypesForBotMatch(PlayerType.Player1, 1);
InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
}
// TODO :: Call when the UI selection is made and game starts
@ -200,6 +204,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
var pawn = playerPawnChild.GetComponent<PlayerPawn>();
playerGameDatasDict[playerGameData.playerType].playerPawnsDict.Add(pawn.PlayerId, pawn);
}
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome = playerGameDatasDict[playerGameData.playerType].playerPawnsDict.Count;
}
}
@ -215,6 +221,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void RollDiceForPlayer(int rolledVal)
{
if (botTypesInGame.Contains(currentPlayerTypeTurn)) return;
OnDiceRolled(rolledVal);
CheckForPlayerSwitching();
}
@ -227,18 +235,19 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
SwitchPlayer();
CanRollDice = true;
}
else if (botTypesInGame.Contains(currentPlayerTypeTurn) && CanRollDiceAgain)
{
Debug.Log($"RollDiceForBot");
Invoke(nameof(RollDiceForBot), 1f);
}
// else if (botTypesInGame.Contains(currentPlayerTypeTurn) && CanRollDiceAgain)
// {
// Debug.Log($"Invoking RollDiceForBot");
// Invoke(nameof(RollDiceForBot), 1f);
// }
}
private void RollDiceForBot()
{
Debug.Log($"CallTest: RollDiceForBot");
OnDiceRolled(UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1));
// OnDiceRolled(diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
OnDiceRolled(diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
SelectPawnFromBotBase();
@ -249,7 +258,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// What happens when you get a 6
private void SelectPawnFromBotBase()
{
if (availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return;
if (availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return; // Have a better check here
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
@ -263,9 +272,17 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
int savedPlayerId = -1;
PlayerPawn pawn = null;
Debug.Log($"SelectPawnFromBotBase: availPlayers.Count(): {availPlayers.Count()}, CanRollDiceAgain: {CanRollDiceAgain}");
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
{
InitActivePlayers();
}
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
{
pawn = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome);
Debug.Log($"SelectedPawn: {pawn.name}");
OnPawnSelected(pawn);
return;
@ -288,6 +305,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
int lastIndex = tilesManager.GetGeneralTilesLength() - 1;
int index = possibleLandingIndex > lastIndex ? (possibleLandingIndex - lastIndex) - 1 : possibleLandingIndex;
Tile possibleTileData = tilesManager.RetrieveTileBasedOnIndex(index);
Debug.Log($"AI playerPawn :: {playerPawn.name} :: state: {playerPawn.GetPlayerState()}, possibleLandingIndex: {possibleLandingIndex > playerGameDatasDict[currentPlayerTypeTurn].endIndex}");
Debug.Log($"AI playerPawn :: {playerPawn.name} :: possibleTileData.IsSafeZone: {possibleTileData.IsSafeZone}");
Debug.Log($"AI playerPawn :: {playerPawn.name} :: possibleTileData.PlayerPawn: {possibleTileData.PlayerPawn}");
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || possibleLandingIndex > playerGameDatasDict[currentPlayerTypeTurn].endIndex)
{
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.FinishingPathMove;
@ -304,12 +326,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
else
{
Debug.Log($"AI playerPawn :: {playerPawn.name} :: normalMove");
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.NormalMove;
}
}
List<int> playerIds = new List<int>();
if (savedPlayerId != -1)
if (savedPlayerId != -1 && playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict[savedPlayerId].CanSelectPlayerFromHome)
{
pawn = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict[savedPlayerId]; // chances are when one of the character reaches towards the finishing point
}
@ -321,25 +344,26 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
savedPlayerId = playerIds[UnityEngine.Random.Range(0, playerIds.Count)];
pawn = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict[savedPlayerId];
Debug.Log($"Getting savedplayer id");
Debug.Log($"AI playerPawn :: {pawn.name} :: Getting savedplayer id");
}
else if (botPawnsDictForCurrentPlayer.ContainsValue(BotMove.SafeMove))
{
InitPawnBasedOnState(BotMove.SafeMove);
Debug.Log($"Getting savedplayer id");
Debug.Log($"AI playerPawn :: {pawn.name} :: Getting savedplayer id");
}
else if (botPawnsDictForCurrentPlayer.ContainsValue(BotMove.AttackMove))
{
InitPawnBasedOnState(BotMove.AttackMove);
Debug.Log($"Getting savedplayer id");
Debug.Log($"AI playerPawn :: {pawn.name} :: Getting savedplayer id");
}
else if (botPawnsDictForCurrentPlayer.ContainsValue(BotMove.NormalMove))
{
InitPawnBasedOnState(BotMove.NormalMove);
Debug.Log($"Getting savedplayer id");
Debug.Log($"AI playerPawn :: {pawn.name} :: Getting savedplayer id");
}
}
Debug.Log($"AI playerPawn :: {pawn.name} :: SelectedPawn: {pawn.name}");
OnPawnSelected(pawn);
void InitPawnBasedOnState(BotMove botMove)
@ -381,6 +405,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}");
diceRolledValue = rolledVal;
diceText.text = $"{diceRolledValue}";
availPlayers.Clear();
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
{
@ -399,11 +424,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
else // if there are any other pawns that are in safe or moving state
{
// for player's logic
availPlayers.Clear();
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
pawn.GetPlayerState() == PlayerState.Moving ||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
InitActivePlayers();
Debug.Log($"availPlayers: {playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn).Where(pawn => pawn.GetPlayerState() == PlayerState.InHome).ToList().Count}");
int customAvailPlayers = availPlayers.Count();
@ -414,10 +435,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"## playerPawn.GetPlayerState(): {playerPawn.GetPlayerState()}");
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath)
{
Debug.Log($"diceRolledValue: {diceRolledValue}, FinishingDataLen: {tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn)}, playerPawn.CurrentTileIndex: {playerPawn.CurrentTileIndex}");
if (diceRolledValue <= tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - (playerPawn.CurrentTileIndex + 1))
{
playerPawn.SetPlayerSelectionState(true);
}
}
else
{
customAvailPlayers--;
@ -438,6 +460,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
}
private void InitActivePlayers()
{
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
pawn.GetPlayerState() == PlayerState.Moving ||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
}
private bool AreAllPawnsInFinishingPath()
{
bool areAllPawnsInFinishingPath = false;
@ -463,6 +493,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerPawn.SetPlayerState(playerState);
}
private void CheckDiceRollForBot(PlayerPawn playerPawn)
{
if (CanRollDiceAgain)
RollDiceForBot();
}
public void OnPawnSelected(PlayerPawn playerPawn)
{
EnablePlayerSelectionStates(false);
@ -478,8 +514,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
GetAndInitPositionInsideSafeZone(playerPawn, targetTile),
onComplete: () =>
{
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
CanRollDice = true;
UpdatePlayerState(playerPawn, PlayerState.InSafeZone);
if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn);
}, playerGameData.startIndex);
return;
@ -491,7 +532,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
int targetIdx = finishingPathIndex + diceRolledValue > tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 ?
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
Debug.Log($"TargetIdx: {targetIdx}");
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
}
else if (playerPawn.GetPlayerState() == PlayerState.InSafeZone || playerPawn.GetPlayerState() == PlayerState.Moving)
@ -502,7 +543,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
int targetIdx = playerPawn.CurrentTileIndex + diceRolledValue;
if (nextTileIdx == 0)
targetIdx = targetIdx - playerPawn.CurrentTileIndex;
targetIdx = (targetIdx - playerPawn.CurrentTileIndex) - 1;
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
if (currentSittingTile.IsSafeZone)
@ -528,7 +569,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
}
private int GetNextGeneralTileIndex(PlayerPawn playerPawn)
public int GetNextGeneralTileIndex(PlayerPawn playerPawn)
{
return playerPawn.CurrentTileIndex == tilesManager.GetGeneralTilesLength() - 1 ? 0 : playerPawn.CurrentTileIndex + 1;
}
@ -636,15 +677,16 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (!nextTile.IsSafeZone)
{
Debug.Log($"nextTile.PlayerPawn: {nextTile.PlayerPawn}, {nextTile.transform.name}");
if (nextTile.PlayerPawn != null)
if (nextTile.PlayerPawn != null && playerPawn.PlayerType != nextTile.PlayerPawn.PlayerType)
{
// play animation for moving back to base.
// TODO :: Send existing pawn back to base.
// means there's already a pawn there, move him back to the base.
var playerBasePos = playerBaseHandler.GetPlayerBase(nextTile.PlayerPawn.PlayerType)
.GetBasePlacementDataPosition(nextTile.PlayerPawn.PlayerId - 1).position;
.GetBasePlacementDataPosition(nextTile.PlayerPawn.PlayerId - 1);
Debug.Log($"playerBasePos: {playerBasePos}");
playerGameDatasDict[nextTile.PlayerPawn.PlayerType].totalPawnsInHome++;
nextTile.PlayerPawn.MoveBackToHome(playerBasePos);
}
@ -737,6 +779,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
}
else
{
Debug.Log($"CurrentTileIndex: {playerPawn.CurrentTileIndex} == lastIndex: {tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1}");
if (playerPawn.CurrentTileIndex == tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
{
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
@ -755,6 +798,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
else
{
CanRollDiceAgain = true;
if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn);
}
}
else

View File

@ -20,8 +20,12 @@ public enum PawnType
public class PlayerPawn : MonoBehaviour
{
[SerializeField] private PlayerState playerState;
[SerializeField] private Animator animator;
private bool canSelectPlayerFromHome;
public bool CanSelectPlayerFromHome
{
get; private set;
}
private GameplayManager gameplayManager;
public int CurrentTileIndex
@ -56,8 +60,8 @@ public class PlayerPawn : MonoBehaviour
public void SetPlayerSelectionState(bool state)
{
canSelectPlayerFromHome = state;
if (canSelectPlayerFromHome)
CanSelectPlayerFromHome = state;
if (CanSelectPlayerFromHome)
{
// TODO :: Play animation for selecting any of the players
}
@ -67,19 +71,34 @@ public class PlayerPawn : MonoBehaviour
{
StepsTaken++;
CurrentTileIndex = tileIndex;
transform.DOMove(startingPoint, 0.5f).onComplete = () => onComplete?.Invoke();
animator?.SetTrigger("Jump");
transform.DOMove(startingPoint, 0.6f).onComplete = () =>
{
animator?.ResetTrigger("Jump");
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
int nextTileIndex = gameplayManager.GetNextGeneralTileIndex(this);
Vector3 lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextTileIndex).transform.position - transform.position;
lookDirection.y = 0;
transform.DOLookAt(transform.position + lookDirection, 0.2f);
onComplete?.Invoke();
};
}
public void MoveToCustomTilePosition(Vector3 targetPoint)
{
StepsTaken++;
transform.DOMove(targetPoint, 0.5f);
transform.DOMove(targetPoint, 1f);
}
// when he is defeated
public void MoveBackToHome(Vector3 pos)
public void MoveBackToHome(Transform transformData)
{
transform.position = pos;
transform.position = transformData.position;
transform.rotation = transformData.rotation;
SetPlayerState(PlayerState.InHome);
StepsTaken = 0;
}
@ -93,7 +112,7 @@ public class PlayerPawn : MonoBehaviour
private void OnMouseDown()
{
if (IsBotPlayer || !canSelectPlayerFromHome) return;
if (IsBotPlayer || !CanSelectPlayerFromHome) return;
SetGameplayManager();
gameplayManager.OnPawnSelected(this);

View File

@ -27,7 +27,7 @@ public class DiceRoller : MonoBehaviour
private void OnDiceRolled()
{
int currentRolledVal = //Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
int currentRolledVal = // Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
diceTestValue != 0 ? diceTestValue : Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
inputManager.SetDiceRollValue(currentRolledVal);
}

View File

@ -24,11 +24,13 @@ public class InputManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void Initialize()
{
Debug.Log($"Initialize");
InterfaceManager.Instance?.RegisterInterface<InputManager>(this);
}
public void InitializeData()
{
Debug.Log($"InitializeData");
GameplayManager = InterfaceManager.Instance?.GetInterfaceInstance<GameplayManager>();
}

View File

@ -9,6 +9,7 @@ public abstract class BootLoader : MonoBehaviour
protected virtual void Start()
{
InterfaceManager.InitInstance();
InitBootLoaders();

View File

@ -19,9 +19,9 @@ public class GameBootLoader : BootLoader
}
}
}
protected override void InitializeData()
{
Debug.Log($"InitializeData: for loaders");
InitializeScriptablesData();
IDataLoader dataLoader = null;
@ -29,6 +29,7 @@ public class GameBootLoader : BootLoader
{
if (GetLoader<IDataLoader>(loader.transform, out dataLoader))
{
Debug.Log($"InitializeData: {loader.transform.name}");
dataLoader.InitializeData();
}
}

View File

@ -34,17 +34,17 @@ public class SafeTile : Tile
playerPawns = new Dictionary<int, PlayerPawn>()
});
Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
Debug.Log($"targetSafeTile. tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn);
playerTypesDict[playerType].commonPlacementTransform = placementQueue.Dequeue();
Debug.Log($"targetSafeTile. Adding player {playerType} {playerTypesDict[playerType].playerCount} tileName: {name}");
Debug.Log($"targetSafeTile. tileName: {name} Adding player {playerType} {playerTypesDict[playerType].playerCount} tileName: {name}");
}
else
{
Debug.Log($"tileName: {name}, playerPawn.PlayerId: {playerPawn.PlayerId}");
playerTypesDict[playerType].playerCount++;
Debug.Log($"targetSafeTile. Adding player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
Debug.Log($"targetSafeTile. tileName: {name} Adding player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
playerTypesDict[playerType].playerPawns.Add(playerPawn.PlayerId, playerPawn);
}
}
@ -55,16 +55,16 @@ public class SafeTile : Tile
{
if (playerTypesDict[playerType].playerCount > 0)
{
Debug.Log($"targetSafeTile. Removing player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType} {playerTypesDict[playerType].playerCount}, tileName: {name}");
playerTypesDict[playerType].playerCount--;
Debug.Log($"targetSafeTile. Removing player {playerType} after: {playerTypesDict[playerType].playerCount}");
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType} after: {playerTypesDict[playerType].playerCount}");
playerTypesDict[playerType].playerPawns.Remove(playerPawn.PlayerId);
if (playerTypesDict[playerType].playerCount == 0)
{
placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform);
playerTypesDict.Remove(playerType);
Debug.Log($"targetSafeTile. Removing player {playerType}");
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType}");
lastOccupiedIndex--;
}
}