//----------------------------------------------- /* public void PotionSaved() * { * DataManager.SavePotion1 = Potion1Num; * DataManager.SavePotion2 = Potion2Num; * DataManager.SavePotion3 = Potion3Num; * DataManager.SavePotion4 = Potion4Num; * DataManager.SavePotion5 = Potion5Num; * DataManager.SavePotion6 = Potion6Num; * DataManager.SavePotion7 = Potion7Num; * DataManager.SavePotion8 = Potion8Num; * DataManager.SavePotion9 = Potion9Num; * DataManager.SavePotion10 = Potion10Num; * DataManager.SavePotion11 = Potion11Num; * }*/ IEnumerator GetPotion() { yield return(new WaitForSeconds(0.5f - (FurnitureEffect.Furniture3_3Effect))); GetPotionCount = 0; GameObject[] Potion = GameObject.FindGameObjectsWithTag("ComPotion"); Vector3 PlayerPos = GameObject.Find("Player").transform.position; Vector3 NPCPos = GameObject.Find("Rain").transform.position; for (int index = 0; index < Potion.Length; index++) { if (Potion[index].transform.position.x >= PlayerPos.x - 0.5f && Potion[index].transform.position.x <= PlayerPos.x + 0.5f && Potion[index].transform.position.y <= -2.2f) { if (GetPotionCount < 1) { PoParmeter = Potion[index].GetComponent <PotionParmeter>(); SoundManager.sounds["Pop (3)"].Play(); Rigidbody2D rigid = Potion[index].GetComponent <Rigidbody2D>(); Vector2 getMotion = new Vector2(0f, 8f); rigid.AddForce(getMotion, ForceMode2D.Impulse); rigid.AddTorque(90f); GetPotionCount++; PotionCase = PoParmeter.PotionCaseNum; switch (PotionCase) { case 0: if (PoParmeter.isGasMat) { MaterialManager.MaterialGasNumber += 2; } else { MaterialManager.MaterialQSilverNumber += 2; } getBase.MaterialButtonUpdate(); break; case 1: if (!FirstPotion1) { DataCallManager.SavePotionType(1); } Potion1Num += PoParmeter.PotionNum; PoList.Potion1ListUpdate(); break; case 2: if (!FirstPotion2) { DataCallManager.SavePotionType(2); } Potion2Num += PoParmeter.PotionNum; PoList.Potion2ListUpdate(); break; case 3: if (!FirstPotion3) { DataCallManager.SavePotionType(3); } Potion3Num += PoParmeter.PotionNum; PoList.Potion3ListUpdate(); break; case 4: if (!FirstPotion4) { DataCallManager.SavePotionType(4); } Potion4Num += PoParmeter.PotionNum; PoList.Potion4ListUpdate(); break; case 5: if (!FirstPotion5) { DataCallManager.SavePotionType(5); } Potion5Num += PoParmeter.PotionNum; PoList.Potion5ListUpdate(); break; case 6: if (!FirstPotion6) { DataCallManager.SavePotionType(6); } Potion6Num += PoParmeter.PotionNum; PoList.Potion6ListUpdate(); break; case 7: if (!FirstPotion7) { DataCallManager.SavePotionType(7); } Potion7Num += PoParmeter.PotionNum; PoList.Potion7ListUpdate(); break; case 8: if (!FirstPotion8) { DataCallManager.SavePotionType(8); } Potion8Num += PoParmeter.PotionNum; PoList.Potion8ListUpdate(); break; case 9: if (!FirstPotion9) { DataCallManager.SavePotionType(9); } Potion9Num += PoParmeter.PotionNum; PoList.Potion9ListUpdate(); break; case 10: if (!FirstPotion10) { DataCallManager.SavePotionType(10); } Potion10Num += PoParmeter.PotionNum; PoList.Potion10ListUpdate(); break; case 11: if (!FirstPotion11) { DataCallManager.SavePotionType(11); } Potion11Num += PoParmeter.PotionNum; PoList.Potion11ListUpdate(); break; case 12: if (!FirstPotion12) { DataCallManager.SavePotionType(12); } Potion12Num += PoParmeter.PotionNum; PoList.Potion12ListUpdate(); break; case 13: if (!FirstPotion13) { DataCallManager.SavePotionType(13); } Potion13Num += PoParmeter.PotionNum; PoList.Potion13ListUpdate(); break; case 14: if (!FirstPotion14) { DataCallManager.SavePotionType(14); } Potion14Num += PoParmeter.PotionNum; PoList.Potion14ListUpdate(); break; case 15: if (!FirstPotion15) { DataCallManager.SavePotionType(15); } Potion15Num += PoParmeter.PotionNum; PoList.Potion15ListUpdate(); break; } Destroy(Potion[index].gameObject, 0.5f); } } else if (Potion[index].transform.position.x >= NPCPos.x - 0.5f && Potion[index].transform.position.x <= NPCPos.x + 0.5f && Potion[index].transform.position.y <= -2.2f) { if (GetPotionCount < 1) { PoParmeter = Potion[index].GetComponent <PotionParmeter>(); SoundManager.sounds["Pop (3)"].Play(); Rigidbody2D rigid = Potion[index].GetComponent <Rigidbody2D>(); Vector2 getMotion = new Vector2(0f, 8f); rigid.AddForce(getMotion, ForceMode2D.Impulse); rigid.AddTorque(90f); GetPotionCount++; PotionCase = PoParmeter.PotionCaseNum; switch (PotionCase) { case 0: if (PoParmeter.isGasMat) { MaterialManager.MaterialGasNumber += 2; } else { MaterialManager.MaterialQSilverNumber += 2; } getBase.MaterialButtonUpdate(); break; case 1: if (!FirstPotion1) { DataCallManager.SavePotionType(1); } Potion1Num += PoParmeter.PotionNum; PoList.Potion1ListUpdate(); break; case 2: if (!FirstPotion2) { DataCallManager.SavePotionType(2); } Potion2Num += PoParmeter.PotionNum; PoList.Potion2ListUpdate(); break; case 3: if (!FirstPotion3) { DataCallManager.SavePotionType(3); } Potion3Num += PoParmeter.PotionNum; PoList.Potion3ListUpdate(); break; case 4: if (!FirstPotion4) { DataCallManager.SavePotionType(4); } Potion4Num += PoParmeter.PotionNum; PoList.Potion4ListUpdate(); break; case 5: if (!FirstPotion5) { DataCallManager.SavePotionType(5); } Potion5Num += PoParmeter.PotionNum; PoList.Potion5ListUpdate(); break; case 6: if (!FirstPotion6) { DataCallManager.SavePotionType(6); } Potion6Num += PoParmeter.PotionNum; PoList.Potion6ListUpdate(); break; case 7: if (!FirstPotion7) { DataCallManager.SavePotionType(7); } Potion7Num += PoParmeter.PotionNum; PoList.Potion7ListUpdate(); break; case 8: if (!FirstPotion8) { DataCallManager.SavePotionType(8); } Potion8Num += PoParmeter.PotionNum; PoList.Potion8ListUpdate(); break; case 9: if (!FirstPotion9) { DataCallManager.SavePotionType(9); } Potion9Num += PoParmeter.PotionNum; PoList.Potion9ListUpdate(); break; case 10: if (!FirstPotion10) { DataCallManager.SavePotionType(10); } Potion10Num += PoParmeter.PotionNum; PoList.Potion10ListUpdate(); break; case 11: if (!FirstPotion11) { DataCallManager.SavePotionType(11); } Potion11Num += PoParmeter.PotionNum; PoList.Potion11ListUpdate(); break; case 12: if (!FirstPotion12) { DataCallManager.SavePotionType(12); } Potion12Num += PoParmeter.PotionNum; PoList.Potion12ListUpdate(); break; case 13: if (!FirstPotion13) { DataCallManager.SavePotionType(13); } Potion13Num += PoParmeter.PotionNum; PoList.Potion13ListUpdate(); break; case 14: if (!FirstPotion14) { DataCallManager.SavePotionType(14); } Potion14Num += PoParmeter.PotionNum; PoList.Potion14ListUpdate(); break; case 15: if (!FirstPotion15) { DataCallManager.SavePotionType(15); } Potion15Num += PoParmeter.PotionNum; PoList.Potion15ListUpdate(); break; } Destroy(Potion[index].gameObject, 0.5f); } } } StartCoroutine("GetPotion"); }
//----------------------------------------- /* public void MaterialSaved() * { * DataManager.SaveItem1 = haveHarb; * DataManager.SaveItem2 = haveTomato; * DataManager.SaveItem3 = haveItem3; * DataManager.SaveItem4 = haveItem4; * DataManager.SaveItem5 = haveItem5; * DataManager.SaveItem6 = haveItem6; * DataManager.SaveItem7 = haveItem7; * DataManager.SaveItem8 = haveItem8; * DataManager.SaveItem9 = haveItem9; * DataManager.SaveItem10 = haveItem10; * DataManager.SaveItem11 = haveItem11; * DataManager.SaveItem12 = haveItem12; * DataManager.SaveItem13 = haveItem13; * DataManager.SaveItem14 = haveItem14; * } */ IEnumerator GetMaterial()//떨어진 재료아이탬을 획득하고 해당 재료를 재료 칸에 띄우는 코루틴 { yield return(new WaitForSeconds(0.5f - (FurnitureEffect.Furniture3_3Effect))); GameObject[] Materials = GameObject.FindGameObjectsWithTag("Material"); Vector3 PlayerPos = GameObject.Find("Player").transform.position; Vector3 NPCPos = GameObject.Find("Rain").transform.position; for (int index = 0; index < Materials.Length; index++) { if (Materials[index].transform.position.x >= PlayerPos.x - 0.5f && Materials[index].transform.position.x <= PlayerPos.x + 0.5f && Materials[index].transform.position.y <= -2.2f) { MatPar = Materials[index].GetComponent <MaterialParmeter>(); MatParSprite = Materials[index].GetComponent <SpriteRenderer>(); SoundManager.sounds["Pop (3)"].Play(); Rigidbody2D rigid = Materials[index].GetComponent <Rigidbody2D>(); Vector2 getMotion = new Vector2(0f, 4f); rigid.AddForce(getMotion, ForceMode2D.Impulse); Itemnum = MatPar.ItemNum; switch (Itemnum) { case 1: if (!FirstItem1) { DataCallManager.SaveItemType(1); } haveHarb += MatPar.ItemCount; haveItem++; matList.HarbListUpdate(); break; case 2: if (!FirstItem2) { DataCallManager.SaveItemType(2); } haveTomato += MatPar.ItemCount; haveItem++; matList.TomatoListUpdate(); break; case 3: if (!FirstItem3) { DataCallManager.SaveItemType(3); } haveItem3 += MatPar.ItemCount; haveItem++; matList.Item3ListUpdate(); break; case 4: if (!FirstItem4) { DataCallManager.SaveItemType(4); } haveItem4 += MatPar.ItemCount; haveItem++; matList.Item4ListUpdate(); break; case 5: if (!FirstItem5) { DataCallManager.SaveItemType(5); } haveItem5 += MatPar.ItemCount; haveItem++; matList.Item5ListUpdate(); break; case 6: if (!FirstItem6) { DataCallManager.SaveItemType(6); } haveItem6 += MatPar.ItemCount; haveItem++; matList.Item6ListUpdate(); break; case 7: if (!FirstItem7) { DataCallManager.SaveItemType(7); } haveItem7 += MatPar.ItemCount; haveItem++; matList.Item7ListUpdate(); break; case 8: if (!FirstItem8) { DataCallManager.SaveItemType(8); } haveItem8 += MatPar.ItemCount; haveItem++; matList.Item8ListUpdate(); break; case 9: if (!FirstItem9) { DataCallManager.SaveItemType(9); } haveItem9 += MatPar.ItemCount; haveItem++; matList.Item9ListUpdate(); break; case 10: if (!FirstItem10) { DataCallManager.SaveItemType(10); } haveItem10 += MatPar.ItemCount; haveItem++; matList.Item10ListUpdate(); break; case 11: if (!FirstItem11) { DataCallManager.SaveItemType(11); } haveItem11 += MatPar.ItemCount; haveItem++; matList.Item11ListUpdate(); break; case 12: if (!FirstItem12) { DataCallManager.SaveItemType(12); } haveItem12 += MatPar.ItemCount; haveItem++; matList.Item12ListUpdate(); break; case 13: if (!FirstItem13) { DataCallManager.SaveItemType(13); } haveItem13 += MatPar.ItemCount; haveItem++; matList.Item13ListUpdate(); break; case 14: if (!FirstItem14) { DataCallManager.SaveItemType(14); } haveItem14 += MatPar.ItemCount; haveItem++; matList.Item14ListUpdate(); break; case 15: if (!FirstItem15) { DataCallManager.SaveItemType(15); } haveItem15 += MatPar.ItemCount; haveItem++; matList.Item15ListUpdate(); break; } Destroy(Materials[index].gameObject, 0.4f); } else if (Materials[index].transform.position.x >= NPCPos.x - 0.5f && Materials[index].transform.position.x <= NPCPos.x + 0.5f && Materials[index].transform.position.y <= -2.2f) { MatPar = Materials[index].GetComponent <MaterialParmeter>(); MatParSprite = Materials[index].GetComponent <SpriteRenderer>(); SoundManager.sounds["Pop (3)"].Play(); Rigidbody2D rigid = Materials[index].GetComponent <Rigidbody2D>(); Vector2 getMotion = new Vector2(0f, 4f); rigid.AddForce(getMotion, ForceMode2D.Impulse); Itemnum = MatPar.ItemNum; switch (Itemnum) { case 1: if (!FirstItem1) { DataCallManager.SaveItemType(1); } haveHarb += MatPar.ItemCount; haveItem++; matList.HarbListUpdate(); break; case 2: if (!FirstItem2) { DataCallManager.SaveItemType(2); } haveTomato += MatPar.ItemCount; haveItem++; matList.TomatoListUpdate(); break; case 3: if (!FirstItem3) { DataCallManager.SaveItemType(3); } haveItem3 += MatPar.ItemCount; haveItem++; matList.Item3ListUpdate(); break; case 4: if (!FirstItem4) { DataCallManager.SaveItemType(4); } haveItem4 += MatPar.ItemCount; haveItem++; matList.Item4ListUpdate(); break; case 5: if (!FirstItem5) { DataCallManager.SaveItemType(5); } haveItem5 += MatPar.ItemCount; haveItem++; matList.Item5ListUpdate(); break; case 6: if (!FirstItem6) { DataCallManager.SaveItemType(6); } haveItem6 += MatPar.ItemCount; haveItem++; matList.Item6ListUpdate(); break; case 7: if (!FirstItem7) { DataCallManager.SaveItemType(7); } haveItem7 += MatPar.ItemCount; haveItem++; matList.Item7ListUpdate(); break; case 8: if (!FirstItem8) { DataCallManager.SaveItemType(8); } haveItem8 += MatPar.ItemCount; haveItem++; matList.Item8ListUpdate(); break; case 9: if (!FirstItem9) { DataCallManager.SaveItemType(9); } haveItem9 += MatPar.ItemCount; haveItem++; matList.Item9ListUpdate(); break; case 10: if (!FirstItem10) { DataCallManager.SaveItemType(10); } haveItem10 += MatPar.ItemCount; haveItem++; matList.Item10ListUpdate(); break; case 11: if (!FirstItem11) { DataCallManager.SaveItemType(11); } haveItem11 += MatPar.ItemCount; haveItem++; matList.Item11ListUpdate(); break; case 12: if (!FirstItem12) { DataCallManager.SaveItemType(12); } haveItem12 += MatPar.ItemCount; haveItem++; matList.Item12ListUpdate(); break; case 13: if (!FirstItem13) { DataCallManager.SaveItemType(13); } haveItem13 += MatPar.ItemCount; haveItem++; matList.Item13ListUpdate(); break; case 14: if (!FirstItem14) { DataCallManager.SaveItemType(14); } haveItem14 += MatPar.ItemCount; haveItem++; matList.Item14ListUpdate(); break; case 15: if (!FirstItem15) { DataCallManager.SaveItemType(15); } haveItem15 += MatPar.ItemCount; haveItem++; matList.Item15ListUpdate(); break; } Destroy(Materials[index].gameObject, 0.4f); } } StartCoroutine("GetMaterial"); }