Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- public class Turn : MonoBehaviour, IPointerClickHandler
- {
- public GameObject varObject;
- public GameObject enemy;
- public GameObject ADeck, CDeck, AHand, CHand;
- public GameObject nextDeck, Summon, image;
- public GameObject EAffixes, PAffixes, CAffixes, weather;
- public GameObject showEnemy;
- private HP var;
- private List<GameObject> enemyDeck;
- private void Awake()
- {
- var = varObject.GetComponent<HP>();
- }
- public IEnumerator MakeThisWork(GameObject loc)
- {
- yield return new WaitForSeconds(1);
- Destroy(loc, 0.1f);
- var.SetTurnText(true);
- {
- var.turn = true;
- var.cardFlag = false;
- if (var.PlayerMaxMana < 5) { var.PlayerMaxMana++; }
- var.TurnCount++;
- var.companionTimer--;
- foreach (Transform child in AHand.transform)
- {
- Destroy(child.gameObject);
- }
- for (int i = 1; i <= 3; i++)
- {
- int Rdm = Random.Range(0, AbilityDeck.Deck.Count - 1);
- GameObject local = Instantiate(AbilityDeck.Deck[Rdm], AHand.transform);
- local.GetComponent<CardEffect>().hpObject = varObject;
- local.GetComponent<CardEffect>().PAffixes = PAffixes;
- local.GetComponent<CardEffect>().EAffixes = EAffixes;
- local.GetComponent<CardEffect>().Weather = weather;
- local.GetComponent<Draggable>().varObject = varObject;
- }
- PlayerAffixes locP = PAffixes.GetComponent<PlayerAffixes>();
- EnemyAffixes locE = EAffixes.GetComponent<EnemyAffixes>();
- //CompanionAffixes locC = CAffixes.GetComponent<CompanionAffixes>();
- locP.UpdatePlayerPoison();
- locP.UpdatePlayerFreeze();
- locP.UpdatePlayerCurse();
- locP.UpdatePlayerRenew();
- locE.UpdateMonsterPoison();
- locE.UpdateMonsterFreeze();
- locE.UpdateMonsterCurse();
- locE.UpdateMonsterRenew();
- var.PlayerMana = var.PlayerMaxMana;
- //locC.UpdateCompanionPoison();
- //locC.UpdateCompanionRenew();
- }
- Debug.Log("Waited for 10 seconds");
- }
- public void OnPointerClick(PointerEventData eventData)
- {
- var.turn = false;
- var.SetTurnText(false);
- enemyDeck = enemy.GetComponent<EnemyDeck>().enemyDeck;
- int i = Random.Range(0, enemyDeck.Count - 1);
- int localManaCost = enemyDeck[i].GetComponent<ManaCost>().manaCost;
- GameObject loc;
- loc = Instantiate(enemyDeck[i], showEnemy.transform);
- CardEffect chites = loc.GetComponent<CardEffect>();
- chites.hpObject = varObject;
- chites.Summon = Summon;
- chites.image = image;
- chites.nextDeck = nextDeck;
- chites.PAffixes = PAffixes;
- chites.EAffixes = EAffixes;
- var.MonsterMana -= localManaCost;
- if (var.MonsterMaxMana < 5) { var.MonsterMaxMana++; }
- var.MonsterMana = var.MonsterMaxMana;
- StartCoroutine(MakeThisWork(loc));
- Debug.Log("Change turn to " + var.turn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement