diff --git a/Assets/Prefabs/Characters/Pirate (Blue).prefab b/Assets/Prefabs/Characters/Pirate (Blue).prefab index 4685476..0c72fb2 100644 --- a/Assets/Prefabs/Characters/Pirate (Blue).prefab +++ b/Assets/Prefabs/Characters/Pirate (Blue).prefab @@ -630,6 +630,7 @@ MonoBehaviour: playerState: 0 animator: {fileID: 5526766409186502679} playerCountCanvasPrefab: {fileID: 9029553984926861784} + playerCountCanvas: {fileID: 5728752331380905399} --- !u!1 &4818123989977612668 GameObject: m_ObjectHideFlags: 0 @@ -1622,6 +1623,17 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} m_PrefabInstance: {fileID: 4537709141704337870} m_PrefabAsset: {fileID: 0} +--- !u!114 &5728752331380905399 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8176763997504289913, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} + m_PrefabInstance: {fileID: 4537709141704337870} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9029553984926861784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12325a6692b2349b5992ec00a2cf8162, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &9029553984926861784 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} diff --git a/Assets/Prefabs/Characters/Pirate (Green).prefab b/Assets/Prefabs/Characters/Pirate (Green).prefab index ca65991..bf55643 100644 --- a/Assets/Prefabs/Characters/Pirate (Green).prefab +++ b/Assets/Prefabs/Characters/Pirate (Green).prefab @@ -630,6 +630,7 @@ MonoBehaviour: playerState: 0 animator: {fileID: 5274388487207906813} playerCountCanvasPrefab: {fileID: 6862258105288866118} + playerCountCanvas: {fileID: 7923051124467737897} --- !u!1 &5059623752267150313 GameObject: m_ObjectHideFlags: 0 @@ -1671,3 +1672,14 @@ GameObject: m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} m_PrefabInstance: {fileID: 2057554100330600784} m_PrefabAsset: {fileID: 0} +--- !u!114 &7923051124467737897 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8176763997504289913, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} + m_PrefabInstance: {fileID: 2057554100330600784} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6862258105288866118} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12325a6692b2349b5992ec00a2cf8162, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Characters/Pirate (Grey).prefab b/Assets/Prefabs/Characters/Pirate (Grey).prefab index cd964e9..09c586e 100644 --- a/Assets/Prefabs/Characters/Pirate (Grey).prefab +++ b/Assets/Prefabs/Characters/Pirate (Grey).prefab @@ -202,6 +202,7 @@ MonoBehaviour: playerState: 0 animator: {fileID: 232863433340697214} playerCountCanvasPrefab: {fileID: 2911420982173280738} + playerCountCanvas: {fileID: 1920934309388072333} --- !u!136 &1627116187348267135 CapsuleCollider: m_ObjectHideFlags: 0 @@ -1661,6 +1662,17 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} +--- !u!114 &1920934309388072333 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8176763997504289913, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} + m_PrefabInstance: {fileID: 7769048123306772980} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2911420982173280738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12325a6692b2349b5992ec00a2cf8162, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2911420982173280738 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} diff --git a/Assets/Prefabs/Characters/Pirate (Red).prefab b/Assets/Prefabs/Characters/Pirate (Red).prefab index 351a27c..9e9ca51 100644 --- a/Assets/Prefabs/Characters/Pirate (Red).prefab +++ b/Assets/Prefabs/Characters/Pirate (Red).prefab @@ -1259,6 +1259,7 @@ MonoBehaviour: playerState: 0 animator: {fileID: 7800412279828783518} playerCountCanvasPrefab: {fileID: 4593694095142779203} + playerCountCanvas: {fileID: 941219433310479660} --- !u!1 &7074820051352815849 GameObject: m_ObjectHideFlags: 0 @@ -1661,6 +1662,17 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} +--- !u!114 &941219433310479660 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8176763997504289913, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} + m_PrefabInstance: {fileID: 8968445451050703189} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4593694095142779203} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12325a6692b2349b5992ec00a2cf8162, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &4593694095142779203 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3} diff --git a/Assets/Scripts/Gameplay/GameplayManager.cs b/Assets/Scripts/Gameplay/GameplayManager.cs index cfddce0..3851847 100644 --- a/Assets/Scripts/Gameplay/GameplayManager.cs +++ b/Assets/Scripts/Gameplay/GameplayManager.cs @@ -1079,7 +1079,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader count = tile.TotalPawnsInTile; } - playerPawn.GetComponentInChildren().SetPlayerCount(count); + playerPawn.PlayerCountCanvas.SetPlayerCount(count); } public void ResetData() diff --git a/Assets/Scripts/Gameplay/Player/PlayerPawn.cs b/Assets/Scripts/Gameplay/Player/PlayerPawn.cs index 02a6437..457b018 100644 --- a/Assets/Scripts/Gameplay/Player/PlayerPawn.cs +++ b/Assets/Scripts/Gameplay/Player/PlayerPawn.cs @@ -90,10 +90,36 @@ public class PlayerPawn : MonoBehaviour TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance(); gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance(); - int nextTileIndex = gameplayManager.GetNextGeneralTileIndex(this); - Vector3 lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextTileIndex).transform.position - transform.position; + Vector3 lookDirection = Vector3.zero; + + if (playerState == PlayerState.InFinishingPath) + { + int nextIndex = CurrentTileIndex + 1; + int maxIndex = tilesManager.GetFinishingTileDataLength(PlayerType) - 1; + + if (nextIndex <= maxIndex) + { + lookDirection = tilesManager.RetrieveFinishingTileBasedOnIndex(PlayerType, nextIndex).transform.position - transform.position; + } + } + else + { + if (gameplayManager.IsGoingInsideFinishingPath(this, out int possibleSteps)) + { + lookDirection =tilesManager.RetrieveFinishingTileBasedOnIndex(PlayerType, 0).transform.position - transform.position; + } + else + { + int nextIndex = gameplayManager.GetNextGeneralTileIndex(this); + lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextIndex).transform.position - transform.position; + } + } + lookDirection.y = 0; - transform.DOLookAt(transform.position + lookDirection, 0.2f); + if (lookDirection != Vector3.zero) + { + transform.DOLookAt(transform.position + lookDirection, 0.2f); + } onComplete?.Invoke(); };