Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
 public void OnEnable()
 {
     m_Object           = new SerializedObject(target);
     overlayLibrary     = m_Object.targetObject as DKOverlayLibrary;
     m_OverlayDataCount = m_Object.FindProperty(kArraySizePath);
     scaleAdjust        = serializedObject.FindProperty("scaleAdjust");
     readWrite          = serializedObject.FindProperty("readWrite");
     compress           = serializedObject.FindProperty("compress");
 }
Exemplo n.º 3
0
    public DKOverlayData(DKOverlayLibrary _overlayLibrary, string elementName)
    {
        DKOverlayData source;

        if (!_overlayLibrary.overlayDictionary.TryGetValue(elementName, out source))
        {
            Debug.LogError("Unable to find DKOverlayData " + elementName);
            this.overlayName = elementName;
            return;
        }

        this.overlayName = source.overlayName;
        this.listID      = source.listID;
        this.color       = new Color(source.color.r, source.color.g, source.color.b, color.a);
        this.rect        = source.rect;
        this.textureList = new Texture2D[source.textureList.Length];
        for (int i = 0; i < textureList.Length; i++)
        {
            this.textureList[i] = source.textureList[i];
        }
    }
Exemplo n.º 4
0
    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 ();
    }