Fixed ForkLifter hand grab bug

This commit is contained in:
Starpelly 2021-12-23 22:36:16 -05:00
parent 3d103fbf7a
commit cb79307b46
14 changed files with 1545 additions and 58 deletions

File diff suppressed because it is too large Load diff

View file

@ -160,8 +160,79 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
path: wig path: wig
m_FloatCurves: [] m_FloatCurves:
m_PPtrCurves: [] - curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handright
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handleft
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handstogether
classID: 1
script: {fileID: 0}
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 5681663196660831668, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
attribute: m_Sprite
path: Hands/handleft
classID: 212
script: {fileID: 0}
- curve:
- time: 0
value: {fileID: -9049834619027126771, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
attribute: m_Sprite
path: Hands/handright
classID: 212
script: {fileID: 0}
m_SampleRate: 60 m_SampleRate: 60
m_WrapMode: 0 m_WrapMode: 0
m_Bounds: m_Bounds:
@ -169,6 +240,41 @@ AnimationClip:
m_Extent: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant: m_ClipBindingConstant:
genericBindings: genericBindings:
- serializedVersion: 2
path: 73026576
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 986104082
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 604036472
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 986104082
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
- serializedVersion: 2
path: 73026576
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
- serializedVersion: 2 - serializedVersion: 2
path: 3373695954 path: 3373695954
attribute: 1 attribute: 1
@ -232,13 +338,15 @@ AnimationClip:
typeID: 4 typeID: 4
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
pptrCurveMapping: [] pptrCurveMapping:
- {fileID: 5681663196660831668, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: -9049834619027126771, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0 m_AdditiveReferencePoseTime: 0
m_StartTime: 0 m_StartTime: 0
m_StopTime: 0 m_StopTime: 0.016666668
m_OrientationOffsetY: 0 m_OrientationOffsetY: 0
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
@ -767,6 +875,63 @@ AnimationClip:
path: legs_2 path: legs_2
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handright
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handleft
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Hands/handstogether
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -168,6 +168,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a7c8ebd2f1b0ce448acc55b6f6608e15, type: 3} m_Script: {fileID: 11500000, guid: a7c8ebd2f1b0ce448acc55b6f6608e15, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
firstEnable: 0
LionLeft: {fileID: 1962334731} LionLeft: {fileID: 1962334731}
faces: faces:
- {fileID: -5723618315912617923, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3} - {fileID: -5723618315912617923, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
@ -695,13 +696,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 206313026} m_GameObject: {fileID: 206313026}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -3.615, y: -1.491, z: 0} m_LocalPosition: {x: -3.615, y: -1.491, z: 0}
m_LocalScale: {x: 1.58387, y: 1.58387, z: 1.4072311} m_LocalScale: {x: 1.58387, y: 1.58387, z: 1.4072311}
m_Children: m_Children:
- {fileID: 209416149} - {fileID: 209416149}
m_Father: {fileID: 950172045} m_Father: {fileID: 610701222}
m_RootOrder: 3 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &206313028 --- !u!212 &206313028
SpriteRenderer: SpriteRenderer:
@ -1554,7 +1555,7 @@ AudioSource:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: ebc898cbaf3e679438e83c68552e527f, type: 3} m_audioClip: {fileID: 8300000, guid: 51af38323954a8d44874780ba4577fb4, type: 3}
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -1680,10 +1681,10 @@ Transform:
m_GameObject: {fileID: 490794386} m_GameObject: {fileID: 490794386}
m_LocalRotation: {x: -0, y: -0, z: 0.1258703, w: -0.9920467} m_LocalRotation: {x: -0, y: -0, z: 0.1258703, w: -0.9920467}
m_LocalPosition: {x: -3.916, y: -0.299, z: 0} m_LocalPosition: {x: -3.916, y: -0.299, z: 0}
m_LocalScale: {x: 1.1646066, y: 1.1646066, z: 0.7352917} m_LocalScale: {x: 1.1646065, y: 1.164606, z: 0.7352917}
m_Children: [] m_Children: []
m_Father: {fileID: 950172045} m_Father: {fileID: 610701222}
m_RootOrder: 5 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -14.462} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -14.462}
--- !u!212 &490794388 --- !u!212 &490794388
SpriteRenderer: SpriteRenderer:
@ -1760,12 +1761,12 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 510428302} m_GameObject: {fileID: 510428302}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -3.1557, y: -0.172, z: 0} m_LocalPosition: {x: -3.1557, y: -0.172, z: 0}
m_LocalScale: {x: 1.8510822, y: 1.8510822, z: 1.1687083} m_LocalScale: {x: 1.8510822, y: 1.8510822, z: 1.1687083}
m_Children: [] m_Children: []
m_Father: {fileID: 950172045} m_Father: {fileID: 610701222}
m_RootOrder: 4 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &510428304 --- !u!212 &510428304
SpriteRenderer: SpriteRenderer:
@ -2229,6 +2230,40 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &610701221
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 610701222}
m_Layer: 0
m_Name: ClapEffect
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &610701222
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 610701221}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 206313027}
- {fileID: 510428303}
- {fileID: 490794387}
- {fileID: 2145437457}
m_Father: {fileID: 950172045}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &628922112 --- !u!1 &628922112
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2724,7 +2759,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 1001 m_SortingOrder: 30000
m_Sprite: {fileID: 21300000, guid: 3a0a4652ccc94254cade74a22a70f3ea, type: 3} m_Sprite: {fileID: 21300000, guid: 3a0a4652ccc94254cade74a22a70f3ea, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 1} m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FlipX: 0 m_FlipX: 0
@ -3357,10 +3392,7 @@ Transform:
- {fileID: 741732138} - {fileID: 741732138}
- {fileID: 601068311} - {fileID: 601068311}
- {fileID: 1810132821} - {fileID: 1810132821}
- {fileID: 206313027} - {fileID: 610701222}
- {fileID: 510428303}
- {fileID: 490794387}
- {fileID: 2145437457}
m_Father: {fileID: 1962334732} m_Father: {fileID: 1962334732}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -4267,6 +4299,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b91bd072f874c8746bee1afaf6dac3b4, type: 3} m_Script: {fileID: 11500000, guid: b91bd072f874c8746bee1afaf6dac3b4, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
firstEnable: 0
ForkLifterHand: {fileID: 1144790346} ForkLifterHand: {fileID: 1144790346}
handAnim: {fileID: 1144790345} handAnim: {fileID: 1144790345}
flickedObject: {fileID: 1671500045} flickedObject: {fileID: 1671500045}
@ -7024,7 +7057,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 32767 m_SortingOrder: 26766
m_Sprite: {fileID: 7482667652216324306, guid: ef2fa2a75dc283e40b9d4fe1f20dc6fb, type: 3} m_Sprite: {fileID: 7482667652216324306, guid: ef2fa2a75dc283e40b9d4fe1f20dc6fb, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 1} m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FlipX: 0 m_FlipX: 0
@ -7242,8 +7275,8 @@ Transform:
m_LocalPosition: {x: -2.2534251, y: -0.30203432, z: 0} m_LocalPosition: {x: -2.2534251, y: -0.30203432, z: 0}
m_LocalScale: {x: -1.1646066, y: 1.1646066, z: 0.7352917} m_LocalScale: {x: -1.1646066, y: 1.1646066, z: 0.7352917}
m_Children: [] m_Children: []
m_Father: {fileID: 950172045} m_Father: {fileID: 610701222}
m_RootOrder: 6 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 29.4} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 29.4}
--- !u!212 &2145437458 --- !u!212 &2145437458
SpriteRenderer: SpriteRenderer:

View file

@ -15,6 +15,7 @@ namespace RhythmHeavenMania
public Transform GamesHolder; public Transform GamesHolder;
private float currentBeat; private float currentBeat;
private float currentLength; private float currentLength;
private string currentSwitchGame;
public delegate void EventCallback(); public delegate void EventCallback();
@ -56,7 +57,8 @@ namespace RhythmHeavenMania
{ {
new MiniGame("gameManager", new List<GameAction>() new MiniGame("gameManager", new List<GameAction>()
{ {
new GameAction("end", delegate { Debug.Log("end"); }) new GameAction("end", delegate { Debug.Log("end"); }),
new GameAction("switchGame", delegate { GameManager.instance.SwitchGame(currentSwitchGame); })
}), }),
new MiniGame("forkLifter", new List<GameAction>() new MiniGame("forkLifter", new List<GameAction>()
{ {
@ -73,10 +75,10 @@ namespace RhythmHeavenMania
// Claps // Claps
new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ), new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ),
new GameAction("bop", delegate { ClappyTrio.instance.Bop(); }, true ), new GameAction("bop", delegate { ClappyTrio.instance.Bop(); } ),
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); }, true ), new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ),
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); }, true ), new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ),
}) })
}; };
@ -117,6 +119,8 @@ namespace RhythmHeavenMania
{ {
currentLength = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length; currentLength = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length;
if (details.Length > 2) currentSwitchGame = details[2];
GameAction action = game.actions.Find(c => c.actionName == details[1]); GameAction action = game.actions.Find(c => c.actionName == details[1]);
action.function.Invoke(); action.function.Invoke();
@ -130,7 +134,7 @@ namespace RhythmHeavenMania
} }
} }
public static List<Beatmap.Entity> GetAllInGameManagerListExcept(string gameName, string[] exclude) public static List<Beatmap.Entity> GetAllInGameManagerList(string gameName, string[] exclude)
{ {
List<Beatmap.Entity> temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); List<Beatmap.Entity> temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
List<Beatmap.Entity> temp2 = new List<Beatmap.Entity>(); List<Beatmap.Entity> temp2 = new List<Beatmap.Entity>();
@ -143,5 +147,21 @@ namespace RhythmHeavenMania
} }
return temp2; return temp2;
} }
public static List<Beatmap.Entity> GetAllPlayerEntities(string gameName)
{
return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
}
public static List<Beatmap.Entity> GetAllPlayerEntitiesExcept(string gameName)
{
return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] != gameName);
}
// elaborate as fuck, boy
public static List<Beatmap.Entity> GetAllPlayerEntitiesExceptBeforeBeat(string gameName, float beat)
{
return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] != gameName && c.beat < beat);
}
} }
} }

View file

@ -6,6 +6,7 @@ using UnityEngine;
using Starpelly; using Starpelly;
using Newtonsoft.Json; using Newtonsoft.Json;
using RhythmHeavenMania.Games;
namespace RhythmHeavenMania namespace RhythmHeavenMania
{ {
@ -23,6 +24,9 @@ namespace RhythmHeavenMania
public float startOffset; public float startOffset;
[Header("Games")]
Coroutine currentGameSwitchIE;
private string currentGame;
private void Awake() private void Awake()
{ {
@ -45,6 +49,8 @@ namespace RhythmHeavenMania
Conductor.instance.SetBpm(Beatmap.bpm); Conductor.instance.SetBpm(Beatmap.bpm);
StartCoroutine(Begin()); StartCoroutine(Begin());
currentGame = eventCaller.GamesHolder.GetComponentsInChildren<Transform>()[1].name;
} }
private IEnumerator Begin() private IEnumerator Begin()
@ -97,6 +103,26 @@ namespace RhythmHeavenMania
} }
} }
public void SwitchGame(string game)
{
if (currentGameSwitchIE != null) StopCoroutine(currentGameSwitchIE);
currentGameSwitchIE = StartCoroutine(SwitchGameIE(game));
}
IEnumerator SwitchGameIE(string game)
{
this.GetComponent<SpriteRenderer>().enabled = true;
eventCaller.minigames.Find(c => c.name == currentGame).holder.SetActive(false);
eventCaller.minigames.Find(c => c.name == game).holder.SetActive(true);
eventCaller.minigames.Find(c => c.name == game).holder.GetComponent<Minigame>().OnGameSwitch();
currentGame = game;
yield return new WaitForSeconds(0.1666f);
this.GetComponent<SpriteRenderer>().enabled = false;
}
private void OnGUI() private void OnGUI()
{ {

View file

@ -6,7 +6,7 @@ using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.ClappyTrio namespace RhythmHeavenMania.Games.ClappyTrio
{ {
public class ClappyTrio : MonoBehaviour public class ClappyTrio : Minigame
{ {
[SerializeField] private GameObject LionLeft; [SerializeField] private GameObject LionLeft;
private GameObject LionMiddle; private GameObject LionMiddle;
@ -24,7 +24,6 @@ namespace RhythmHeavenMania.Games.ClappyTrio
public bool playerHitLast = false; public bool playerHitLast = false;
public static ClappyTrio instance { get; set; } public static ClappyTrio instance { get; set; }
private void Awake() private void Awake()
@ -32,6 +31,14 @@ namespace RhythmHeavenMania.Games.ClappyTrio
instance = this; instance = this;
} }
public override void OnGameSwitch()
{
SetFace(0, 0);
SetFace(1, 0);
SetFace(2, 0);
PlayAnimationAll("Idle");
}
private void Start() private void Start()
{ {
LionMiddle = Instantiate(LionLeft, LionLeft.transform.parent); LionMiddle = Instantiate(LionLeft, LionLeft.transform.parent);
@ -76,12 +83,16 @@ namespace RhythmHeavenMania.Games.ClappyTrio
clapIndex = 0; clapIndex = 0;
isClapping = false; isClapping = false;
currentClappingLength = 0; currentClappingLength = 0;
ClappyTrioPlayer.clapStarted = false;
} }
} }
} }
public void Clap(float beat, float length) public void Clap(float beat, float length)
{ {
ClappyTrioPlayer.clapStarted = true;
ClappyTrioPlayer.canHit = true; // this is technically a lie, this just restores the ability to hit
playerHitLast = false; playerHitLast = false;
isClapping = true; isClapping = true;
lastClapStart = beat; lastClapStart = beat;
@ -105,14 +116,20 @@ namespace RhythmHeavenMania.Games.ClappyTrio
SetFace(1, 1); SetFace(1, 1);
SetFace(2, 1); SetFace(2, 1);
} }
else
{
SetFace(0, 2);
SetFace(1, 2);
SetFace(2, 0);
}
PlayAnimationAll("Bop"); PlayAnimationAll("Bop");
} }
private void PlayAnimationAll(string anim) private void PlayAnimationAll(string anim)
{ {
LionLeft.GetComponent<Animator>().Play(anim, 0, 0); LionLeft.GetComponent<Animator>().Play(anim, -1, 0);
LionMiddle.GetComponent<Animator>().Play(anim, 0, 0); LionMiddle.GetComponent<Animator>().Play(anim, -1, 0);
LionPlayer.GetComponent<Animator>().Play(anim, 0, 0); LionPlayer.GetComponent<Animator>().Play(anim, -1, 0);
} }
public void SetFace(int lion, int type) public void SetFace(int lion, int type)

View file

@ -17,10 +17,20 @@ namespace RhythmHeavenMania.Games.ClappyTrio
private int lastIndex; private int lastIndex;
private float perfectTime = 0.25f, lateTime = 0.46f; private float perfectTime = 0.25f, lateTime = 0.43f;
private bool hit; private bool hit;
public bool clapStarted = false;
public bool canHit;
private GameObject clapEffect;
private void Start()
{
clapEffect = transform.GetChild(4).GetChild(3).gameObject;
}
private void Update() private void Update()
{ {
if (PlayerInput.Pressed()) if (PlayerInput.Pressed())
@ -79,13 +89,20 @@ namespace RhythmHeavenMania.Games.ClappyTrio
if (canHit) if (canHit)
{ {
clapEffect.SetActive(true);
Jukebox.PlayOneShotGame("clappyTrio/rightClap"); Jukebox.PlayOneShotGame("clappyTrio/rightClap");
ClappyTrio.instance.playerHitLast = true;
if (this.canHit)
ClappyTrio.instance.playerHitLast = true;
} }
else else
{ {
clapEffect.SetActive(false);
Jukebox.PlayOneShot("miss"); Jukebox.PlayOneShot("miss");
ClappyTrio.instance.playerHitLast = false; ClappyTrio.instance.playerHitLast = false;
if (clapStarted)
this.canHit = false;
} }
ClappyTrio.instance.SetFace(2, 4); ClappyTrio.instance.SetFace(2, 4);

View file

@ -8,7 +8,7 @@ using DG.Tweening;
namespace RhythmHeavenMania.Games.ForkLifter namespace RhythmHeavenMania.Games.ForkLifter
{ {
public class ForkLifter : MonoBehaviour public class ForkLifter : Minigame
{ {
public static ForkLifter instance; public static ForkLifter instance;
@ -33,6 +33,12 @@ namespace RhythmHeavenMania.Games.ForkLifter
instance = this; instance = this;
} }
public override void OnGameSwitch()
{
ForkLifterHand.CheckNextFlick();
ForkLifterPlayer.instance.RemoveObjFromFork();
}
private void Start() private void Start()
{ {
GameManager = GameManager.instance; GameManager = GameManager.instance;

View file

@ -17,27 +17,29 @@ namespace RhythmHeavenMania.Games.ForkLifter
public void CheckNextFlick() public void CheckNextFlick()
{ {
allPlayerActions = EventCaller.GetAllInGameManagerListExcept("forkLifter", new string[] { "gulp", "sigh", "prepare" }); // allPlayerActions = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "gulp", "sigh", "prepare" });
allPlayerActions = EventCaller.GetAllPlayerEntities("forkLifter");
int currentPlayerEvent = GameManager.instance.currentPlayerEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("forkLifter", Conductor.instance.songPositionInBeats).Count;
if (GameManager.instance.currentPlayerEvent < allPlayerActions.Count) if (currentPlayerEvent < allPlayerActions.Count)
{ {
switch (allPlayerActions[GameManager.instance.currentPlayerEvent].datamodel.Split('/')[1]) switch (allPlayerActions[currentPlayerEvent].datamodel.Split('/')[1])
{ {
case "pea": case "pea":
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0]; ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
fastSprite.sprite = fastSprites[0]; fastSprite.sprite = fastSprites[0];
break; break;
case "topbun": case "topbun":
fastSprite.sprite = fastSprites[0];
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1]; ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
fastSprite.sprite = fastSprites[0];
break; break;
case "burger": case "burger":
fastSprite.sprite = fastSprites[1];
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2]; ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
fastSprite.sprite = fastSprites[1];
break; break;
case "bottombun": case "bottombun":
fastSprite.sprite = fastSprites[0];
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3]; ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
fastSprite.sprite = fastSprites[0];
break; break;
} }
} }

View file

@ -105,6 +105,11 @@ namespace RhythmHeavenMania.Games.ForkLifter
} }
} }
RemoveObjFromFork();
}
public void RemoveObjFromFork()
{
for (int i = 0; i < early.transform.childCount; i++) for (int i = 0; i < early.transform.childCount; i++)
{ {
Destroy(early.transform.GetChild(i).gameObject); Destroy(early.transform.GetChild(i).gameObject);
@ -220,7 +225,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
FastEffectHit(EligibleHits[currentHitInList].pea.type); FastEffectHit(EligibleHits[currentHitInList].pea.type);
Jukebox.PlayOneShotGame("miss"); Jukebox.PlayOneShot("miss");
currentEarlyPeasOnFork++; currentEarlyPeasOnFork++;
@ -249,7 +254,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
FastEffectHit(EligibleHits[currentHitInList].pea.type); FastEffectHit(EligibleHits[currentHitInList].pea.type);
Jukebox.PlayOneShotGame("miss"); Jukebox.PlayOneShot("miss");
currentLatePeasOnFork++; currentLatePeasOnFork++;

View file

@ -73,7 +73,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
if (normalizedBeat > endTime && endstate <= 1) if (normalizedBeat > endTime && endstate <= 1)
{ {
endstate++; endstate++;
Jukebox.PlayOneShotGame("audience/disappointed"); Jukebox.PlayOneShot("audience/disappointed");
} }
if (normalizedBeat > 1.35f) if (normalizedBeat > 1.35f)

View file

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania.Games
{
public class Minigame : MonoBehaviour
{
public int firstEnable = 0;
public virtual void OnGameSwitch()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c59cddacfd5c42547b00e692560a8312
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,5 @@
{ {
"bpm": 117.26, "bpm": 130,
"entities": [ "entities": [
{ {
"beat": 1, "beat": 1,
@ -67,6 +67,58 @@
{ {
"beat": 19, "beat": 19,
"datamodel": "clappyTrio/bop" "datamodel": "clappyTrio/bop"
},
{
"beat": 28,
"datamodel": "gameManager/switchGame/forkLifter"
},
{
"beat": 29,
"datamodel": "forkLifter/pea"
},
{
"beat": 32,
"datamodel": "gameManager/switchGame/clappyTrio"
},
{
"beat": 33,
"length": 1,
"datamodel": "clappyTrio/clap"
},
{
"beat": 36,
"datamodel": "gameManager/switchGame/forkLifter"
},
{
"beat": 37,
"datamodel": "forkLifter/pea"
},
{
"beat": 40,
"datamodel": "gameManager/switchGame/clappyTrio"
},
{
"beat": 41,
"length": 1,
"datamodel": "clappyTrio/clap"
},
{
"beat": 44,
"datamodel": "clappyTrio/bop"
},
{
"beat": 44.25,
"datamodel": "gameManager/switchGame/forkLifter"
},
{
"beat": 45,
"datamodel": "forkLifter/topbun"
},
{
"beat": 45.5,
"datamodel": "forkLifter/pea"
} }
] ]
} }