Proper namespaces
This commit is contained in:
parent
33bd99bbc1
commit
0b383940ac
8
Assets/Resources/Fonts/rodin.meta
Normal file
8
Assets/Resources/Fonts/rodin.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96ed2f99a777c924f882e2f3c41b1881
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,13 +1,13 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &-1154359511425921776
|
||||
--- !u!21 &-1662932664650235619
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: rodin_merged Material
|
||||
m_Name: rodin_lat_cy_ja_ko_spec Material
|
||||
m_Shader: {fileID: 4800000, guid: 128e987d567d4e2c824d754223b3f3b0, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
|
@ -24,7 +24,7 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 1363669669053061815}
|
||||
m_Texture: {fileID: 8801383763965547972}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
|
@ -53,14 +53,14 @@ MonoBehaviour:
|
|||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
|
||||
m_Name: rodin_merged
|
||||
m_Name: rodin_lat_cy_ja_ko_spec
|
||||
m_EditorClassIdentifier:
|
||||
hashCode: 0
|
||||
material: {fileID: -1154359511425921776}
|
||||
material: {fileID: -1662932664650235619}
|
||||
materialHashCode: 0
|
||||
m_Version: 1.1.0
|
||||
m_SourceFontFileGUID: d245bd2e354835547b32cf6c1a738d45
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: d245bd2e354835547b32cf6c1a738d45, type: 3}
|
||||
m_SourceFontFileGUID: 6459e01c422d8fb469d08b74a81e6b81
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: 6459e01c422d8fb469d08b74a81e6b81, type: 3}
|
||||
m_SourceFontFile: {fileID: 0}
|
||||
m_AtlasPopulationMode: 0
|
||||
m_FaceInfo:
|
||||
|
@ -79,7 +79,7 @@ MonoBehaviour:
|
|||
m_SuperscriptSize: 0.5
|
||||
m_SubscriptOffset: -39.989998
|
||||
m_SubscriptSize: 0.5
|
||||
m_UnderlineOffset: -85.374
|
||||
m_UnderlineOffset: -104.346
|
||||
m_UnderlineThickness: 18.972
|
||||
m_StrikethroughOffset: 41.2
|
||||
m_StrikethroughThickness: 18.972
|
||||
|
@ -2717,7 +2717,7 @@ MonoBehaviour:
|
|||
m_Height: 185
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 466
|
||||
- m_Index: 596
|
||||
m_Metrics:
|
||||
m_Width: 93
|
||||
m_Height: 14
|
||||
|
@ -2731,7 +2731,7 @@ MonoBehaviour:
|
|||
m_Height: 14
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 467
|
||||
- m_Index: 597
|
||||
m_Metrics:
|
||||
m_Width: 186
|
||||
m_Height: 13
|
||||
|
@ -2745,7 +2745,7 @@ MonoBehaviour:
|
|||
m_Height: 13
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 470
|
||||
- m_Index: 600
|
||||
m_Metrics:
|
||||
m_Width: 25
|
||||
m_Height: 54
|
||||
|
@ -2759,7 +2759,7 @@ MonoBehaviour:
|
|||
m_Height: 54
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 471
|
||||
- m_Index: 601
|
||||
m_Metrics:
|
||||
m_Width: 25
|
||||
m_Height: 55
|
||||
|
@ -2773,7 +2773,7 @@ MonoBehaviour:
|
|||
m_Height: 55
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 472
|
||||
- m_Index: 602
|
||||
m_Metrics:
|
||||
m_Width: 25
|
||||
m_Height: 55
|
||||
|
@ -2787,7 +2787,7 @@ MonoBehaviour:
|
|||
m_Height: 55
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 474
|
||||
- m_Index: 604
|
||||
m_Metrics:
|
||||
m_Width: 59
|
||||
m_Height: 54
|
||||
|
@ -2801,7 +2801,7 @@ MonoBehaviour:
|
|||
m_Height: 54
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 475
|
||||
- m_Index: 605
|
||||
m_Metrics:
|
||||
m_Width: 58
|
||||
m_Height: 55
|
||||
|
@ -2815,7 +2815,7 @@ MonoBehaviour:
|
|||
m_Height: 55
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 476
|
||||
- m_Index: 606
|
||||
m_Metrics:
|
||||
m_Width: 58
|
||||
m_Height: 55
|
||||
|
@ -2829,7 +2829,7 @@ MonoBehaviour:
|
|||
m_Height: 55
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 477
|
||||
- m_Index: 607
|
||||
m_Metrics:
|
||||
m_Width: 90
|
||||
m_Height: 168
|
||||
|
@ -2843,7 +2843,7 @@ MonoBehaviour:
|
|||
m_Height: 168
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 478
|
||||
- m_Index: 608
|
||||
m_Metrics:
|
||||
m_Width: 90
|
||||
m_Height: 168
|
||||
|
@ -2857,7 +2857,7 @@ MonoBehaviour:
|
|||
m_Height: 168
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 479
|
||||
- m_Index: 609
|
||||
m_Metrics:
|
||||
m_Width: 43
|
||||
m_Height: 42
|
||||
|
@ -2871,7 +2871,7 @@ MonoBehaviour:
|
|||
m_Height: 42
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 481
|
||||
- m_Index: 611
|
||||
m_Metrics:
|
||||
m_Width: 152
|
||||
m_Height: 28
|
||||
|
@ -2885,7 +2885,7 @@ MonoBehaviour:
|
|||
m_Height: 28
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 482
|
||||
- m_Index: 612
|
||||
m_Metrics:
|
||||
m_Width: 169
|
||||
m_Height: 153
|
||||
|
@ -2899,7 +2899,7 @@ MonoBehaviour:
|
|||
m_Height: 153
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 485
|
||||
- m_Index: 615
|
||||
m_Metrics:
|
||||
m_Width: 69
|
||||
m_Height: 105
|
||||
|
@ -2913,7 +2913,7 @@ MonoBehaviour:
|
|||
m_Height: 105
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 486
|
||||
- m_Index: 616
|
||||
m_Metrics:
|
||||
m_Width: 69
|
||||
m_Height: 105
|
||||
|
@ -2927,7 +2927,7 @@ MonoBehaviour:
|
|||
m_Height: 105
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 489
|
||||
- m_Index: 619
|
||||
m_Metrics:
|
||||
m_Width: 100
|
||||
m_Height: 155
|
||||
|
@ -2941,7 +2941,7 @@ MonoBehaviour:
|
|||
m_Height: 155
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 490
|
||||
- m_Index: 620
|
||||
m_Metrics:
|
||||
m_Width: 124
|
||||
m_Height: 153
|
||||
|
@ -2955,7 +2955,7 @@ MonoBehaviour:
|
|||
m_Height: 153
|
||||
m_Scale: 1
|
||||
m_AtlasIndex: 0
|
||||
- m_Index: 498
|
||||
- m_Index: 628
|
||||
m_Metrics:
|
||||
m_Width: 135
|
||||
m_Height: 78
|
||||
|
@ -3724,78 +3724,78 @@ MonoBehaviour:
|
|||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8211
|
||||
m_GlyphIndex: 466
|
||||
m_GlyphIndex: 596
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8212
|
||||
m_GlyphIndex: 467
|
||||
m_GlyphIndex: 597
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8216
|
||||
m_GlyphIndex: 470
|
||||
m_GlyphIndex: 600
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8217
|
||||
m_GlyphIndex: 471
|
||||
m_GlyphIndex: 601
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8218
|
||||
m_GlyphIndex: 472
|
||||
m_GlyphIndex: 602
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8220
|
||||
m_GlyphIndex: 474
|
||||
m_GlyphIndex: 604
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8221
|
||||
m_GlyphIndex: 475
|
||||
m_GlyphIndex: 605
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8222
|
||||
m_GlyphIndex: 476
|
||||
m_GlyphIndex: 606
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8224
|
||||
m_GlyphIndex: 477
|
||||
m_GlyphIndex: 607
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8225
|
||||
m_GlyphIndex: 478
|
||||
m_GlyphIndex: 608
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8226
|
||||
m_GlyphIndex: 479
|
||||
m_GlyphIndex: 609
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8230
|
||||
m_GlyphIndex: 481
|
||||
m_GlyphIndex: 611
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8240
|
||||
m_GlyphIndex: 482
|
||||
m_GlyphIndex: 612
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8249
|
||||
m_GlyphIndex: 485
|
||||
m_GlyphIndex: 615
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8250
|
||||
m_GlyphIndex: 486
|
||||
m_GlyphIndex: 616
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8260
|
||||
m_GlyphIndex: 489
|
||||
m_GlyphIndex: 619
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8364
|
||||
m_GlyphIndex: 490
|
||||
m_GlyphIndex: 620
|
||||
m_Scale: 1
|
||||
- m_ElementType: 1
|
||||
m_Unicode: 8482
|
||||
m_GlyphIndex: 498
|
||||
m_GlyphIndex: 628
|
||||
m_Scale: 1
|
||||
m_AtlasTextures:
|
||||
- {fileID: 1363669669053061815}
|
||||
- {fileID: 8801383763965547972}
|
||||
m_AtlasTextureIndex: 0
|
||||
m_IsMultiAtlasTexturesEnabled: 0
|
||||
m_ClearDynamicDataOnBuild: 0
|
||||
|
@ -5341,7 +5341,7 @@ MonoBehaviour:
|
|||
m_FallbackFontAssetTable: []
|
||||
m_CreationSettings:
|
||||
sourceFontFileName:
|
||||
sourceFontFileGUID: d245bd2e354835547b32cf6c1a738d45
|
||||
sourceFontFileGUID: 6459e01c422d8fb469d08b74a81e6b81
|
||||
pointSizeSamplingMode: 0
|
||||
pointSize: 186
|
||||
padding: 12
|
||||
|
@ -5384,13 +5384,13 @@ MonoBehaviour:
|
|||
boldSpacing: 7
|
||||
italicStyle: 35
|
||||
tabSize: 10
|
||||
--- !u!28 &1363669669053061815
|
||||
--- !u!28 &8801383763965547972
|
||||
Texture2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: rodin_merged Atlas
|
||||
m_Name: rodin_lat_cy_ja_ko_spec Atlas
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 391dfd08cb8a3cf4dbae153523abce8b
|
||||
guid: 795a65f16e097f44eb799cb2ec026fc1
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
BIN
Assets/Resources/Fonts/rodin/rodin_lat_cy_ja_ko_spec.ttf
Normal file
BIN
Assets/Resources/Fonts/rodin/rodin_lat_cy_ja_ko_spec.ttf
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d245bd2e354835547b32cf6c1a738d45
|
||||
guid: 6459e01c422d8fb469d08b74a81e6b81
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
|
@ -10,7 +10,8 @@ TrueTypeFontImporter:
|
|||
includeFontData: 1
|
||||
fontNames:
|
||||
- nintendo_NTLG-DB_001
|
||||
fallbackFontReferences: []
|
||||
fallbackFontReferences:
|
||||
- {fileID: 12800000, guid: d245bd2e354835547b32cf6c1a738d45, type: 3}
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CommonAnimEvents : MonoBehaviour
|
||||
{
|
||||
public void Destroy()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
|
@ -4,9 +4,11 @@ using UnityEngine;
|
|||
|
||||
using Starpelly;
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class Conductor : MonoBehaviour
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class Conductor : MonoBehaviour
|
||||
{
|
||||
//Song beats per minute
|
||||
//This is determined by the song you're trying to sync up to
|
||||
public float songBpm;
|
||||
|
@ -164,4 +166,5 @@ public class Conductor : MonoBehaviour
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ForkLifter : MonoBehaviour
|
||||
{
|
||||
public static ForkLifter instance;
|
||||
|
||||
GameManager GameManager;
|
||||
|
||||
[Header("Objects")]
|
||||
public Animator handAnim;
|
||||
public GameObject flickedObject;
|
||||
public SpriteRenderer peaPreview;
|
||||
|
||||
public Sprite[] peaSprites;
|
||||
public Sprite[] peaHitSprites;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameManager = GameManager.instance;
|
||||
}
|
||||
|
||||
public void Flick(float beat, int type)
|
||||
{
|
||||
Jukebox.PlayOneShot("flick");
|
||||
handAnim.Play("Hand_Flick", 0, 0);
|
||||
GameObject fo = Instantiate(flickedObject);
|
||||
fo.GetComponent<Pea>().startBeat = beat;
|
||||
fo.GetComponent<Pea>().type = type;
|
||||
fo.SetActive(true);
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class ForkLifterHand : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer fastSprite;
|
||||
|
||||
public Sprite[] fastSprites;
|
||||
|
||||
List<GameManager.Event> allPlayerActions;
|
||||
|
||||
public static ForkLifterHand instance { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void CheckNextFlick()
|
||||
{
|
||||
allPlayerActions = GameManager.instance.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare");
|
||||
|
||||
if (GameManager.instance.currentEventPlayer < allPlayerActions.Count)
|
||||
{
|
||||
switch (allPlayerActions[GameManager.instance.currentEventPlayer].eventName)
|
||||
{
|
||||
case "pea":
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
break;
|
||||
case "topbun":
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
|
||||
break;
|
||||
case "burger":
|
||||
fastSprite.sprite = fastSprites[1];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
|
||||
break;
|
||||
case "bottombun":
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ForkLifter.instance.peaPreview.sprite = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
Jukebox.PlayOneShot("flickPrepare");
|
||||
GetComponent<Animator>().Play("Hand_Prepare");
|
||||
}
|
||||
}
|
|
@ -1,312 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
public class ForkLifterPlayer : MonoBehaviour
|
||||
{
|
||||
[Header("Objects")]
|
||||
public GameObject fork;
|
||||
public Sprite peaSprite;
|
||||
public Sprite hitFX;
|
||||
public Sprite hitFXG;
|
||||
public Sprite hitFXMiss;
|
||||
public Sprite hitFX2;
|
||||
public Transform early, perfect, late;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider2D col;
|
||||
|
||||
private Animator anim;
|
||||
|
||||
public List<Eligible> EligibleHits = new List<Eligible>();
|
||||
private int currentHitInList = 0;
|
||||
|
||||
public static ForkLifterPlayer instance { get; set; }
|
||||
|
||||
public float timescale = 1;
|
||||
|
||||
private int currentEarlyPeasOnFork;
|
||||
private int currentPerfectPeasOnFork;
|
||||
private int currentLatePeasOnFork;
|
||||
|
||||
private bool isEating = false;
|
||||
|
||||
// Burger shit
|
||||
|
||||
private bool topbun, middleburger, bottombun;
|
||||
|
||||
// -----------
|
||||
|
||||
[System.Serializable]
|
||||
public class Eligible
|
||||
{
|
||||
public Pea pea;
|
||||
public bool early;
|
||||
public bool perfect;
|
||||
public bool late;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Time.timeScale = timescale;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
Stab();
|
||||
}
|
||||
|
||||
if (EligibleHits.Count == 0)
|
||||
{
|
||||
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()
|
||||
{
|
||||
if (currentEarlyPeasOnFork != 0 || currentPerfectPeasOnFork != 0 || currentLatePeasOnFork != 0)
|
||||
{
|
||||
anim.Play("Player_Eat", 0, 0);
|
||||
isEating = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void EatConfirm()
|
||||
{
|
||||
if (topbun && middleburger && bottombun)
|
||||
{
|
||||
Jukebox.PlayOneShot("burger");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentEarlyPeasOnFork > 0 || currentLatePeasOnFork > 0)
|
||||
{
|
||||
Jukebox.PlayOneShot($"cough_{Random.Range(1, 3)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("gulp");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < early.transform.childCount; i++)
|
||||
{
|
||||
Destroy(early.transform.GetChild(i).gameObject);
|
||||
}
|
||||
for (int i = 0; i < perfect.transform.childCount; i++)
|
||||
{
|
||||
Destroy(perfect.transform.GetChild(i).gameObject);
|
||||
}
|
||||
for (int i = 0; i < late.transform.childCount; i++)
|
||||
{
|
||||
Destroy(late.transform.GetChild(i).gameObject);
|
||||
}
|
||||
currentEarlyPeasOnFork = 0;
|
||||
currentPerfectPeasOnFork = 0;
|
||||
currentLatePeasOnFork = 0;
|
||||
|
||||
isEating = false;
|
||||
|
||||
topbun = false; middleburger = false; bottombun = false;
|
||||
}
|
||||
|
||||
public void Stab()
|
||||
{
|
||||
if (isEating) return;
|
||||
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);
|
||||
|
||||
if (canHit)
|
||||
{
|
||||
GameObject pea = new GameObject();
|
||||
|
||||
if (EligibleHits[currentHitInList].perfect)
|
||||
{
|
||||
pea.transform.parent = perfect.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
|
||||
for (int i = 0; i < perfect.transform.childCount; i++)
|
||||
{
|
||||
perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentPerfectPeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
switch (EligibleHits[currentHitInList].pea.type)
|
||||
{
|
||||
case 0:
|
||||
psprite.sortingOrder = 101;
|
||||
break;
|
||||
case 1:
|
||||
psprite.sortingOrder = 104;
|
||||
break;
|
||||
case 2:
|
||||
psprite.sortingOrder = 103;
|
||||
break;
|
||||
case 3:
|
||||
psprite.sortingOrder = 102;
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject hitFXo = new GameObject();
|
||||
hitFXo.transform.localPosition = new Vector3(1.9969f, -3.7026f);
|
||||
hitFXo.transform.localScale = new Vector3(3.142196f, 3.142196f);
|
||||
SpriteRenderer hfxs = hitFXo.AddComponent<SpriteRenderer>();
|
||||
hfxs.sprite = hitFX;
|
||||
hfxs.sortingOrder = 100;
|
||||
hfxs.DOColor(new Color(1, 1, 1, 0), 0.05f).OnComplete(delegate { Destroy(hitFXo); });
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("stab");
|
||||
|
||||
currentPerfectPeasOnFork++;
|
||||
|
||||
if (EligibleHits[currentHitInList].pea.type == 1)
|
||||
{
|
||||
topbun = true;
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].pea.type == 2)
|
||||
{
|
||||
middleburger = true;
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].pea.type == 3)
|
||||
{
|
||||
bottombun = true;
|
||||
}
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Hit();
|
||||
GameProfiler.instance.IncreaseScore();
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].early)
|
||||
{
|
||||
pea.transform.parent = early.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
||||
|
||||
for (int i = 0; i < early.transform.childCount; i++)
|
||||
{
|
||||
early.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentEarlyPeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
currentEarlyPeasOnFork++;
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].late)
|
||||
{
|
||||
pea.transform.parent = late.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
||||
|
||||
for (int i = 0; i < late.transform.childCount; i++)
|
||||
{
|
||||
late.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentLatePeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
currentLatePeasOnFork++;
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("stabnohit");
|
||||
}
|
||||
|
||||
anim.Play("Player_Stab", 0, 0);
|
||||
}
|
||||
|
||||
private void FastEffectHit(int type)
|
||||
{
|
||||
GameObject hitFX2o = new GameObject();
|
||||
hitFX2o.transform.localPosition = new Vector3(0.11f, -2.15f);
|
||||
hitFX2o.transform.localScale = new Vector3(5.401058f, 1.742697f);
|
||||
hitFX2o.transform.localRotation = Quaternion.Euler(0, 0, -38.402f);
|
||||
SpriteRenderer hfx2s = hitFX2o.AddComponent<SpriteRenderer>();
|
||||
if (type == 2)
|
||||
hfx2s.sprite = hitFXG;
|
||||
else
|
||||
hfx2s.sprite = hitFX2;
|
||||
hfx2s.sortingOrder = -5;
|
||||
hfx2s.DOColor(new Color(1, 1, 1, 0), 0.07f).OnComplete(delegate { Destroy(hitFX2o); });
|
||||
}
|
||||
|
||||
private void HitFXMiss(Vector2 pos, Vector2 size)
|
||||
{
|
||||
GameObject hitFXo = new GameObject();
|
||||
hitFXo.transform.localPosition = new Vector3(pos.x, pos.y);
|
||||
hitFXo.transform.localScale = new Vector3(size.x, size.y);
|
||||
SpriteRenderer hfxs = hitFXo.AddComponent<SpriteRenderer>();
|
||||
hfxs.sprite = hitFXMiss;
|
||||
hfxs.sortingOrder = 100;
|
||||
hfxs.DOColor(new Color(1, 1, 1, 0), 0.05f).OnComplete(delegate { Destroy(hitFXo); });
|
||||
}
|
||||
|
||||
private void RemovePea()
|
||||
{
|
||||
if (currentHitInList < EligibleHits.Count)
|
||||
{
|
||||
Destroy(EligibleHits[currentHitInList].pea.gameObject);
|
||||
EligibleHits.Remove(EligibleHits[currentHitInList]);
|
||||
currentHitInList++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Pea : MonoBehaviour
|
||||
{
|
||||
[Header("Latency")]
|
||||
public float earlyTime;
|
||||
public float perfectTime;
|
||||
public float lateTime;
|
||||
public float endTime;
|
||||
|
||||
private Animator anim;
|
||||
|
||||
public float startBeat;
|
||||
|
||||
private bool inList = false;
|
||||
|
||||
public int type;
|
||||
|
||||
private ForkLifterPlayer.Eligible e = new ForkLifterPlayer.Eligible();
|
||||
|
||||
public int estate, pstate, lstate, endstate;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
Jukebox.PlayOneShot("zoom");
|
||||
GetComponentInChildren<SpriteRenderer>().sprite = ForkLifter.instance.peaSprites[type];
|
||||
|
||||
e = new ForkLifterPlayer.Eligible();
|
||||
e.pea = this;
|
||||
|
||||
for (int i = 0; i < transform.GetChild(0).childCount; i++)
|
||||
{
|
||||
transform.GetChild(0).GetChild(i).GetComponent<SpriteRenderer>().sprite = transform.GetChild(0).GetComponent<SpriteRenderer>().sprite;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.5f));
|
||||
anim.Play("Flicked_Object", -1, normalizedBeat);
|
||||
anim.speed = 0;
|
||||
|
||||
// Early State
|
||||
if (normalizedBeat > earlyTime && normalizedBeat < perfectTime && estate <= 1)
|
||||
{
|
||||
estate++;
|
||||
MakeEligible(true, false, false);
|
||||
}
|
||||
// Perfect State
|
||||
else if (normalizedBeat > perfectTime && normalizedBeat < lateTime && pstate <= 1)
|
||||
{
|
||||
pstate++;
|
||||
MakeEligible(false, true, false);
|
||||
}
|
||||
// Late State
|
||||
else if (normalizedBeat > lateTime && normalizedBeat < endTime && lstate <= 1)
|
||||
{
|
||||
lstate++;
|
||||
MakeEligible(false, false, true);
|
||||
}
|
||||
else if (normalizedBeat < earlyTime || normalizedBeat > endTime)
|
||||
{
|
||||
MakeInEligible();
|
||||
}
|
||||
|
||||
if (normalizedBeat > endTime && endstate <= 1)
|
||||
{
|
||||
endstate++;
|
||||
Jukebox.PlayOneShot("disappointed");
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
|
||||
if (normalizedBeat > 1.35f)
|
||||
{
|
||||
MakeInEligible();
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeEligible(bool early, bool perfect, bool late)
|
||||
{
|
||||
// print($"{early}, {perfect}, {late}");
|
||||
|
||||
if (!inList)
|
||||
{
|
||||
e.early = early;
|
||||
e.perfect = perfect;
|
||||
e.late = late;
|
||||
|
||||
ForkLifterPlayer.instance.EligibleHits.Add(e);
|
||||
inList = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ForkLifterPlayer.Eligible es = ForkLifterPlayer.instance.EligibleHits[ForkLifterPlayer.instance.EligibleHits.IndexOf(e)];
|
||||
es.early = early;
|
||||
es.perfect = perfect;
|
||||
es.late = late;
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeInEligible()
|
||||
{
|
||||
if (!inList) return;
|
||||
|
||||
ForkLifterPlayer.instance.EligibleHits.Remove(e);
|
||||
inList = false;
|
||||
}
|
||||
}
|
|
@ -7,8 +7,13 @@ using UnityEngine;
|
|||
using Starpelly;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
using RhythmHeavenMania.Games.ForkLifter;
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static GameManager instance;
|
||||
|
||||
public List<Event> Events = new List<Event>();
|
||||
|
@ -179,4 +184,5 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
// GUI.Box(new Rect(0, 0, 300, 50), $"SongPosInBeats: {Conductor.instance.songPositionInBeats}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,8 +2,10 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameProfiler : MonoBehaviour
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class GameProfiler : MonoBehaviour
|
||||
{
|
||||
public float score = 0;
|
||||
public int totalHits = 0;
|
||||
|
||||
|
@ -31,4 +33,5 @@ public class GameProfiler : MonoBehaviour
|
|||
{
|
||||
return (value / totalValue) * 100;
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Scripts/Games.meta
Normal file
8
Assets/Scripts/Games.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cc7b4daee555e974cac4bcee60f9e6f0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
44
Assets/Scripts/Games/ForkLifter/ForkLifter.cs
Normal file
44
Assets/Scripts/Games/ForkLifter/ForkLifter.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.ForkLifter
|
||||
{
|
||||
public class ForkLifter : MonoBehaviour
|
||||
{
|
||||
public static ForkLifter instance;
|
||||
|
||||
GameManager GameManager;
|
||||
|
||||
[Header("Objects")]
|
||||
public Animator handAnim;
|
||||
public GameObject flickedObject;
|
||||
public SpriteRenderer peaPreview;
|
||||
|
||||
public Sprite[] peaSprites;
|
||||
public Sprite[] peaHitSprites;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameManager = GameManager.instance;
|
||||
}
|
||||
|
||||
public void Flick(float beat, int type)
|
||||
{
|
||||
Jukebox.PlayOneShot("flick");
|
||||
handAnim.Play("Hand_Flick", 0, 0);
|
||||
GameObject fo = Instantiate(flickedObject);
|
||||
fo.GetComponent<Pea>().startBeat = beat;
|
||||
fo.GetComponent<Pea>().type = type;
|
||||
fo.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
63
Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs
Normal file
63
Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.ForkLifter
|
||||
{
|
||||
public class ForkLifterHand : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer fastSprite;
|
||||
|
||||
public Sprite[] fastSprites;
|
||||
|
||||
List<GameManager.Event> allPlayerActions;
|
||||
|
||||
public static ForkLifterHand instance { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void CheckNextFlick()
|
||||
{
|
||||
allPlayerActions = GameManager.instance.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare");
|
||||
|
||||
if (GameManager.instance.currentEventPlayer < allPlayerActions.Count)
|
||||
{
|
||||
switch (allPlayerActions[GameManager.instance.currentEventPlayer].eventName)
|
||||
{
|
||||
case "pea":
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
break;
|
||||
case "topbun":
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
|
||||
break;
|
||||
case "burger":
|
||||
fastSprite.sprite = fastSprites[1];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
|
||||
break;
|
||||
case "bottombun":
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ForkLifter.instance.peaPreview.sprite = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
Jukebox.PlayOneShot("flickPrepare");
|
||||
GetComponent<Animator>().Play("Hand_Prepare");
|
||||
}
|
||||
}
|
||||
}
|
317
Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs
Normal file
317
Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs
Normal file
|
@ -0,0 +1,317 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.ForkLifter
|
||||
{
|
||||
public class ForkLifterPlayer : MonoBehaviour
|
||||
{
|
||||
[Header("Objects")]
|
||||
public GameObject fork;
|
||||
public Sprite peaSprite;
|
||||
public Sprite hitFX;
|
||||
public Sprite hitFXG;
|
||||
public Sprite hitFXMiss;
|
||||
public Sprite hitFX2;
|
||||
public Transform early, perfect, late;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider2D col;
|
||||
|
||||
private Animator anim;
|
||||
|
||||
public List<Eligible> EligibleHits = new List<Eligible>();
|
||||
private int currentHitInList = 0;
|
||||
|
||||
public static ForkLifterPlayer instance { get; set; }
|
||||
|
||||
public float timescale = 1;
|
||||
|
||||
private int currentEarlyPeasOnFork;
|
||||
private int currentPerfectPeasOnFork;
|
||||
private int currentLatePeasOnFork;
|
||||
|
||||
private bool isEating = false;
|
||||
|
||||
// Burger shit
|
||||
|
||||
private bool topbun, middleburger, bottombun;
|
||||
|
||||
// -----------
|
||||
|
||||
[System.Serializable]
|
||||
public class Eligible
|
||||
{
|
||||
public Pea pea;
|
||||
public bool early;
|
||||
public bool perfect;
|
||||
public bool late;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Time.timeScale = timescale;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
Stab();
|
||||
}
|
||||
|
||||
if (EligibleHits.Count == 0)
|
||||
{
|
||||
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()
|
||||
{
|
||||
if (currentEarlyPeasOnFork != 0 || currentPerfectPeasOnFork != 0 || currentLatePeasOnFork != 0)
|
||||
{
|
||||
anim.Play("Player_Eat", 0, 0);
|
||||
isEating = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void EatConfirm()
|
||||
{
|
||||
if (topbun && middleburger && bottombun)
|
||||
{
|
||||
Jukebox.PlayOneShot("burger");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentEarlyPeasOnFork > 0 || currentLatePeasOnFork > 0)
|
||||
{
|
||||
Jukebox.PlayOneShot($"cough_{Random.Range(1, 3)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("gulp");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < early.transform.childCount; i++)
|
||||
{
|
||||
Destroy(early.transform.GetChild(i).gameObject);
|
||||
}
|
||||
for (int i = 0; i < perfect.transform.childCount; i++)
|
||||
{
|
||||
Destroy(perfect.transform.GetChild(i).gameObject);
|
||||
}
|
||||
for (int i = 0; i < late.transform.childCount; i++)
|
||||
{
|
||||
Destroy(late.transform.GetChild(i).gameObject);
|
||||
}
|
||||
currentEarlyPeasOnFork = 0;
|
||||
currentPerfectPeasOnFork = 0;
|
||||
currentLatePeasOnFork = 0;
|
||||
|
||||
isEating = false;
|
||||
|
||||
topbun = false; middleburger = false; bottombun = false;
|
||||
}
|
||||
|
||||
public void Stab()
|
||||
{
|
||||
if (isEating) return;
|
||||
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);
|
||||
|
||||
if (canHit)
|
||||
{
|
||||
GameObject pea = new GameObject();
|
||||
|
||||
if (EligibleHits[currentHitInList].perfect)
|
||||
{
|
||||
pea.transform.parent = perfect.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
|
||||
for (int i = 0; i < perfect.transform.childCount; i++)
|
||||
{
|
||||
perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentPerfectPeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
switch (EligibleHits[currentHitInList].pea.type)
|
||||
{
|
||||
case 0:
|
||||
psprite.sortingOrder = 101;
|
||||
break;
|
||||
case 1:
|
||||
psprite.sortingOrder = 104;
|
||||
break;
|
||||
case 2:
|
||||
psprite.sortingOrder = 103;
|
||||
break;
|
||||
case 3:
|
||||
psprite.sortingOrder = 102;
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject hitFXo = new GameObject();
|
||||
hitFXo.transform.localPosition = new Vector3(1.9969f, -3.7026f);
|
||||
hitFXo.transform.localScale = new Vector3(3.142196f, 3.142196f);
|
||||
SpriteRenderer hfxs = hitFXo.AddComponent<SpriteRenderer>();
|
||||
hfxs.sprite = hitFX;
|
||||
hfxs.sortingOrder = 100;
|
||||
hfxs.DOColor(new Color(1, 1, 1, 0), 0.05f).OnComplete(delegate { Destroy(hitFXo); });
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("stab");
|
||||
|
||||
currentPerfectPeasOnFork++;
|
||||
|
||||
if (EligibleHits[currentHitInList].pea.type == 1)
|
||||
{
|
||||
topbun = true;
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].pea.type == 2)
|
||||
{
|
||||
middleburger = true;
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].pea.type == 3)
|
||||
{
|
||||
bottombun = true;
|
||||
}
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Hit();
|
||||
GameProfiler.instance.IncreaseScore();
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].early)
|
||||
{
|
||||
pea.transform.parent = early.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
||||
|
||||
for (int i = 0; i < early.transform.childCount; i++)
|
||||
{
|
||||
early.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentEarlyPeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
currentEarlyPeasOnFork++;
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
else if (EligibleHits[currentHitInList].late)
|
||||
{
|
||||
pea.transform.parent = late.transform;
|
||||
pea.transform.localScale = Vector2.one;
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
||||
|
||||
for (int i = 0; i < late.transform.childCount; i++)
|
||||
{
|
||||
late.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentLatePeasOnFork);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].pea.type];
|
||||
psprite.sortingOrder = 20;
|
||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
||||
|
||||
FastEffectHit(EligibleHits[currentHitInList].pea.type);
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
currentLatePeasOnFork++;
|
||||
|
||||
RemovePea();
|
||||
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("stabnohit");
|
||||
}
|
||||
|
||||
anim.Play("Player_Stab", 0, 0);
|
||||
}
|
||||
|
||||
private void FastEffectHit(int type)
|
||||
{
|
||||
GameObject hitFX2o = new GameObject();
|
||||
hitFX2o.transform.localPosition = new Vector3(0.11f, -2.15f);
|
||||
hitFX2o.transform.localScale = new Vector3(5.401058f, 1.742697f);
|
||||
hitFX2o.transform.localRotation = Quaternion.Euler(0, 0, -38.402f);
|
||||
SpriteRenderer hfx2s = hitFX2o.AddComponent<SpriteRenderer>();
|
||||
if (type == 2)
|
||||
hfx2s.sprite = hitFXG;
|
||||
else
|
||||
hfx2s.sprite = hitFX2;
|
||||
hfx2s.sortingOrder = -5;
|
||||
hfx2s.DOColor(new Color(1, 1, 1, 0), 0.07f).OnComplete(delegate { Destroy(hitFX2o); });
|
||||
}
|
||||
|
||||
private void HitFXMiss(Vector2 pos, Vector2 size)
|
||||
{
|
||||
GameObject hitFXo = new GameObject();
|
||||
hitFXo.transform.localPosition = new Vector3(pos.x, pos.y);
|
||||
hitFXo.transform.localScale = new Vector3(size.x, size.y);
|
||||
SpriteRenderer hfxs = hitFXo.AddComponent<SpriteRenderer>();
|
||||
hfxs.sprite = hitFXMiss;
|
||||
hfxs.sortingOrder = 100;
|
||||
hfxs.DOColor(new Color(1, 1, 1, 0), 0.05f).OnComplete(delegate { Destroy(hitFXo); });
|
||||
}
|
||||
|
||||
private void RemovePea()
|
||||
{
|
||||
if (currentHitInList < EligibleHits.Count)
|
||||
{
|
||||
Destroy(EligibleHits[currentHitInList].pea.gameObject);
|
||||
EligibleHits.Remove(EligibleHits[currentHitInList]);
|
||||
currentHitInList++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
Assets/Scripts/Games/ForkLifter/Pea.cs
Normal file
117
Assets/Scripts/Games/ForkLifter/Pea.cs
Normal file
|
@ -0,0 +1,117 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.ForkLifter
|
||||
{
|
||||
public class Pea : MonoBehaviour
|
||||
{
|
||||
[Header("Latency")]
|
||||
public float earlyTime;
|
||||
public float perfectTime;
|
||||
public float lateTime;
|
||||
public float endTime;
|
||||
|
||||
private Animator anim;
|
||||
|
||||
public float startBeat;
|
||||
|
||||
private bool inList = false;
|
||||
|
||||
public int type;
|
||||
|
||||
private ForkLifterPlayer.Eligible e = new ForkLifterPlayer.Eligible();
|
||||
|
||||
public int estate, pstate, lstate, endstate;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
Jukebox.PlayOneShot("zoom");
|
||||
GetComponentInChildren<SpriteRenderer>().sprite = ForkLifter.instance.peaSprites[type];
|
||||
|
||||
e = new ForkLifterPlayer.Eligible();
|
||||
e.pea = this;
|
||||
|
||||
for (int i = 0; i < transform.GetChild(0).childCount; i++)
|
||||
{
|
||||
transform.GetChild(0).GetChild(i).GetComponent<SpriteRenderer>().sprite = transform.GetChild(0).GetComponent<SpriteRenderer>().sprite;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.5f));
|
||||
anim.Play("Flicked_Object", -1, normalizedBeat);
|
||||
anim.speed = 0;
|
||||
|
||||
// Early State
|
||||
if (normalizedBeat > earlyTime && normalizedBeat < perfectTime && estate <= 1)
|
||||
{
|
||||
estate++;
|
||||
MakeEligible(true, false, false);
|
||||
}
|
||||
// Perfect State
|
||||
else if (normalizedBeat > perfectTime && normalizedBeat < lateTime && pstate <= 1)
|
||||
{
|
||||
pstate++;
|
||||
MakeEligible(false, true, false);
|
||||
}
|
||||
// Late State
|
||||
else if (normalizedBeat > lateTime && normalizedBeat < endTime && lstate <= 1)
|
||||
{
|
||||
lstate++;
|
||||
MakeEligible(false, false, true);
|
||||
}
|
||||
else if (normalizedBeat < earlyTime || normalizedBeat > endTime)
|
||||
{
|
||||
MakeInEligible();
|
||||
}
|
||||
|
||||
if (normalizedBeat > endTime && endstate <= 1)
|
||||
{
|
||||
endstate++;
|
||||
Jukebox.PlayOneShot("disappointed");
|
||||
GoForAPerfect.instance.Miss();
|
||||
}
|
||||
|
||||
if (normalizedBeat > 1.35f)
|
||||
{
|
||||
MakeInEligible();
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeEligible(bool early, bool perfect, bool late)
|
||||
{
|
||||
// print($"{early}, {perfect}, {late}");
|
||||
|
||||
if (!inList)
|
||||
{
|
||||
e.early = early;
|
||||
e.perfect = perfect;
|
||||
e.late = late;
|
||||
|
||||
ForkLifterPlayer.instance.EligibleHits.Add(e);
|
||||
inList = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ForkLifterPlayer.Eligible es = ForkLifterPlayer.instance.EligibleHits[ForkLifterPlayer.instance.EligibleHits.IndexOf(e)];
|
||||
es.early = early;
|
||||
es.perfect = perfect;
|
||||
es.late = late;
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeInEligible()
|
||||
{
|
||||
if (!inList) return;
|
||||
|
||||
ForkLifterPlayer.instance.EligibleHits.Remove(e);
|
||||
inList = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,8 +5,10 @@ using UnityEngine.SceneManagement;
|
|||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
public class GlobalGameManager : MonoBehaviour
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class GlobalGameManager : MonoBehaviour
|
||||
{
|
||||
public static GlobalGameManager instance { get; set; }
|
||||
|
||||
public static int loadedScene;
|
||||
|
@ -89,4 +91,6 @@ public class GlobalGameManager : MonoBehaviour
|
|||
fade.GetComponent<SpriteRenderer>().color = new Color(0, 0, 0, 0);
|
||||
fade.GetComponent<SpriteRenderer>().DOColor(Color.black, fadeDuration).OnComplete(() => { SceneManager.LoadScene(loadedScene); fade.GetComponent<SpriteRenderer>().DOColor(new Color(0, 0, 0, 0), fadeDuration).OnComplete(() => { Destroy(fade); }); });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
70
Assets/Scripts/GoForAPerfect.cs
Normal file
70
Assets/Scripts/GoForAPerfect.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class GoForAPerfect : MonoBehaviour
|
||||
{
|
||||
public static GoForAPerfect instance { get; set; }
|
||||
|
||||
private Animator pAnim;
|
||||
|
||||
private bool active = false;
|
||||
|
||||
public bool perfect;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pAnim = transform.GetChild(0).GetChild(0).GetComponent<Animator>();
|
||||
perfect = true;
|
||||
}
|
||||
|
||||
public void Hit()
|
||||
{
|
||||
if (!active) return;
|
||||
pAnim.Play("PerfectIcon_Hit", 0, 0);
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
if (!active) return;
|
||||
perfect = false;
|
||||
|
||||
GameProfiler.instance.perfect = false;
|
||||
|
||||
transform.GetChild(0).GetChild(1).gameObject.SetActive(false);
|
||||
this.GetComponent<Animator>().Play("GoForAPerfect_Miss");
|
||||
Jukebox.PlayOneShot("perfectMiss");
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
SetActive();
|
||||
transform.GetChild(0).gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
SetInactive();
|
||||
transform.GetChild(0).gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetActive()
|
||||
{
|
||||
active = true;
|
||||
}
|
||||
public void SetInactive()
|
||||
{
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Jukebox
|
||||
{
|
||||
public enum AudioType
|
||||
{
|
||||
OGG,
|
||||
WAV
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is me just idiot-proofing.
|
||||
/// </summary>
|
||||
public static void BasicCheck()
|
||||
{
|
||||
if (FindJukebox() == null)
|
||||
{
|
||||
GameObject Jukebox = new GameObject("Jukebox");
|
||||
Jukebox.AddComponent<AudioSource>();
|
||||
Jukebox.tag = "Jukebox";
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject FindJukebox()
|
||||
{
|
||||
if (GameObject.FindGameObjectWithTag("Jukebox") != null)
|
||||
return GameObject.FindGameObjectWithTag("Jukebox");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SetVolume(float volume)
|
||||
{
|
||||
BasicCheck();
|
||||
FindJukebox().GetComponent<AudioSource>().volume = volume;
|
||||
}
|
||||
|
||||
public static void PlayOneShot(string name)
|
||||
{
|
||||
GameObject oneShot = new GameObject("oneShot");
|
||||
AudioSource aus = oneShot.AddComponent<AudioSource>();
|
||||
aus.playOnAwake = false;
|
||||
Sound snd = oneShot.AddComponent<Sound>();
|
||||
snd.clip = Resources.Load<AudioClip>($"Sfx/{name}");
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Sound : MonoBehaviour
|
||||
{
|
||||
public AudioClip clip;
|
||||
public float pitch;
|
||||
|
||||
private AudioSource audioSource;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
audioSource.PlayOneShot(clip);
|
||||
StartCoroutine(play());
|
||||
}
|
||||
|
||||
private IEnumerator play()
|
||||
{
|
||||
yield return new WaitForSeconds(clip.length);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GoForAPerfect : MonoBehaviour
|
||||
{
|
||||
public static GoForAPerfect instance { get; set; }
|
||||
|
||||
private Animator pAnim;
|
||||
|
||||
private bool active = false;
|
||||
|
||||
public bool perfect;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pAnim = transform.GetChild(0).GetChild(0).GetComponent<Animator>();
|
||||
perfect = true;
|
||||
}
|
||||
|
||||
public void Hit()
|
||||
{
|
||||
if (!active) return;
|
||||
pAnim.Play("PerfectIcon_Hit", 0, 0);
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
if (!active) return;
|
||||
perfect = false;
|
||||
|
||||
GameProfiler.instance.perfect = false;
|
||||
|
||||
transform.GetChild(0).GetChild(1).gameObject.SetActive(false);
|
||||
this.GetComponent<Animator>().Play("GoForAPerfect_Miss");
|
||||
Jukebox.PlayOneShot("perfectMiss");
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
SetActive();
|
||||
transform.GetChild(0).gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
SetInactive();
|
||||
transform.GetChild(0).gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetActive()
|
||||
{
|
||||
active = true;
|
||||
}
|
||||
public void SetInactive()
|
||||
{
|
||||
active = false;
|
||||
}
|
||||
}
|
|
@ -2,8 +2,10 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Prologue : MonoBehaviour
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class Prologue : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float waitSeconds;
|
||||
|
||||
public GameObject Holder;
|
||||
|
@ -32,4 +34,6 @@ public class Prologue : MonoBehaviour
|
|||
yield return new WaitForSeconds(2);
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,8 +5,12 @@ using UnityEngine.UI;
|
|||
using TMPro;
|
||||
using DG.Tweening;
|
||||
|
||||
public class Rating : MonoBehaviour
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class Rating : MonoBehaviour
|
||||
{
|
||||
public GameObject Title;
|
||||
public GameObject Desc;
|
||||
public GameObject Rank;
|
||||
|
@ -136,4 +140,6 @@ public class Rating : MonoBehaviour
|
|||
yield return new WaitForSeconds(8);
|
||||
GlobalGameManager.LoadScene(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
8
Assets/Scripts/Util.meta
Normal file
8
Assets/Scripts/Util.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23db959b7a4cf21438c0b20d9b30b688
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
15
Assets/Scripts/Util/CommonAnimEvents.cs
Normal file
15
Assets/Scripts/Util/CommonAnimEvents.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Util
|
||||
{
|
||||
public class CommonAnimEvents : MonoBehaviour
|
||||
{
|
||||
public void Destroy()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
53
Assets/Scripts/Util/Jukebox.cs
Normal file
53
Assets/Scripts/Util/Jukebox.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Util
|
||||
{
|
||||
public class Jukebox
|
||||
{
|
||||
public enum AudioType
|
||||
{
|
||||
OGG,
|
||||
WAV
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is me just idiot-proofing.
|
||||
/// </summary>
|
||||
public static void BasicCheck()
|
||||
{
|
||||
if (FindJukebox() == null)
|
||||
{
|
||||
GameObject Jukebox = new GameObject("Jukebox");
|
||||
Jukebox.AddComponent<AudioSource>();
|
||||
Jukebox.tag = "Jukebox";
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject FindJukebox()
|
||||
{
|
||||
if (GameObject.FindGameObjectWithTag("Jukebox") != null)
|
||||
return GameObject.FindGameObjectWithTag("Jukebox");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SetVolume(float volume)
|
||||
{
|
||||
BasicCheck();
|
||||
FindJukebox().GetComponent<AudioSource>().volume = volume;
|
||||
}
|
||||
|
||||
public static void PlayOneShot(string name)
|
||||
{
|
||||
GameObject oneShot = new GameObject("oneShot");
|
||||
AudioSource aus = oneShot.AddComponent<AudioSource>();
|
||||
aus.playOnAwake = false;
|
||||
Sound snd = oneShot.AddComponent<Sound>();
|
||||
snd.clip = Resources.Load<AudioClip>($"Sfx/{name}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
Assets/Scripts/Util/Sound.cs
Normal file
27
Assets/Scripts/Util/Sound.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Util
|
||||
{
|
||||
public class Sound : MonoBehaviour
|
||||
{
|
||||
public AudioClip clip;
|
||||
public float pitch;
|
||||
|
||||
private AudioSource audioSource;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
audioSource.PlayOneShot(clip);
|
||||
StartCoroutine(play());
|
||||
}
|
||||
|
||||
private IEnumerator play()
|
||||
{
|
||||
yield return new WaitForSeconds(clip.length);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WTF : MonoBehaviour
|
||||
// this is a script for testing
|
||||
|
||||
namespace RhythmHeavenMania.Tests
|
||||
{
|
||||
public class WTF : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -15,4 +17,5 @@ public class WTF : MonoBehaviour
|
|||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Shaders.meta
Normal file
8
Assets/Shaders.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ba8fd574a5948a4b9c3bb56e0c57a2d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue