public void GenerateChestMap(List <ChestmapPoint> newMap) { Debug.Log(newMap.Count); foreach (ChestmapPoint chestPoint in newMap) { FoundChest curentChest = findChestWithID(chestPoint.chest_ID); GameObject instance = Instantiate(chestmapPrefab, curentChest.position, curentChest.rotation) as GameObject; spawnedChestMap.Add(instance); //instance.GetComponent<ShowUIOnHover>().SetReasonText(deathPoint.reason); } }
FoundChest findChestWithID(int id) { foreach (GameObject chest in chestList) { if (chest.GetComponent <ChestListener>().chestID == id) { FoundChest foundChest = new FoundChest(); foundChest.position = chest.GetComponent <ChestListener>().chestMesh.transform.position; foundChest.rotation = chest.GetComponent <ChestListener>().chestMesh.transform.rotation; return(foundChest); } } return(null); }