new studio dance choreo system
This commit is contained in:
parent
803f756584
commit
4435ec4a26
|
|
@ -107,7 +107,7 @@ AnimatorState:
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: ShuffleTest
|
m_Name: ShuffleA
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions: []
|
||||||
|
|
@ -126,6 +126,32 @@ AnimatorState:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
|
--- !u!1102 &4269625300119266542
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: ShuffleB
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions: []
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400000, guid: 21ce814234f0f7b41aa97755774227a4, type: 2}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
--- !u!1102 &4458562493945474950
|
--- !u!1102 &4458562493945474950
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|
@ -207,7 +233,10 @@ AnimatorStateMachine:
|
||||||
m_Position: {x: 270, y: 230, z: 0}
|
m_Position: {x: 270, y: 230, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 3033663514174944207}
|
m_State: {fileID: 3033663514174944207}
|
||||||
m_Position: {x: 305, y: 295, z: 0}
|
m_Position: {x: 500, y: 80, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 4269625300119266542}
|
||||||
|
m_Position: {x: 500, y: 130, z: 0}
|
||||||
m_ChildStateMachines: []
|
m_ChildStateMachines: []
|
||||||
m_AnyStateTransitions: []
|
m_AnyStateTransitions: []
|
||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
|
|
@ -215,7 +244,7 @@ AnimatorStateMachine:
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
m_ExitPosition: {x: 50, y: 210, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
m_DefaultState: {fileID: -7358310358408031479}
|
m_DefaultState: {fileID: -7358310358408031479}
|
||||||
--- !u!1102 &7185868682324471420
|
--- !u!1102 &7185868682324471420
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 09aa5bca6a3f8fe4fab7d89ba92724b6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21ce814234f0f7b41aa97755774227a4
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -10,7 +10,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 973228652645146835}
|
- component: {fileID: 973228652645146835}
|
||||||
- component: {fileID: 4775133465026292988}
|
- component: {fileID: 4775133465026292988}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: EyeR
|
m_Name: EyeR
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -94,7 +94,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 6655367851817632929}
|
- component: {fileID: 6655367851817632929}
|
||||||
- component: {fileID: 4953487523721041835}
|
- component: {fileID: 4953487523721041835}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Mouth
|
m_Name: Mouth
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -178,7 +178,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4702797700737321925}
|
- component: {fileID: 4702797700737321925}
|
||||||
- component: {fileID: 5458371096400718163}
|
- component: {fileID: 5458371096400718163}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: LegL
|
m_Name: LegL
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -262,7 +262,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2110027195199092298}
|
- component: {fileID: 2110027195199092298}
|
||||||
- component: {fileID: 4427864031391791721}
|
- component: {fileID: 4427864031391791721}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Hips
|
m_Name: Hips
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -346,7 +346,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 7505236120496206873}
|
- component: {fileID: 7505236120496206873}
|
||||||
- component: {fileID: 557025351280167168}
|
- component: {fileID: 557025351280167168}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: LegR
|
m_Name: LegR
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -431,7 +431,7 @@ GameObject:
|
||||||
- component: {fileID: 6255441584635482009}
|
- component: {fileID: 6255441584635482009}
|
||||||
- component: {fileID: 3010192506600983308}
|
- component: {fileID: 3010192506600983308}
|
||||||
- component: {fileID: 2183142695466388869}
|
- component: {fileID: 2183142695466388869}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: FacePoser
|
m_Name: FacePoser
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -518,7 +518,7 @@ SortingGroup:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 4
|
m_SortingOrder: 3
|
||||||
--- !u!1 &5026812869604169951
|
--- !u!1 &5026812869604169951
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -529,7 +529,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 7709742647477725240}
|
- component: {fileID: 7709742647477725240}
|
||||||
- component: {fileID: 6312424392463044102}
|
- component: {fileID: 6312424392463044102}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: ArmL
|
m_Name: ArmL
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -614,7 +614,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1083994433150499968}
|
- component: {fileID: 1083994433150499968}
|
||||||
- component: {fileID: 5523632144322233404}
|
- component: {fileID: 5523632144322233404}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Torso
|
m_Name: Torso
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -699,7 +699,7 @@ GameObject:
|
||||||
- component: {fileID: 3517870697961505299}
|
- component: {fileID: 3517870697961505299}
|
||||||
- component: {fileID: 64880960188446444}
|
- component: {fileID: 64880960188446444}
|
||||||
- component: {fileID: 8921318804363366668}
|
- component: {fileID: 8921318804363366668}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Arisa
|
m_Name: Arisa
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -760,6 +760,7 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: e57f95bd19852bc46a88eb6f67404fce, type: 3}
|
m_Script: {fileID: 11500000, guid: e57f95bd19852bc46a88eb6f67404fce, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
debugChoreography: {fileID: 11400000, guid: d96e0429653a87e458402bf2b27c9d48, type: 2}
|
||||||
--- !u!1 &5151345010187160570
|
--- !u!1 &5151345010187160570
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -770,7 +771,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 5005212596909708348}
|
- component: {fileID: 5005212596909708348}
|
||||||
- component: {fileID: 4416567173055721529}
|
- component: {fileID: 4416567173055721529}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Hair
|
m_Name: Hair
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -854,7 +855,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 5160251771824588981}
|
- component: {fileID: 5160251771824588981}
|
||||||
- component: {fileID: 3554116500381240446}
|
- component: {fileID: 3554116500381240446}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Body
|
m_Name: Body
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -941,7 +942,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4525173648653743717}
|
- component: {fileID: 4525173648653743717}
|
||||||
- component: {fileID: 7310797463115372175}
|
- component: {fileID: 7310797463115372175}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: EyeL
|
m_Name: EyeL
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -1025,7 +1026,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2039106335442564576}
|
- component: {fileID: 2039106335442564576}
|
||||||
- component: {fileID: 7586809368672341742}
|
- component: {fileID: 7586809368672341742}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: HandR
|
m_Name: HandR
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -1109,7 +1110,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 6527505363066208356}
|
- component: {fileID: 6527505363066208356}
|
||||||
- component: {fileID: 564498618862425150}
|
- component: {fileID: 564498618862425150}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: HandL
|
m_Name: HandL
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -1193,7 +1194,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2718293722777145542}
|
- component: {fileID: 2718293722777145542}
|
||||||
- component: {fileID: 750753234517336609}
|
- component: {fileID: 750753234517336609}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Collar
|
m_Name: Collar
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -1277,7 +1278,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 526469563006529719}
|
- component: {fileID: 526469563006529719}
|
||||||
- component: {fileID: 6366747730854244537}
|
- component: {fileID: 6366747730854244537}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: ArmR
|
m_Name: ArmR
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
@ -1362,7 +1363,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1088882758183167198}
|
- component: {fileID: 1088882758183167198}
|
||||||
- component: {fileID: 7073094819256516695}
|
- component: {fileID: 7073094819256516695}
|
||||||
m_Layer: 0
|
m_Layer: 14
|
||||||
m_Name: Head
|
m_Name: Head
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82247a0c3ab46d7439ea60acda5a6715
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
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: ffc57f31522460641a3c6563cbfc7d5b, type: 3}
|
||||||
|
m_Name: Maker
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
choreographyName: Maker
|
||||||
|
choreographySteps:
|
||||||
|
- stateName: MakerR
|
||||||
|
beatLength: 1
|
||||||
|
- stateName: MakerL
|
||||||
|
beatLength: 1
|
||||||
|
poseStateOdd: MakerPoseL
|
||||||
|
poseStateEven: MakerPoseR
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1d8cd7bea66e99945b457e88cb3e64e8
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
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: ffc57f31522460641a3c6563cbfc7d5b, type: 3}
|
||||||
|
m_Name: Shuffle
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
choreographyName: Shuffle
|
||||||
|
choreographySteps:
|
||||||
|
- stateName: ShuffleA
|
||||||
|
beatLength: 2
|
||||||
|
- stateName: ShuffleA
|
||||||
|
beatLength: 2
|
||||||
|
- stateName: ShuffleB
|
||||||
|
beatLength: 4
|
||||||
|
poseStateOdd: NoPose
|
||||||
|
poseStateEven: NoPose
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d96e0429653a87e458402bf2b27c9d48
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
23
Assets/Scripts/StudioDance/ChoreographyInfo.cs
Normal file
23
Assets/Scripts/StudioDance/ChoreographyInfo.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace HeavenStudio.StudioDance
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "New Choreography", menuName = "StudioDance/Choreography")]
|
||||||
|
public class ChoreographyInfo : ScriptableObject
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public struct ChoreographyStep
|
||||||
|
{
|
||||||
|
public string stateName;
|
||||||
|
public double beatLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string choreographyName;
|
||||||
|
public List<ChoreographyStep> choreographySteps;
|
||||||
|
public string poseStateOdd;
|
||||||
|
public string poseStateEven;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/StudioDance/ChoreographyInfo.cs.meta
Normal file
11
Assets/Scripts/StudioDance/ChoreographyInfo.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ffc57f31522460641a3c6563cbfc7d5b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using HeavenStudio.Util;
|
using HeavenStudio.Util;
|
||||||
|
|
||||||
|
|
@ -5,52 +6,85 @@ namespace HeavenStudio.StudioDance
|
||||||
{
|
{
|
||||||
public class Dancer : MonoBehaviour
|
public class Dancer : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] ChoreographyInfo debugChoreography;
|
||||||
private Animator animator;
|
private Animator animator;
|
||||||
private double lastReportedBeat = 0f;
|
|
||||||
private double currentBeat = 0f;
|
private double currentBeat = 0f;
|
||||||
|
|
||||||
private bool isDance = false;
|
private bool isDance = false;
|
||||||
|
|
||||||
|
private ChoreographyInfo currentChoreography;
|
||||||
|
private double totalChoreographyLength = 0f;
|
||||||
|
|
||||||
|
public void SetChoreography(ChoreographyInfo choreography)
|
||||||
|
{
|
||||||
|
currentChoreography = choreography;
|
||||||
|
totalChoreographyLength = 0f;
|
||||||
|
foreach (var step in choreography.choreographySteps)
|
||||||
|
{
|
||||||
|
totalChoreographyLength += step.beatLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
|
|
||||||
|
var gm = GameManager.instance;
|
||||||
|
if (gm != null)
|
||||||
|
{
|
||||||
|
gm.onBeatPulse += OnBeatPulse;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debugChoreography != null)
|
||||||
|
{
|
||||||
|
SetChoreography(debugChoreography);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
currentBeat = beat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
if (cond == null || !cond.isPlaying)
|
if (currentChoreography == null || cond == null) return;
|
||||||
|
if (!cond.isPlaying)
|
||||||
{
|
{
|
||||||
if (!isDance) return;
|
if (!isDance) return;
|
||||||
if (currentBeat % 2 != 0)
|
if (currentBeat % 2 != 0)
|
||||||
{
|
{
|
||||||
animator.DoScaledAnimationAsync("MakerPoseL");
|
animator.DoScaledAnimationAsync(currentChoreography.poseStateOdd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
animator.DoScaledAnimationAsync("MakerPoseR");
|
animator.DoScaledAnimationAsync(currentChoreography.poseStateEven);
|
||||||
}
|
}
|
||||||
isDance = false;
|
isDance = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isDance = true;
|
isDance = true;
|
||||||
|
|
||||||
if (cond.ReportBeat(ref lastReportedBeat))
|
double choreoBeat = cond.songPositionInBeatsAsDouble % totalChoreographyLength;
|
||||||
{
|
double cycleStartBeat = Math.Floor(cond.songPositionInBeatsAsDouble / totalChoreographyLength) * totalChoreographyLength;
|
||||||
currentBeat = lastReportedBeat;
|
|
||||||
}
|
|
||||||
else if (cond.songPositionInBeats < lastReportedBeat)
|
|
||||||
{
|
|
||||||
lastReportedBeat = Mathf.Round(cond.songPositionInBeats);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentBeat % 2 != 0)
|
double beatSum = 0.0;
|
||||||
|
double stepLength = 0.0;
|
||||||
|
string stepState = "";
|
||||||
|
foreach (ChoreographyInfo.ChoreographyStep s in currentChoreography.choreographySteps)
|
||||||
{
|
{
|
||||||
animator.DoScaledAnimation("MakerL", currentBeat);
|
if (choreoBeat > beatSum && choreoBeat < beatSum + s.beatLength)
|
||||||
|
{
|
||||||
|
stepLength = s.beatLength;
|
||||||
|
stepState = s.stateName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
beatSum += s.beatLength;
|
||||||
}
|
}
|
||||||
else
|
if (stepState is not null or "")
|
||||||
{
|
{
|
||||||
animator.DoScaledAnimation("MakerR", currentBeat);
|
animator.DoScaledAnimation(stepState, cycleStartBeat + beatSum, stepLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace HeavenStudio.Util
|
||||||
/// <param name="length">duration of animation (progress 1.0)</param>
|
/// <param name="length">duration of animation (progress 1.0)</param>
|
||||||
/// <param name="timeScale">multiplier for animation progress (smaller values make animation slower)</param>
|
/// <param name="timeScale">multiplier for animation progress (smaller values make animation slower)</param>
|
||||||
/// <param name="animLayer">animator layer to play animation on</param>
|
/// <param name="animLayer">animator layer to play animation on</param>
|
||||||
public static void DoScaledAnimation(this Animator anim, string animName, double startTime, float length = 1f, float timeScale = 1f, int animLayer = -1, bool clamp = false)
|
public static void DoScaledAnimation(this Animator anim, string animName, double startTime, double length = 1, float timeScale = 1f, int animLayer = -1, bool clamp = false)
|
||||||
{
|
{
|
||||||
if (anim == null) return;
|
if (anim == null) return;
|
||||||
float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale;
|
float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue