cart guy is awesome. and tack reaction.

🐱 🐱 🐱 🐱 🐱
This commit is contained in:
AstrlJelly 2023-12-19 18:30:19 -05:00
parent 9b19134fac
commit 7db74c03c7
8 changed files with 553 additions and 50 deletions

View file

@ -1,5 +1,31 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-9008917868659873937
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MoveLeft
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: 77aa89fd26040bc44851871d6dc2e147, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &-4704827389909949502 --- !u!1107 &-4704827389909949502
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 6 serializedVersion: 6
@ -14,7 +40,10 @@ AnimatorStateMachine:
m_Position: {x: 270, y: 50, z: 0} m_Position: {x: 270, y: 50, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -920925156090114162} m_State: {fileID: -920925156090114162}
m_Position: {x: 270, y: 110, z: 0} m_Position: {x: 160, y: 110, z: 0}
- serializedVersion: 1
m_State: {fileID: -9008917868659873937}
m_Position: {x: 380, y: 110, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
@ -58,7 +87,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: Move m_Name: MoveRight
m_Speed: 1 m_Speed: 1
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions: []

View file

@ -0,0 +1,285 @@
%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: CartguyMoveLeft
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: 15, y: -4.5, z: 0.07427993}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: -31.5, 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: -16.5, y: -4.5, z: 0.07427993}
inSlope: {x: -31.5, 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: CartGuy
m_ScaleCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: -1, y: 1, z: 1}
inSlope: {x: 0, 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}
- serializedVersion: 3
time: 1
value: {x: -1, y: 1, z: 1}
inSlope: {x: 0, 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: CartGuy
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: 1110194031
attribute: 1
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 1110194031
attribute: 3
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: 15
inSlope: 0
outSlope: -31.5
tangentMode: 69
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: -16.5
inSlope: -31.5
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: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: -4.5
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: -4.5
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.y
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.07427993
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.07427993
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.z
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: -1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: -1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.x
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.y
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.z
path: CartGuy
classID: 4
script: {fileID: 0}
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 77aa89fd26040bc44851871d6dc2e147
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -6,7 +6,7 @@ AnimationClip:
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: CartguyMove m_Name: CartguyMoveRight
serializedVersion: 6 serializedVersion: 6
m_Legacy: 0 m_Legacy: 0
m_Compressed: 0 m_Compressed: 0
@ -20,17 +20,43 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: {x: -15.5, y: -4.5, z: 0.07427993} value: {x: -15, y: -4.5, z: 0.07427993}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 32.5, y: 0, z: 0} outSlope: {x: 31.5, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
weightedMode: 0 weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3 - serializedVersion: 3
time: 1 time: 1
value: {x: 17, y: -4.5, z: 0.07427993} value: {x: 16.5, y: -4.5, z: 0.07427993}
inSlope: {x: 32.5, y: 0, z: 0} inSlope: {x: 31.5, 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: CartGuy
m_ScaleCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, 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}
- serializedVersion: 3
time: 1
value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
weightedMode: 0 weightedMode: 0
@ -40,7 +66,6 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
path: CartGuy path: CartGuy
m_ScaleCurves: []
m_FloatCurves: [] m_FloatCurves: []
m_PPtrCurves: [] m_PPtrCurves: []
m_SampleRate: 60 m_SampleRate: 60
@ -57,6 +82,13 @@ AnimationClip:
typeID: 4 typeID: 4
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 1110194031
attribute: 3
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
pptrCurveMapping: [] pptrCurveMapping: []
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
@ -84,17 +116,17 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: -15.5 value: -15
inSlope: 0 inSlope: 0
outSlope: 32.5 outSlope: 31.5
tangentMode: 69 tangentMode: 69
weightedMode: 0 weightedMode: 0
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 1 time: 1
value: 17 value: 16.5
inSlope: 32.5 inSlope: 31.5
outSlope: 0 outSlope: 0
tangentMode: 69 tangentMode: 69
weightedMode: 0 weightedMode: 0
@ -163,6 +195,90 @@ AnimationClip:
path: CartGuy path: CartGuy
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.x
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.y
path: CartGuy
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalScale.z
path: CartGuy
classID: 4
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View file

@ -177,6 +177,32 @@ AnimatorState:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &-2709756463524822852
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TackMissBacon
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: 2a5c3a654d086a1499f41d1b1e6526b2, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-2460084252410259005 --- !u!1101 &-2460084252410259005
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -610,6 +636,9 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 5934958711024326403} m_State: {fileID: 5934958711024326403}
m_Position: {x: -55, y: 435, z: 0} m_Position: {x: -55, y: 435, z: 0}
- serializedVersion: 1
m_State: {fileID: -2709756463524822852}
m_Position: {x: -410, y: -10, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []

View file

@ -19,8 +19,9 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
[NonSerialized] public double startBeat; [NonSerialized] public double startBeat;
[NonSerialized] public MeatType meatType; [NonSerialized] public MeatType meatType;
[NonSerialized] public double reactionBeats = -1;
[NonSerialized] public int reaction;
private string meatTypeStr;
private bool isHit = false; private bool isHit = false;
// const float meatStart = 0; // const float meatStart = 0;
@ -50,10 +51,9 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
private void Start() private void Start()
{ {
meatTypeStr = meatType.ToString();
sr.sprite = meats[(int)meatType]; sr.sprite = meats[(int)meatType];
Debug.Log(meats[(int)meatType]); Debug.Log(startBeat);
Debug.Log(sr.sprite.name); Debug.Log(reactionBeats);
game.ScheduleInput(startBeat, 1, MeatGrinder.InputAction_Press, Hit, Miss, Nothing); game.ScheduleInput(startBeat, 1, MeatGrinder.InputAction_Press, Hit, Miss, Nothing);
} }
@ -61,22 +61,18 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
private void Update() private void Update()
{ {
Conductor cond = Conductor.instance; Conductor cond = Conductor.instance;
// if (Input.GetKey(KeyCode.G)) { // Insane.
// anim.enabled = true;
// }
Debug.Log(sr.sprite.name);
if (!isHit) if (!isHit)
{ {
double startTime = cond.GetSongPosFromBeat(startBeat); double startTime = cond.GetSongPosFromBeat(startBeat);
double hitTime = cond.GetSongPosFromBeat(startBeat + 1); double hitTime = cond.GetSongPosFromBeat(startBeat + 1);
double missTime = cond.GetSongPosFromBeat(startBeat + 1) + MeatGrinder.ngLateTime; double missTime = hitTime + MeatGrinder.ngLateTime;
double currentTime = cond.songPositionAsDouble; double currentTime = cond.songPositionAsDouble;
Vector3 lastPos = transform.position; Vector3 lastPos = transform.position;
Vector3 startPos = meatType == MeatType.LightMeat ? startPositionAlt.position : startPosition.position; Vector3 startPos = meatType == MeatType.LightMeat ? startPositionAlt.position : startPosition.position;
float hitAlongMissRatio = Vector3.Dot((startPos - missPosition.position), (startPos - hitPosition.position)); float hitAlongMissRatio = Vector3.Dot((startPos - missPosition.position), (startPos - hitPosition.position));
hitAlongMissRatio /= Vector3.Dot((startPos - missPosition.position), (startPos - missPosition.position)); hitAlongMissRatio /= Vector3.Dot((startPos - missPosition.position), (startPos - missPosition.position));
Vector3 hitOnMissPos = startPos + (missPosition.position - startPos) * hitAlongMissRatio; Vector3 hitOnMissPos = startPos + ((missPosition.position - startPos) * hitAlongMissRatio);
float totalProg = (float)((currentTime - startTime) / (missTime - startTime)); float totalProg = (float)((currentTime - startTime) / (missTime - startTime));
@ -90,9 +86,9 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
float prog = (float)((currentTime - startTime) / (hitTime - startTime)); float prog = (float)((currentTime - startTime) / (hitTime - startTime));
transform.position = Vector3.Lerp(startPos, hitOnMissPos, prog); transform.position = Vector3.Lerp(startPos, hitOnMissPos, prog);
} }
float yMul = totalProg * 2f - 1f; float yMul = (totalProg * 2f) - 1f;
float yWeight = -(yMul * yMul) + 1f; float yWeight = -(yMul * yMul) + 1f;
transform.position += Vector3.up * (meatType == MeatType.LightMeat ? meatFlyHeightAlt : meatFlyHeight) * yWeight; transform.position += (meatType == MeatType.LightMeat ? meatFlyHeightAlt : meatFlyHeight) * yWeight * Vector3.up;
// point towards the next position // point towards the next position
transform.right = transform.position - lastPos; transform.right = transform.position - lastPos;
@ -105,13 +101,19 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
anim.enabled = true; anim.enabled = true;
isHit = true; isHit = true;
game.TackAnim.SetBool("tackMeated", false); game.TackAnim.SetBool("tackMeated", false);
anim.DoScaledAnimationAsync(meatTypeStr + "Hit", 0.5f); anim.DoScaledAnimationAsync(meatType.ToString() + "Hit", 0.5f);
bool isBarely = state is >= 1f or <= -1f; bool isBarely = state is >= 1f or <= -1f;
game.bossAnnoyed = isBarely; game.bossAnnoyed = isBarely;
SoundByte.PlayOneShotGame("meatGrinder/" + (isBarely ? "tink" : "meatHit")); SoundByte.PlayOneShotGame("meatGrinder/" + (isBarely ? "tink" : "meatHit"));
game.TackAnim.DoScaledAnimationAsync("TackHit" + (isBarely ? "Barely" : "Success"), 0.5f); game.TackAnim.DoScaledAnimationAsync("TackHit" + (isBarely ? "Barely" : "Success"), 0.5f);
if (reactionBeats > 0) {
BeatAction.New(game, new List<BeatAction.Action>() {
new(startBeat + reactionBeats + 1, delegate { game.TackExpression(reaction); })
});
}
} }
private void Miss(PlayerActionEvent caller) private void Miss(PlayerActionEvent caller)
@ -120,7 +122,7 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
game.bossAnnoyed = true; game.bossAnnoyed = true;
SoundByte.PlayOneShotGame("meatGrinder/miss"); SoundByte.PlayOneShotGame("meatGrinder/miss");
game.TackAnim.DoScaledAnimationAsync("TackMiss" + meatTypeStr, 0.5f); game.TackAnim.DoScaledAnimationAsync("TackMiss" + meatType.ToString(), 0.5f);
game.TackAnim.SetBool("tackMeated", true); game.TackAnim.SetBool("tackMeated", true);
game.BossAnim.DoScaledAnimationAsync("BossMiss", 0.5f); game.BossAnim.DoScaledAnimationAsync("BossMiss", 0.5f);

View file

@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MeatGrinder.instance.MeatToss(e.beat, e["bacon"]); MeatGrinder.instance.MeatToss(e.beat, e["bacon"], e["reaction"], e["reactionBeats"]);
}, },
inactiveFunction = delegate { inactiveFunction = delegate {
MeatGrinder.QueueMeatToss(eventCaller.currentEntity); MeatGrinder.QueueMeatToss(eventCaller.currentEntity);
@ -41,6 +41,10 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("bacon", false, "Bacon Ball", "Throw a bacon ball instead of the typical meat"), new Param("bacon", false, "Bacon Ball", "Throw a bacon ball instead of the typical meat"),
new Param("reaction", MeatGrinder.TackExpressions.None, "Tack Reaction", "If this is hit, what expression should tack do?", new List<Param.CollapseParam>() {
new((x, y) => (int)x != (int)MeatGrinder.TackExpressions.None, new string[] { "reactionBeats" }),
}),
new Param("reactionBeats", new EntityTypes.Float(0.5f, 10, 1), "React After", "The amount of beats to wait until reacting"),
}, },
}, },
new GameAction("StartInterval", "Start Interval") new GameAction("StartInterval", "Start Interval")
@ -63,6 +67,13 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f, defaultLength = 0.5f,
priority = 2, priority = 2,
preFunctionLength = 1f, preFunctionLength = 1f,
parameters = new List<Param>()
{
new Param("reaction", MeatGrinder.TackExpressions.None, "Tack Reaction", "If this is hit, what expression should tack do?", new List<Param.CollapseParam>() {
new((x, y) => (int)x != (int)MeatGrinder.TackExpressions.None, new string[] { "reactionBeats" }),
}),
new Param("reactionBeats", new EntityTypes.Float(0.5f, 10, 1), "React After", "The amount of beats to wait until reacting"),
},
}, },
new GameAction("passTurn", "Pass Turn") new GameAction("passTurn", "Pass Turn")
{ {
@ -80,12 +91,14 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MeatGrinder.instance.CartGuy(e.beat, e.length, e["spider"]); MeatGrinder.instance.CartGuy(e.beat, e.length, e["spider"], e["direction"], e["ease"]);
}, },
resizable = true, resizable = true,
defaultLength = 16, defaultLength = 16,
parameters = new List<Param>() { parameters = new List<Param>() {
new Param("spider", false, "On Phone", "Put a spider in the box?"), new Param("spider", false, "On Phone", "Put a spider in the box?"),
new Param("direction", MeatGrinder.CartGuyDirection.Right, "Direction", "The direction the cart will be carted to."),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "What ease will"),
} }
}, },
} }
@ -105,15 +118,16 @@ namespace HeavenStudio.Games
public class MeatGrinder : Minigame public class MeatGrinder : Minigame
{ {
static List<QueuedInterval> queuedIntervals = new(); private static List<QueuedInterval> queuedIntervals = new();
struct QueuedInterval
private struct QueuedInterval
{ {
public double beat; public double beat;
public float length; public float length;
public bool autoPassTurn; public bool autoPassTurn;
} }
static List<RiqEntity> queuedMeats = new(); private static List<RiqEntity> queuedMeats = new();
[Header("Objects")] [Header("Objects")]
public GameObject MeatBase; public GameObject MeatBase;
@ -127,20 +141,29 @@ namespace HeavenStudio.Games
[Header("Variables")] [Header("Variables")]
private bool bossBop = true; private bool bossBop = true;
public bool bossAnnoyed = false; public bool bossAnnoyed = false;
public Util.EasingFunction.Ease cartEase = Util.EasingFunction.Ease.Linear;
public double cartBeat = double.MaxValue; public double cartBeat = double.MaxValue;
public float cartLength = 0; public float cartLength = 0;
public bool cartSpider = false; public bool cartSpider = false;
const string sfxName = "meatGrinder/"; public string cartDir = "Left";
private const string sfxName = "meatGrinder/";
public static MeatGrinder instance; public static MeatGrinder instance;
public enum TackExpressions public enum TackExpressions
{ {
None,
Content, Content,
// Smug, // Smug,
Wonder, Wonder,
} }
public enum CartGuyDirection
{
Right,
Left,
}
protected static bool IA_PadAny(out double dt) protected static bool IA_PadAny(out double dt)
{ {
return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt) return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt)
@ -175,7 +198,7 @@ namespace HeavenStudio.Games
if (passedTurns.Count > 0) if (passedTurns.Count > 0)
{ {
foreach (var pass in passedTurns) foreach (double pass in passedTurns)
{ {
PassTurnStandalone(pass); PassTurnStandalone(pass);
} }
@ -186,8 +209,11 @@ namespace HeavenStudio.Games
{ {
// CartGuyParentAnim.gameObject.SetActive(true); // CartGuyParentAnim.gameObject.SetActive(true);
if (cartSpider) CartGuyAnim.Play("Phone", 0, 0); if (cartSpider) CartGuyAnim.Play("Phone", 0, 0);
float beatPos = Conductor.instance.GetPositionFromBeat(cartBeat, cartLength); float normalizedBeat = Conductor.instance.GetPositionFromBeat(cartBeat, cartLength);
CartGuyParentAnim.DoNormalizedAnimation("Move", beatPos); Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(cartEase);
float newPos = func(0f, 1f, normalizedBeat);
CartGuyParentAnim.DoNormalizedAnimation($"Move{cartDir}", newPos);
if (normalizedBeat >= 1) cartLength = 0;
} }
} }
@ -212,7 +238,7 @@ namespace HeavenStudio.Games
} }
if (queuedMeats.Count > 0) if (queuedMeats.Count > 0)
{ {
foreach (var meat in queuedMeats) MeatToss(meat.beat, meat["bacon"]); foreach (var meat in queuedMeats) MeatToss(meat.beat, meat["bacon"], meat["reaction"], meat["reactionBeats"]);
queuedMeats.Clear(); queuedMeats.Clear();
} }
OnPlay(beat); OnPlay(beat);
@ -223,7 +249,7 @@ namespace HeavenStudio.Games
RiqEntity cg = GameManager.instance.Beatmap.Entities.Find(c => c.datamodel == "meatGrinder/cartGuy"); RiqEntity cg = GameManager.instance.Beatmap.Entities.Find(c => c.datamodel == "meatGrinder/cartGuy");
if (cg != null) if (cg != null)
{ {
CartGuy(cg.beat, cg.length, cg["spider"]); CartGuy(cg.beat, cg.length, cg["spider"], cg["direction"], cg["ease"]);
} }
} }
@ -237,16 +263,16 @@ namespace HeavenStudio.Games
bossBop = autoBop; bossBop = autoBop;
if (doesBop) if (doesBop)
{ {
var actions = new List<BeatAction.Action>();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
BeatAction.New(instance, new List<BeatAction.Action>() { actions.Add( new BeatAction.Action(beat + i, delegate {
new BeatAction.Action(beat + i, delegate { if (!BossAnim.IsPlayingAnimationNames("BossCall", "BossSignal")) {
if (!BossAnim.IsPlayingAnimationNames("BossCall") && !BossAnim.IsPlayingAnimationNames("BossSignal")) { BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f); }
} }));
})
});
} }
BeatAction.New(instance, actions);
} }
} }
@ -257,11 +283,13 @@ namespace HeavenStudio.Games
Debug.Log(anim); Debug.Log(anim);
} }
public void CartGuy(double beat, float length, bool spider) public void CartGuy(double beat, float length, bool spider, int direction, int ease)
{ {
cartBeat = beat; cartBeat = beat;
cartLength = length; cartLength = length;
cartSpider = spider; cartSpider = spider;
cartDir = direction == 0 ? "Right" : "Left";
cartEase = (Util.EasingFunction.Ease)ease;
} }
public static void PreInterval(double beat, float length, bool autoPassTurn) public static void PreInterval(double beat, float length, bool autoPassTurn)
@ -318,7 +346,7 @@ namespace HeavenStudio.Games
queuedMeats.Add(entity); queuedMeats.Add(entity);
} }
public void MeatToss(double beat, bool bacon) public void MeatToss(double beat, bool bacon, int reaction, float reactionBeat)
{ {
SoundByte.PlayOneShotGame(sfxName + "toss"); SoundByte.PlayOneShotGame(sfxName + "toss");
@ -326,6 +354,8 @@ namespace HeavenStudio.Games
meat.gameObject.SetActive(true); meat.gameObject.SetActive(true);
meat.startBeat = beat; meat.startBeat = beat;
meat.meatType = bacon ? Meat.MeatType.BaconBall : Meat.MeatType.DarkMeat; meat.meatType = bacon ? Meat.MeatType.BaconBall : Meat.MeatType.DarkMeat;
meat.reactionBeats = reactionBeat;
meat.reaction = reaction;
} }
public static void PrePassTurn(double beat) public static void PrePassTurn(double beat)
@ -356,12 +386,16 @@ namespace HeavenStudio.Games
for (int i = 0; i < allCallEvents.Count; i++) for (int i = 0; i < allCallEvents.Count; i++)
{ {
double relativeBeat = allCallEvents[i].beat - intervalBeat; double relativeBeat = allCallEvents[i].beat - intervalBeat;
float reactionBeats = allCallEvents[i]["reactionBeats"];
int reaction = allCallEvents[i]["reaction"];
meatCalls.Add(new BeatAction.Action(beat + relativeBeat - 1, delegate meatCalls.Add(new BeatAction.Action(beat + relativeBeat - 1, delegate
{ {
Meat Meat = Instantiate(MeatBase, transform).GetComponent<Meat>(); Meat meat = Instantiate(MeatBase, transform).GetComponent<Meat>();
Meat.gameObject.SetActive(true); meat.gameObject.SetActive(true);
Meat.startBeat = beat + relativeBeat - 1; meat.startBeat = beat + relativeBeat - 1;
Meat.meatType = Meat.MeatType.LightMeat; meat.meatType = Meat.MeatType.LightMeat;
meat.reactionBeats = reactionBeats;
meat.reaction = reaction;
})); }));
} }
BeatAction.New(this, meatCalls); BeatAction.New(this, meatCalls);