public void DetectAll() { if (_DK_UMACrowd == null) { UMACrowdObj = GameObject.Find("DKUMACrowd"); if (UMACrowdObj == null) { UMACrowdObj = (GameObject)Instantiate(Resources.Load("DKUMACrowd"), Vector3.zero, Quaternion.identity); UMACrowdObj.name = "DKUMACrowd"; #if UNITY_EDITOR PrefabUtility.ReconnectToLastPrefab(UMACrowdObj); #endif } _DK_UMACrowd = UMACrowdObj.GetComponent <DK_UMACrowd>(); } if (!DKumaGenerator) { DKumaGenerator = GameObject.Find("DKUMAGenerator").GetComponent("DKUMAGenerator") as DKUMAGenerator; } if (!slotLibrary) { slotLibrary = _DK_UMACrowd.slotLibrary; } if (!raceLibrary) { raceLibrary = _DK_UMACrowd.raceLibrary; } if (!overlayLibrary) { overlayLibrary = _DK_UMACrowd.overlayLibrary; } }
public void Awaking() { // Debug.Log ("Awaking"); firstBake = true; DetectAll(); if (this.transform.parent && this.transform.parent.GetComponentInChildren <DK_Model>() == true) { // Debug.Log ( this.transform.parent.name); // DKSlotLibraryObj = this.transform.parent.GetComponent<DK_Model>().DKSlotLibraryObj; if (!slotLibrary) { GameObject slotLibraryObj = GameObject.Find(DKSlotLibraryObj); if (slotLibraryObj) { slotLibrary = slotLibraryObj.GetComponent("DKSlotLibrary") as DKSlotLibrary; } else { Debug.LogError("The model '" + this.transform.parent.name + "' has not been generated : The Uma model does not found the needed Slot Library. You need to get the Library used during its creation: '" + DKSlotLibraryObj + "'. Try to contact the creator of the model's Asset to get: '" + DKSlotLibraryObj + "'" + " Or create a new Library named : '" + DKSlotLibraryObj + "', be sure to append all the recquired Elements needed by the model."); if (this.transform.parent.parent.childCount == 1) { if (Application.isPlaying) { Destroy(this.transform.parent.parent.gameObject); } else { DestroyImmediate(this.transform.parent.parent.gameObject); } } else { if (Application.isPlaying) { Destroy(this.transform.parent.gameObject); } else { DestroyImmediate(this.transform.parent.gameObject); } } } } else // RaceLibraryObj = this.transform.parent.GetComponent<DK_Model>().RaceLibraryObj; if (!raceLibrary) { GameObject raceLibraryObj = GameObject.Find(RaceLibraryObj); if (raceLibraryObj) { raceLibrary = raceLibraryObj.GetComponent("DKRaceLibrary") as DKRaceLibrary; } else { Debug.LogError("The model '" + this.transform.parent.name + "' has not been generated : The Uma model does not found the needed Race Library. You need to get the Library used during its creation: '" + DKSlotLibraryObj + "'. Try to contact the creator of the model's Asset to get: '" + RaceLibraryObj + "'" + " Or create a new Library named : '" + RaceLibraryObj + "', be sure to append all the recquired Elements needed by the model."); if (this.transform.parent.parent.childCount == 1) { if (Application.isPlaying) { Destroy(this.transform.parent.parent.gameObject); } else { DestroyImmediate(this.transform.parent.parent.gameObject); } } else { if (Application.isPlaying) { Destroy(this.transform.parent.gameObject); } else { DestroyImmediate(this.transform.parent.gameObject); } } } } else // OverlayLibraryObj = this.transform.parent.GetComponent<DK_Model>().OverlayLibraryObj; if (!overlayLibrary) { GameObject overlayLibraryObj = GameObject.Find(OverlayLibraryObj); if (overlayLibraryObj) { overlayLibrary = overlayLibraryObj.GetComponent("DKOverlayLibrary") as DKOverlayLibrary; } else { Debug.LogError("The model '" + this.transform.parent.name + "' has not been generated : The Uma model does not found the needed Overlay Library. You need to get the Library used during its creation: '" + DKSlotLibraryObj + "'. Try to contact the creator of the model's Asset to get: '" + OverlayLibraryObj + "'" + " Or create a new Library named : '" + OverlayLibraryObj + "', be sure to append all the recquired Elements needed by the model."); if (this.transform.parent.parent.childCount == 1) { if (Application.isPlaying) { Destroy(this.transform.parent.parent.gameObject); } else { DestroyImmediate(this.transform.parent.parent.gameObject); } } else { if (Application.isPlaying) { Destroy(this.transform.parent.gameObject); } else { DestroyImmediate(this.transform.parent.gameObject); } } } } } for (int i = 0; i < DKumaGenerator.umaDirtyList.Count; i++) { if (DKumaGenerator.umaDirtyList[i] == null) { DKumaGenerator.umaDirtyList.Remove(DKumaGenerator.umaDirtyList[i]); Debug.Log("Removing Missing Dirty"); } } boneList.Clear(); if (!Loading && boneList.Count == 0) { UpdateBoneData(); } else if (boneList.Count == 0) { UpdateBoneData(); } UseNaturalBehaviour = _DK_UMACrowd.UseNaturalBehaviour; // if ( UseNaturalBehaviour && this.gameObject.GetComponent<NaturalLauncher>() == null ) AddNaturalLauncher (); }
public void OnEnable() { m_Object = new SerializedObject(target); slotLibrary = m_Object.targetObject as DKSlotLibrary; m_SlotDataCount = m_Object.FindProperty(kArraySizePath); }