Fixed problem with Trio faces not changing

This commit is contained in:
Starpelly 2021-12-23 19:58:48 -05:00
parent dab2379f68
commit 3d103fbf7a
15 changed files with 667 additions and 29 deletions

View file

@ -808,8 +808,6 @@ AnimationClip:
- curve:
- time: 0
value: {fileID: 1205416701152040810, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- time: 0.1
value: {fileID: 1205416701152040810, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
attribute: m_Sprite
path: head_1
classID: 212
@ -1032,7 +1030,6 @@ AnimationClip:
- {fileID: 21300000, guid: b01ec1bd0238b3443a8341bdf61719a7, type: 3}
- {fileID: 21300000, guid: 7bfc6e0ecd236df4db88e0a6734409b4, type: 3}
- {fileID: 1205416701152040810, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: 1205416701152040810, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: -2354044729926064474, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: -2354044729926064474, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: 7936729200490868366, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}

View file

@ -175,6 +175,144 @@ MonoBehaviour:
- {fileID: -7678601869563919383, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: -7561877552320588135, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
- {fileID: 1205416701152040810, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
lionHeadLeft: {fileID: 0}
lionHeadMiddle: {fileID: 0}
lionHeadPlayer: {fileID: 0}
playerHitLast: 0
--- !u!1 &96506772
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 96506773}
- component: {fileID: 96506775}
- component: {fileID: 96506774}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &96506773
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 96506772}
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: []
m_Father: {fileID: 848278998}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -1.38, y: 3.34}
m_SizeDelta: {x: 276.36, y: 38.25}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &96506774
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 96506772}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 'SongPosBeats:'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 795a65f16e097f44eb799cb2ec026fc1, type: 2}
m_sharedMaterial: {fileID: -1662932664650235619, guid: 795a65f16e097f44eb799cb2ec026fc1, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16.3
m_fontSizeBase: 19.89
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 5.3
m_fontSizeMax: 16.3
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &96506775
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 96506772}
m_CullTransparentMesh: 1
--- !u!1 &142958109
GameObject:
m_ObjectHideFlags: 0
@ -1021,6 +1159,7 @@ GameObject:
m_Component:
- component: {fileID: 366093812}
- component: {fileID: 366093811}
- component: {fileID: 366093813}
m_Layer: 0
m_Name: GameProfiler
m_TagString: Untagged
@ -1053,10 +1192,24 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.27990133, y: 0.7170337, z: 484.31635}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 967430035}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &366093813
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 366093810}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 667da2762ac6e314c91fe7636f4ff3cf, type: 3}
m_Name:
m_EditorClassIdentifier:
Template: {fileID: 848278997}
--- !u!1 &384377809
GameObject:
m_ObjectHideFlags: 0
@ -2859,6 +3012,82 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &848278997
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 848278998}
- component: {fileID: 848279000}
- component: {fileID: 848278999}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &848278998
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 848278997}
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: 96506773}
m_Father: {fileID: 967430035}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -495.03998, y: 337.52997}
m_SizeDelta: {x: 289.91, y: 44.93}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &848278999
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 848278997}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.45490196}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &848279000
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 848278997}
m_CullTransparentMesh: 1
--- !u!1 &864470280
GameObject:
m_ObjectHideFlags: 0
@ -3217,6 +3446,106 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &967430034
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 967430035}
- component: {fileID: 967430038}
- component: {fileID: 967430037}
- component: {fileID: 967430036}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &967430035
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 967430034}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 848278998}
m_Father: {fileID: 366093812}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &967430036
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 967430034}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &967430037
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 967430034}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &967430038
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 967430034}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 519420031}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 32767
m_TargetDisplay: 0
--- !u!1 &978514677
GameObject:
m_ObjectHideFlags: 0

52
Assets/Scripts/DebugUI.cs Normal file
View file

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
// hardcoded because im lazy
namespace RhythmHeavenMania
{
public class DebugUI : MonoBehaviour
{
public GameObject Template;
private TMP_Text SongPosBeats;
private TMP_Text BPM;
private TMP_Text currEvent;
private void Start()
{
for (int i = 0; i < 3; i++)
{
GameObject debug = Instantiate(Template, Template.transform.parent);
debug.SetActive(true);
debug.transform.localPosition = new Vector3(Template.transform.localPosition.x, Template.transform.localPosition.y - 44.9301f * i);
switch (i)
{
case 0:
SongPosBeats = debug.transform.GetChild(0).GetComponent<TMP_Text>();
break;
case 1:
BPM = debug.transform.GetChild(0).GetComponent<TMP_Text>();
break;
case 2:
currEvent = debug.transform.GetChild(0).GetComponent<TMP_Text>();
break;
}
}
}
private void Update()
{
SongPosBeats.text = $"SongPosBeats: {Conductor.instance.songPositionInBeats}";
BPM.text = $"BPM: {Conductor.instance.songBpm}";
if (GameManager.instance.currentEvent - 1 >= 0)
currEvent.text = $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - 1].datamodel}";
else
currEvent.text = $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].datamodel}";
}
}
}

View file

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

View file

@ -73,9 +73,10 @@ namespace RhythmHeavenMania
// Claps
new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ),
new GameAction("bop", delegate { ClappyTrio.instance.Bop(); }, true ),
new GameAction("prepare_0", delegate { ClappyTrio.instance.Prepare(0); }, true ),
new GameAction("prepare_4", delegate { ClappyTrio.instance.Prepare(4); }, true ),
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); }, true ),
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); }, true ),
})
};

View file

@ -58,6 +58,16 @@ namespace RhythmHeavenMania
if (Beatmap.entities.Count < 1)
return;
if (Input.GetKeyDown(KeyCode.A))
{
Conductor.instance.musicSource.time += 3;
}
else if (Input.GetKeyDown(KeyCode.S))
{
Conductor.instance.musicSource.time -= 3;
GameManager.instance.SetCurrentEventToClosest();
}
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)

View file

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania
{
public class GameProperties
{
public class Latency
{
public static float early = 0.71f;
public static float perfect = 0.74f;
public static float late = 0.84f;
}
}
}

View file

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

View file

@ -13,12 +13,18 @@ namespace RhythmHeavenMania.Games.ClappyTrio
private GameObject LionPlayer;
[SerializeField] private Sprite[] faces;
public SpriteRenderer lionHeadLeft, lionHeadMiddle, lionHeadPlayer;
private bool isClapping;
private float currentClappingLength;
private float lastClapStart;
private int clapIndex;
private ClappyTrioPlayer ClappyTrioPlayer;
public bool playerHitLast = false;
public static ClappyTrio instance { get; set; }
private void Awake()
@ -33,6 +39,12 @@ namespace RhythmHeavenMania.Games.ClappyTrio
LionPlayer = Instantiate(LionLeft, LionLeft.transform.parent);
LionPlayer.transform.localPosition = new Vector3(6.2f, 0);
ClappyTrioPlayer = LionPlayer.AddComponent<ClappyTrioPlayer>();
lionHeadLeft = LionLeft.transform.GetChild(1).GetComponent<SpriteRenderer>();
lionHeadMiddle = LionMiddle.transform.GetChild(1).GetComponent<SpriteRenderer>();
lionHeadPlayer = LionPlayer.transform.GetChild(1).GetComponent<SpriteRenderer>();
}
private void Update()
@ -43,6 +55,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
if (songPosBeat > lastClapStart && songPosBeat < lastClapStart + 1 && clapIndex == 0)
{
SetFace(0, 4);
LionLeft.GetComponent<Animator>().Play("Clap", 0, 0);
Jukebox.PlayOneShotGame("clappyTrio/leftClap");
@ -50,23 +63,26 @@ namespace RhythmHeavenMania.Games.ClappyTrio
}
else if (songPosBeat > lastClapStart + currentClappingLength && songPosBeat < lastClapStart + (currentClappingLength * 2) && clapIndex == 1)
{
SetFace(1, 4);
LionMiddle.GetComponent<Animator>().Play("Clap", 0, 0);
Jukebox.PlayOneShotGame("clappyTrio/middleClap");
clapIndex++;
}
else if (songPosBeat > lastClapStart + (currentClappingLength * 2) && clapIndex == 2)
else if (songPosBeat > lastClapStart + (currentClappingLength * 2 - 0.35f) && clapIndex == 2)
{
LionPlayer.GetComponent<Animator>().Play("Clap", 0, 0);
Jukebox.PlayOneShotGame("clappyTrio/rightClap");
ClappyTrioPlayer.SetClapAvailability(lastClapStart + (currentClappingLength * 2 - 0.35f));
clapIndex++;
clapIndex = 0;
isClapping = false;
currentClappingLength = 0;
}
}
}
public void Clap(float beat, float length)
{
playerHitLast = false;
isClapping = true;
lastClapStart = beat;
currentClappingLength = length;
@ -74,11 +90,22 @@ namespace RhythmHeavenMania.Games.ClappyTrio
public void Prepare(int type)
{
PlayAnimationAll("Prepare");
Jukebox.PlayOneShotGame("clappyTrio/ready");
SetFace(0, type);
SetFace(1, type);
SetFace(2, type);
PlayAnimationAll("Prepare");
Jukebox.PlayOneShotGame("clappyTrio/ready");
}
public void Bop()
{
if (playerHitLast)
{
SetFace(0, 1);
SetFace(1, 1);
SetFace(2, 1);
}
PlayAnimationAll("Bop");
}
private void PlayAnimationAll(string anim)
@ -88,14 +115,14 @@ namespace RhythmHeavenMania.Games.ClappyTrio
LionPlayer.GetComponent<Animator>().Play(anim, 0, 0);
}
private void SetFace(int lion, int type)
public void SetFace(int lion, int type)
{
if (lion == 0)
LionLeft.transform.GetChild(1).GetComponent<SpriteRenderer>().sprite = faces[type];
else if (lion == 1)
LionMiddle.transform.GetChild(1).GetComponent<SpriteRenderer>().sprite = faces[type];
else if (lion == 3)
LionPlayer.transform.GetChild(1).GetComponent<SpriteRenderer>().sprite = faces[type];
lionHeadLeft.sprite = faces[type];
if (lion == 1)
lionHeadMiddle.sprite = faces[type];
if (lion == 2)
lionHeadPlayer.sprite = faces[type];
}
}
}

View file

@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.ClappyTrio
{
public class ClappyTrioPlayer : MonoBehaviour
{
public bool early;
public bool perfect;
public bool late;
private float lastClapBeat;
private bool clapVacant;
private int lastIndex;
private float perfectTime = 0.25f, lateTime = 0.46f;
private bool hit;
private void Update()
{
if (PlayerInput.Pressed())
{
Clap();
}
if (clapVacant == true)
{
float songPosBeat = Conductor.instance.songPositionInBeats;
if (songPosBeat > lastClapBeat && songPosBeat < lastClapBeat + perfectTime && lastIndex == 0)
{
SetEligibility(true, false, false);
lastIndex++;
}
else if (songPosBeat > lastClapBeat + perfectTime && songPosBeat < lastClapBeat + lateTime && lastIndex == 1)
{
SetEligibility(false, true, false);
// Clap();
lastIndex++;
}
else if (songPosBeat > lastClapBeat + lateTime && lastIndex == 2)
{
SetEligibility(false, false, true);
clapVacant = false;
lastIndex = 0;
hit = false;
}
}
}
public void SetClapAvailability(float startBeat)
{
lastClapBeat = startBeat;
clapVacant = true;
}
private void SetEligibility(bool early, bool perfect, bool late)
{
this.early = false;
this.perfect = false;
this.late = false;
if (early)
this.early = true;
else if (perfect)
this.perfect = true;
else if (late)
this.late = true;
}
private void Clap()
{
bool canHit = early != true && late != true && perfect == true && hit == false;
if (canHit)
{
Jukebox.PlayOneShotGame("clappyTrio/rightClap");
ClappyTrio.instance.playerHitLast = true;
}
else
{
Jukebox.PlayOneShot("miss");
ClappyTrio.instance.playerHitLast = false;
}
ClappyTrio.instance.SetFace(2, 4);
this.GetComponent<Animator>().Play("Clap", 0, 0);
}
}
}

View file

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

View file

@ -76,16 +76,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
{
currentHitInList = 0;
}
if (Input.GetKeyDown(KeyCode.A))
{
Conductor.instance.musicSource.time += 3;
}
else if (Input.GetKeyDown(KeyCode.S))
{
Conductor.instance.musicSource.time -= 3;
GameManager.instance.SetCurrentEventToClosest();
}
}
public void Eat()

View file

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania
{
public class PlayerInput
{
public static bool Pressed()
{
return (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0));
}
public static bool Pressing()
{
return (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0));
}
}
}

View file

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

View file

@ -3,12 +3,70 @@
"entities": [
{
"beat": 1,
"datamodel": "clappyTrio/prepare_4"
"datamodel": "clappyTrio/prepare_alt"
},
{
"beat": 4,
"length": 2,
"datamodel": "clappyTrio/clap"
},
{
"beat": 12,
"datamodel": "clappyTrio/prepare_alt"
},
{
"beat": 13,
"length": 1,
"datamodel": "clappyTrio/clap"
},
{
"beat": 20,
"datamodel": "clappyTrio/prepare_alt"
},
{
"beat": 21,
"length": 1,
"datamodel": "clappyTrio/clap"
},
{
"beat": 24,
"datamodel": "clappyTrio/prepare_alt"
},
{
"beat": 24.5,
"length": 0.5,
"datamodel": "clappyTrio/clap"
},
{
"beat": 26.5,
"datamodel": "clappyTrio/bop"
},
{
"beat": 10,
"datamodel": "clappyTrio/bop"
},
{
"beat": 11,
"datamodel": "clappyTrio/bop"
},
{
"beat": 16,
"datamodel": "clappyTrio/bop"
},
{
"beat": 17,
"datamodel": "clappyTrio/bop"
},
{
"beat": 18,
"datamodel": "clappyTrio/bop"
},
{
"beat": 19,
"datamodel": "clappyTrio/bop"
}
]
}