private void PlaceMuseumObjects(List <CommandCenter.MuseumObject> mObjects) { foreach (CommandCenter.MuseumObject museumObject in mObjects) { GameObject indicator = Instantiate(indicatorPrefab); indicator.name = museumObject.id; indicator.transform.parent = augmentLayer.transform; GameObject floor = floors[(int)museumObject.location.y]; indicator.transform.position = new Vector3(museumObject.location.x * floor.GetComponent <Renderer>().bounds.size.x, floor.transform.position.y + 0.3f, museumObject.location.z * floor.GetComponent <Renderer>().bounds.size.z); CommandCenter.ChangeColor(indicator, museumObject.color); } }
private void PlaceMuseumObjects(Dictionary <string, CommandCenter.MuseumObject> museumObjs) { foreach (CommandCenter.MuseumObject museumObject in museumObjs.Values) { GameObject indicator = Instantiate(indicatorPrefab); indicator.name = museumObject.id; indicator.transform.parent = objLayer.transform; GameObject floor = floors[(int)museumObject.location.y]; indicator.transform.position = new Vector3(museumObject.location.x * floor.GetComponent <Renderer>().bounds.size.x * 10, floor.transform.position.y + 0.3f, -museumObject.location.z * floor.GetComponent <Renderer>().bounds.size.z * 10); indicator.transform.localScale = new Vector3(3, 3, 3); CommandCenter.ChangeColor(indicator, museumObject.color); museumObjectsGO.Add(museumObject.id, indicator); GameObject sign = Instantiate(signPrefab); sign.name = museumObject.id; sign.transform.parent = augLayer.transform; GameObject largeCylinder = sign.transform.Find("LCylinder").gameObject; GameObject billboard = sign.transform.Find("LabelBoard").gameObject; TextMeshPro label = sign.transform.Find("Label").GetComponent <TextMeshPro>(); Vector3 oldScale = billboard.gameObject.transform.localScale; label.text = museumObject.name; label.ForceMeshUpdate(); CommandCenter.ChangeColor(largeCylinder, museumObject.color); CommandCenter.ChangeColor(billboard, museumObject.color); billboard.transform.localScale = new Vector3(label.GetRenderedValues().x / 6 + 0.25f, oldScale.y, oldScale.z); billboard.transform.position = largeCylinder.transform.position; billboard.transform.Translate(billboard.transform.localScale.x / 2 + 0.1f, 0, 0); museumSignsGO.Add(museumObject.id, sign); } }