add character edit sliders
This commit is contained in:
+1788
-885
File diff suppressed because it is too large
Load Diff
@@ -3,19 +3,24 @@ using UnityEngine.AI;
|
|||||||
using UMA;
|
using UMA;
|
||||||
using UMA.CharacterSystem;
|
using UMA.CharacterSystem;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class CharacterDescriptor : MonoBehaviour
|
public class CharacterDescriptor : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
public CharacterSex Sex { get; private set; }
|
||||||
public CharacterSex Sex;
|
|
||||||
private NavMeshAgent _navMeshAgent;
|
private NavMeshAgent _navMeshAgent;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
private DynamicCharacterAvatar _avatar;
|
private DynamicCharacterAvatar _avatar;
|
||||||
private Dictionary<string, DnaSetter> _dna;
|
private Dictionary<string, DnaSetter> _dna;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private Slider _height;
|
||||||
|
[SerializeField]
|
||||||
|
private Slider _belly;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
_avatar = GetComponent<DynamicCharacterAvatar>();
|
|
||||||
_navMeshAgent = GetComponentInParent<NavMeshAgent>();
|
_navMeshAgent = GetComponentInParent<NavMeshAgent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,11 +32,51 @@ public class CharacterDescriptor : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
_avatar.CharacterUpdated.AddListener(Updated);
|
||||||
|
_height.onValueChanged.AddListener(HeightChange);
|
||||||
|
_belly.onValueChanged.AddListener(BellyChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
_avatar.CharacterUpdated.RemoveListener(Updated);
|
||||||
|
_height.onValueChanged.RemoveListener(HeightChange);
|
||||||
|
_belly.onValueChanged.RemoveListener(BellyChange);
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeSex(bool isMale)
|
public void ChangeSex(bool isMale)
|
||||||
{
|
{
|
||||||
if (isMale)
|
if (isMale)
|
||||||
|
{
|
||||||
|
Sex = CharacterSex.Male;
|
||||||
_avatar.ChangeRace("HumanMale");
|
_avatar.ChangeRace("HumanMale");
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Sex = CharacterSex.Female;
|
||||||
_avatar.ChangeRace("HumanFemale");
|
_avatar.ChangeRace("HumanFemale");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Updated(UMAData data)
|
||||||
|
{
|
||||||
|
_dna = _avatar.GetDNA();
|
||||||
|
_height.value = _dna["height"].Get();
|
||||||
|
_belly.value = _dna["belly"].Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HeightChange(float value)
|
||||||
|
{
|
||||||
|
_dna["height"].Set(value);
|
||||||
|
_avatar.BuildCharacter();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BellyChange(float value)
|
||||||
|
{
|
||||||
|
_dna["belly"].Set(value);
|
||||||
|
_avatar.BuildCharacter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class StartUp : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
// GameManager.Instance.Scene.Change("City");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a2308c7357aa6fe46b0c1dc06cab6865
|
|
||||||
@@ -22,6 +22,7 @@ public class UISystem : MonoBehaviour
|
|||||||
_blurOverlay.SetActive(false);
|
_blurOverlay.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowTimeSliderDialog(string title, string description, Action onCancel, Action<TimeSpan> onConfirm)
|
public void ShowTimeSliderDialog(string title, string description, Action onCancel, Action<TimeSpan> onConfirm)
|
||||||
{
|
{
|
||||||
var timeSlider = Instantiate(_timeSliderPrefab, transform);
|
var timeSlider = Instantiate(_timeSliderPrefab, transform);
|
||||||
|
|||||||
Reference in New Issue
Block a user