Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class InventoryCardPlace : MonoBehaviour
- {
- public int InventoryPlaceIndex;
- public GameObject thisCard;
- private GameObject DATAHOLDER;
- private ConjurationTable _ConjurationTableLink;
- private bool hasCard;
- void Awake()
- {
- _ConjurationTableLink = GameObject.FindWithTag("TableMaster").GetComponent<ConjurationTable>();
- DATAHOLDER = GameObject.Find("DataHolder");
- }
- void Update()
- {
- if (!_ConjurationTableLink.CanDeployBattleCard() && !hasCard)
- {
- gameObject.GetComponent<BoxCollider>().enabled = false;
- }
- else
- {
- gameObject.GetComponent<BoxCollider>().enabled = true;
- }
- }
- //Receber cartas no inventario da mesa de batalha
- public void ReceiveCard(GameObject card)
- {
- thisCard = card;
- //print("Received Card: Con: " + card.GetComponent<WarriorCard>().GetCardCon());
- _ConjurationTableLink.AddInventoryCard();
- DATAHOLDER.GetComponent<ConjurationData>().AddCard(card.GetComponent<WarriorCard>(), InventoryPlaceIndex);
- hasCard = true;
- }
- public void SetHasCard()
- {
- hasCard = true;
- }
- //Remove cartas do inventario da mesa de batalha
- public void RemoveCard()
- {
- _ConjurationTableLink.RemoveInventoryCard();
- thisCard = null;
- DATAHOLDER.GetComponent<ConjurationData>().RemoveCard(InventoryPlaceIndex);
- hasCard = false;
- }
- public GameObject ReturnCard()
- {
- return thisCard;
- }
- public bool CanDropHere()
- {
- if (hasCard)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- public Vector3 GetPosition()
- {
- return transform.position;
- }
- }
Add Comment
Please, Sign In to add comment