void Start() { gameOverPanelCanvasGroup = gameOverPanel.GetComponent <CanvasGroup>(); lootPanel = gameOverPanel.GetComponentInChildren <LootPanel>(); SetGameOverCanvasGroup(false); interactionToastList = new List <InteractionToast>(); for (int i = 0; i < toastPoolStartSize; i++) { SpawnInteractionToast(); } }
public void DeleteLoot() { GameObject LootSlots = GameObject.FindGameObjectWithTag("LootSlots"); for (int i = 0; i < LootSlots.transform.childCount; i++) { if (LootSlots.transform.GetChild(i).childCount > 0) { Items.Remove(LootSlots.transform.GetChild(i).GetChild(0).transform); StartCoroutine(DeleteItem(LootSlots.transform.GetChild(i).GetChild(0).GetComponent <ItemManager> ().appliedItem.ID)); DestroyImmediate(LootSlots.transform.GetChild(i).GetChild(0).gameObject); } } LootPanel.SetActive(false); }
public void Open(LootData lootData) { gameObject.SetActive(true); LootPanelData lootPanelData = null; for (int i = 0; i < lootPanelDatas.Length; i++) { if (lootPanelDatas[i].lootType == lootData.lootType) { lootPanelData = lootPanelDatas[i]; break; } } if (lootPanelData == null) { return; } if (lootPanel != null) { Destroy(lootPanel.gameObject); } lootPanel = Instantiate(lootPanelData.lootPanel, lootPanelParent.position, Quaternion.identity, lootPanelParent); lootPanel.icon = lootPanelData.icon; if (lootData.lootType == LootType.Diamonds || lootData.lootType == LootType.Lives) { lootPanel.text = Converter.ConvertToString(lootData.count); } else { lootPanel.text = lootPanelData.text; } }
void Awake() { k_Manager = this; plantedFriends = new List <List <int> > (); currentSkillList = new List <GameObject> (); listedSkillManagers = new List <GameObject> (); playersOnline = new List <PlayerOnline> (); ItemImages = Resources.LoadAll <Sprite>("RPG_inventory_icons"); Backgrounds = Resources.LoadAll <Sprite>("Backgrounds"); // Stats = GameObject.FindGameObjectWithTag ("Stats"); // PositionOverview = GameObject.FindGameObjectWithTag ("Positions"); // Inventorys = GameObject.FindGameObjectWithTag ("InventorySlot"); // CharacterSlot = GameObject.FindGameObjectWithTag ("CharacterSlots"); // BackpackSlot = GameObject.FindGameObjectWithTag ("Backpack"); k_player = GameObject.FindGameObjectWithTag("Player"); k_player.GetComponent <Player> ().sceneloaded = true; pre_Item = Resources.Load("Item") as GameObject; pre_FriendPosition = Resources.Load("FriendPositionImage") as GameObject; currentCharacter = k_player.GetComponent <Player> ().Characters [0]; if (k_player.gameObject.GetComponent <Player>().OutstandingLoot.Count > 0) { LootPanel.SetActive(true); ApplyLoot(); } Skills = new GameObject[4]; Skills [0] = Skill1; Skill1.GetComponent <SkillManager> ().id = 0; Skills [1] = Skill2; Skill2.GetComponent <SkillManager> ().id = 1; Skills [2] = Skill3; Skill3.GetComponent <SkillManager> ().id = 2; Skills [3] = Skill4; Skill4.GetComponent <SkillManager> ().id = 3; Positions = new GameObject[17]; for (int i = 0; i < PositionOverview.transform.childCount; i++) { Positions [i] = PositionOverview.transform.GetChild(i).gameObject; } Positions [16] = GameObject.FindGameObjectWithTag("CharacterPositionSlot"); InventorySlots = new GameObject[36]; for (int i = 0; i < Inventorys.transform.childCount; i++) { InventorySlots [i] = Inventorys.transform.GetChild(i).gameObject; } CharacterSlots = new GameObject[10]; for (int i = 1; i < CharacterSlot.transform.childCount - 1; i++) { CharacterSlots [i - 1] = CharacterSlot.transform.GetChild(i).gameObject; } BackpackSlots = new GameObject[8]; for (int i = 0; i < BackpackSlot.transform.childCount; i++) { BackpackSlots [i] = BackpackSlot.transform.GetChild(i).gameObject; } pre_PlayerOnline = Resources.Load("PlayerOnline") as GameObject; PlayerPanel = GameObject.FindGameObjectWithTag("PlayerOnline"); SkillList = new GameObject[10]; SkillList [0] = Skill_Start; SkillList [1] = Skill_First1; SkillList [2] = Skill_First2; SkillList [3] = Skill_Second1; SkillList [4] = Skill_Second2; SkillList [5] = Skill_Third1; SkillList [6] = Skill_Third2; SkillList [7] = Skill_Ultimate1; SkillList [8] = Skill_Ultimate2; SkillList [9] = Skill_Ultimate3; InstantiateItems(); InstatiatePositionItems(); this.SkillPoints = 20; SkillStats = new GameObject[4]; for (int i = 0; i < SkillStats.Length; i++) { SkillStats [i] = SkillStat.transform.GetChild(i).gameObject; } }
private IEnumerator FlipCardTask(GameObject revers, int cardID, int PanelID) { AudioClip AtoPlay = null; LootPanel Panel = CardsPanels [PanelID].GetComponent <LootPanel> (); GameObject card = MainMenuComponent.DeckBaseComponent.CardsBaseComponent.SpawnCardByID(cardID); card.transform.SetParent(revers.transform); card.transform.localPosition = new Vector3(0, 0, 0); card.transform.localRotation = Quaternion.Euler(0, 180, 0); card.transform.localScale = new Vector3(CardEndScale, CardEndScale, CardEndScale); //card.GetComponent<CardInteraction> ().SetObjectVisible(false); card.SetActive(false); revers.GetComponent <SmothTransform> ().SmothTransformTo(Quaternion.Euler(0, 180, 0), 5); if (Panel.Rarity == CardInteraction.CardRarityEnum.common) { AtoPlay = FlipCardNormal; } else if (Panel.Rarity == CardInteraction.CardRarityEnum.gold) { GameObject fx = Instantiate(GoldCardFlipFX, Panel.transform); fx.transform.localPosition = new Vector3(0, 0, 0); fx.transform.localScale = new Vector3(76, 76, 76); AtoPlay = FlipCardGold; } else if (Panel.Rarity == CardInteraction.CardRarityEnum.diamond) { GameObject fx = Instantiate(DiamondCardFlipFX, Panel.transform); fx.transform.localPosition = new Vector3(0, 0, 0); fx.transform.localScale = new Vector3(76, 76, 76); AtoPlay = FlipCardDiamond; } if (AtoPlay != null) { revers.GetComponent <AudioSource> ().PlayOneShot(AtoPlay); } int timeout = 20; while (revers.transform.rotation.eulerAngles.y < 90) { if (timeout < 0) { break; } timeout--; yield return(new WaitForSeconds(0.1f)); } //Debug.Log (" rot y : " + revers.transform.rotation.eulerAngles.y); //card.GetComponent<CardInteraction> ().SetObjectVisible(true); card.SetActive(true); revers.GetComponent <CardInteraction> ().SetObjectVisible(false); if (Panel.Duplicate) { string mes = "Nadliczbowa\n+" + CardsPanels [PanelID].GetComponent <LootPanel> ().RewardForDuplicate; Instantiate(DuplicateNotify, revers.transform.parent).GetComponent <TextMeshPro> ().SetText(mes); MainMenuComponent.CreditCurrency += CardsPanels [PanelID].GetComponent <LootPanel> ().RewardForDuplicate; PackAudioSource.PlayOneShot(CashSound); } if (AllFlipped()) { yield return(new WaitForSeconds(0.1f)); AnimationController.SetTrigger("EndOpen"); //urodziny //AudioStartAndLoop audioManager = GameObject.Find("AudioManager").GetComponent<AudioStartAndLoop>(); //audioManager.StopMusic (); //audioManager.AudioManager.clip = UrodzinyGosi; //audioManager.AudioManager.Play (); //audioManager.AudioManager.volume = 1; //audioManager.AudioManager.loop = true; } }
private void GrantPackItems(List <ItemInstance> GrantedItems) { int i = 0; Debug.Log("Result open normal card pack:" + GrantedItems.Count); ButtonText.text = "ZGARNIJ"; PackParticleEffect.Emit(1); RemoveItem(MainMenuComponent.CardsPacks[0]); foreach (ItemInstance item in GrantedItems) { int id = -1; Int32.TryParse(item.ItemId, out id); int quantity = item.RemainingUses.GetValueOrDefault(1); CardsBase.CardDescriptionClass cardDesc = MainMenuComponent.DeckBaseComponent.CardsBaseComponent.FindCardDescByID(id); Debug.Log("unlock card :" + item.DisplayName + " x" + item.RemainingUses.GetValueOrDefault(1) + " class:" + item.ItemClass); int maxCount = 3; int givenMoney = 5; if (cardDesc.Rarity == CardInteraction.CardRarityEnum.common) { maxCount = 3; givenMoney = 5; } else if (cardDesc.Rarity == CardInteraction.CardRarityEnum.gold) { maxCount = 2; givenMoney = 10; } else if (cardDesc.Rarity == CardInteraction.CardRarityEnum.diamond) { maxCount = 1; givenMoney = 20; } int cardNumber = cardDesc.Quantity; quantity -= cardDesc.Quantity; while (quantity > 0) { if (MainMenuComponent != null) { cardDesc = MainMenuComponent.DeckBaseComponent.CardsBaseComponent.UnlockCard(id); } GameObject card = Instantiate(CardRevers); card.transform.position = Package.transform.position; card.transform.rotation = Package.transform.rotation; card.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); if (card != null) { GameObject panel = Instantiate(CardPanel, CardsTable); LootPanel lootPanel = panel.GetComponent <LootPanel> (); if ((quantity + cardNumber) > maxCount) { lootPanel.Duplicate = true; lootPanel.RewardForDuplicate = givenMoney; } lootPanel.Rarity = cardDesc.Rarity; card.GetComponent <CardInteraction> ().SetCardOrder(2); StartCoroutine(AddCardFromPack(card, panel, i, cardDesc)); lootPanel.RegisterListener(FlipCard, Int32.Parse(item.ItemId), i); Cards.Add(card); CardsPanels.Add(panel); i++; } quantity--; } } PackAnimationController.SetTrigger("EndOpen"); PackAudioSource.PlayOneShot(PackOpen); PackLoaded = false; OpenFinished = true; }