public object Clone() { RawGems clonedItem = new RawGems(null); clonedItem.Type = Type; clonedItem.SortingLayer = SortingLayer; clonedItem.Count = Count; return(clonedItem); }
private void CreateRecipes() { Recipes = new Recipe[10]; Item[] items = new Item[9]; Item[] _rTMP = { null, null, null, null, new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null, null, null }; Recipes[0] = new Recipe(_rTMP, "NAAAME", 100, new Item[] { new Gems(null, "Red gem", "A blood red gem", ItemValues.RedGem), null, null }); Recipes[0].isKnown = true; Recipes[0].InventorySprite = _rTMP[4].InventorySprite; Item[] _rTMP2 = { null, null, null, null, new Gems(null, "Red gem", "a blood red gem", ItemValues.RedGem), null, null, null, null }; Recipes[1] = new Recipe(_rTMP2, "BWAA", 100, new Item[] { new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null }); Recipes[1].isKnown = true; Recipes[1].InventorySprite = _rTMP2[4].InventorySprite; Item[] _rTMP3 = { null, null, null, null, new Gems(null, "Yellow gem", "A yellow gem", ItemValues.YellowGem), null, null, null, null }; Recipes[2] = new Recipe(_rTMP3, "TOTO", 100, new Item[] { new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null }); Recipes[2].InventorySprite = _rTMP3[4].InventorySprite; #region Rocks for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.BasaltName, ItemValues.RockBasalt); } Recipes[3] = new Recipe(items, RockBlocks.BasaltName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.BasaltName, ItemValues.BlocBasalt), null }); Recipes[3].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.DioriteName, ItemValues.RockDiorite); } Recipes[4] = new Recipe(items, RockBlocks.DioriteName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.DioriteName, ItemValues.BlocDiorite), null }); Recipes[4].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.GabbroName, ItemValues.RockGabbro); } Recipes[4] = new Recipe(items, RockBlocks.GabbroName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.GabbroName, ItemValues.BlocGabbro), null }); Recipes[4].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.GranitName, ItemValues.RockGranit); } Recipes[5] = new Recipe(items, RockBlocks.GranitName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.GranitName, ItemValues.BlocGranit), null }); Recipes[5].InventorySprite = ResourcesManager.instance.IN_Bloc; #endregion for (int i = 0; i < 9; i++) { if (i == 4) { items[i] = new RawGems(null); } else { items[i] = null; } } Recipes[6] = new Recipe(items, "Raw gem", 50, null, true, new Item[] { new Gems(null, "Red gem", "A blood red gem", ItemValues.RedGem), new Gems(null, "White gem", "A shiny white gem", ItemValues.WhiteGem), new Gems(null, "Yellow gem", "A yellow gem", ItemValues.YellowGem) }, 1); Recipes[6].InventorySprite = ResourcesManager.instance.IN_RawGem; }
private void CreateRecipes() { Recipes = new Recipe[10]; Item[] items = new Item[9]; Item[] _rTMP = { null, null, null, null, new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null, null, null }; Recipes[0] = new Recipe(_rTMP, "NAAAME", 100, new Item[] { new Gems(null, "Red gem", "A blood red gem", ItemValues.RedGem), null, null }); Recipes[0].isKnown = true; Recipes[0].InventorySprite = _rTMP[4].InventorySprite; Item[] _rTMP2 = { null, null, null, null, new Gems(null, "Red gem", "a blood red gem", ItemValues.RedGem), null, null, null, null }; Recipes[1] = new Recipe(_rTMP2, "BWAA", 100, new Item[] { new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null }); Recipes[1].isKnown = true; Recipes[1].InventorySprite = _rTMP2[4].InventorySprite; Item[] _rTMP3 = { null, null, null, null, new Gems(null, "Yellow gem", "A yellow gem", ItemValues.YellowGem), null, null, null, null }; Recipes[2] = new Recipe(_rTMP3, "TOTO", 100, new Item[] { new Gems(null, "White gem", "A white gem", ItemValues.WhiteGem), null, null }); Recipes[2].InventorySprite = _rTMP3[4].InventorySprite; #region Rocks for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.BasaltName, ItemValues.RockBasalt); } Recipes[3] = new Recipe(items, RockBlocks.BasaltName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.BasaltName, ItemValues.BlocBasalt), null }); Recipes[3].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.DioriteName, ItemValues.RockDiorite); } Recipes[4] = new Recipe(items, RockBlocks.DioriteName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.DioriteName, ItemValues.BlocDiorite), null }); Recipes[4].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.GabbroName, ItemValues.RockGabbro); } Recipes[4] = new Recipe(items, RockBlocks.GabbroName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.GabbroName, ItemValues.BlocGabbro), null }); Recipes[4].InventorySprite = ResourcesManager.instance.IN_Bloc; //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- for (int i = 0; i < 9; i++) { items[i] = new Rocks(null, Rocks.GranitName, ItemValues.RockGranit); } Recipes[5] = new Recipe(items, RockBlocks.GranitName, 100, new Item[] { null, new RockBlocks(null, RockBlocks.GranitName, ItemValues.BlocGranit), null }); Recipes[5].InventorySprite = ResourcesManager.instance.IN_Bloc; #endregion for (int i = 0; i < 9; i++) { if (i == 4) items[i] = new RawGems(null); else items[i] = null; } Recipes[6] = new Recipe(items, "Raw gem", 50, null, true, new Item[] { new Gems(null, "Red gem", "A blood red gem", ItemValues.RedGem), new Gems(null, "White gem", "A shiny white gem", ItemValues.WhiteGem), new Gems(null, "Yellow gem", "A yellow gem", ItemValues.YellowGem)}, 1); Recipes[6].InventorySprite = ResourcesManager.instance.IN_RawGem; }
public bool OnDamage(float damagePoints, int index) { HealthPoints -= (damagePoints * DamageCoef); Audio.PlayOneShot(Clips[Random.Range(0, Clips.Length)]); if(HealthPoints <= 0) { Scene._grid[index].isWalkable = true; //Spawn bag: GameObject toInstantiate = MonoBehaviour.Instantiate(HexTileManager.instance.Containers[Random.Range(0, HexTileManager.instance.Containers.Length)], Scene._grid[index].position, Quaternion.identity) as GameObject; toInstantiate.transform.SetParent(Scene._grid[index].TileObject.transform); //Set the hex tile as parent toInstantiate.GetComponent<MonoItem>().spriteRenderer.enabled = true; //Create items: int maxItem = Random.Range(3, 6); Item[] content = new Item[maxItem]; for (int i = 0; i < maxItem; i++) { //Select a random item // [GEMS][POWDER][RAWGEM][RAWCRYSTAL] switch (Random.Range(0, 4)) { //[GEMS] case 0: //Add a gem //Get a random gem switch (CrystalBiome.GemValues[Random.Range(0, CrystalBiome.GemValues.Length)]) { case ItemValues.WhiteGem: content[i] = new Gems(null, Gems.RedGemName, Gems.RedGemDescription, ItemValues.WhiteGem); break; case ItemValues.YellowGem: content[i] = new Gems(null, Gems.YellowGemName, Gems.YellowGemDescription, ItemValues.YellowGem); break; case ItemValues.RedGem: content[i] = new Gems(null, Gems.WhiteGemName, Gems.WhiteGemDescription, ItemValues.RedGem); break; } content[i].Count = Random.Range(2, 6); break; case 1: switch(CrystalPowder.PowderValues[Random.Range(0, CrystalPowder.PowderValues.Length)]) { case ItemValues.PentanitePowder: content[i] = new CrystalPowder(null, ItemValues.PentanitePowder); content[i].Count = Random.Range(4, 11); break; } break; case 2: content[i] = new RawGems(null); content[i].Count = Random.Range(1, 4); break; case 3: switch (CrystalRaw.RawValues[Random.Range(0, CrystalRaw.RawValues.Length)]) { case ItemValues.PentaniteRaw: content[i] = new CrystalRaw(null, ItemValues.PentaniteRaw); content[i].Count = Random.Range(3, 8); break; } break; } } (toInstantiate.GetComponent<MonoItem>().thisItem as ItemContainer).SetContent(content); Scene._grid[index].ItemValue = toInstantiate.GetComponent<MonoItem>().thisItem.ItemValue; return true; } return false; }
public object Clone() { RawGems clonedItem = new RawGems(null); clonedItem.Type = Type; clonedItem.SortingLayer = SortingLayer; clonedItem.Count = Count; return clonedItem; }
public bool OnDamage(float damagePoints, int index) { HealthPoints -= (damagePoints * DamageCoef); Audio.PlayOneShot(Clips[Random.Range(0, Clips.Length)]); if (HealthPoints <= 0) { Scene._grid[index].isWalkable = true; //Spawn bag: GameObject toInstantiate = MonoBehaviour.Instantiate(HexTileManager.instance.Containers[Random.Range(0, HexTileManager.instance.Containers.Length)], Scene._grid[index].position, Quaternion.identity) as GameObject; toInstantiate.transform.SetParent(Scene._grid[index].TileObject.transform); //Set the hex tile as parent toInstantiate.GetComponent <MonoItem>().spriteRenderer.enabled = true; //Create items: int maxItem = Random.Range(1, 4); Item[] content = new Item[maxItem]; for (int i = 0; i < maxItem; i++) { //Select a random item // [GEMS][POWDER][RAWGEM][RAWCRYSTAL] switch (Random.Range(0, 4)) { //[GEMS] case 0: //Add a gem //Get a random gem switch (CrystalBiome.GemValues[Random.Range(0, CrystalBiome.GemValues.Length)]) { case ItemValues.WhiteGem: content[i] = new Gems(null, Gems.RedGemName, Gems.RedGemDescription, ItemValues.WhiteGem); break; case ItemValues.YellowGem: content[i] = new Gems(null, Gems.YellowGemName, Gems.YellowGemDescription, ItemValues.YellowGem); break; case ItemValues.RedGem: content[i] = new Gems(null, Gems.WhiteGemName, Gems.WhiteGemDescription, ItemValues.RedGem); break; } content[i].Count = Random.Range(1, 3); break; case 1: switch (CrystalPowder.PowderValues[Random.Range(0, CrystalPowder.PowderValues.Length)]) { case ItemValues.PentanitePowder: content[i] = new CrystalPowder(null, ItemValues.PentanitePowder); content[i].Count = Random.Range(1, 6); break; } break; case 2: content[i] = new RawGems(null); content[i].Count = Random.Range(1, 3); break; case 3: switch (CrystalRaw.RawValues[Random.Range(0, CrystalRaw.RawValues.Length)]) { case ItemValues.PentaniteRaw: content[i] = new CrystalRaw(null, ItemValues.PentaniteRaw); content[i].Count = Random.Range(1, 4); break; } break; } } (toInstantiate.GetComponent <MonoItem>().thisItem as ItemContainer).SetContent(content); Scene._grid[index].ItemValue = toInstantiate.GetComponent <MonoItem>().thisItem.ItemValue; return(true); } return(false); }