Item Gedöns bissl benüüüützen
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NoPlayablePlayer : Player
|
||||
{
|
||||
@@ -31,6 +32,8 @@ public class NoPlayablePlayer : Player
|
||||
|
||||
activated = false;
|
||||
diceScript = dice.GetComponent<Dice>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void BuyStar()
|
||||
@@ -56,6 +59,13 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
wurfelt = true;
|
||||
this.wurfelZahl = wurfelZahl;
|
||||
|
||||
if (activeItem == Item.Type.Mushroom)
|
||||
{
|
||||
wurfelZahl += 3;
|
||||
activeItem = Item.Type.None;
|
||||
}
|
||||
|
||||
//nächstes Feld anvisieren
|
||||
TargetNextField();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Net.Mail;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayablePlayer : Player
|
||||
{
|
||||
@@ -36,6 +37,7 @@ public class PlayablePlayer : Player
|
||||
QualitySettings.vSyncCount = 0;
|
||||
Application.targetFrameRate = 61;
|
||||
diceScript = dice.GetComponent<Dice>();
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -53,25 +55,30 @@ public class PlayablePlayer : Player
|
||||
//Generiere Würfelzahl von 1-6 wenn gerade gewürfelt werden darf
|
||||
if ((Input.GetMouseButtonUp(0) && !uiHandler.MapOpen) && wurfelZahl == 0 && !wurfelt)
|
||||
{
|
||||
if(!Physics.Raycast(new Vector3(Input.mousePosition.x, Input.mousePosition.y, -200), Vector3.forward))
|
||||
if (!Physics.Raycast(new Vector3(Input.mousePosition.x, Input.mousePosition.y, -200), Vector3.forward))
|
||||
{
|
||||
wurfelt = true;
|
||||
wurfelZahl = Random.Range(1, 7);
|
||||
|
||||
if (activeItem == Item.Type.Mushroom)
|
||||
{
|
||||
wurfelt = true;
|
||||
wurfelZahl = Random.Range(1, 7);
|
||||
textLeftMoves.text = wurfelZahl + "";
|
||||
|
||||
client.SendWurfeln(wurfelZahl);
|
||||
|
||||
//nächstes Feld anvisieren
|
||||
TargetNextField();
|
||||
|
||||
//stop the dice
|
||||
diceScript.StopRandom(wurfelZahl);
|
||||
|
||||
//delay for walk start
|
||||
timeSinceWurfeln = Time.time;
|
||||
wurfelZahl += 3;
|
||||
activeItem = Item.Type.None;
|
||||
}
|
||||
|
||||
|
||||
|
||||
textLeftMoves.text = wurfelZahl + "";
|
||||
|
||||
client.SendWurfeln(wurfelZahl);
|
||||
|
||||
//nächstes Feld anvisieren
|
||||
TargetNextField();
|
||||
|
||||
//stop the dice
|
||||
diceScript.StopRandom(wurfelZahl);
|
||||
|
||||
//delay for walk start
|
||||
timeSinceWurfeln = Time.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public abstract class Player : MonoBehaviour
|
||||
public UIHandler uiHandler;
|
||||
public Item[] items = new Item[3];
|
||||
public Image[] uiItems;
|
||||
public Item.Type activeItem = Item.Type.None;
|
||||
|
||||
//for coin animation
|
||||
private AnimationHandler animationHandler;
|
||||
@@ -84,11 +85,19 @@ public abstract class Player : MonoBehaviour
|
||||
{
|
||||
items[i] = item;
|
||||
uiItems[i].sprite = item.sprite;
|
||||
uiItems[i].gameObject.SetActive(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ActivateItem(int index, Item.Type type)
|
||||
{
|
||||
uiItems[index].gameObject.SetActive(false);
|
||||
items[index] = null;
|
||||
activeItem = type;
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider c)
|
||||
{
|
||||
eventstop = true;
|
||||
|
||||
Reference in New Issue
Block a user