Esempio n. 1
0
		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
#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>();
		}
		if (Instance == null) Instance = this;
	}
Esempio n. 3
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. 4
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;
 }
Esempio n. 5
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];
                }
            }
        }
        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. 7
0
    void GenerateUMA()
    {
        umaDynamicAvatar = avatarGOFactory.Create();
        GameObject player = umaDynamicAvatar.gameObject;
        player.name = "MyUMA";

        this.slotLibrary = umaDynamicAvatar.context.slotLibrary;
        this.overlayLibrary = umaDynamicAvatar.context.overlayLibrary;
        this.raceLibrary = umaDynamicAvatar.context.raceLibrary;

        umaData = player.AddComponent<UMAData> ();
        umaDynamicAvatar.umaData = umaData;
        umaData.umaRecipe = CreateMaleRecipe();

        // Generate UMA
        umaDynamicAvatar.UpdateNewRace();

        Animator animator = player.GetComponent<Animator>();
        //		controller.m_Animator = animator;
    }