Dynamic event manager

This commit is contained in:
Starpelly 2021-12-22 19:08:35 -05:00
parent a4609989e6
commit a0e2636ecd
10 changed files with 503 additions and 290 deletions

View file

@ -133,12 +133,12 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 49975355} - component: {fileID: 49975355}
m_Layer: 0 m_Layer: 0
m_Name: ClappyTrio m_Name: clappyTrio
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!4 &49975355 --- !u!4 &49975355
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -146,14 +146,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 49975354} m_GameObject: {fileID: 49975354}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 1962334732} - {fileID: 1962334732}
- {fileID: 1739654936} - {fileID: 1739654936}
m_Father: {fileID: 0} m_Father: {fileID: 1923614611}
m_RootOrder: 5 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &142958109 --- !u!1 &142958109
GameObject: GameObject:
@ -906,7 +906,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1161847961} m_Father: {fileID: 1161847961}
m_RootOrder: 6 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &325946115 --- !u!1 &325946115
GameObject: GameObject:
@ -1148,8 +1148,8 @@ Transform:
m_Children: m_Children:
- {fileID: 1855769657} - {fileID: 1855769657}
- {fileID: 1765874089} - {fileID: 1765874089}
m_Father: {fileID: 1161847961} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &411650320 --- !u!1 &411650320
GameObject: GameObject:
@ -1479,7 +1479,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &490794386 --- !u!1 &490794386
GameObject: GameObject:
@ -3290,7 +3290,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 709067356} - {fileID: 709067356}
m_Father: {fileID: 1161847961} m_Father: {fileID: 1161847961}
m_RootOrder: 5 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
@ -3879,12 +3879,12 @@ GameObject:
- component: {fileID: 1161847961} - component: {fileID: 1161847961}
- component: {fileID: 1161847962} - component: {fileID: 1161847962}
m_Layer: 0 m_Layer: 0
m_Name: Fork Lifter m_Name: forkLifter
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!4 &1161847961 --- !u!4 &1161847961
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3892,7 +3892,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161847960} m_GameObject: {fileID: 1161847960}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
@ -3900,12 +3900,11 @@ Transform:
- {fileID: 1594730740} - {fileID: 1594730740}
- {fileID: 1144790344} - {fileID: 1144790344}
- {fileID: 1671500047} - {fileID: 1671500047}
- {fileID: 389255204}
- {fileID: 978514681} - {fileID: 978514681}
- {fileID: 311483437} - {fileID: 311483437}
- {fileID: 1495387615} - {fileID: 1495387615}
m_Father: {fileID: 0} m_Father: {fileID: 1923614611}
m_RootOrder: 4 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1161847962 --- !u!114 &1161847962
MonoBehaviour: MonoBehaviour:
@ -3919,7 +3918,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:
allPlayerActions: [] ForkLifterHand: {fileID: 1144790346}
handAnim: {fileID: 1144790345} handAnim: {fileID: 1144790345}
flickedObject: {fileID: 1671500045} flickedObject: {fileID: 1671500045}
peaPreview: {fileID: 2132733992} peaPreview: {fileID: 2132733992}
@ -4813,7 +4812,7 @@ Transform:
m_LocalScale: {x: 18.9426, y: 11.7704, z: 1} m_LocalScale: {x: 18.9426, y: 11.7704, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1161847961} m_Father: {fileID: 1161847961}
m_RootOrder: 7 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1531143822 --- !u!1 &1531143822
GameObject: GameObject:
@ -5049,7 +5048,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 3
m_Sprite: {fileID: 5006612820273086949, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3} m_Sprite: {fileID: 5006612820273086949, guid: bfb4e4bb08acdb14792cdd4c46253ab0, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
@ -6173,6 +6172,38 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &1923614610
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1923614611}
m_Layer: 0
m_Name: Games
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1923614611
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1923614610}
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: 1161847961}
- {fileID: 49975355}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1924956155 --- !u!1 &1924956155
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6562,6 +6593,9 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 2072389416} - component: {fileID: 2072389416}
- component: {fileID: 2072389417} - component: {fileID: 2072389417}
- component: {fileID: 2072389418}
- component: {fileID: 2072389419}
- component: {fileID: 2072389420}
m_Layer: 0 m_Layer: 0
m_Name: GameManager m_Name: GameManager
m_TagString: Untagged m_TagString: Untagged
@ -6577,11 +6611,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072389415} m_GameObject: {fileID: 2072389415}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -4.2372236, y: 2.3456008, z: -32.89208} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 25, y: 15, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2072389417 --- !u!114 &2072389417
MonoBehaviour: MonoBehaviour:
@ -6595,10 +6629,89 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fd86589935fb46c4db0d3d23d52743a9, type: 3} m_Script: {fileID: 11500000, guid: fd86589935fb46c4db0d3d23d52743a9, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Events: [] Beatmap:
bpm: 0
entities: []
currentEvent: 0 currentEvent: 0
txt: {fileID: 4900000, guid: cbe1a43c8ddc790498fde2e01e66d23e, type: 3} txt: {fileID: 4900000, guid: cbe1a43c8ddc790498fde2e01e66d23e, type: 3}
startOffset: 1 startOffset: 1
--- !u!212 &2072389418
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072389415}
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 32767
m_Sprite: {fileID: 7482667652216324306, guid: ef2fa2a75dc283e40b9d4fe1f20dc6fb, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &2072389419
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072389415}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 07e916edcdacfd744913fda312ab186c, type: 3}
m_Name:
m_EditorClassIdentifier:
GamesHolder: {fileID: 1923614611}
minigames: []
--- !u!114 &2072389420
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072389415}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b526b8bc5e3c6894a9d30b072c68fa27, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2127056958 --- !u!1 &2127056958
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -1,18 +1,25 @@
using System.Collections; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine;
public class Beatmap : MonoBehaviour namespace RhythmHeavenMania
{ {
// Start is called before the first frame update [Serializable]
void Start() public class Beatmap
{ {
public double bpm;
public List<Entity> entities;
[Serializable]
public class Entity : ICloneable
{
public float beat;
public int track;
public string datamodel;
public object Clone()
{
return this.MemberwiseClone();
}
} }
// Update is called once per frame
void Update()
{
} }
} }

