Skrr
This commit is contained in:
AliIbnAbiTalib
2023-03-23 21:09:02 +01:00
parent 1a0559addb
commit 09c1c29a09
11 changed files with 178 additions and 1090 deletions
File diff suppressed because it is too large Load Diff
+1 -17
View File
@@ -28,7 +28,6 @@ public class Client : MonoBehaviour
[SerializeField] private GameObject[] playerInfo;
private PlayerInfoElements[] playerInfoElements = new PlayerInfoElements[4];
[SerializeField] private GameObject layout2;
[SerializeField] private Image[] uiItems;
[SerializeField] private Item[] items;
[SerializeField] private Button[] itemButtons;
@@ -53,12 +52,7 @@ public class Client : MonoBehaviour
Application.targetFrameRate = 100;
thisClient = this;
foreach(Image img in uiItems)
{
img.gameObject.SetActive(false);
}
for (int i = 0; i < 4; i++)
{
playerInfo[i].SetActive(false);
@@ -207,17 +201,7 @@ public class Client : MonoBehaviour
players[job.data[1]].textLeftMoves = textLeftMoves;
players[job.data[1]].AddCoins(3);
Image[] tempUIItems = new Image[3];
int f = 0;
for (int i = job.data[1] * 3; i < job.data[1] * 3 + 3; i++)
{
tempUIItems[f] = uiItems[i];
}
players[job.data[1]].uiItems = tempUIItems;
players[job.data[1]].Init();
playerNameTexts[job.data[1]].text = Encoding.ASCII.GetString(name).Replace(" ", "");
@@ -96,7 +96,6 @@ public class NoPlayablePlayer : Player
if (activated && !name.Equals(""))
{
camera.transform.position = Vector3.SmoothDamp(camera.transform.position, transform.position + cameraOffset, ref velocity, 0.2f);
if (!wait)
{
//Laufe zum nöchsten Feld, falls noch Züge übrig sind
@@ -115,7 +114,7 @@ public class NoPlayablePlayer : Player
textLeftMoves.text = wurfelZahl + "";
//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)
{
TargetNextField();
}
@@ -125,10 +124,10 @@ public class NoPlayablePlayer : Player
{
if (!wurfelt)
{
//start the dice
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
transform.position + Vector3.up * 2, ref useLess, 0.2f);
diceScript.StartRandom();
StartDice();
}else if (activated)
{
StartDice();
}
}
}
@@ -191,4 +190,11 @@ public class NoPlayablePlayer : Player
}
}
public void StartDice()
{
//start the dice
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
transform.position + Vector3.up * 2, ref useLess, 0.2f);
diceScript.StartRandom();
}
}
@@ -17,6 +17,7 @@ public class PlayablePlayer : Player
private float speed = 5;
private float interPol = 0;
private int wurfelZahl = 0;
private bool checkDoubleDice = true;
private bool wait = false;
@@ -65,14 +66,26 @@ public class PlayablePlayer : Player
{
if (!Physics.Raycast(new Vector3(Input.mousePosition.x, Input.mousePosition.y, -200), Vector3.forward))
{
wurfelt = true;
wurfelZahl = Random.Range(1, 7);
switch (activeItem)
{
case Item.Type.Mushroom: wurfelZahl += 3; activeItem = Item.Type.None; break;
case Item.Type.DoubleDice: checkDoubleDice = true; break;
}
/*
if (activeItem == Item.Type.Mushroom)
{
wurfelZahl += 3;
activeItem = Item.Type.None;
}else if (activeItem == Item.Type.DoubleDice)
{
checkDoubleDice = true;
}
*/
textLeftMoves.text = wurfelZahl + "";
@@ -144,15 +157,20 @@ public class PlayablePlayer : Player
break;
}
Invoke("Finish", 2);
activated = false;
if (!checkDoubleDice)
{
Invoke("Finish", 2);
activated = false;
}
else
{
checkDoubleDice = false;
wurfelt = false;
}
}
else
{
//start the dice
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
transform.position + Vector3.up * 2, ref useLess, 0.2f);
diceScript.StartRandom();
StartDice();
}
}
}
@@ -274,4 +292,12 @@ public class PlayablePlayer : Player
base.AddItem(item);
client.SendBuyItem(item);
}
public void StartDice()
{
//start the dice
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
transform.position + Vector3.up * 2, ref useLess, 0.2f);
diceScript.StartRandom();
}
}
@@ -22,7 +22,6 @@ public abstract class Player : MonoBehaviour
protected bool eventstop = false;
public UIHandler uiHandler;
public Item[] items = new Item[3];
public Image[] uiItems;
public Item.Type activeItem = Item.Type.None;
//for coin animation
@@ -84,8 +83,6 @@ public abstract class Player : MonoBehaviour
if (items[i] == null)
{
items[i] = item;
uiItems[i].sprite = item.sprite;
uiItems[i].gameObject.SetActive(true);
break;
}
}
@@ -94,7 +91,6 @@ public abstract class Player : MonoBehaviour
public void ActivateItem(int index)
{
activeItem = items[index].type;
uiItems[index].gameObject.SetActive(false);
items[index] = null;
}