sync dice

dice synced for noplayableplayers
This commit is contained in:
AliIbnAbiTalib
2023-03-28 19:28:11 +02:00
parent 930fb5fa16
commit 07f499dc91
6 changed files with 59 additions and 37 deletions
@@ -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;
}
}
}
}
@@ -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();
}
}
public void ActivateItem(int index)
{
activeItem = items[index].type;
items[index] = null;
client.SendActiveItem((byte)index);
}
}