View file

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using RhythmHeavenMania.Games.ForkLifter;
using RhythmHeavenMania.Games.ClappyTrio;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania
{
public class EventCaller : MonoBehaviour
{
public Transform GamesHolder;
private float currentBeat;
public delegate void EventCallback();
public List<MiniGame> minigames = new List<MiniGame>()
{
};
[Serializable]
public class MiniGame
{
public string name;
public GameObject holder;
public List<GameAction> actions = new List<GameAction>();
public MiniGame(string name, List<GameAction> actions)
{
this.name = name;
this.actions = actions;
}
}
public class GameAction
{
public string actionName;
public EventCallback function;
public GameAction(string actionName, EventCallback function)
{
this.actionName = actionName;
this.function = function;
}
}
public void Init()
{
minigames = new List<MiniGame>()
{
new MiniGame("forkLifter", new List<GameAction>()
{
new GameAction("pea", delegate { ForkLifter.instance.Flick(currentBeat, 0); } ),
new GameAction("topbun", delegate { ForkLifter.instance.Flick(currentBeat, 1); } ),
new GameAction("burger", delegate { ForkLifter.instance.Flick(currentBeat, 2); } ),
new GameAction("bottombun", delegate { ForkLifter.instance.Flick(currentBeat, 3); } ),
new GameAction("prepare", delegate { ForkLifter.instance.ForkLifterHand.Prepare(); }),
new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }),
new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); })
})
};
for (int i = 0; i < minigames.Count; i++)
{
minigames[i].holder = GamesHolder.Find(minigames[i].name).gameObject;
}
}
private void Update()
{
if (GameManager.instance.currentEvent > 0 && GameManager.instance.currentEvent < GameManager.instance.Beatmap.entities.Count)
currentBeat = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].beat;
}
public void CallEvent(string event_, float beat)
{
string[] details = event_.Split('/');
MiniGame game = minigames.Find(c => c.name == details[0]);
try
{
GameAction action = game.actions.Find(c => c.actionName == details[1]);
action.function.Invoke();
}
catch (Exception ex)
{
Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented.");
}
}
}
}

View file

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

View file

@ -12,8 +12,9 @@ namespace RhythmHeavenMania
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
public static GameManager instance; public static GameManager instance;
private EventCaller eventCaller;
public List<Event> Events = new List<Event>(); public Beatmap Beatmap;
public int currentEvent; public int currentEvent;
@ -21,17 +22,6 @@ namespace RhythmHeavenMania
public float startOffset; public float startOffset;
[Serializable]
public class Event : ICloneable
{
public float spawnTime;
public string eventName;
public object Clone()
{
return this.MemberwiseClone();
}
}
private void Awake() private void Awake()
{ {
@ -43,13 +33,16 @@ namespace RhythmHeavenMania
SortEventsList(); SortEventsList();
string json = txt.text; string json = txt.text;
Events = JsonConvert.DeserializeObject<List<Event>>(json); Beatmap.entities = JsonConvert.DeserializeObject<List<Beatmap.Entity>>(json);
SortEventsList(); SortEventsList();
StartCoroutine(Begin()); StartCoroutine(Begin());
GlobalGameManager.Init(); GlobalGameManager.Init();
eventCaller = GetComponent<EventCaller>();
eventCaller.Init();
} }
private IEnumerator Begin() private IEnumerator Begin()
@ -60,15 +53,17 @@ namespace RhythmHeavenMania
private void Update() private void Update()
{ {
if (Events.Count < 1) if (Beatmap.entities.Count < 1)
return; return;
List<float> floats = Events.Select(c => c.spawnTime).ToList(); List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
if (currentEvent < Events.Count && currentEvent >= 0) if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)
{ {
if (Conductor.instance.songPositionInBeats >= floats[currentEvent]) if (Conductor.instance.songPositionInBeats >= entities[currentEvent])
{ {
eventCaller.CallEvent(Beatmap.entities[currentEvent].datamodel, Beatmap.entities[currentEvent].beat);
currentEvent++; currentEvent++;
} }
} }
@ -76,15 +71,15 @@ namespace RhythmHeavenMania
public void SortEventsList() public void SortEventsList()
{ {
Events.Sort((x, y) => x.spawnTime.CompareTo(y.spawnTime)); Beatmap.entities.Sort((x, y) => x.beat.CompareTo(y.beat));
} }
public void SetCurrentEventToClosest() public void SetCurrentEventToClosest()
{ {
if (Events.Count > 0) if (Beatmap.entities.Count > 0)
{ {
List<float> floats = Events.Select(c => c.spawnTime).ToList(); List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
currentEvent = floats.IndexOf(Mathp.GetClosestInList(floats, Conductor.instance.songPositionInBeats)); currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, Conductor.instance.songPositionInBeats));
} }
} }

View file

@ -4,15 +4,18 @@ using UnityEngine;
using RhythmHeavenMania.Util; using RhythmHeavenMania.Util;
using DG.Tweening;
namespace RhythmHeavenMania.Games.ForkLifter namespace RhythmHeavenMania.Games.ForkLifter
{ {
public class ForkLifter : MonoBehaviour public class ForkLifter : MonoBehaviour
{ {
public static ForkLifter instance; public static ForkLifter instance;
GameManager GameManager; [Header("References")]
public ForkLifterHand ForkLifterHand;
private GameManager GameManager;
public List<GameManager.Event> allPlayerActions = new List<GameManager.Event>();
[Header("Objects")] [Header("Objects")]
public Animator handAnim; public Animator handAnim;
@ -22,6 +25,9 @@ namespace RhythmHeavenMania.Games.ForkLifter
public Sprite[] peaSprites; public Sprite[] peaSprites;
public Sprite[] peaHitSprites; public Sprite[] peaHitSprites;
private List<Beatmap.Entity> allPlayerActions = new List<Beatmap.Entity>();
private void Awake() private void Awake()
{ {
instance = this; instance = this;
@ -30,7 +36,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
private void Start() private void Start()
{ {
GameManager = GameManager.instance; GameManager = GameManager.instance;
allPlayerActions = GameManager.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare" && c.eventName != "end"); // allPlayerActions = GameManager.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare" && c.eventName != "end");
/*List<Event> temp = new List<Event>(); /*List<Event> temp = new List<Event>();
for (int i = 0; i < allPlayerActions.Count; i++) for (int i = 0; i < allPlayerActions.Count; i++)

View file

@ -13,18 +13,11 @@ namespace RhythmHeavenMania.Games.ForkLifter
public Sprite[] fastSprites; public Sprite[] fastSprites;
List<GameManager.Event> allPlayerActions; // List<GameManager.Event> allPlayerActions;
public static ForkLifterHand instance { get; set; }
private void Awake()
{
instance = this;
}
public void CheckNextFlick() public void CheckNextFlick()
{ {
allPlayerActions = GameManager.instance.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare"); // allPlayerActions = GameManager.instance.Events.FindAll(c => c.eventName != "gulp" && c.eventName != "sigh" && c.eventName != "prepare");
/*if (GameManager.instance.currentEventPlayer < allPlayerActions.Count) /*if (GameManager.instance.currentEventPlayer < allPlayerActions.Count)
{ {

View file

@ -10,6 +10,8 @@ namespace RhythmHeavenMania.Games.ForkLifter
{ {
public class ForkLifterPlayer : MonoBehaviour public class ForkLifterPlayer : MonoBehaviour
{ {
public static ForkLifterPlayer instance { get; set; }
[Header("Objects")] [Header("Objects")]
public GameObject fork; public GameObject fork;
public Sprite peaSprite; public Sprite peaSprite;
@ -27,7 +29,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
public List<Eligible> EligibleHits = new List<Eligible>(); public List<Eligible> EligibleHits = new List<Eligible>();
private int currentHitInList = 0; private int currentHitInList = 0;
public static ForkLifterPlayer instance { get; set; }
public float timescale = 1; public float timescale = 1;
@ -204,7 +205,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
RemovePea(); RemovePea();
GoForAPerfect.instance.Hit();
GameProfiler.instance.IncreaseScore(); GameProfiler.instance.IncreaseScore();
} }
else if (EligibleHits[currentHitInList].early) else if (EligibleHits[currentHitInList].early)
@ -235,8 +235,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
currentEarlyPeasOnFork++; currentEarlyPeasOnFork++;
RemovePea(); RemovePea();
GoForAPerfect.instance.Miss();
} }
else if (EligibleHits[currentHitInList].late) else if (EligibleHits[currentHitInList].late)
{ {
@ -266,8 +264,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
currentLatePeasOnFork++; currentLatePeasOnFork++;
RemovePea(); RemovePea();
GoForAPerfect.instance.Miss();
} }
} }
else else

View file

@ -74,7 +74,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
{ {
endstate++; endstate++;
Jukebox.PlayOneShot("disappointed"); Jukebox.PlayOneShot("disappointed");
GoForAPerfect.instance.Miss();
} }
if (normalizedBeat > 1.35f) if (normalizedBeat > 1.35f)

View file

@ -1,432 +1,432 @@
[ [
{ {
"spawnTime": 9, "beat": 9,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 13, "beat": 13,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 18, "beat": 18,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 21, "beat": 21,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 25, "beat": 25,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 29, "beat": 29,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 34, "beat": 34,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 37, "beat": 37,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 41, "beat": 41,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 42, "beat": 42,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 45, "beat": 45,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 45.5, "beat": 45.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 49, "beat": 49,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 50, "beat": 50,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 53, "beat": 53,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 53.5, "beat": 53.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 57, "beat": 57,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 58, "beat": 58,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 62, "beat": 62,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 65, "beat": 65,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 66, "beat": 66,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 69, "beat": 69,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 69.5, "beat": 69.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 73, "beat": 73,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 74, "beat": 74,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 77, "beat": 77,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 81, "beat": 81,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 82, "beat": 82,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 85.5, "beat": 85.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 86, "beat": 86,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 86.5, "beat": 86.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 90, "beat": 90,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 93, "beat": 93,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 94, "beat": 94,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 98, "beat": 98,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 101, "beat": 101,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 105, "beat": 105,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 106, "beat": 106,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 109, "beat": 109,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 114, "beat": 114,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 117, "beat": 117,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 118, "beat": 118,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 121, "beat": 121,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 122, "beat": 122,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 125, "beat": 125,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 126, "beat": 126,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 130, "beat": 130,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 133, "beat": 133,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 137.5, "beat": 137.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 138, "beat": 138,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 141, "beat": 141,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 145.5, "beat": 145.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 146, "beat": 146,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 149, "beat": 149,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 153.5, "beat": 153.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 154, "beat": 154,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 157, "beat": 157,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 161.5, "beat": 161.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 162, "beat": 162,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 165, "beat": 165,
"eventName": "topbun" "datamodel": "forkLifter/topbun"
}, },
{ {
"spawnTime": 165.65, "beat": 165.65,
"eventName": "burger" "datamodel": "forkLifter/burger"
}, },
{ {
"spawnTime": 166.25, "beat": 166.25,
"eventName": "bottombun" "datamodel": "forkLifter/bottombun"
}, },
{ {
"spawnTime": 169.5, "beat": 169.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 170, "beat": 170,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 173, "beat": 173,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 177.5, "beat": 177.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 178, "beat": 178,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 181, "beat": 181,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 185.5, "beat": 185.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 186, "beat": 186,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 188.5, "beat": 188.5,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 189, "beat": 189,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 193, "beat": 193,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 196, "beat": 196,
"eventName": "pea" "datamodel": "forkLifter/pea"
}, },
{ {
"spawnTime": 16, "beat": 16,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 24, "beat": 24,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 32, "beat": 32,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 39.75, "beat": 39.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 44.25, "beat": 44.25,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 48, "beat": 48,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 52.25, "beat": 52.25,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 56, "beat": 56,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 64.25, "beat": 64.25,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 68.5, "beat": 68.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 72, "beat": 72,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 80, "beat": 80,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 84.5, "beat": 84.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 88.75, "beat": 88.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 96.75, "beat": 96.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 103.5, "beat": 103.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 112, "beat": 112,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 120.5, "beat": 120.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 124.5, "beat": 124.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 128.75, "beat": 128.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 135.75, "beat": 135.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 143.75, "beat": 143.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 151.75, "beat": 151.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 160, "beat": 160,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 164.25, "beat": 164.25,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 168.75, "beat": 168.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 175.75, "beat": 175.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 183.75, "beat": 183.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 188.5, "beat": 188.5,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 191.75, "beat": 191.75,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 199, "beat": 199,
"eventName": "gulp" "datamodel": "forkLifter/gulp"
}, },
{ {
"spawnTime": 201, "beat": 201,
"eventName": "sigh" "datamodel": "sigh"
}, },
{"spawnTime":8.0,"eventName":"prepare"},{"spawnTime":12.0,"eventName":"prepare"},{"spawnTime":17.0,"eventName":"prepare"},{"spawnTime":20.0,"eventName":"prepare"},{"spawnTime":24.0,"eventName":"prepare"},{"spawnTime":28.0,"eventName":"prepare"},{"spawnTime":33.0,"eventName":"prepare"},{"spawnTime":36.0,"eventName":"prepare"},{"spawnTime":40.0,"eventName":"prepare"},{"spawnTime":44.0,"eventName":"prepare"},{"spawnTime":48.0,"eventName":"prepare"},{"spawnTime":52.0,"eventName":"prepare"},{"spawnTime":56.0,"eventName":"prepare"},{"spawnTime":61.0,"eventName":"prepare"},{"spawnTime":64.0,"eventName":"prepare"},{"spawnTime":68.0,"eventName":"prepare"},{"spawnTime":72.0,"eventName":"prepare"},{"spawnTime":76.0,"eventName":"prepare"},{"spawnTime":80.0,"eventName":"prepare"},{"spawnTime":84.5,"eventName":"prepare"},{"spawnTime":89.0,"eventName":"prepare"},{"spawnTime":92.0,"eventName":"prepare"},{"spawnTime":97.0,"eventName":"prepare"},{"spawnTime":100.0,"eventName":"prepare"},{"spawnTime":104.0,"eventName":"prepare"},{"spawnTime":108.0,"eventName":"prepare"},{"spawnTime":113.0,"eventName":"prepare"},{"spawnTime":116.0,"eventName":"prepare"},{"spawnTime":120.0,"eventName":"prepare"},{"spawnTime":124.0,"eventName":"prepare"},{"spawnTime":129.0,"eventName":"prepare"},{"spawnTime":132.0,"eventName":"prepare"},{"spawnTime":136.5,"eventName":"prepare"},{"spawnTime":140.0,"eventName":"prepare"},{"spawnTime":144.5,"eventName":"prepare"},{"spawnTime":148.0,"eventName":"prepare"},{"spawnTime":152.5,"eventName":"prepare"},{"spawnTime":156.0,"eventName":"prepare"},{"spawnTime":160.5,"eventName":"prepare"},{"spawnTime":164.0,"eventName":"prepare"},{"spawnTime":168.5,"eventName":"prepare"},{"spawnTime":172.0,"eventName":"prepare"},{"spawnTime":176.5,"eventName":"prepare"},{"spawnTime":180.0,"eventName":"prepare"},{"spawnTime":184.5,"eventName":"prepare"},{"spawnTime":187.5,"eventName":"prepare"},{"spawnTime":192.0,"eventName":"prepare"},{"spawnTime":195.0,"eventName":"prepare"} {"beat":8.0,"datamodel":"forkLifter/prepare"},{"beat":12.0,"datamodel":"forkLifter/prepare"},{"beat":17.0,"datamodel":"forkLifter/prepare"},{"beat":20.0,"datamodel":"forkLifter/prepare"},{"beat":24.0,"datamodel":"forkLifter/prepare"},{"beat":28.0,"datamodel":"forkLifter/prepare"},{"beat":33.0,"datamodel":"forkLifter/prepare"},{"beat":36.0,"datamodel":"forkLifter/prepare"},{"beat":40.0,"datamodel":"forkLifter/prepare"},{"beat":44.0,"datamodel":"forkLifter/prepare"},{"beat":48.0,"datamodel":"forkLifter/prepare"},{"beat":52.0,"datamodel":"forkLifter/prepare"},{"beat":56.0,"datamodel":"forkLifter/prepare"},{"beat":61.0,"datamodel":"forkLifter/prepare"},{"beat":64.0,"datamodel":"forkLifter/prepare"},{"beat":68.0,"datamodel":"forkLifter/prepare"},{"beat":72.0,"datamodel":"forkLifter/prepare"},{"beat":76.0,"datamodel":"forkLifter/prepare"},{"beat":80.0,"datamodel":"forkLifter/prepare"},{"beat":84.5,"datamodel":"forkLifter/prepare"},{"beat":89.0,"datamodel":"forkLifter/prepare"},{"beat":92.0,"datamodel":"forkLifter/prepare"},{"beat":97.0,"datamodel":"forkLifter/prepare"},{"beat":100.0,"datamodel":"forkLifter/prepare"},{"beat":104.0,"datamodel":"forkLifter/prepare"},{"beat":108.0,"datamodel":"forkLifter/prepare"},{"beat":113.0,"datamodel":"forkLifter/prepare"},{"beat":116.0,"datamodel":"forkLifter/prepare"},{"beat":120.0,"datamodel":"forkLifter/prepare"},{"beat":124.0,"datamodel":"forkLifter/prepare"},{"beat":129.0,"datamodel":"forkLifter/prepare"},{"beat":132.0,"datamodel":"forkLifter/prepare"},{"beat":136.5,"datamodel":"forkLifter/prepare"},{"beat":140.0,"datamodel":"forkLifter/prepare"},{"beat":144.5,"datamodel":"forkLifter/prepare"},{"beat":148.0,"datamodel":"forkLifter/prepare"},{"beat":152.5,"datamodel":"forkLifter/prepare"},{"beat":156.0,"datamodel":"forkLifter/prepare"},{"beat":160.5,"datamodel":"forkLifter/prepare"},{"beat":164.0,"datamodel":"forkLifter/prepare"},{"beat":168.5,"datamodel":"forkLifter/prepare"},{"beat":172.0,"datamodel":"forkLifter/prepare"},{"beat":176.5,"datamodel":"forkLifter/prepare"},{"beat":180.0,"datamodel":"forkLifter/prepare"},{"beat":184.5,"datamodel":"forkLifter/prepare"},{"beat":187.5,"datamodel":"forkLifter/prepare"},{"beat":192.0,"datamodel":"forkLifter/prepare"},{"beat":195.0,"datamodel":"forkLifter/prepare"}
, ,
{ {
"spawnTime": 206, "beat": 206,
"eventName": "end" "datamodel": "end"
} }
] ]