Compare commits
No commits in common. "318a34e19241e4dc1806e1329f9459bd57dd15da" and "f5629aa2836b268738c67ab8a5679ab171ee2173" have entirely different histories.
318a34e192
...
f5629aa283
Binary file not shown.
BIN
Assets/Artifacts/Audio/Home BGM1.mp3
Normal file
BIN
Assets/Artifacts/Audio/Home BGM1.mp3
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 25dd9172f3ed8497bb638d649e5309f0
|
guid: 44a099190c52447f7a3254e3679ecfd8
|
||||||
AudioImporter:
|
AudioImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@ -1,48 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &8621343442563501342
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 8621343442563501343}
|
|
||||||
- component: {fileID: 8621343442563501340}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: FinishingPathWaypoint
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &8621343442563501343
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8621343442563501342}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: -0.12, y: 0, z: -14.976}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &8621343442563501340
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8621343442563501342}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: be69a8cfb3b2940308cbac570565e629, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
isSafeZone: 0
|
|
||||||
centeredPoint: {fileID: 8621343442563501343}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b9f6f4c66b5a34d7eb7286e772505389
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -27,8 +27,6 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
|
|
||||||
public void Roll(Action<int> onComplete, bool isBot)
|
public void Roll(Action<int> onComplete, bool isBot)
|
||||||
{
|
{
|
||||||
Debug.Log($"Start rolling: {rolling}");
|
|
||||||
|
|
||||||
if (!rolling)
|
if (!rolling)
|
||||||
{
|
{
|
||||||
Debug.Log($"isBot: {isBot}");
|
Debug.Log($"isBot: {isBot}");
|
||||||
@ -76,8 +74,9 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
//TODO: Use the dice value as needed
|
//TODO: Use the dice value as needed
|
||||||
Debug.Log($"Dice rolled: {value}");
|
Debug.Log($"Dice rolled: {value}");
|
||||||
|
|
||||||
ResetDice();
|
|
||||||
onRollingComplete?.Invoke(value);
|
onRollingComplete?.Invoke(value);
|
||||||
|
|
||||||
|
ResetDice();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetDiceValue()
|
int GetDiceValue()
|
||||||
@ -99,7 +98,7 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
transform.localPosition = new Vector3(0, 20, 0);
|
transform.localPosition = new Vector3(0, 20, 0);
|
||||||
rolling = false;
|
rolling = false;
|
||||||
|
|
||||||
// Invoke(nameof(ResetEvent), 0.1f);
|
Invoke(nameof(ResetEvent), 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetEvent()
|
private void ResetEvent()
|
||||||
|
|||||||
@ -630,7 +630,6 @@ MonoBehaviour:
|
|||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 5526766409186502679}
|
animator: {fileID: 5526766409186502679}
|
||||||
playerCountCanvasPrefab: {fileID: 9029553984926861784}
|
playerCountCanvasPrefab: {fileID: 9029553984926861784}
|
||||||
playerCountCanvas: {fileID: 5728752331380905399}
|
|
||||||
--- !u!1 &4818123989977612668
|
--- !u!1 &4818123989977612668
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1623,17 +1622,6 @@ RectTransform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 953143927943285832, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
||||||
m_PrefabInstance: {fileID: 4537709141704337870}
|
m_PrefabInstance: {fileID: 4537709141704337870}
|
||||||
m_PrefabAsset: {fileID: 0}
|
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
|
--- !u!1 &9029553984926861784 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
||||||
|
|||||||
@ -630,7 +630,6 @@ MonoBehaviour:
|
|||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 5274388487207906813}
|
animator: {fileID: 5274388487207906813}
|
||||||
playerCountCanvasPrefab: {fileID: 6862258105288866118}
|
playerCountCanvasPrefab: {fileID: 6862258105288866118}
|
||||||
playerCountCanvas: {fileID: 7923051124467737897}
|
|
||||||
--- !u!1 &5059623752267150313
|
--- !u!1 &5059623752267150313
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1672,14 +1671,3 @@ GameObject:
|
|||||||
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
||||||
m_PrefabInstance: {fileID: 2057554100330600784}
|
m_PrefabInstance: {fileID: 2057554100330600784}
|
||||||
m_PrefabAsset: {fileID: 0}
|
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:
|
|
||||||
|
|||||||
@ -202,7 +202,6 @@ MonoBehaviour:
|
|||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 232863433340697214}
|
animator: {fileID: 232863433340697214}
|
||||||
playerCountCanvasPrefab: {fileID: 2911420982173280738}
|
playerCountCanvasPrefab: {fileID: 2911420982173280738}
|
||||||
playerCountCanvas: {fileID: 1920934309388072333}
|
|
||||||
--- !u!136 &1627116187348267135
|
--- !u!136 &1627116187348267135
|
||||||
CapsuleCollider:
|
CapsuleCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1662,17 +1661,6 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
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
|
--- !u!1 &2911420982173280738 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
||||||
|
|||||||
@ -1259,7 +1259,6 @@ MonoBehaviour:
|
|||||||
playerState: 0
|
playerState: 0
|
||||||
animator: {fileID: 7800412279828783518}
|
animator: {fileID: 7800412279828783518}
|
||||||
playerCountCanvasPrefab: {fileID: 4593694095142779203}
|
playerCountCanvasPrefab: {fileID: 4593694095142779203}
|
||||||
playerCountCanvas: {fileID: 941219433310479660}
|
|
||||||
--- !u!1 &7074820051352815849
|
--- !u!1 &7074820051352815849
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1662,17 +1661,6 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
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
|
--- !u!1 &4593694095142779203 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4879164135252893718, guid: a925361762f504380a8aa4d7eb87b32c, type: 3}
|
||||||
|
|||||||
@ -215,7 +215,7 @@ Canvas:
|
|||||||
m_VertexColorAlwaysGammaSpace: 0
|
m_VertexColorAlwaysGammaSpace: 0
|
||||||
m_AdditionalShaderChannelsFlag: 25
|
m_AdditionalShaderChannelsFlag: 25
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingOrder: 5
|
m_SortingOrder: 0
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
--- !u!114 &1334714064113256010
|
--- !u!114 &1334714064113256010
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6e82d850a90884a54a07beff74d9a324
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public enum MusicType
|
|
||||||
{
|
|
||||||
HomeMusic,
|
|
||||||
GameMusic,
|
|
||||||
GameOverMusic
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public class MusicData
|
|
||||||
{
|
|
||||||
public MusicType musicType;
|
|
||||||
public int priority;
|
|
||||||
public AudioClip musicClip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MusicManager : MonoBehaviour, IBootLoader, IBase, IDataLoader
|
|
||||||
{
|
|
||||||
[SerializeField] AudioSource audioSource;
|
|
||||||
[SerializeField] private MusicData[] musicDatas;
|
|
||||||
|
|
||||||
public bool IsGamemusicOn
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<MusicType, MusicData> musicDataDict = new Dictionary<MusicType, MusicData>();
|
|
||||||
|
|
||||||
public void Initialize()
|
|
||||||
{
|
|
||||||
InterfaceManager.Instance?.RegisterInterface<MusicManager>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitializeData()
|
|
||||||
{
|
|
||||||
audioSource.priority = 0;
|
|
||||||
for (int idx = 0; idx < musicDatas.Length; idx++)
|
|
||||||
{
|
|
||||||
if (musicDataDict.ContainsKey(musicDatas[idx].musicType))
|
|
||||||
musicDataDict[musicDatas[idx].musicType] = musicDatas[idx];
|
|
||||||
else
|
|
||||||
musicDataDict.Add(musicDatas[idx].musicType, musicDatas[idx]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetGamemusic(bool state)
|
|
||||||
{
|
|
||||||
IsGamemusicOn = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PlayMusicClip(MusicType musicType)
|
|
||||||
{
|
|
||||||
if (!enabled) return;
|
|
||||||
|
|
||||||
MusicData musicData = musicDataDict[musicType];
|
|
||||||
|
|
||||||
audioSource.priority = musicData.priority;
|
|
||||||
audioSource.clip = musicData.musicClip;
|
|
||||||
audioSource.Play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6f598c418041d4a9e89aa7a25efc1185
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -25,7 +25,7 @@ public class BotModeData
|
|||||||
public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||||
{
|
{
|
||||||
private GameplayManager gameplayManager;
|
private GameplayManager gameplayManager;
|
||||||
private GameManager gameManager;
|
|
||||||
private PVPModeData pvpModeData;
|
private PVPModeData pvpModeData;
|
||||||
private BotModeData botModeData;
|
private BotModeData botModeData;
|
||||||
|
|
||||||
@ -41,7 +41,6 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
public void InitializeData()
|
public void InitializeData()
|
||||||
{
|
{
|
||||||
gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
|
||||||
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +69,6 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
public void OnGameRestarted()
|
public void OnGameRestarted()
|
||||||
{
|
{
|
||||||
gameManager.OnGameStateChanged(GameState.InGame);
|
|
||||||
gameplayManager.ResetGameRestartData();
|
|
||||||
switch (CurrentGameModeType)
|
switch (CurrentGameModeType)
|
||||||
{
|
{
|
||||||
case GameModeType.PVP:
|
case GameModeType.PVP:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
using TMPro;
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
public enum BotMove
|
public enum BotMove
|
||||||
{
|
{
|
||||||
@ -16,15 +16,9 @@ public enum BotMove
|
|||||||
|
|
||||||
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||||
{
|
{
|
||||||
[SerializeField] private bool isDebugTest = false;
|
|
||||||
|
|
||||||
public bool IsDebugTest => isDebugTest;
|
|
||||||
|
|
||||||
[SerializeField] DiceRollHandler diceRollHandler;
|
[SerializeField] DiceRollHandler diceRollHandler;
|
||||||
|
|
||||||
[SerializeField] private int diceValue = 0;
|
[SerializeField] private int diceValue = 0;
|
||||||
[SerializeField] private int maxDiceSixRollCounter = 2;
|
|
||||||
[SerializeField] private int totalStepsForCharacter = 57;
|
|
||||||
|
|
||||||
[SerializeField] private TextMeshProUGUI diceText;
|
[SerializeField] private TextMeshProUGUI diceText;
|
||||||
|
|
||||||
@ -52,7 +46,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
private TilesManager tilesManager;
|
private TilesManager tilesManager;
|
||||||
private UIManager uIManager;
|
private UIManager uIManager;
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
private GameModeHandler gameModeHandler;
|
|
||||||
|
|
||||||
private int diceRolledValue;
|
private int diceRolledValue;
|
||||||
|
|
||||||
@ -86,13 +79,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||||
uIManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
|
uIManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
|
||||||
gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
||||||
gameModeHandler = InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitPlayerTypesForPVP(List<PlayerType> types, List<string> names)
|
public void InitPlayerTypesForPVP(List<PlayerType> types, List<string> names)
|
||||||
{
|
{
|
||||||
allPlayerTypes = new List<PlayerType>(types);
|
allPlayerTypes = new List<PlayerType>(types);
|
||||||
playerDatas = new List<PlayerData>();
|
playerDatas.Clear();
|
||||||
|
|
||||||
TotalPlayersInGame = types.Count;
|
TotalPlayersInGame = types.Count;
|
||||||
|
|
||||||
@ -127,7 +119,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
if (botTypesInGame.Contains(playerType))
|
if (botTypesInGame.Contains(playerType))
|
||||||
{
|
{
|
||||||
allPlayerTypes.Add(playerType);
|
allPlayerTypes.Add(playerType);
|
||||||
playerDatas.Add(new PlayerData { playerType = playerType, playerName = $"{playerType}" });
|
playerDatas.Add(new PlayerData { playerType = selectedPlayerData.playerType, playerName = $"{playerType}" });
|
||||||
}
|
}
|
||||||
else if (selectedPlayerData.playerType == playerType)
|
else if (selectedPlayerData.playerType == playerType)
|
||||||
{
|
{
|
||||||
@ -136,6 +128,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var type in allPlayerTypes)
|
||||||
|
Debug.Log($"allPlayerTypes ::: {type}");
|
||||||
|
|
||||||
tilesManager.InitTilesData();
|
tilesManager.InitTilesData();
|
||||||
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
||||||
InitCurrentGamePlayerInfo();
|
InitCurrentGamePlayerInfo();
|
||||||
@ -210,12 +205,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO :: Call based on 2P/3P/4P
|
||||||
public void InitCurrentGamePlayerInfo()
|
public void InitCurrentGamePlayerInfo()
|
||||||
{
|
{
|
||||||
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
||||||
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
|
||||||
|
|
||||||
SetCurrentSelectedPointer();
|
|
||||||
|
|
||||||
// initialize the board based on the player types
|
// initialize the board based on the player types
|
||||||
playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>();
|
playerGameDatasDict = new Dictionary<PlayerType, PlayerGameData>();
|
||||||
@ -275,7 +268,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private bool CheckForMaxDiceRollAttempt()
|
private bool CheckForMaxDiceRollAttempt()
|
||||||
{
|
{
|
||||||
if (diceSixRollCounter > maxDiceSixRollCounter) // TODO :: Reset after test
|
if (diceSixRollCounter == 3)
|
||||||
{
|
{
|
||||||
CanRollDiceAgain = false;
|
CanRollDiceAgain = false;
|
||||||
SwitchPlayer();
|
SwitchPlayer();
|
||||||
@ -310,6 +303,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
|
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
|
||||||
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
|
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
|
||||||
|
|
||||||
|
// check the data from the playerGameDataDict
|
||||||
|
// change playerPawnsDict to list
|
||||||
|
|
||||||
|
// only select the pawns that are active
|
||||||
|
// if no pawns have left the home select the first pawn inside the base should be selected
|
||||||
|
|
||||||
int savedPlayerId = -1;
|
int savedPlayerId = -1;
|
||||||
PlayerPawn pawn = null;
|
PlayerPawn pawn = null;
|
||||||
|
|
||||||
@ -317,7 +316,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
||||||
{
|
{
|
||||||
UpdateActivePlayersAndSetDisplay();
|
InitActivePlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
|
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
|
||||||
@ -332,21 +331,27 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
// TODO :: Double check
|
// TODO :: Double check
|
||||||
foreach (var key in botPawnsDictForCurrentPlayer.Keys)
|
foreach (var key in botPawnsDictForCurrentPlayer.Keys)
|
||||||
{
|
{
|
||||||
Debug.Log($"b :: botPawnsDictForCurrentPlayer[key]: {key}, {botPawnsDictForCurrentPlayer[key]}");
|
Debug.Log($"b :: botPawnsDictForCurrentPlayer[key]: {botPawnsDictForCurrentPlayer[key]}");
|
||||||
// botPawnsDictForCurrentPlayer[key] = BotMove.NoMoves;
|
// botPawnsDictForCurrentPlayer[key] = BotMove.NoMoves;
|
||||||
|
Debug.Log($"a :: botPawnsDictForCurrentPlayer[key]: {botPawnsDictForCurrentPlayer[key]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Debug.Log($"Before Iterating");
|
Debug.Log($"Before Iterating");
|
||||||
foreach (var playerPawn in availPlayers)
|
foreach (var playerPawn in availPlayers)
|
||||||
{
|
{
|
||||||
int possibleSteps = 0;
|
Debug.Log($"Iterating");
|
||||||
Tile possibleTileData = null;
|
var possibleLandingIndex = playerPawn.CurrentTileIndex + diceRolledValue;
|
||||||
|
|
||||||
if (playerPawn.GetPlayerState() != PlayerState.InFinishingPath)
|
int lastIndex = tilesManager.GetGeneralTilesLength() - 1;
|
||||||
FindPossibleTileData(playerPawn, out possibleSteps, out possibleTileData);
|
int index = possibleLandingIndex > lastIndex ? possibleLandingIndex - lastIndex - 1 : possibleLandingIndex;
|
||||||
|
Tile possibleTileData = tilesManager.RetrieveTileBasedOnIndex(index);
|
||||||
|
|
||||||
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || possibleSteps > playerGameDatasDict[currentPlayerTypeTurn].endIndex) // TODO :: have a better second check
|
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.HasPawnsAvailable}");
|
||||||
|
|
||||||
|
if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath || possibleLandingIndex > playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
||||||
{
|
{
|
||||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: inFinishingPath :: canSelectPlayer: {playerPawn.CanSelectPlayer}");
|
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: inFinishingPath :: canSelectPlayer: {playerPawn.CanSelectPlayer}");
|
||||||
if (playerPawn.CanSelectPlayer)
|
if (playerPawn.CanSelectPlayer)
|
||||||
@ -360,12 +365,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.NoMoves;
|
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.NoMoves;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (possibleTileData != null && possibleTileData.IsSafeZone)
|
else if (possibleTileData.IsSafeZone)
|
||||||
{
|
{
|
||||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: safeMove");
|
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: safeMove");
|
||||||
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.SafeMove;
|
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.SafeMove;
|
||||||
}
|
}
|
||||||
else if (possibleTileData != null && possibleTileData.HasPawnsAvailable && possibleTileData.CurrentHoldingPlayerType != playerPawn.PlayerType)
|
else if (possibleTileData.HasPawnsAvailable)
|
||||||
{
|
{
|
||||||
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: attackMove");
|
Debug.Log($"AI playerPawn :: {playerPawn.name} :: {playerPawn.PlayerId} :: attackMove");
|
||||||
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.AttackMove;
|
botPawnsDictForCurrentPlayer[playerPawn.PlayerId] = BotMove.AttackMove;
|
||||||
@ -412,23 +417,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pawn != null)
|
|
||||||
{
|
|
||||||
Debug.Log($"AI playerPawn :: {pawn.name} :: SelectedPawn: {pawn.name}");
|
Debug.Log($"AI playerPawn :: {pawn.name} :: SelectedPawn: {pawn.name}");
|
||||||
OnPawnSelected(pawn);
|
OnPawnSelected(pawn);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (CheckForMaxDiceRollAttempt())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
|
||||||
HandleDiceRoll();
|
|
||||||
else
|
|
||||||
SwitchPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitPawnBasedOnState(BotMove botMove)
|
void InitPawnBasedOnState(BotMove botMove)
|
||||||
{
|
{
|
||||||
@ -458,28 +448,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FindPossibleTileData(PlayerPawn playerPawn, out int possibleSteps, out Tile possibleTileData)
|
|
||||||
{
|
|
||||||
int lastStepGenTile = totalStepsForCharacter - tilesManager.GetFinishingTileDataLength(playerPawn.PlayerType);//playerGameDatasDict[playerPawn.PlayerType].endIndex;
|
|
||||||
int possibleTileIndex = playerPawn.CurrentTileIndex + diceRolledValue;
|
|
||||||
|
|
||||||
int lastTileIndex = tilesManager.GetGeneralTilesLength() - 1;
|
|
||||||
bool canGoingInsideFinishingPath = IsGoingInsideFinishingPath(playerPawn, out possibleSteps);
|
|
||||||
|
|
||||||
int index = canGoingInsideFinishingPath ? possibleSteps - lastStepGenTile - 1
|
|
||||||
: possibleTileIndex > lastTileIndex ? possibleTileIndex - lastTileIndex - 1 : possibleTileIndex; // case for addressing the scenario when going through the last index of general tiles.
|
|
||||||
|
|
||||||
Debug.Log($"possibleTileIndex: {possibleTileIndex}, lastStepGenTileIdx: {lastStepGenTile}");
|
|
||||||
Debug.Log($"index: {index}");
|
|
||||||
possibleTileData = canGoingInsideFinishingPath ? tilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, index) : tilesManager.RetrieveTileBasedOnIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsGoingInsideFinishingPath(PlayerPawn playerPawn, out int possibleSteps)
|
|
||||||
{
|
|
||||||
possibleSteps = playerGameDatasDict[playerPawn.PlayerType].playerPawnsDict[playerPawn.PlayerId].StepsTaken + diceRolledValue;
|
|
||||||
return possibleSteps > tilesManager.GetGeneralTilesLength() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDiceRolled(int rolledVal)
|
public void OnDiceRolled(int rolledVal)
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(false);
|
SetCanRollDiceForUser(false);
|
||||||
@ -506,7 +474,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"### AreAllPawnsInFinishingPath");
|
Debug.Log($"### AreAllPawnsInFinishingPath");
|
||||||
if (AreAllPawnsInFinishingPath())
|
if (AreAllPawnsInFinishingPath())
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn));
|
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -520,7 +488,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
else // if there are any other pawns that are in safe or moving state
|
else // if there are any other pawns that are in safe or moving state
|
||||||
{
|
{
|
||||||
// for player's logic
|
// for player's logic
|
||||||
UpdateActivePlayersAndSetDisplay();
|
InitActivePlayers();
|
||||||
|
|
||||||
int customAvailPlayers = availPlayers.Count();
|
int customAvailPlayers = availPlayers.Count();
|
||||||
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
|
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
|
||||||
@ -550,8 +518,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
availPlayers[i].SetPlayerSelectionState(true);
|
availPlayers[i].SetPlayerSelectionState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int idx = indexesToRemove.Count - 1; idx >= 0; idx--)
|
foreach (int i in indexesToRemove) availPlayers.RemoveAt(i);
|
||||||
availPlayers.RemoveAt(idx);
|
|
||||||
|
|
||||||
// if (availPlayers.Count() < 1)
|
// if (availPlayers.Count() < 1)
|
||||||
Debug.Log($"CustomAvailablePlayers: {customAvailPlayers}");
|
Debug.Log($"CustomAvailablePlayers: {customAvailPlayers}");
|
||||||
@ -562,14 +529,22 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateActivePlayersAndSetDisplay()
|
private void InitActivePlayers()
|
||||||
{
|
{
|
||||||
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
||||||
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
||||||
pawn.GetPlayerState() == PlayerState.Moving ||
|
pawn.GetPlayerState() == PlayerState.Moving ||
|
||||||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
||||||
|
|
||||||
SetDisplayCountForAllAvailPlayers(true);
|
Debug.Log($"#### UpdatePlayerState in InitActivePlayers ");
|
||||||
|
foreach (var pawn in playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values)
|
||||||
|
{
|
||||||
|
Debug.Log($"pawn: {pawn.name}, state: {pawn.GetPlayerState()}");
|
||||||
|
}
|
||||||
|
foreach (var player in availPlayers) // TODO :: Move from here
|
||||||
|
{
|
||||||
|
DisplayPlayerCountOnTile(player, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AreAllPawnsInFinishingPath()
|
private bool AreAllPawnsInFinishingPath()
|
||||||
@ -600,7 +575,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
playerPawn.SetPlayerState(playerState);
|
playerPawn.SetPlayerState(playerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckDiceRollForBot()
|
private void CheckDiceRollForBot(PlayerPawn playerPawn)
|
||||||
{
|
{
|
||||||
if (CanRollDiceAgain)
|
if (CanRollDiceAgain)
|
||||||
{
|
{
|
||||||
@ -610,39 +585,37 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void HandleDiceRoll()
|
private void HandleDiceRoll()
|
||||||
{
|
{
|
||||||
if (isDebugTest)
|
// diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal));
|
||||||
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
|
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal), diceValue == 0 ? UnityEngine.Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1) : diceValue);
|
||||||
else
|
|
||||||
diceRollHandler.HandleDiceViewForBot((rollVal) => RollDiceForBot(rollVal));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPawnSelected(PlayerPawn selectedPawn)
|
public void OnPawnSelected(PlayerPawn playerPawn)
|
||||||
{
|
{
|
||||||
EnablePlayerSelectionStates(false);
|
EnablePlayerSelectionStates(false);
|
||||||
|
|
||||||
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
|
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
|
||||||
Debug.Log($"playerPawn.GetPlayerState(): {selectedPawn.GetPlayerState()}");
|
Debug.Log($"playerPawn.GetPlayerState(): {playerPawn.GetPlayerState()}");
|
||||||
|
|
||||||
|
|
||||||
if (selectedPawn.GetPlayerState() == PlayerState.InHome)
|
if (playerPawn.GetPlayerState() == PlayerState.InHome)
|
||||||
{
|
{
|
||||||
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
|
Tile targetTile = tilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
|
||||||
|
|
||||||
selectedPawn.ShowPlayerCountCanvas(false);
|
DisplayPlayerCountOnTile(playerPawn, false);
|
||||||
selectedPawn.MoveToTile(
|
playerPawn.MoveToTile(
|
||||||
GetAndInitPositionInsideSafeZone(selectedPawn, targetTile),
|
GetAndInitPositionInsideSafeZone(playerPawn, targetTile),
|
||||||
onComplete: () =>
|
onComplete: () =>
|
||||||
{
|
{
|
||||||
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
|
playerGameDatasDict[playerGameData.playerType].totalPawnsInHome--;
|
||||||
UpdatePlayerState(selectedPawn, PlayerState.InSafeZone);
|
UpdatePlayerState(playerPawn, PlayerState.InSafeZone);
|
||||||
ShowUpdatedPlayerCountOnTile(selectedPawn);
|
DisplayPlayerCountOnTile(playerPawn, true);
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedPawn.IsBotPlayer)
|
if (playerPawn.IsBotPlayer)
|
||||||
CheckDiceRollForBot();
|
CheckDiceRollForBot(playerPawn);
|
||||||
else
|
else
|
||||||
SetCanRollDiceForUser(true);
|
SetCanRollDiceForUser(true);
|
||||||
|
|
||||||
@ -650,71 +623,53 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (selectedPawn.GetPlayerState() == PlayerState.InFinishingPath)
|
else if (playerPawn.GetPlayerState() == PlayerState.InFinishingPath)
|
||||||
{
|
{
|
||||||
Tile currentSittingTile = tilesManager.RetrieveFinishingTileBasedOnIndex(selectedPawn.PlayerType, selectedPawn.CurrentTileIndex);
|
ApplyFinishingPathLogic(playerPawn);
|
||||||
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
}
|
||||||
|
else if (playerPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
||||||
if (currentSittingTile.HasPawnsAvailable)
|
|
||||||
{
|
{
|
||||||
var playerPawns = currentSittingTile.GetPlayerPawns();
|
tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex).ResetPlayerPawn(playerPawn);
|
||||||
foreach (var pawn in playerPawns)
|
ApplyFinishingPathLogic(playerPawn);
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
|
||||||
}
|
}
|
||||||
|
else if (playerPawn.GetPlayerState() == PlayerState.InSafeZone || playerPawn.GetPlayerState() == PlayerState.Moving)
|
||||||
ApplyFinishingPathLogic(selectedPawn);
|
|
||||||
}
|
|
||||||
else if (selectedPawn.CurrentTileIndex == playerGameDatasDict[currentPlayerTypeTurn].endIndex)
|
|
||||||
{
|
|
||||||
tilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex).ResetPlayerPawn(selectedPawn);
|
|
||||||
ApplyFinishingPathLogic(selectedPawn);
|
|
||||||
}
|
|
||||||
else if (selectedPawn.GetPlayerState() == PlayerState.InSafeZone || selectedPawn.GetPlayerState() == PlayerState.Moving)
|
|
||||||
{
|
{
|
||||||
// move based on the dice value
|
// move based on the dice value
|
||||||
Debug.Log($"Tile Index :: currentTileIndex: {selectedPawn.CurrentTileIndex}");
|
Debug.Log($"Tile Index :: currentTileIndex: {playerPawn.CurrentTileIndex}");
|
||||||
int nextTileIdx = GetNextGeneralTileIndex(selectedPawn);
|
int nextTileIdx = GetNextGeneralTileIndex(playerPawn);
|
||||||
int targetIdx = selectedPawn.CurrentTileIndex + diceRolledValue;
|
int targetIdx = playerPawn.CurrentTileIndex + diceRolledValue;
|
||||||
|
|
||||||
if (nextTileIdx == 0)
|
if (nextTileIdx == 0)
|
||||||
targetIdx = (targetIdx - selectedPawn.CurrentTileIndex) - 1;
|
targetIdx = (targetIdx - playerPawn.CurrentTileIndex) - 1;
|
||||||
|
|
||||||
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(selectedPawn.CurrentTileIndex);
|
Tile currentSittingTile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
|
||||||
if (currentSittingTile.IsSafeZone)
|
if (currentSittingTile.IsSafeZone)
|
||||||
{
|
{
|
||||||
SafeTile safeTile = (SafeTile)currentSittingTile;
|
SafeTile safeTile = (SafeTile)currentSittingTile;
|
||||||
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, selectedPawn);
|
safeTile.UpdateSafeZonePlayerData(currentPlayerTypeTurn, playerPawn);
|
||||||
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
|
// DisplayPlayerCountOnTile(playerPawn, false);
|
||||||
{
|
// if (safeTile.PlayerTypesCount > 0)
|
||||||
var playerPawns = safeTile.GetPlayerPawns(selectedPawn.PlayerType);
|
// {
|
||||||
|
// var pawns = safeTile.GetPlayerPawns(playerPawn.PlayerType);
|
||||||
|
// foreach (var pawn in pawns)
|
||||||
|
// DisplayPlayerCountOnTile(pawn, true);
|
||||||
|
// }
|
||||||
|
|
||||||
if (safeTile.PlayerTypesCount == 1)
|
if (safeTile.PlayerTypesCount == 1)
|
||||||
{
|
{
|
||||||
PlayerType playerType = safeTile.GetFirstPlayerType();
|
PlayerType playerType = safeTile.GetFirstPlayerType();
|
||||||
|
|
||||||
|
var playerPawns = safeTile.GetPlayerPawns(playerType);
|
||||||
foreach (var pawn in playerPawns)
|
foreach (var pawn in playerPawns)
|
||||||
pawn.MoveToCustomTilePosition(safeTile.CenterPlacementPosition);
|
pawn.MoveToCustomTilePosition(safeTile.CenterPlacementPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (safeTile.ContainsPlayerType(selectedPawn.PlayerType))
|
|
||||||
{
|
|
||||||
foreach (var pawn in playerPawns)
|
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentSittingTile.ResetPlayerPawn(selectedPawn);
|
currentSittingTile.ResetPlayerPawn(playerPawn);
|
||||||
if (currentSittingTile.HasPawnsAvailable)
|
|
||||||
{
|
|
||||||
var playerPawns = currentSittingTile.GetPlayerPawns();
|
|
||||||
foreach (var pawn in playerPawns)
|
|
||||||
ShowUpdatedPlayerCountOnTile(pawn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveThroughTiles(selectedPawn, nextTileIdx, targetIndex: targetIdx);
|
MoveThroughTiles(playerPawn, nextTileIdx, targetIndex: targetIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,8 +680,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
|
tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1 : finishingPathIndex + diceRolledValue;
|
||||||
|
|
||||||
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
Debug.Log($"TargetIdx: {targetIdx}, finishingPathIndex: {finishingPathIndex}");
|
||||||
|
|
||||||
playerPawn.ShowPlayerCountCanvas(false);
|
|
||||||
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
MoveThroughFinishingPath(playerPawn, finishingPathIndex, targetIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,10 +706,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
|
Debug.Log($"currentPlayerTurnIndex: {currentPlayerTurnIndex}");
|
||||||
|
|
||||||
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
||||||
|
if (availPlayers.Count < 1)
|
||||||
|
InitActivePlayers();
|
||||||
|
|
||||||
UpdateActivePlayersAndSetDisplay();
|
|
||||||
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
||||||
SetDisplayCountForAllAvailPlayers(false);
|
foreach (var pawn in availPlayers)
|
||||||
|
{
|
||||||
|
DisplayPlayerCountOnTile(pawn, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (allPlayerTypes.Count == 1)
|
if (allPlayerTypes.Count == 1)
|
||||||
{
|
{
|
||||||
@ -764,8 +721,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPlayerTurnIndex = allPlayerTypes.FindIndex(type => type == currentPlayerTypeTurn);
|
|
||||||
|
|
||||||
if (currentPlayerTypeTurn == allPlayerTypes[allPlayerTypes.Count - 1])
|
if (currentPlayerTypeTurn == allPlayerTypes[allPlayerTypes.Count - 1])
|
||||||
{
|
{
|
||||||
currentPlayerTurnIndex = 0;
|
currentPlayerTurnIndex = 0;
|
||||||
@ -782,43 +737,30 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
diceSixRollCounter = 0;
|
diceSixRollCounter = 0;
|
||||||
diceText.text = $"{0}";
|
diceText.text = $"{0}";
|
||||||
|
|
||||||
UpdateActivePlayersAndSetDisplay();
|
InitActivePlayers();
|
||||||
|
foreach (var pawn in availPlayers)
|
||||||
|
{
|
||||||
|
DisplayPlayerCountOnTile(pawn, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
|
||||||
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
||||||
SetCanRollDiceForUser(gameModeHandler.CurrentGameModeType != GameModeType.Bot || !botTypesInGame.Contains(currentPlayerTypeTurn));
|
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
|
||||||
SetCurrentSelectedPointer();
|
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
|
||||||
|
|
||||||
pointerMeshRend.material = turnMat;
|
pointerMeshRend.material = turnMat;
|
||||||
// pointerMeshRend.materials[0] = turnMat;
|
// pointerMeshRend.materials[0] = turnMat;
|
||||||
|
|
||||||
// Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
|
Debug.Log($"botTypesInGame.Contains(currentPlayerTypeTurn): {botTypesInGame.Contains(currentPlayerTypeTurn)}");
|
||||||
|
|
||||||
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
if (botTypesInGame.Contains(currentPlayerTypeTurn)) // TODO :: Double check calling of the function
|
||||||
{
|
{
|
||||||
Debug.Log($"Invoking RollDiceForBot");
|
Debug.Log($"Invoking RollDiceForBot");
|
||||||
Invoke(nameof(HandleDiceRoll), 1f);
|
Invoke(nameof(HandleDiceRoll), 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
availPlayers.ForEach(pawn => ShowUpdatedPlayerCountOnTile(pawn));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
availPlayers.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);
|
||||||
@ -836,7 +778,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"tile targetPosition: {targetPosition}");
|
Debug.Log($"tile targetPosition: {targetPosition}");
|
||||||
playerPawn.ShowPlayerCountCanvas(false);
|
DisplayPlayerCountOnTile(playerPawn, false);
|
||||||
|
|
||||||
playerPawn.MoveToTile(
|
playerPawn.MoveToTile(
|
||||||
targetPosition,
|
targetPosition,
|
||||||
@ -869,7 +811,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
|
Debug.Log($"nextTile.IsSafeZone: {nextTile.IsSafeZone}");
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
if (CanRollDiceAgain)
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
DisplayPlayerCountOnTile(playerPawn, true);
|
||||||
|
|
||||||
if (!nextTile.IsSafeZone)
|
if (!nextTile.IsSafeZone)
|
||||||
{
|
{
|
||||||
@ -888,7 +830,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"pawn: {pawn}");
|
Debug.Log($"pawn: {pawn}");
|
||||||
Debug.Log($"playerBase: {playerBaseHandler}");
|
Debug.Log($"playerBase: {playerBaseHandler}");
|
||||||
|
|
||||||
var playerBasePos = playerBaseHandler.GetPlayerBase(pawn.PlayerType).GetBasePlacementDataPosition(pawn.PlayerId - 1);
|
var playerBasePos = playerBaseHandler.GetPlayerBase(pawn.PlayerType)
|
||||||
|
.GetBasePlacementDataPosition(pawn.PlayerId - 1);
|
||||||
Debug.Log($"playerBasePos: {playerBasePos}");
|
Debug.Log($"playerBasePos: {playerBasePos}");
|
||||||
|
|
||||||
playerGameDatasDict[pawn.PlayerType].totalPawnsInHome++;
|
playerGameDatasDict[pawn.PlayerType].totalPawnsInHome++;
|
||||||
@ -898,19 +841,17 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||||
// UpdatePlayerCountOnTile(playerPawn, true);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CanRollDiceAgain = true;
|
CanRollDiceAgain = true;
|
||||||
if (!playerPawn.IsBotPlayer)
|
if (playerPawn.IsBotPlayer)
|
||||||
|
CheckDiceRollForBot(playerPawn);
|
||||||
|
else
|
||||||
SetCanRollDiceForUser(true);
|
SetCanRollDiceForUser(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
|
||||||
|
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -991,8 +932,9 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
{
|
{
|
||||||
UpdatePlayerState(playerPawn, PlayerState.InFinishingPath);
|
UpdatePlayerState(playerPawn, PlayerState.InFinishingPath);
|
||||||
|
|
||||||
|
DisplayPlayerCountOnTile(playerPawn, false);
|
||||||
playerPawn.MoveToTile(
|
playerPawn.MoveToTile(
|
||||||
tilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, index).transform.position,
|
tilesManager.RetrievePositionForFinishingTile(currentPlayerTypeTurn, index).position,
|
||||||
onComplete: () =>
|
onComplete: () =>
|
||||||
{
|
{
|
||||||
diceRolledValue--;
|
diceRolledValue--;
|
||||||
@ -1010,43 +952,45 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DisplayPlayerCountOnTile(playerPawn, true);
|
||||||
|
Debug.Log($"CurrentTileIndex: {playerPawn.CurrentTileIndex} == lastIndex: {tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1}");
|
||||||
if (playerPawn.CurrentTileIndex == tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
|
if (playerPawn.CurrentTileIndex == tilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
|
||||||
{
|
{
|
||||||
playerPawn.ShowPlayerCountCanvas(false);
|
|
||||||
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
|
UpdatePlayerState(playerPawn, PlayerState.HasFinished);
|
||||||
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
|
playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished++;
|
||||||
|
|
||||||
|
Debug.Log($"totalPawnsFinished: {playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished}, playerPawnsDict.Count: {playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count}");
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished == playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count)
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsFinished == playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Count)
|
||||||
{
|
{
|
||||||
CanRollDiceAgain = false;
|
CanRollDiceAgain = false;
|
||||||
|
|
||||||
var playerTypeToRemove = currentPlayerTypeTurn;
|
if (allPlayerTypes.Contains(currentPlayerTypeTurn))
|
||||||
SwitchPlayer();
|
|
||||||
|
|
||||||
if (allPlayerTypes.Contains(playerTypeToRemove))
|
|
||||||
{
|
{
|
||||||
allPlayerTypes.Remove(playerTypeToRemove);
|
allPlayerTypes.Remove(currentPlayerTypeTurn);
|
||||||
playerDatas.FirstOrDefault(data => data.playerType == playerTypeToRemove).ranking = TotalPlayersInGame - allPlayerTypes.Count;
|
playerDatas[(int)currentPlayerTypeTurn].ranking = TotalPlayersInGame - allPlayerTypes.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allPlayerTypes.Count == 1)
|
if (allPlayerTypes.Count == 1)
|
||||||
{
|
{
|
||||||
// Game is over
|
// Game is over
|
||||||
var lastUnfinishingPlayerType = allPlayerTypes[0];
|
|
||||||
allPlayerTypes.RemoveAt(0);
|
allPlayerTypes.RemoveAt(0);
|
||||||
playerDatas.FirstOrDefault(data => data.playerType == lastUnfinishingPlayerType).ranking = TotalPlayersInGame - allPlayerTypes.Count;
|
playerDatas[(int)currentPlayerTypeTurn].ranking = TotalPlayersInGame - allPlayerTypes.Count;
|
||||||
|
|
||||||
// Show Game Over panel
|
// Show Game Over panel
|
||||||
gameManager.OnGameStateChanged(GameState.GameOver);
|
gameManager.OnGameStateChanged(GameState.GameOver);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwitchPlayer();
|
||||||
|
|
||||||
|
Debug.Log($"PlayerTypes: {allPlayerTypes.Count}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CanRollDiceAgain = true;
|
CanRollDiceAgain = true;
|
||||||
if (playerPawn.IsBotPlayer)
|
if (playerPawn.IsBotPlayer)
|
||||||
CheckDiceRollForBot();
|
CheckDiceRollForBot(playerPawn);
|
||||||
else
|
else
|
||||||
SetCanRollDiceForUser(true);
|
SetCanRollDiceForUser(true);
|
||||||
}
|
}
|
||||||
@ -1054,16 +998,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// activate here
|
// activate here
|
||||||
tilesManager.RetrieveFinishingTileBasedOnIndex(currentPlayerTypeTurn, playerPawn.CurrentTileIndex).InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
|
|
||||||
|
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CanRollDiceAgain)
|
|
||||||
ShowUpdatedPlayerCountOnTile(playerPawn);
|
|
||||||
|
|
||||||
SwitchPlayer();
|
SwitchPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1077,13 +1016,12 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowUpdatedPlayerCountOnTile(PlayerPawn playerPawn)
|
private void DisplayPlayerCountOnTile(PlayerPawn playerPawn, bool show)
|
||||||
{
|
{
|
||||||
Tile tile = playerPawn.GetPlayerState() == PlayerState.InFinishingPath ?
|
Tile tile = tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
|
||||||
tilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, playerPawn.CurrentTileIndex)
|
Debug.Log($"Displaycount: {playerPawn.name} on tile: {tile.name}, show: {show}");
|
||||||
: tilesManager.RetrieveTileBasedOnIndex(playerPawn.CurrentTileIndex);
|
playerPawn.ShowPlayerCountCanvas(show);
|
||||||
|
if (!show) return;
|
||||||
playerPawn.ShowPlayerCountCanvas(true);
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (tile.IsSafeZone)
|
if (tile.IsSafeZone)
|
||||||
@ -1095,28 +1033,18 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
count = tile.TotalPawnsInTile;
|
count = tile.TotalPawnsInTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"ShowUpdatedPlayerCountOnTile: {count}");
|
playerPawn.GetComponentInChildren<PlayerCountCanvas>().SetPlayerCount(count);
|
||||||
|
|
||||||
playerPawn.PlayerCountCanvas.SetPlayerCount(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetData()
|
public void ResetData()
|
||||||
{
|
{
|
||||||
ResetGameRestartData();
|
|
||||||
|
|
||||||
playerDatas = null;
|
playerDatas = null;
|
||||||
|
botTypesInGame = null;
|
||||||
allPlayerTypes = null;
|
allPlayerTypes = null;
|
||||||
|
|
||||||
|
botRuntimeMovementData = null;
|
||||||
playerGameDatasDict = null;
|
playerGameDatasDict = null;
|
||||||
playerDatas = null;
|
playerDatas = null;
|
||||||
availPlayers = null;
|
availPlayers = null;
|
||||||
|
|
||||||
botTypesInGame = null;
|
|
||||||
botRuntimeMovementData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetGameRestartData()
|
|
||||||
{
|
|
||||||
currentPlayerTurnIndex = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
{
|
{
|
||||||
[SerializeField] private PlayerState playerState;
|
[SerializeField] private PlayerState playerState;
|
||||||
[SerializeField] private Animator animator;
|
[SerializeField] private Animator animator;
|
||||||
|
[SerializeField] private GameObject playerCountCanvasPrefab;
|
||||||
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
||||||
|
|
||||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||||
@ -89,36 +90,10 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
TilesManager tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||||
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||||
|
|
||||||
Vector3 lookDirection = Vector3.zero;
|
int nextTileIndex = gameplayManager.GetNextGeneralTileIndex(this);
|
||||||
|
Vector3 lookDirection = tilesManager.RetrieveTileBasedOnIndex(nextTileIndex).transform.position - transform.position;
|
||||||
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;
|
lookDirection.y = 0;
|
||||||
if (lookDirection != Vector3.zero)
|
|
||||||
{
|
|
||||||
transform.DOLookAt(transform.position + lookDirection, 0.2f);
|
transform.DOLookAt(transform.position + lookDirection, 0.2f);
|
||||||
}
|
|
||||||
|
|
||||||
onComplete?.Invoke();
|
onComplete?.Invoke();
|
||||||
};
|
};
|
||||||
@ -126,6 +101,7 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
|
|
||||||
public void MoveToCustomTilePosition(Vector3 targetPoint)
|
public void MoveToCustomTilePosition(Vector3 targetPoint)
|
||||||
{
|
{
|
||||||
|
StepsTaken++;
|
||||||
transform.DOMove(targetPoint, 1f);
|
transform.DOMove(targetPoint, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +145,8 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
|
|
||||||
public void ShowPlayerCountCanvas(bool show)
|
public void ShowPlayerCountCanvas(bool show)
|
||||||
{
|
{
|
||||||
playerCountCanvas.gameObject.SetActive(show);
|
if (playerCountCanvasPrefab == null) return;
|
||||||
|
|
||||||
|
playerCountCanvasPrefab.SetActive(show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,15 +34,13 @@ public class DiceRollHandler : MonoBehaviour
|
|||||||
SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>();
|
SoundManager soundManager = InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>();
|
||||||
soundManager?.PlayGameSoundClip(SoundType.Dice);
|
soundManager?.PlayGameSoundClip(SoundType.Dice);
|
||||||
|
|
||||||
if (inputManager.GameplayManager.IsDebugTest)
|
|
||||||
OnUserDiceRollComplete(GetDiceTestVal());
|
OnUserDiceRollComplete(GetDiceTestVal());
|
||||||
else
|
// diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
|
||||||
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleDiceViewForBot(Action<int> onComplete)
|
public void HandleDiceViewForBot(Action<int> onComplete)
|
||||||
{
|
{
|
||||||
diceView.Roll(onComplete: onComplete, true);
|
diceView.Roll(onComplete: (val) => onComplete?.Invoke(val), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleDiceViewForBot(Action<int> onComplete, int val)
|
public void HandleDiceViewForBot(Action<int> onComplete, int val)
|
||||||
|
|||||||
@ -10,7 +10,6 @@ public enum GameState
|
|||||||
public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||||
{
|
{
|
||||||
private UIManager uiManager;
|
private UIManager uiManager;
|
||||||
private TilesManager tilesManager;
|
|
||||||
private GameplayManager gameplayManager;
|
private GameplayManager gameplayManager;
|
||||||
|
|
||||||
public GameState GameState
|
public GameState GameState
|
||||||
@ -26,7 +25,6 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
public void InitializeData()
|
public void InitializeData()
|
||||||
{
|
{
|
||||||
uiManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
|
uiManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
|
||||||
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
|
||||||
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||||
|
|
||||||
OnGameStateChanged(GameState.InMenu);
|
OnGameStateChanged(GameState.InMenu);
|
||||||
@ -35,12 +33,10 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
public void OnGameStateChanged(GameState gameState)
|
public void OnGameStateChanged(GameState gameState)
|
||||||
{
|
{
|
||||||
GameState = gameState;
|
GameState = gameState;
|
||||||
Debug.Log($"OnGameStateChanged: {gameState}");
|
|
||||||
switch (gameState)
|
switch (gameState)
|
||||||
{
|
{
|
||||||
case GameState.InMenu:
|
case GameState.InMenu:
|
||||||
gameplayManager.ResetData();
|
gameplayManager.ResetData();
|
||||||
tilesManager.ResetData();
|
|
||||||
uiManager.OnInMenuScreen();
|
uiManager.OnInMenuScreen();
|
||||||
break;
|
break;
|
||||||
case GameState.InGame:
|
case GameState.InGame:
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public class SafeTile : Tile
|
|||||||
placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform);
|
placementQueue.Enqueue(playerTypesDict[playerType].commonPlacementTransform);
|
||||||
playerTypesDict.Remove(playerType);
|
playerTypesDict.Remove(playerType);
|
||||||
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType}");
|
Debug.Log($"targetSafeTile. tileName: {name} Removing player {playerType}");
|
||||||
|
lastOccupiedIndex--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,9 @@ public class Tile : MonoBehaviour
|
|||||||
|
|
||||||
public Vector3 CenterPlacementPosition => centeredPoint.position;
|
public Vector3 CenterPlacementPosition => centeredPoint.position;
|
||||||
|
|
||||||
private List<PlayerPawn> PlayerPawns = new List<PlayerPawn>(); // Change implementation
|
protected int lastOccupiedIndex = 0;
|
||||||
|
|
||||||
public List<PlayerPawn> GetPlayerPawns() => PlayerPawns;
|
private List<PlayerPawn> PlayerPawns = new List<PlayerPawn>(); // Change implementation
|
||||||
|
|
||||||
public bool HasPawnsAvailable => PlayerPawns.Count > 0;
|
public bool HasPawnsAvailable => PlayerPawns.Count > 0;
|
||||||
public PlayerType CurrentHoldingPlayerType => PlayerPawns[0].PlayerType;
|
public PlayerType CurrentHoldingPlayerType => PlayerPawns[0].PlayerType;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
|
|
||||||
private GameplayManager gameplayManager;
|
private GameplayManager gameplayManager;
|
||||||
|
|
||||||
private Dictionary<PlayerType, List<Tile>> finishingTileDataPairs = new Dictionary<PlayerType, List<Tile>>();
|
private Dictionary<PlayerType, List<Transform>> finishingTileDataPairs = new Dictionary<PlayerType, List<Transform>>();
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
@ -32,14 +32,13 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
|
|
||||||
public void InitTilesData()
|
public void InitTilesData()
|
||||||
{
|
{
|
||||||
finishingTileDataPairs = new Dictionary<PlayerType, List<Tile>>();
|
|
||||||
foreach (var tileData in tileDatas)
|
foreach (var tileData in tileDatas)
|
||||||
{
|
{
|
||||||
if (gameplayManager.PlayerTypesCollection.Contains(tileData.playerType))
|
if (gameplayManager.PlayerTypesCollection.Contains(tileData.playerType))
|
||||||
{
|
{
|
||||||
finishingTileDataPairs.Add(tileData.playerType, new List<Tile>());
|
finishingTileDataPairs.Add(tileData.playerType, new List<Transform>());
|
||||||
foreach (Transform child in tileData.playerFinishingTileParent)
|
foreach (Transform child in tileData.playerFinishingTileParent)
|
||||||
finishingTileDataPairs[tileData.playerType].Add(child.GetComponent<Tile>());
|
finishingTileDataPairs[tileData.playerType].Add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,17 +52,16 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
Debug.Log($"RetrieveTileBasedOnIndex: Index: {index}");
|
Debug.Log($"RetrieveTileBasedOnIndex: Index: {index}");
|
||||||
|
|
||||||
Tile tile = index == generalTiles.Length ? generalTiles[0] : generalTiles[index];
|
Tile tile = index == generalTiles.Length ? generalTiles[0] : generalTiles[index];
|
||||||
|
// if (tile.IsSafeZone)
|
||||||
|
// {
|
||||||
|
// return (SafeTile)tile;
|
||||||
|
// }
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tile RetrieveFinishingTileBasedOnIndex(PlayerType playerType, int index)
|
public Transform RetrievePositionForFinishingTile(PlayerType playerType, int index)
|
||||||
{
|
{
|
||||||
return finishingTileDataPairs[playerType][index];
|
return finishingTileDataPairs[playerType][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetData()
|
|
||||||
{
|
|
||||||
finishingTileDataPairs.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class ScreenBase : UIBase, IUIBase
|
|||||||
|
|
||||||
public ScreenType ScreenType => screenType;
|
public ScreenType ScreenType => screenType;
|
||||||
|
|
||||||
protected ScreenManager screenManager;
|
private ScreenManager screenManager;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -13,26 +12,7 @@ public class GameOverPopup : PopupBase
|
|||||||
[SerializeField] private TextMeshProUGUI[] texts;
|
[SerializeField] private TextMeshProUGUI[] texts;
|
||||||
|
|
||||||
private GameModeHandler gameModeHandler;
|
private GameModeHandler gameModeHandler;
|
||||||
|
private ScreenManager screenManager;
|
||||||
public void InitData(List<PlayerData> playerData)
|
|
||||||
{
|
|
||||||
for (int idx = 0; idx < texts.Length; idx++)
|
|
||||||
{
|
|
||||||
if (idx >= playerData.Count)
|
|
||||||
{
|
|
||||||
texts[idx].gameObject.SetActive(false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerData[idx].ranking == 1)
|
|
||||||
{
|
|
||||||
texts[playerData[idx].ranking - 1].text = $"{playerData[idx].playerName} Wins";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
texts[playerData[idx].ranking - 1].text = $"{playerData[idx].ranking}. {playerData[idx].playerName}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
@ -62,5 +42,22 @@ public class GameOverPopup : PopupBase
|
|||||||
public void OnMainMenuClicked()
|
public void OnMainMenuClicked()
|
||||||
{
|
{
|
||||||
HidePopup();
|
HidePopup();
|
||||||
|
|
||||||
|
screenManager = screenManager == null ? InterfaceManager.Instance.GetInterfaceInstance<ScreenManager>() : screenManager;
|
||||||
|
screenManager.ShowScreen(ScreenType.MenuScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitData(List<PlayerData> playerDatas)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < playerDatas.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
texts[i].text = $"{playerDatas[i].playerName} Wins";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
texts[i].text = $"{(i + 1)}. {playerDatas[i].playerName}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ public class PvPModePopup : PopupBase
|
|||||||
|
|
||||||
private ScreenManager screenManager;
|
private ScreenManager screenManager;
|
||||||
private SoundManager soundManager;
|
private SoundManager soundManager;
|
||||||
private GameManager gameManager;
|
|
||||||
private GameModeHandler gameModeHandler;
|
private GameModeHandler gameModeHandler;
|
||||||
|
|
||||||
private int selectedPlayerCount;
|
private int selectedPlayerCount;
|
||||||
@ -152,9 +151,6 @@ public class PvPModePopup : PopupBase
|
|||||||
|
|
||||||
gameModeHandler = gameModeHandler == null ? InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>() : gameModeHandler;
|
gameModeHandler = gameModeHandler == null ? InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>() : gameModeHandler;
|
||||||
gameModeHandler.InitPVPModeData(playerNameMap.Keys.ToList(), playerNameMap.Values.ToList());
|
gameModeHandler.InitPVPModeData(playerNameMap.Keys.ToList(), playerNameMap.Values.ToList());
|
||||||
|
|
||||||
gameManager = gameManager == null ? InterfaceManager.Instance.GetInterfaceInstance<GameManager>() : gameManager;
|
|
||||||
gameManager.OnGameStateChanged(GameState.InGame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClick_SwitchButton()
|
private void OnClick_SwitchButton()
|
||||||
|
|||||||
@ -1,44 +1,8 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class GameOverScreen : ScreenBase
|
public class GameOverScreen : ScreenBase
|
||||||
{
|
{
|
||||||
[SerializeField] private Button playAgainBtn;
|
|
||||||
[SerializeField] private Button mainMenuBtn;
|
|
||||||
|
|
||||||
private GameModeHandler gameModeHandler;
|
|
||||||
|
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
playAgainBtn.onClick.AddListener(OnPlayAgainClicked);
|
|
||||||
mainMenuBtn.onClick.AddListener(OnMainMenuClicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDisable()
|
|
||||||
{
|
|
||||||
playAgainBtn.onClick.RemoveAllListeners();
|
|
||||||
mainMenuBtn.onClick.RemoveAllListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPlayAgainClicked()
|
|
||||||
{
|
|
||||||
HideScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HideScreen()
|
|
||||||
{
|
|
||||||
screenManager.HideScreen(screenType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnMainMenuClicked()
|
|
||||||
{
|
|
||||||
HideScreen();
|
|
||||||
|
|
||||||
screenManager = screenManager == null ? InterfaceManager.Instance.GetInterfaceInstance<ScreenManager>() : screenManager;
|
|
||||||
screenManager.ShowScreen(ScreenType.MenuScreen);
|
|
||||||
screenManager.ShowScreen(ScreenType.MainMenuScreen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user