impl ITimeControl to Vrm10AnimationInstance

This commit is contained in:
ousttrue 2025-01-23 19:04:39 +09:00
parent 239841f519
commit de4c357f09
7 changed files with 65 additions and 4 deletions

View File

@ -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();
}
}
}

View File

@ -9,7 +9,8 @@
"GUID:f2ca1407928ebdc4bbe7765cc278be44",
"GUID:2665a8d13d1b3f18800f46e256720795",
"GUID:1cd941934d098654fa21a13f28346412",
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@ -7,7 +7,8 @@
"GUID:1cd941934d098654fa21a13f28346412",
"GUID:e47c917724578cc43b5506c17a27e9a0",
"GUID:308b348fb80d89d42a9620951b0f60db",
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@ -6,7 +6,8 @@
"GUID:8d76e605759c3f64a957d63ef96ada7c",
"GUID:e47c917724578cc43b5506c17a27e9a0",
"GUID:1cd941934d098654fa21a13f28346412",
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
"GUID:3e5d614bc16b50d41bd94c8d7444ca46",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@ -10,6 +10,7 @@
"com.unity.postprocessing": "3.4.0",
"com.unity.render-pipelines.universal": "14.0.11",
"com.unity.test-framework": "1.1.33",
"com.unity.timeline": "1.7.6",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

View File

@ -141,6 +141,18 @@
},
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.7.6",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.ugui": {
"version": "1.0.0",
"depth": 0,

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 53
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3}
m_Name:
m_EditorClassIdentifier:
assetDefaultFramerate: 60
m_DefaultFrameRate: 60