diff --git a/Assets/Resources/Games/fillbots.prefab b/Assets/Resources/Games/fillbots.prefab index a7351973e..ad2755a1d 100644 --- a/Assets/Resources/Games/fillbots.prefab +++ b/Assets/Resources/Games/fillbots.prefab @@ -517,6 +517,7 @@ GameObject: m_Component: - component: {fileID: 2070320588382753355} - component: {fileID: 4290602135507938543} + - component: {fileID: 2237466706539414986} m_Layer: 0 m_Name: Conveyer m_TagString: Untagged @@ -592,6 +593,27 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!95 &2237466706539414986 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3041902986915776654} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 65eaca3e3da4ccc4eb3ef7e44b8d2749, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1 &3486375956011209790 GameObject: m_ObjectHideFlags: 0 @@ -1302,6 +1324,10 @@ MonoBehaviour: firstEnable: 0 mediumBot: {fileID: 1884715170989137582, guid: 3de1d3cd9808711448ace845114bf9e0, type: 3} filler: {fileID: 3297081550122758325} + gears: + - {fileID: 4840209470412854651} + - {fileID: 4526144785777034668} + conveyerBelt: {fileID: 2237466706539414986} --- !u!1 &6708099093686922731 GameObject: m_ObjectHideFlags: 0 @@ -1665,7 +1691,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7653508434358181563} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 27.35, y: 0, z: 0} + m_LocalPosition: {x: 26.885, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller b/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller new file mode 100644 index 000000000..595e86461 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller @@ -0,0 +1,101 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-3986231019882260814 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3900114388803756193} + m_Position: {x: 200, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: -1786993670294510315} + m_Position: {x: 235, y: 65, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3900114388803756193} +--- !u!1102 &-3900114388803756193 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ConveyerIdle + 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: be83c0b595a6a6b46a5b9a9664af8c40, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &-1786993670294510315 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Move + 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: 5cefc5fbcc67ff04b924cc8e197d0cc4, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Conveyer + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -3986231019882260814} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller.meta b/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller.meta new file mode 100644 index 000000000..b7061c841 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/Conveyer.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65eaca3e3da4ccc4eb3ef7e44b8d2749 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim b/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim new file mode 100644 index 000000000..514c900e2 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim @@ -0,0 +1,53 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ConveyerIdle + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: [] + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim.meta b/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim.meta new file mode 100644 index 000000000..0415461f0 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/ConveyerIdle.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be83c0b595a6a6b46a5b9a9664af8c40 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim b/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim new file mode 100644 index 000000000..d064bc2e5 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim @@ -0,0 +1,169 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Move + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0.16, y: -4.57, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: -13.4425, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1 + value: {x: -13.2825, y: -4.57, z: 0} + inSlope: {x: -13.4425, y: -0, z: -0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.16 + inSlope: 0 + outSlope: -13.4425 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: -13.2825 + inSlope: -13.4425 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -4.57 + inSlope: 0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: -4.57 + inSlope: -0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim.meta b/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim.meta new file mode 100644 index 000000000..b0b65c1f0 --- /dev/null +++ b/Assets/Resources/Sprites/Games/Fillbots/Animations/Move.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5cefc5fbcc67ff04b924cc8e197d0cc4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Fillbots/Fillbots.cs b/Assets/Scripts/Games/Fillbots/Fillbots.cs index 578bdfccc..ad3c2ed9a 100644 --- a/Assets/Scripts/Games/Fillbots/Fillbots.cs +++ b/Assets/Scripts/Games/Fillbots/Fillbots.cs @@ -25,6 +25,8 @@ namespace HeavenStudio.Games.Loaders namespace HeavenStudio.Games { using Scripts_Fillbots; + using System; + public class Fillbots : Minigame { private struct QueuedFillbot @@ -39,9 +41,17 @@ namespace HeavenStudio.Games [Header("Components")] [SerializeField] private NtrFillbot mediumBot; public Animator filler; + [SerializeField] private Transform[] gears; + [SerializeField] private Animator conveyerBelt; public static Fillbots instance; + [NonSerialized] public List currentBots = new List(); + + [NonSerialized] public double conveyerStartBeat = -1; + + [NonSerialized] public float conveyerNormalizedOffset; + private void Awake() { instance = this; @@ -79,6 +89,49 @@ namespace HeavenStudio.Games filler.DoScaledAnimationAsync("Release", 0.5f); SoundByte.PlayOneShotGame("fillbots/armRetractionWhiff"); } + + if (conveyerStartBeat >= 0) + { + float normalizedBeat = cond.GetPositionFromBeat(conveyerStartBeat, 1); + + if (normalizedBeat >= 0) + { + for (int i = 0; i < currentBots.Count; i++) + { + var bot = currentBots[i]; + bot.MoveConveyer(normalizedBeat); + } + conveyerBelt.Play("Move", -1, ((normalizedBeat + conveyerNormalizedOffset) % 1) / 4); + foreach (var gear in gears) + { + gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, normalizedBeat + conveyerNormalizedOffset)); + } + } + else + { + foreach (var bot in currentBots) + { + bot.StopConveyer(); + } + conveyerBelt.Play("Move", -1, (conveyerNormalizedOffset % 1) / 4); + foreach (var gear in gears) + { + gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, conveyerNormalizedOffset)); + } + } + } + else + { + foreach (var bot in currentBots) + { + bot.StopConveyer(); + } + conveyerBelt.Play("Move", -1, (conveyerNormalizedOffset % 1) / 4); + foreach (var gear in gears) + { + gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, conveyerNormalizedOffset)); + } + } } } @@ -110,9 +163,15 @@ namespace HeavenStudio.Games spawnedBot.Init(beat); BeatAction.New(instance.gameObject, new List() { + new BeatAction.Action(beat, delegate + { + if (conveyerStartBeat != -1) conveyerNormalizedOffset = Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1); + conveyerStartBeat = -2; + }), new BeatAction.Action(beat + 3, delegate { filler.DoScaledAnimationAsync("FillerPrepare", 0.5f); + conveyerStartBeat = beat + 3; }) }); } diff --git a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs index 10e10cfbf..eb2f783ab 100644 --- a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs +++ b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs @@ -60,6 +60,10 @@ namespace HeavenStudio.Games.Scripts_Fillbots private bool holding; + private float lerpPosX; + + private bool canStop = true; + private void OnDestroy() { if (fillSound != null) fillSound.KillLoop(0); @@ -83,6 +87,29 @@ namespace HeavenStudio.Games.Scripts_Fillbots startPosX = transform.position.x; } + public void MoveConveyer(float normalized) + { + if (!headHasFallen || !bodyHasFallen || !legsHaveFallen) return; + canStop = true; + transform.position = new Vector3(Mathf.LerpUnclamped(startPosX, lerpPosX, normalized), transform.position.y); + + if (normalized >= 4) + { + game.currentBots.Remove(this); + Destroy(gameObject); + } + } + + public void StopConveyer() + { + if (!headHasFallen || !bodyHasFallen || !legsHaveFallen) return; + if (!canStop) return; + float lerpDistance = lerpPosX - startPosX; + startPosX = transform.position.x; + lerpPosX = startPosX + lerpDistance; + canStop = false; + } + public void Init(double beat) { startBeat = beat; @@ -117,6 +144,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots }); game.ScheduleInput(startBeat, 4, InputType.STANDARD_DOWN, JustHold, HoldOut, HoldOut); + + game.currentBots.Add(this); } private void Update() @@ -178,6 +207,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots fullBody.Play("HoldBarely", 0, 0); return; } + if (game.conveyerStartBeat != -1) game.conveyerNormalizedOffset = Conductor.instance.GetPositionFromBeat(game.conveyerStartBeat, 1); + game.conveyerStartBeat = -1; + transform.position = new Vector3(0, transform.position.y, 0); holding = true; fullBody.DoScaledAnimationAsync("Hold", 1f); game.filler.DoScaledAnimationAsync("Hold", 0.5f); @@ -205,6 +237,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots beepEvent.enabled = false; holding = false; game.filler.DoScaledAnimationAsync("Release", 0.5f); + if (game.conveyerStartBeat != -2) game.conveyerStartBeat = caller.timer + caller.startBeat + 1; if (state >= 1f || state <= -1f) { return;