2021-12-24 03:36:16 +00:00
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
namespace RhythmHeavenMania.Games
{
public class Minigame : MonoBehaviour
{
2022-01-23 07:01:59 +00:00
public static float earlyTime = 0.84f , perfectTime = 0.91f , lateTime = 1.09f , endTime = 1.15f ;
2021-12-29 06:52:48 +00:00
public List < Minigame . Eligible > EligibleHits = new List < Minigame . Eligible > ( ) ;
2021-12-25 12:16:40 +00:00
[System.Serializable]
public class Eligible
{
public GameObject gameObject ;
public bool early ;
public bool perfect ;
public bool late ;
2022-01-23 03:40:53 +00:00
public bool notPerfect ( ) { return early | | late ; }
public bool eligible ( ) { return early | | perfect | | late ; }
2022-01-17 05:00:26 +00:00
public float createBeat ;
2021-12-25 12:16:40 +00:00
}
2021-12-25 02:37:03 +00:00
// hopefully these will fix the lowbpm problem
public static float EarlyTime ( )
{
return earlyTime ;
}
public static float PerfectTime ( )
{
return perfectTime ;
}
public static float LateTime ( )
{
return lateTime ;
}
public static float EndTime ( )
{
return endTime ;
}
2021-12-24 23:41:35 +00:00
2021-12-24 03:36:16 +00:00
public int firstEnable = 0 ;
2022-03-02 21:59:35 +00:00
public string name = "" ;
2021-12-24 03:36:16 +00:00
public virtual void OnGameSwitch ( )
{
2022-03-02 21:59:35 +00:00
//Below is a template that can be used for handling previous entities. There are multiple sections that have different functions, you don't need to use all of them
float beat = Conductor . instance . songPositionInBeats ;
List < Beatmap . Entity > prevEntities = GameManager . instance . Beatmap . entities . FindAll ( c = > c . beat < = beat & & c . datamodel . Split ( 0 ) = = name ) ;
2021-12-24 03:36:16 +00:00
2022-03-02 21:59:35 +00:00
//section below is if you only want to look at entities that overlap the game switch
foreach ( Beatmap . Entity entity in prevEntities )
{
if ( entity . beat + entity . length > = beat )
{
}
}
2021-12-24 03:36:16 +00:00
}
2021-12-26 05:11:54 +00:00
public virtual void OnTimeChange ( )
{
}
2022-01-17 05:00:26 +00:00
public int MultipleEventsAtOnce ( )
{
int sameTime = 0 ;
for ( int i = 0 ; i < EligibleHits . Count ; i + + )
{
float createBeat = EligibleHits [ i ] . createBeat ;
if ( EligibleHits . FindAll ( c = > c . createBeat = = createBeat ) . Count > 0 )
{
sameTime + = 1 ;
}
}
if ( sameTime = = 0 & & EligibleHits . Count > 0 )
sameTime = 1 ;
return sameTime ;
}
2021-12-24 03:36:16 +00:00
}
}