Advertisement
Guest User

Untitled

a guest
May 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.EventSystems;
  6.  
  7. public class Turn : MonoBehaviour, IPointerClickHandler
  8. {
  9. public GameObject varObject;
  10. public GameObject enemy;
  11. public GameObject ADeck, CDeck, AHand, CHand;
  12. public GameObject nextDeck, Summon, image;
  13. public GameObject EAffixes, PAffixes, CAffixes, weather;
  14. public GameObject showEnemy;
  15.  
  16. private HP var;
  17. private List<GameObject> enemyDeck;
  18.  
  19. private void Awake()
  20. {
  21. var = varObject.GetComponent<HP>();
  22. }
  23.  
  24. public IEnumerator MakeThisWork(GameObject loc)
  25. {
  26. yield return new WaitForSeconds(1);
  27. Destroy(loc, 0.1f);
  28. var.SetTurnText(true);
  29. {
  30. var.turn = true;
  31. var.cardFlag = false;
  32. if (var.PlayerMaxMana < 5) { var.PlayerMaxMana++; }
  33. var.TurnCount++;
  34. var.companionTimer--;
  35. foreach (Transform child in AHand.transform)
  36. {
  37. Destroy(child.gameObject);
  38. }
  39. for (int i = 1; i <= 3; i++)
  40. {
  41. int Rdm = Random.Range(0, AbilityDeck.Deck.Count - 1);
  42. GameObject local = Instantiate(AbilityDeck.Deck[Rdm], AHand.transform);
  43. local.GetComponent<CardEffect>().hpObject = varObject;
  44. local.GetComponent<CardEffect>().PAffixes = PAffixes;
  45. local.GetComponent<CardEffect>().EAffixes = EAffixes;
  46. local.GetComponent<CardEffect>().Weather = weather;
  47. local.GetComponent<Draggable>().varObject = varObject;
  48. }
  49. PlayerAffixes locP = PAffixes.GetComponent<PlayerAffixes>();
  50. EnemyAffixes locE = EAffixes.GetComponent<EnemyAffixes>();
  51. //CompanionAffixes locC = CAffixes.GetComponent<CompanionAffixes>();
  52.  
  53. locP.UpdatePlayerPoison();
  54. locP.UpdatePlayerFreeze();
  55. locP.UpdatePlayerCurse();
  56. locP.UpdatePlayerRenew();
  57.  
  58. locE.UpdateMonsterPoison();
  59. locE.UpdateMonsterFreeze();
  60. locE.UpdateMonsterCurse();
  61. locE.UpdateMonsterRenew();
  62.  
  63. var.PlayerMana = var.PlayerMaxMana;
  64.  
  65. //locC.UpdateCompanionPoison();
  66. //locC.UpdateCompanionRenew();
  67. }
  68. Debug.Log("Waited for 10 seconds");
  69. }
  70.  
  71. public void OnPointerClick(PointerEventData eventData)
  72. {
  73. var.turn = false;
  74. var.SetTurnText(false);
  75.  
  76. enemyDeck = enemy.GetComponent<EnemyDeck>().enemyDeck;
  77. int i = Random.Range(0, enemyDeck.Count - 1);
  78.  
  79. int localManaCost = enemyDeck[i].GetComponent<ManaCost>().manaCost;
  80. GameObject loc;
  81. loc = Instantiate(enemyDeck[i], showEnemy.transform);
  82.  
  83. CardEffect chites = loc.GetComponent<CardEffect>();
  84. chites.hpObject = varObject;
  85. chites.Summon = Summon;
  86. chites.image = image;
  87. chites.nextDeck = nextDeck;
  88. chites.PAffixes = PAffixes;
  89. chites.EAffixes = EAffixes;
  90. var.MonsterMana -= localManaCost;
  91.  
  92.  
  93. if (var.MonsterMaxMana < 5) { var.MonsterMaxMana++; }
  94. var.MonsterMana = var.MonsterMaxMana;
  95. StartCoroutine(MakeThisWork(loc));
  96. Debug.Log("Change turn to " + var.turn);
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement