mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-02 07:42:25 -05:00
impl ITimeControl to Vrm10AnimationInstance
This commit is contained in:
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
||||
using UniGLTF;
|
||||
using UniHumanoid;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public class Vrm10AnimationInstance : MonoBehaviour, IVrm10Animation
|
||||
public class Vrm10AnimationInstance : MonoBehaviour, IVrm10Animation, ITimeControl
|
||||
{
|
||||
public SkinnedMeshRenderer BoxMan;
|
||||
public void ShowBoxMan(bool enable)
|
||||
@@ -330,5 +331,33 @@ namespace UniVRM10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Animation m_animation;
|
||||
AnimationState m_state;
|
||||
|
||||
public void OnControlTimeStart()
|
||||
{
|
||||
m_animation = GetComponent<Animation>();
|
||||
foreach (AnimationState state in m_animation)
|
||||
{
|
||||
m_state = state;
|
||||
break;
|
||||
}
|
||||
m_state.speed = 0;
|
||||
m_state.enabled = true;
|
||||
m_animation.Play();
|
||||
}
|
||||
|
||||
public void OnControlTimeStop()
|
||||
{
|
||||
m_animation.Stop();
|
||||
m_state = null;
|
||||
}
|
||||
|
||||
public void SetTime(double time)
|
||||
{
|
||||
m_state.time = (float)time;
|
||||
m_animation.Sample();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"GUID:f2ca1407928ebdc4bbe7765cc278be44",
|
||||
"GUID:2665a8d13d1b3f18800f46e256720795",
|
||||
"GUID:1cd941934d098654fa21a13f28346412",
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
|
||||
"GUID:f06555f75b070af458a003d92f9efb00"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"GUID:1cd941934d098654fa21a13f28346412",
|
||||
"GUID:e47c917724578cc43b5506c17a27e9a0",
|
||||
"GUID:308b348fb80d89d42a9620951b0f60db",
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
|
||||
"GUID:f06555f75b070af458a003d92f9efb00"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"GUID:8d76e605759c3f64a957d63ef96ada7c",
|
||||
"GUID:e47c917724578cc43b5506c17a27e9a0",
|
||||
"GUID:1cd941934d098654fa21a13f28346412",
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
|
||||
"GUID:f06555f75b070af458a003d92f9efb00"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
Reference in New Issue
Block a user