public virtual void AddToLibraries(OverlayLibraryBase overlayLibrary, SlotLibraryBase slotLibrary, RaceLibraryBase raceLibrary)
        {
            if (overlayLibrary != null && overlayData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(overlayLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < overlayData.Length; i++)
                {
                    overlayLibrary.AddOverlayAsset(overlayData[i]);
                }
            }
            if (slotLibrary != null && slotData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(slotLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < slotData.Length; i++)
                {
                    slotLibrary.AddSlotAsset(slotData[i]);
                }
            }
            if (raceLibrary != null && raceData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(raceLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < raceData.Length; i++)
                {
                    raceLibrary.AddRace(raceData[i]);
                }
            }
        }
Esempio n. 2
0
        public virtual void AddToLibraries(OverlayLibraryBase overlayLibrary, SlotLibraryBase slotLibrary, RaceLibraryBase raceLibrary, UMACrowd crowd)
        {
            if (overlayLibrary != null && overlayData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(overlayLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < overlayData.Length; i++)
                {
                    overlayLibrary.AddOverlay(overlayData[i]);
                }
            }
            if (slotLibrary != null && slotData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(slotLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < slotData.Length; i++)
                {
                    slotLibrary.AddSlot(slotData[i]);
                }
            }
            if (raceLibrary != null && raceData.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(raceLibrary, "Added Asset Collection");
#endif
                for (int i = 0; i < raceData.Length; i++)
                {
                    raceLibrary.AddRace(raceData[i]);
                }
            }

            if (crowd != null && randomSets.Length > 0)
            {
#if UNITY_EDITOR
                UnityEditor.Undo.RecordObject(crowd, "Added Asset Collection");
#endif
                var newPool = new UMACrowdRandomSet[crowd.randomPool.Length + randomSets.Length];
                Array.Copy(crowd.randomPool, newPool, crowd.randomPool.Length);
                for (int i = 0; i < randomSets.Length; i++)
                {
                    newPool[crowd.randomPool.Length + i] = randomSets[i];
                }
            }
        }
Esempio n. 3
0
 #pragma warning disable 618
 public void Start()
 {
     if (!slotLibrary)
     {
         slotLibrary = GameObject.Find("SlotLibrary").GetComponent <SlotLibraryBase>();
     }
     if (!raceLibrary)
     {
         raceLibrary = GameObject.Find("RaceLibrary").GetComponent <RaceLibraryBase>();
     }
     if (!overlayLibrary)
     {
         overlayLibrary = GameObject.Find("OverlayLibrary").GetComponent <OverlayLibraryBase>();
     }
     // Note: Removed null check so that this is always assigned if you have a UMAContext in your scene
     // This will avoid those occasions where someone drops in a bogus context in a test scene, and then
     // later loads a valid scene (and everything breaks)
     Instance = this;
 }