Item Gedöns bissl benüüüützen

This commit is contained in:
brausjonas
2023-03-04 00:25:41 +01:00
parent 32f5b49c0d
commit fd0a36ccb7
11 changed files with 974 additions and 98 deletions
+1 -1
View File
@@ -134,7 +134,7 @@
<workItem from="1677516389539" duration="4730000" />
<workItem from="1677521614865" duration="735000" />
<workItem from="1677789832911" duration="4364000" />
<workItem from="1677881158579" duration="881000" />
<workItem from="1677881158579" duration="4292000" />
</task>
<servers />
</component>
File diff suppressed because it is too large Load Diff
+10
View File
@@ -30,6 +30,7 @@ public class Client : MonoBehaviour
[SerializeField] private GameObject layout2;
[SerializeField] private Image[] uiItems;
[SerializeField] private Item[] items;
[SerializeField] private Button[] itemButtons;
private int playerAmount = 0;
@@ -44,6 +45,11 @@ public class Client : MonoBehaviour
{
thisClient = this;
foreach(Image img in uiItems)
{
img.gameObject.SetActive(false);
}
for (int i = 0; i < 4; i++)
{
playerInfo[i].SetActive(false);
@@ -142,6 +148,8 @@ public class Client : MonoBehaviour
script.nextField = nextField;
script.dice = dice;
script.camera = cam;
itemButtons[job.data[5]].interactable = true;
}
//player is not playable
else
@@ -155,6 +163,8 @@ public class Client : MonoBehaviour
script.nextField = nextField;
script.dice = dice;
script.camera = cam;
itemButtons[job.data[5]].interactable = false;
}
break;
+1 -1
View File
@@ -19,6 +19,6 @@ public class Item : MonoBehaviour
public enum Type
{
Mushroom = 0, DoubleDice = 1
None = -1, Mushroom = 0, DoubleDice = 1
}
}
@@ -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;
}
}
}
}
+10 -1
View File
@@ -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;
+6
View File
@@ -108,6 +108,12 @@ public class UIHandler : MonoBehaviour
layoutItemShop.GetComponent<ItemShop>().Init(currentPlayer);
}
//TODO: Only temp, make additional function for Item selection
public void ActivateLayoutItemSelect()
{
currentPlayer.ActivateItem(0, Item.Type.Mushroom);
}
public void ButtonBuyStar()
{
((PlayablePlayer)currentPlayer).BuyStar(true);
@@ -137,9 +137,7 @@ PlayerSettings:
16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets:
- {fileID: -6230802382160794249, guid: 90cd1b71078984c4980fcd1aa03eaaa3, type: 2}
- {fileID: 11400000, guid: 48bf7376b3770c44cbfe3f40e77359ab, type: 2}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
+1 -1
View File
@@ -89,7 +89,7 @@
<workItem from="1677445028345" duration="816000" />
<workItem from="1677520608630" duration="13000" />
<workItem from="1677789901008" duration="661000" />
<workItem from="1677881295823" duration="754000" />
<workItem from="1677881295823" duration="2233000" />
</task>
<servers />
</component>
+18
View File
@@ -118,6 +118,16 @@ public class Room
timeOut = System.currentTimeMillis();
/*
----------------------------------------
----------------------------------------
----------------------------------------
HERE IS THE ROOM / GAME LOGIC
----------------------------------------
----------------------------------------
----------------------------------------
*/
switch (readData[0])
{
@@ -158,6 +168,8 @@ public class Room
}
break;
//Es wurde auf ein CoinField getreten (Rot oder Blau)
//1 x, x = player; 2 y, y = Loose or Get
case 6:
for (int i = 0; i < players.length; i++)
{
@@ -168,12 +180,15 @@ public class Room
}
break;
//Eventstop (ItemShop, BuyStar, ...) ist fertig
//1 x, x = player
case 7:
for (int i = 0; i < players.length; i++)
{
players[i].output.write(new byte[]{7, (byte)player, 0, 0, 0, 0, 0, 0, 0, 0});
}
break;
//Spieler hat einen Stern gekauft
case 8:
for (int i = 0; i < players.length; i++)
{
@@ -183,6 +198,9 @@ public class Room
}
}
break;
//Spieler hat ein Item Gekauft
//1 x, x = player; 2 y, y = Item.Type (byte)
case 9:
for (int i = 0; i < players.length; i++)
{