Simple Buy Item Logic
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public abstract class Player : MonoBehaviour
|
||||
{
|
||||
@@ -20,6 +21,8 @@ public abstract class Player : MonoBehaviour
|
||||
public TMP_Text textCoinsInfo, textStarsInfo, textLeftMoves;
|
||||
protected bool eventstop = false;
|
||||
public UIHandler uiHandler;
|
||||
public Item[] items = new Item[3];
|
||||
public Image[] uiItems;
|
||||
|
||||
//for coin animation
|
||||
private AnimationHandler animationHandler;
|
||||
@@ -72,6 +75,19 @@ public abstract class Player : MonoBehaviour
|
||||
PlayAnimation(AnimationType.Coin);
|
||||
Client.GetCurrentInstance().CalculatePlacement();
|
||||
}
|
||||
|
||||
public void AddItem(Item item)
|
||||
{
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
{
|
||||
if (items[i] == null)
|
||||
{
|
||||
items[i] = item;
|
||||
uiItems[i].sprite = item.sprite;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider c)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user