diff --git a/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml b/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml index ea0e290..edf186b 100644 --- a/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml +++ b/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml @@ -3,15 +3,10 @@ - - - - - - + diff --git a/FlufflParty/Assets/Scripts/Client.cs b/FlufflParty/Assets/Scripts/Client.cs index e3b10e8..64428c4 100644 --- a/FlufflParty/Assets/Scripts/Client.cs +++ b/FlufflParty/Assets/Scripts/Client.cs @@ -225,6 +225,9 @@ public class Client : MonoBehaviour players[job.data[1]].AddCoins(-items[job.data[3]].Cost); players[job.data[1]].AddItem(items[job.data[3]]); break; + case 10: + players[job.data[1]].ActivateItem(job.data[2]); + break; case 126: stream.Write(new byte[]{126, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 10); break; @@ -310,4 +313,9 @@ public class Client : MonoBehaviour { stream.Write(new byte[] { 9, (byte)item.type, 0, 0, 0, 0, 0, 0, 0, 0 }); } + + public void SendActiveItem(byte index) + { + stream.Write(new byte[]{10, index, 0, 0, 0, 0, 0, 0, 0, 0}); + } } \ No newline at end of file diff --git a/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs b/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs index bd37672..c795e65 100644 --- a/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs +++ b/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs @@ -22,8 +22,9 @@ public class NoPlayablePlayer : Player private float timeSinceWurfeln = 0; private Vector3 useLess = new Vector3(); - - + + private bool checkDoubleDice = false; + public override void Init() { @@ -59,11 +60,11 @@ public class NoPlayablePlayer : Player { wurfelt = true; this.wurfelZahl = wurfelZahl; - - if (activeItem == Item.Type.Mushroom) + + switch (activeItem) { - wurfelZahl += 3; - activeItem = Item.Type.None; + case Item.Type.Mushroom: wurfelZahl += 3; activeItem = Item.Type.None; break; + case Item.Type.DoubleDice: checkDoubleDice = true; activeItem = Item.Type.None; break; } //nächstes Feld anvisieren @@ -125,9 +126,18 @@ public class NoPlayablePlayer : Player if (!wurfelt) { StartDice(); - }else if (activated) + } + else { - StartDice(); + if (!checkDoubleDice) + { + activated = false; + } + else + { + checkDoubleDice = false; + wurfelt = false; + } } } } diff --git a/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs b/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs index dbdd211..43a5070 100644 --- a/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs +++ b/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs @@ -73,7 +73,7 @@ public class PlayablePlayer : Player switch (activeItem) { case Item.Type.Mushroom: wurfelZahl += 3; activeItem = Item.Type.None; break; - case Item.Type.DoubleDice: checkDoubleDice = true; break; + case Item.Type.DoubleDice: checkDoubleDice = true; activeItem = Item.Type.None; break; } /* @@ -300,4 +300,11 @@ public class PlayablePlayer : Player transform.position + Vector3.up * 2, ref useLess, 0.2f); diceScript.StartRandom(); } -} \ No newline at end of file + + public void ActivateItem(int index) + { + activeItem = items[index].type; + items[index] = null; + client.SendActiveItem((byte)index); + } +} diff --git a/FlufflParty/Assets/Scripts/UIHandler.cs b/FlufflParty/Assets/Scripts/UIHandler.cs index 8ea2628..76b050a 100644 --- a/FlufflParty/Assets/Scripts/UIHandler.cs +++ b/FlufflParty/Assets/Scripts/UIHandler.cs @@ -167,7 +167,8 @@ public class UIHandler : MonoBehaviour public void ButtonSelectItem(int index) { - currentPlayer.ActivateItem(index); + ((PlayablePlayer)currentPlayer).ActivateItem(index); ActivateLayout1(); + } } diff --git a/FlufflParty/UserSettings/Layouts/default-2021.dwlt b/FlufflParty/UserSettings/Layouts/default-2021.dwlt index 26c8dc7..b844b17 100644 --- a/FlufflParty/UserSettings/Layouts/default-2021.dwlt +++ b/FlufflParty/UserSettings/Layouts/default-2021.dwlt @@ -19,7 +19,7 @@ MonoBehaviour: width: 1536 height: 772.8 m_ShowMode: 4 - m_Title: Inspector + m_Title: Game m_RootView: {fileID: 7} m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} @@ -47,7 +47,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 1 - controlID: 114 + controlID: 109 --- !u!114 &3 MonoBehaviour: m_ObjectHideFlags: 52 @@ -72,7 +72,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 115 + controlID: 110 --- !u!114 &4 MonoBehaviour: m_ObjectHideFlags: 52 @@ -119,8 +119,8 @@ MonoBehaviour: y: 0 width: 225.6 height: 471.2 - m_MinSize: {x: 200, y: 200} - m_MaxSize: {x: 4000, y: 4000} + m_MinSize: {x: 201, y: 221} + m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 19} m_Panes: - {fileID: 19} @@ -248,7 +248,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 53 + controlID: 52 --- !u!114 &11 MonoBehaviour: m_ObjectHideFlags: 52 @@ -273,7 +273,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 54 + controlID: 53 --- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 @@ -725,7 +725,7 @@ MonoBehaviour: m_FarClip: 10000 m_DynamicClip: 1 m_OcclusionCulling: 0 - m_LastSceneViewRotation: {x: -0.017479911, y: 0.9293452, z: -0.3661485, w: -0.044362627} + m_LastSceneViewRotation: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226} m_LastSceneViewOrtho: 0 m_ReplacementShader: {fileID: 0} m_ReplacementString: @@ -928,10 +928,10 @@ MonoBehaviour: m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 0} - m_SelectedIDs: 7a670000 - m_LastClickedID: 26490 - m_ExpandedIDs: 0000000076670000786700007a67000000ca9a3b + scrollPos: {x: 0, y: 188.39972} + m_SelectedIDs: 7a620000 + m_LastClickedID: 25210 + m_ExpandedIDs: 0000000076620000786200007a62000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -959,7 +959,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 0000000076670000786700007a670000 + m_ExpandedIDs: 0000000076620000786200007a620000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1087,23 +1087,23 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: + m_SelectedIDs: ba620000 m_LastClickedID: 0 - m_ExpandedIDs: 36bbffffeacfffff4cd8ffff02dbffff94e4ffff6af1fffffef9ffff6c8600008c86000090860000fc8600004087000044870000808800008e8900007a8a0000168b000020a200004ca200006ca2000070a2000090a20000dca2000020a3000024a3000070a300008aa300000ca400001aa400002aa4000040a400003ea5000094a500001aa60000aea60000 + m_ExpandedIDs: 06fbffff m_RenameOverlay: m_UserAcceptedRename: 0 - m_Name: Canvas - m_OriginalName: Canvas + m_Name: + m_OriginalName: m_EditFieldRect: serializedVersion: 2 x: 0 y: 0 width: 0 height: 0 - m_UserData: 41584 + m_UserData: 0 m_IsWaitingForDelay: 0 m_IsRenaming: 0 - m_OriginalEventType: 0 + m_OriginalEventType: 11 m_IsRenamingFilename: 0 m_ClientGUIView: {fileID: 5} m_SearchString: