Transferprotocol Definitions

This commit is contained in:
brausjonas
2023-01-31 21:21:42 +01:00
parent e0db81370b
commit b479594017
15 changed files with 88 additions and 25 deletions
+59
View File
@@ -0,0 +1,59 @@
Field Definitions:
0: Get Coins Field
1: Loose Coins Field
2: LuckyField
3: ItemFIeld
4: UnluckyField
5: VSField
6: EventField
Inital Game Definitions (Server):
Get Room Code:
Client -> Server
Server -> Client
[2, ...]
Join Room Code:
Client -> Server
First Message:
[1, ...]
Second Message:
[Room Code in Ascii]
Third Message:
[Name]
Game Run Definitions (Room Server):
TimeoutCheck:
[126, ...] (10 minute timeout checked every 10 seconds) Room and Clients
Rolled:
Client -> Server:
[3, number, ...]
Server -> Client:
[3, playerID, number, ...]
PathSelection:
Client -> Server:
[4, directionID, ...]
Server -> Client:
[4, playerID, directionID, ...]
FinishMovingEvent:
Client -> Server
[5, ...]
Server -> Client
[2, nextPlayerID, ...] (Player Activation event)
DeleteRoomCall:
[0, ...]
LocalPlayerCreateEvent:
Server -> Client
[1, playable/dummy, startPosition.3.] 1 = playable !1 = dummy
TransferNameDistrubutor:
Server -> Client
[5, playerID, name.8.]
+1
View File
@@ -111,6 +111,7 @@
<workItem from="1674945078351" duration="7063000" /> <workItem from="1674945078351" duration="7063000" />
<workItem from="1675011774462" duration="1723000" /> <workItem from="1675011774462" duration="1723000" />
<workItem from="1675112930043" duration="1858000" /> <workItem from="1675112930043" duration="1858000" />
<workItem from="1675193746966" duration="2586000" />
</task> </task>
<servers /> <servers />
</component> </component>
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: eb6f7c9a6e6cd424c853338442fa92fc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+2 -1
View File
@@ -106,8 +106,9 @@ public class Client : MonoBehaviour
} }
players[job.data[1]].name = Encoding.ASCII.GetString(name).Replace(" ", ""); players[job.data[1]].name = Encoding.ASCII.GetString(name).Replace(" ", "");
players[job.data[1]].index = job.data[1];
players[job.data[1]].Init(); players[job.data[1]].Init();
playerNameTexts[job.data[1]].text = Encoding.ASCII.GetString(name).Replace(" ", ""); playerNameTexts[job.data[1]].text = Encoding.ASCII.GetString(name).Replace(" ", "");
uiHandler.ActivateLayout1(); uiHandler.ActivateLayout1();
@@ -4,8 +4,8 @@ using UnityEngine;
public class EventField : Field public class EventField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 6;
} }
} }
+5 -1
View File
@@ -8,6 +8,10 @@ public abstract class Field : MonoBehaviour
[SerializeField] private Field[] target; [SerializeField] private Field[] target;
[SerializeField] private Arrow[] directionalArrows; [SerializeField] private Arrow[] directionalArrows;
/*
* Field Definition:
*/
public Field[] Target public Field[] Target
{ {
get get
@@ -25,5 +29,5 @@ public abstract class Field : MonoBehaviour
} }
//Feld aktion (Münzen etc..) //Feld aktion (Münzen etc..)
public abstract void Action(); public abstract int Action(int playerIndex);
} }
@@ -4,8 +4,8 @@ using UnityEngine;
public class GetCoinsField : Field public class GetCoinsField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 0;
} }
} }
@@ -4,8 +4,8 @@ using UnityEngine;
public class ItemField : Field public class ItemField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 3;
} }
} }
@@ -4,8 +4,8 @@ using UnityEngine;
public class LooseCoinsField : Field public class LooseCoinsField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 1;
} }
} }
@@ -4,8 +4,8 @@ using UnityEngine;
public class LuckField : Field public class LuckField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 2;
} }
} }
@@ -4,8 +4,8 @@ using UnityEngine;
public class UnluckyField : Field public class UnluckyField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 4;
} }
} }
+2 -2
View File
@@ -4,8 +4,8 @@ using UnityEngine;
public class VSField : Field public class VSField : Field
{ {
public override void Action() public override int Action(int playerIndex)
{ {
return 5;
} }
} }
@@ -81,6 +81,9 @@ public class PlayablePlayer : Player
{ {
wurfelZahl--; wurfelZahl--;
//the next field is the current field XD
currentField = nextField;
//Visiere das nächste Feld an falls noch ein Zug übrig ist (Player steht gerade auf einem Feld oder läuft darüber) //Visiere das nächste Feld an falls noch ein Zug übrig ist (Player steht gerade auf einem Feld oder läuft darüber)
if (wurfelZahl > 0) if (wurfelZahl > 0)
{ {
@@ -93,6 +96,7 @@ public class PlayablePlayer : Player
//TODO: temp spieler finsihed erst, wenn field action ausgeführt wurde //TODO: temp spieler finsihed erst, wenn field action ausgeführt wurde
if (wurfelt) if (wurfelt)
{ {
currentField.Action(index);
Invoke("Finish", 2); Invoke("Finish", 2);
activated = false; activated = false;
} }
@@ -146,7 +150,6 @@ public class PlayablePlayer : Player
{ {
interPol = 0; interPol = 0;
lastPos = transform.position; lastPos = transform.position;
currentField = nextField;
if (nextField.Target.Length == 1) if (nextField.Target.Length == 1)
{ {
nextField = nextField.Target[0]; nextField = nextField.Target[0];
@@ -12,6 +12,8 @@ public abstract class Player : MonoBehaviour
protected Vector3 velocity = Vector3.zero; protected Vector3 velocity = Vector3.zero;
protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f); protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f);
public int index;
public int coins = 0;
//Aktiviert den Player //Aktiviert den Player
public void Activate() public void Activate()
+1
View File
@@ -78,6 +78,7 @@
<workItem from="1674945364389" duration="7759000" /> <workItem from="1674945364389" duration="7759000" />
<workItem from="1675011672827" duration="777000" /> <workItem from="1675011672827" duration="777000" />
<workItem from="1675111963945" duration="610000" /> <workItem from="1675111963945" duration="610000" />
<workItem from="1675193290788" duration="1637000" />
</task> </task>
<servers /> <servers />
</component> </component>