squash commits
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UMA.CharacterSystem;
|
||||
|
||||
namespace UMA.Timeline
|
||||
{
|
||||
[Serializable]
|
||||
public class UmaWardrobeBehaviour : PlayableBehaviour
|
||||
{
|
||||
public enum WardrobeOptions
|
||||
{
|
||||
AddRecipes,
|
||||
ClearSlots,
|
||||
ClearAllSlots
|
||||
}
|
||||
|
||||
public WardrobeOptions wardrobeOption = 0;
|
||||
public List<UMAWardrobeRecipe> recipesToAdd = new List<UMAWardrobeRecipe>();
|
||||
public List<string> slotsToClear = new List<string>();
|
||||
[Tooltip("Whether to rebuild the uma avatar immediately on setting/clearing or instead accummulate the changes.")]
|
||||
public bool rebuildImmediately = true;
|
||||
|
||||
[HideInInspector]
|
||||
public bool isAdded = false;
|
||||
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
bool dcaUpdated = false;
|
||||
DynamicCharacterAvatar avatar = playerData as DynamicCharacterAvatar;
|
||||
if (avatar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isAdded)
|
||||
{
|
||||
isAdded = true;
|
||||
dcaUpdated = true;
|
||||
|
||||
if (wardrobeOption == UmaWardrobeBehaviour.WardrobeOptions.AddRecipes)
|
||||
{
|
||||
if (recipesToAdd != null)
|
||||
{
|
||||
for (int i = 0; i < recipesToAdd.Count; i++)
|
||||
{
|
||||
UMAWardrobeRecipe recipe = recipesToAdd[i];
|
||||
avatar.SetSlot(recipe);
|
||||
dcaUpdated = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Debug.isDebugBuild)
|
||||
{
|
||||
Debug.LogWarning("Wardrobe recipes not set!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wardrobeOption == UmaWardrobeBehaviour.WardrobeOptions.ClearSlots)
|
||||
{
|
||||
avatar.ClearSlots(slotsToClear);
|
||||
dcaUpdated = true;
|
||||
}
|
||||
|
||||
if (wardrobeOption == UmaWardrobeBehaviour.WardrobeOptions.ClearAllSlots)
|
||||
{
|
||||
avatar.ClearSlots();
|
||||
dcaUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dcaUpdated && rebuildImmediately)
|
||||
{
|
||||
avatar.BuildCharacter(true,!avatar.BundleCheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c1ed44a66b845d438e0c7ed7bf8c76e
|
||||
timeCreated: 1537147278
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 35611
|
||||
packageName: UMA 2
|
||||
packageVersion: 2.13
|
||||
assetPath: Assets/UMA/Core/Extensions/Timeline/UmaWardrobe/UmaWardrobeBehaviour.cs
|
||||
uploadId: 679826
|
||||
@@ -0,0 +1,26 @@
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace UMA.Timeline
|
||||
{
|
||||
[Serializable]
|
||||
public class UmaWardrobeClip : PlayableAsset, ITimelineClipAsset
|
||||
{
|
||||
public UmaWardrobeBehaviour template = new UmaWardrobeBehaviour();
|
||||
|
||||
public ClipCaps clipCaps
|
||||
{
|
||||
get { return ClipCaps.None; }
|
||||
}
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
var playable = ScriptPlayable<UmaWardrobeBehaviour>.Create(graph, template);
|
||||
return playable;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d67d1bdd757e7dd49826ea5f02ae84f7
|
||||
timeCreated: 1537147278
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 35611
|
||||
packageName: UMA 2
|
||||
packageVersion: 2.13
|
||||
assetPath: Assets/UMA/Core/Extensions/Timeline/UmaWardrobe/UmaWardrobeClip.cs
|
||||
uploadId: 679826
|
||||
@@ -0,0 +1,14 @@
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
using UnityEngine.Timeline;
|
||||
using UMA.CharacterSystem;
|
||||
|
||||
namespace UMA.Timeline
|
||||
{
|
||||
[TrackColor(0.2f, 0.0f, 0.2f)]
|
||||
[TrackClipType(typeof(UmaWardrobeClip))]
|
||||
[TrackBindingType(typeof(DynamicCharacterAvatar))]
|
||||
public class UmaWardrobeTrack : TrackAsset
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21904e453c5200943a2c55faeb7bbf57
|
||||
timeCreated: 1537147278
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 35611
|
||||
packageName: UMA 2
|
||||
packageVersion: 2.13
|
||||
assetPath: Assets/UMA/Core/Extensions/Timeline/UmaWardrobe/UmaWardrobeTrack.cs
|
||||
uploadId: 679826
|
||||
Reference in New Issue
Block a user