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
@@ -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;
}