void Update() { // Note: SwapSlots is now taken care of on UMASimpleLOD if (characterCount > 0) { if (!isBuilding) { characterCount--; isBuilding = true; crowd.ResetSpawnPos(); var go = crowd.GenerateUMA(Random.Range(0, 2), transform.position + new Vector3(Random.Range(-range, range), 0, Random.Range(-range, range))); go.transform.localRotation = Quaternion.Euler(0, Random.Range(0, 360), 0); UMAData umaData = go.GetComponent <UMAData>(); umaData.CharacterCreated.AddListener(CharacterCreated); var lod = go.AddComponent <UMASimpleLOD>(); var display = go.AddComponent <LODDisplay>(); display.LODDisplayPrefab = LODDisplayPrefab; lod.lodDistance = lodDistance; lod.swapSlots = swapSlots; lod.lodOffset = lodOffset; lod.Update(); } } }
public void ButtonMale() { Destroy(GameObject.Find("UMACrowd").transform.GetChild(0).gameObject); crowdHandle.ResetSpawnPos(); GameObject myUma = crowdHandle.GenerateOneUMA(0); myUma.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); GetUMAData(myUma); if (bodyArea != 0) { float yPos = GameObject.Find("NoseMiddle").transform.position.y; myCamera.transform.position = new Vector3(0, yPos + 0.05f, -0.62f); if (bodyArea == 2) { panel.FindChild("LowerHead/FacialHair").gameObject.SetActive(true); } } }
void Update() { if (swapSlots != _swapSlots || lodOffset != _lodOffset) { _swapSlots = swapSlots; _lodOffset = lodOffset; var lods = transform.GetComponentsInChildren <UMASimpleLOD>(); foreach (var lod in lods) { lod.SetSwapSlots(_swapSlots, _lodOffset); } } if (characterCount > 0) { if (!isBuilding) { characterCount--; isBuilding = true; crowd.ResetSpawnPos(); var go = crowd.GenerateUMA(Random.Range(0, 2), transform.position + new Vector3(Random.Range(-range, range), 0, Random.Range(-range, range))); go.transform.localRotation = Quaternion.Euler(0, Random.Range(0, 360), 0); // Add the display prefab GameObject tm = (GameObject)GameObject.Instantiate(LODDisplayPrefab, go.transform.position, go.transform.rotation); tm.transform.SetParent(go.transform); tm.transform.localPosition = new Vector3(0, 2f, 0f); tm.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); var lod = go.AddComponent <UMASimpleLOD>(); lod.lodDistance = lodDistance; lod.lodDisplay = tm.GetComponent <TextMesh>(); lod.umaData = go.GetComponent <UMAData>(); lod.umaData.CharacterUpdated.AddListener(lod.CharacterUpdated); lod.umaData.CharacterCreated.AddListener(CharacterCreated); lod.swapSlots = swapSlots; lod.lodOffset = lodOffset; lod.Update(); } } }