Integration of Jukebox Library (#451)

* add Jukebox library

todo:
- saving / loading of new format
- inferrence of unknown data like past versions
- move the temporary float casts to proper use of double
- make sound related functions take double for timing
- inform people that the Jukebox sound player was renamed to SoundByte lol

* make sound, input scheduling, and super curve use double precision

* successfully load charts

* editor works again

v1 riqs can be saved and loaded

* first tempo and volume markers are unmovable

fix loading of charts' easing values

* use gsync / freesync

* update Jukebox refs to SoundByte

* game events use double part 1

Air Rally - Glee Club converted

* don't load song if chart load fails

* finish conversion of all minigames

* remove editor waveform toggle

* timeline now respects added song offset length

clear cache files on app close
prepped notes for dsp sync

* update timeline length when offset changed

* update to latest Jukebox

* make error panel object in global game manager

* improve conductor music scheduling

* added error message box

fix first game events sometimes not playing
This commit is contained in:
minenice55 2023-06-10 15:13:29 -04:00 committed by GitHub
parent 2b0ced2f17
commit 50a1b7bcdb
176 changed files with 4868 additions and 3013 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0d89ef13f0e54ef4a9d25d14626da7d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ErrorPanelMaterial
m_Shader: {fileID: 4800000, guid: 777678d31f953e04e8f15812003b9c27, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OutSmoothness: 0.015
- _OutThickness: 0.75
- _Parallax: 0.02
- _Smoothness: 0.015
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _Thickness: 0.85
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _OutColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: efcc40f3353c0f6449f5289c2a5efb7e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3577,7 +3577,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -289.15, y: 2}
m_AnchoredPosition: {x: -289.15002, y: 2}
m_SizeDelta: {x: -578.29, y: 49.92}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &156962255
@ -8240,12 +8240,9 @@ MonoBehaviour:
raycastRect: {fileID: 1186810249}
moving: 0
hovering: 0
first: 0
volumeTXT: {fileID: 746356640}
volumeLine: {fileID: 1126835990}
volumeChange:
beat: 0
length: 0
volume: 0
--- !u!114 &380411596
MonoBehaviour:
m_ObjectHideFlags: 0
@ -14314,12 +14311,9 @@ MonoBehaviour:
raycastRect: {fileID: 983551349}
moving: 0
hovering: 0
first: 0
tempoTXT: {fileID: 499528699}
tempoLine: {fileID: 1287203019}
tempoChange:
beat: 0
length: 0
tempo: 0
--- !u!114 &666273486
MonoBehaviour:
m_ObjectHideFlags: 0
@ -14922,7 +14916,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -84, y: -128.1}
m_AnchoredPosition: {x: -84, y: -128.09998}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &683816223
@ -17478,13 +17472,6 @@ MonoBehaviour:
resizeGraphic: {fileID: 880758902}
leftDrag: {fileID: 2046851080}
rightDrag: {fileID: 184364176}
entity:
beat: 0
track: 0
length: 0
swing: 0
datamodel:
eventObj: {fileID: 0}
length: 0
eligibleToMove: 0
selected: 0
@ -17494,7 +17481,7 @@ MonoBehaviour:
moving: 0
wasDuplicated: 0
isCreating: 0
eventObjID:
eventObjID: 0
NormalCol: {r: 0.8470589, g: 0.8470589, b: 1, a: 1}
--- !u!222 &798021451
CanvasRenderer:
@ -18298,13 +18285,6 @@ MonoBehaviour:
DropdownP: {fileID: 184838087}
ColorP: {fileID: 1443721746}
StringP: {fileID: 1671827686}
entity:
beat: 0
track: 0
length: 0
swing: 0
datamodel:
eventObj: {fileID: 0}
active: 0
canDisable: 1
--- !u!114 &830452355
@ -23941,7 +23921,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 129.96861}
m_AnchoredPosition: {x: 0, y: 129.92226}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1154875944
@ -25916,7 +25896,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1274337802
RectTransform:
m_ObjectHideFlags: 0
@ -25933,9 +25913,9 @@ RectTransform:
m_Father: {fileID: 1871675778}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 129, y: -23}
m_SizeDelta: {x: 35, y: 35}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1274337803
@ -31347,14 +31327,10 @@ MonoBehaviour:
raycastRect: {fileID: 738028140}
moving: 0
hovering: 0
first: 0
sectionLabel: {fileID: 297792673}
chartLine: {fileID: 856705695}
sectionDialog: {fileID: 292323699}
chartSection:
beat: 0
startPerfect: 0
sectionName:
isCheckpoint: 0
--- !u!114 &1542666928
MonoBehaviour:
m_ObjectHideFlags: 0
@ -32174,7 +32150,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1292844878}
m_HandleRect: {fileID: 1292844877}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@ -33034,7 +33010,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 111.50012, y: -29.533981}
m_AnchoredPosition: {x: 111.50012, y: -29.533966}
m_SizeDelta: {x: 223, y: -108.27}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1671351976
@ -35819,7 +35795,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -84.98996}
m_AnchoredPosition: {x: 0, y: -84.98999}
m_SizeDelta: {x: 320, y: -84.99}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1852819572
@ -38348,7 +38324,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -29.529953}
m_AnchoredPosition: {x: 0, y: -29.529938}
m_SizeDelta: {x: 0, y: -108.26}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1980243267
@ -41342,7 +41318,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 8995444695224805070, guid: 51bd6620194834c4c9118dd0f64b1b3d, type: 3}
propertyPath: m_AnchoredPosition.y
value: -49.99991
value: -49.999878
objectReference: {fileID: 0}
- target: {fileID: 8995444695466730802, guid: 51bd6620194834c4c9118dd0f64b1b3d, type: 3}
propertyPath: tabs.Array.size

View File

@ -1,124 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
using Newtonsoft.Json;
using HeavenStudio.Util;
namespace HeavenStudio
{
[Serializable]
public class Beatmap
{
public float bpm;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(100)]
public int musicVolume; // In percent (1-100)
public List<Entity> entities = new List<Entity>();
public List<TempoChange> tempoChanges = new List<TempoChange>();
public List<VolumeChange> volumeChanges = new List<VolumeChange>();
public float firstBeatOffset;
[Serializable]
public class Entity : ICloneable
{
public float beat;
public int track;
// consideration: use arrays instead of hardcoding fixed parameter names
// note from zeo: yeah definately use arrays
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type3;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type4;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type5;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type6;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorC;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorD;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorE;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorF;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text1;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text2;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text3;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing;
public string datamodel;
[JsonIgnore] public Editor.Track.TimelineEventObj eventObj;
public object Clone()
{
return this.MemberwiseClone();
}
public Entity DeepCopy()
{
//lol the AI generated this
return JsonConvert.DeserializeObject<Entity>(JsonConvert.SerializeObject(this));
}
public dynamic this[string propertyName]
{
get
{
try
{
return typeof(Entity).GetField(propertyName).GetValue(this);
}
catch (NullReferenceException ex)
{
UnityEngine.Debug.LogWarning($"{propertyName} doesn't exist in this Legacy Entity. Conversion needs to create this field... Exception log: {ex}");
return null;
}
}
set
{
try
{
typeof(Entity).GetField(propertyName).SetValue(this, value);
}
catch (Exception ex)
{
UnityEngine.Debug.LogError($"You probably misspelled a parameter, or defined the object type wrong. Exception log: {ex}");
}
}
}
}
[Serializable]
public class TempoChange : ICloneable
{
public float beat;
public float length;
public float tempo;
public object Clone()
{
return this.MemberwiseClone();
}
}
[Serializable]
public class VolumeChange : ICloneable
{
public float beat;
public float length;
public float volume;
public object Clone()
{
return this.MemberwiseClone();
}
}
}
}

View File

@ -1,468 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text.RegularExpressions;
using UnityEngine;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using HeavenStudio.Util;
namespace HeavenStudio
{
[Serializable]
public class DynamicBeatmap
{
public static int CurrentRiqVersion = 0;
public float bpm;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(100)] public int musicVolume; // In percent (1-100)
public Dictionary<string, object> properties =
new Dictionary<string, object>() {
// software version (MajorMinorPatch, revision)
{"productversion", 000},
{"productsubversion", 0},
// file format version
{"riqversion", CurrentRiqVersion},
// mapper set properties? (future: use this to flash the button)
{"propertiesmodified", false},
////// CATEGORY 1: SONG INFO
// general chart info
{"remixtitle", "New Remix"}, // chart name
{"remixauthor", "Your Name"}, // charter's name
{"remixdesc", "Remix Description"}, // chart description
{"remixlevel", 1}, // chart difficulty (maybe offer a suggestion but still have the mapper determine it)
{"remixtempo", 120f}, // avg. chart tempo
{"remixtags", ""}, // chart tags
{"icontype", 0}, // chart icon (presets, custom - future)
{"iconurl", ""}, // custom icon location (future)
// chart song info
{"idolgenre", "Song Genre"}, // song genre
{"idolsong", "Song Name"}, // song name
{"idolcredit", "Artist"}, // song artist
////// CATEGORY 2: PROLOGUE AND EPILOGUE
// chart prologue
{"prologuetype", 0}, // prologue card animation (future)
{"prologuecaption", "Remix"}, // prologue card sub-title (future)
// chart results screen messages
{"resultcaption", "Rhythm League Notes"}, // result screen header
{"resultcommon_hi", "Good rhythm."}, // generic "Superb" message (one-liner, or second line for single-type)
{"resultcommon_ok", "Eh. Passable."}, // generic "OK" message (one-liner, or second line for single-type)
{"resultcommon_ng", "Try harder next time."}, // generic "Try Again" message (one-liner, or second line for single-type)
// the following are shown / hidden in-editor depending on the tags of the games used
{"resultnormal_hi", "You show strong fundamentals."}, // "Superb" message for normal games (two-liner)
{"resultnormal_ng", "Work on your fundamentals."}, // "Try Again" message for normal games (two-liner)
{"resultkeep_hi", "You kept the beat well."}, // "Superb" message for keep-the-beat games (two-liner)
{"resultkeep_ng", "You had trouble keeping the beat."}, // "Try Again" message for keep-the-beat games (two-liner)
{"resultaim_hi", "You had great aim."}, // "Superb" message for aim games (two-liner)
{"resultaim_ng", "Your aim was a little shaky."}, // "Try Again" message for aim games (two-liner)
{"resultrepeat_hi", "You followed the example well."}, // "Superb" message for call-and-response games (two-liner)
{"resultrepeat_ng", "Next time, follow the example better."}, // "Try Again" message for call-and-response games (two-liner)
};
public List<DynamicEntity> entities = new List<DynamicEntity>();
public List<TempoChange> tempoChanges = new List<TempoChange>();
public List<VolumeChange> volumeChanges = new List<VolumeChange>();
public List<ChartSection> beatmapSections = new List<ChartSection>();
public float firstBeatOffset;
[Serializable]
public class DynamicEntity : ICloneable
{
public float beat;
public int track;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing;
public Dictionary<string, dynamic> DynamicData = new Dictionary<string, dynamic>();
public string datamodel;
[JsonIgnore] public Editor.Track.TimelineEventObj eventObj;
public object Clone()
{
return this.MemberwiseClone();
}
public DynamicEntity DeepCopy()
{
DynamicEntity copy = (DynamicEntity)this.MemberwiseClone();
copy.DynamicData = new Dictionary<string, dynamic>(this.DynamicData);
return copy;
}
public dynamic this[string propertyName]
{
get
{
switch (propertyName)
{
case "beat":
return beat;
case "track":
return track;
case "length":
return length;
case "swing":
return swing;
case "datamodel":
return datamodel;
default:
if (DynamicData.ContainsKey(propertyName))
return DynamicData[propertyName];
else
{
Minigames.Minigame game = EventCaller.instance.GetMinigame(datamodel.Split(0));
Minigames.Param param = EventCaller.instance.GetGameParam(game, datamodel.Split(1), propertyName);
return param.parameter;
}
}
}
set
{
switch (propertyName)
{
case "beat":
case "track":
case "length":
case "swing":
case "datamodel":
UnityEngine.Debug.LogWarning($"Property name {propertyName} is reserved and cannot be set.");
break;
default:
if (DynamicData.ContainsKey(propertyName))
DynamicData[propertyName] = value;
else
UnityEngine.Debug.LogError($"This entity does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}");
break;
}
}
}
public void CreateProperty(string name, dynamic defaultValue)
{
if (!DynamicData.ContainsKey(name))
DynamicData.Add(name, defaultValue);
}
}
[Serializable]
public class TempoChange : ICloneable
{
public float beat;
public float length;
public float tempo;
public object Clone()
{
return this.MemberwiseClone();
}
}
[Serializable]
public class VolumeChange : ICloneable
{
public float beat;
public float length;
public float volume;
public object Clone()
{
return this.MemberwiseClone();
}
}
[Serializable]
public class ChartSection : ICloneable
{
public float beat;
public bool startPerfect;
public string sectionName;
public bool isCheckpoint; // really don't think we need this but who knows
public object Clone()
{
return this.MemberwiseClone();
}
}
public dynamic this[string propertyName]
{
get
{
return properties[propertyName] ?? null;
}
set
{
if (properties.ContainsKey(propertyName))
{
properties[propertyName] = value;
}
else
{
UnityEngine.Debug.LogError($"This beatmap does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}");
}
}
}
/// <summary>
/// converts from the old "rhmania" / "tengoku" format to the new "riq" format
/// </summary>
/// <param name="beatmap">a deserialized .rhmania or .tengoku beatmap</param>
/// <returns>a .riq beatmap</returns>
public static DynamicBeatmap BeatmapConverter(Beatmap beatmap)
{
DynamicBeatmap dynamicBeatmap = new DynamicBeatmap();
dynamicBeatmap.bpm = beatmap.bpm;
dynamicBeatmap.musicVolume = beatmap.musicVolume;
dynamicBeatmap.firstBeatOffset = beatmap.firstBeatOffset;
Minigames.Minigame game;
Minigames.GameAction action;
System.Type type, pType;
foreach (var e in beatmap.entities)
{
game = EventCaller.instance.GetMinigame(e.datamodel.Split(0));
action = EventCaller.instance.GetGameAction(game, e.datamodel.Split(1));
if (game == null || action == null)
{
//FUTURE: attempt to convert to a new entity if a converter exists for this datamodel
UnityEngine.Debug.LogError($"Could not find game or gameaction from datamodel {e.datamodel} @ beat {e.beat}, skipping entity");
continue;
}
// Debug.Log($"{game.name} {action.displayName} @ beat {e.beat}");
Dictionary<string, dynamic> dynamicData = new Dictionary<string, dynamic>();
//check each param of the action
if (action.parameters != null)
{
foreach (var param in action.parameters)
{
if (e[param.propertyName] == null)
{
dynamicData.Add(param.propertyName, param.parameter);
continue;
}
type = param.parameter.GetType();
pType = e[param.propertyName].GetType();
// Debug.Log($"adding parameter {param.propertyName} of type {type}");
if (!dynamicData.ContainsKey(param.propertyName))
{
if (pType == type)
{
dynamicData.Add(param.propertyName, e[param.propertyName]);
}
else
{
if (type == typeof(EntityTypes.Integer))
dynamicData.Add(param.propertyName, (int) e[param.propertyName]);
else if (type == typeof(EntityTypes.Float))
dynamicData.Add(param.propertyName, (float) e[param.propertyName]);
else if (type.IsEnum && param.propertyName != "ease")
dynamicData.Add(param.propertyName, (int) e[param.propertyName]);
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
dynamicData.Add(param.propertyName, e[param.propertyName].ToObject(type));
else
dynamicData.Add(param.propertyName, Convert.ChangeType(e[param.propertyName], type));
}
}
else
{
Debug.LogWarning($"Property {param.propertyName} already exists in the entity's dynamic data! Skipping...");
}
}
}
dynamicBeatmap.entities.Add(new DynamicEntity()
{
beat = e.beat,
track = e.track,
length = e.length,
swing = e.swing,
datamodel = e.datamodel,
DynamicData = dynamicData
});
}
foreach (var tempoChange in beatmap.tempoChanges)
{
dynamicBeatmap.tempoChanges.Add(new TempoChange()
{
beat = tempoChange.beat,
length = tempoChange.length,
tempo = tempoChange.tempo
});
}
foreach (var volumeChange in beatmap.volumeChanges)
{
dynamicBeatmap.volumeChanges.Add(new VolumeChange()
{
beat = volumeChange.beat,
length = volumeChange.length,
volume = volumeChange.volume
});
}
return dynamicBeatmap;
}
/// <summary>
/// FUTURE: converts from a karateka mania chart ("bor") to the "riq" format
/// </summary>
/// <param name="bor">a rawtext .bor chart</param>
/// <returns>a .riq beatmap</returns>
/// <remarks>not implemented yet</remarks>
public static DynamicBeatmap KManiaBorConverter(String bor)
{
return null;
}
/// <summary>
/// updates an "riq" beatmap
/// </summary>
/// <param name="beatmap">old beatmap</param>
/// <param name="version">version of old beatmap</param>
/// <returns>updated beatmap</returns>
/// <remarks>not implemented yet</remarks>
public static DynamicBeatmap BeatmapUpdater(DynamicBeatmap beatmap, int version)
{
return beatmap;
}
/// <summary>
/// processes an riq beatmap after it is loaded
/// </summary>
public void PostProcess()
{
DynamicBeatmap beatmapModel = new DynamicBeatmap();
Minigames.Minigame game;
Minigames.GameAction action;
System.Type type, pType;
foreach (var e in entities)
{
var gameName = e.datamodel.Split(0);
var actionName = e.datamodel.Split(1);
game = EventCaller.instance.GetMinigame(gameName);
if (game == null)
{
Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game...");
game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n<color=#eb5454>[inferred from remix.json]</color>", "", false, false, new List<Minigames.GameAction>(), inferred: true);
EventCaller.instance.minigames.Add(game);
if (Editor.Editor.instance != null)
Editor.Editor.instance.AddIcon(game);
}
action = EventCaller.instance.GetGameAction(game, actionName);
if (action == null)
{
Debug.LogWarning($"Unknown action {gameName}/{actionName} found in remix.json! Adding action...");
var parameters = new List<Minigames.Param>();
foreach (var item in e.DynamicData)
{
var value = item.Value;
if (value.GetType() == typeof(long))
value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value);
else if (value.GetType() == typeof(double))
value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value);
parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]"));
}
action = new Minigames.GameAction(actionName, DisplayName(actionName), e.length, true, parameters);
game.actions.Add(action);
}
Dictionary<string, dynamic> dynamicData = new Dictionary<string, dynamic>();
//check each param of the action
if (action.parameters != null)
{
foreach (var param in action.parameters)
{
if (!dynamicData.ContainsKey(param.propertyName))
{
type = param.parameter.GetType();
//FUTURE: attempt to convert to a new entity if a converter exists for this datamodel
//add property if it doesn't exist
if (!e.DynamicData.ContainsKey(param.propertyName))
{
Debug.LogWarning($"Property {param.propertyName} does not exist in the entity's dynamic data! Adding...");
if (type == typeof(EntityTypes.Integer))
dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val);
else if (type == typeof(EntityTypes.Float))
dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val);
else if (type.IsEnum && param.propertyName != "ease")
dynamicData.Add(param.propertyName, (int)param.parameter);
else
dynamicData.Add(param.propertyName, Convert.ChangeType(param.parameter, type));
continue;
}
pType = e[param.propertyName].GetType();
if (pType == type)
{
dynamicData.Add(param.propertyName, e[param.propertyName]);
}
else
{
if (type == typeof(EntityTypes.Integer))
dynamicData.Add(param.propertyName, (int)e[param.propertyName]);
else if (type == typeof(EntityTypes.Float))
dynamicData.Add(param.propertyName, (float)e[param.propertyName]);
else if (type == typeof(EasingFunction.Ease) && pType == typeof(string))
dynamicData.Add(param.propertyName, Enum.Parse(typeof(EasingFunction.Ease), (string)e[param.propertyName]));
else if (type.IsEnum)
dynamicData.Add(param.propertyName, (int)e[param.propertyName]);
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
dynamicData.Add(param.propertyName, e[param.propertyName].ToObject(type));
else
dynamicData.Add(param.propertyName, Convert.ChangeType(e[param.propertyName], type));
}
}
else
{
Debug.LogWarning($"Property {param.propertyName} already exists in the entity's dynamic data! Skipping...");
}
}
}
e.DynamicData = dynamicData;
}
//go thru each property of the model beatmap and add any missing keyvalue pair
foreach (var prop in beatmapModel.properties)
{
if (!properties.ContainsKey(prop.Key))
{
properties.Add(prop.Key, prop.Value);
}
}
}
private string DisplayName(string name)
{
// "gameName" -> "Game Name"
// "action name" -> "Action Name"
if (!name.Contains(" "))
name = SplitCamelCase(name);
System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
return textInfo.ToTitleCase(name);
}
// https://stackoverflow.com/a/5796793
public static string SplitCamelCase(string str)
{
return Regex.Replace(
Regex.Replace(
str,
@"(\P{Ll})(\P{Ll}\p{Ll})",
"$1 $2"
),
@"(\p{Ll})(\P{Ll})",
"$1 $2"
);
}
}
}

View File

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

View File

@ -26,7 +26,7 @@ namespace HeavenStudio.Util
this.clips = new List<SequenceClip>(clips);
}
public MultiSound Play(float startBeat, params SequenceParams[] args)
public MultiSound Play(double startBeat, params SequenceParams[] args)
{
List<MultiSound.Sound> sounds = new List<MultiSound.Sound>();
Dictionary<string, string> paramMaps = new Dictionary<string, string>();
@ -34,11 +34,11 @@ namespace HeavenStudio.Util
foreach (SequenceClip clipdat in clips)
{
string clip = clipdat.clip;
float beat = clipdat.beat;
double beat = clipdat.beat;
float pitch = clipdat.pitch;
float volume = clipdat.volume;
bool looping = clipdat.looping;
float offset = clipdat.offset;
double offset = clipdat.offset;
if (args != null && clipdat.parameters != null && clipdat.parameters.Length > 0)
{
paramMaps.Clear();

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using UnityEngine;
using Starpelly;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio
{
@ -14,10 +16,12 @@ namespace HeavenStudio
public float songBpm;
// The number of seconds for each song beat
public float secPerBeat;
public float secPerBeat => (float)secPerBeatAsDouble;
public double secPerBeatAsDouble;
// The number of seconds for each song beat, inversely scaled to song pitch (higer pitch = shorter time)
public float pitchedSecPerBeat => (secPerBeat / SongPitch);
public float pitchedSecPerBeat => (float)pitchedSecPerBeatAsDouble;
public double pitchedSecPerBeatAsDouble => (secPerBeat / SongPitch);
// Current song position, in seconds
private double songPos; // for Conductor use only
@ -31,12 +35,14 @@ namespace HeavenStudio
// Current time of the song
private double time;
double lastAbsTime;
double dspTime, lastDspTime;
double absTime, lastAbsTime;
// the dspTime we started at
private double dspStartTime;
public double dspStartTimeAsDouble => dspStartTime;
private double dspStart;
private float dspStartTime => (float)dspStart;
public double dspStartTimeAsDouble => dspStart;
DateTime startTime;
//the beat we started at
private double startBeat;
@ -46,7 +52,7 @@ namespace HeavenStudio
public AudioSource musicSource;
// The offset to the first beat of the song in seconds
public float firstBeatOffset;
public double firstBeatOffset;
// Conductor instance
public static Conductor instance;
@ -58,7 +64,7 @@ namespace HeavenStudio
public bool isPaused;
// Last reported beat based on song position
private float lastReportedBeat = 0f;
private double lastReportedBeat = 0f;
// Metronome tick sound enabled
public bool metronome = false;
@ -68,6 +74,8 @@ namespace HeavenStudio
private float timelinePitch = 1f;
private float minigamePitch = 1f;
public float SongPitch { get => isPaused ? 0f : (timelinePitch * minigamePitch); }
private float musicScheduledPitch = 1f;
private double musicScheduledTime = 0;
public void SetTimelinePitch(float pitch)
{
@ -105,84 +113,60 @@ namespace HeavenStudio
public void Play(double beat)
{
if (isPlaying) return;
var chart = GameManager.instance.Beatmap;
double offset = chart.data.offset;
bool negativeOffset = offset < 0;
double dspTime = AudioSettings.dspTime;
GameManager.instance.SortEventsList();
bool negativeOffset = firstBeatOffset < 0f;
bool negativeStartTime = false;
// Debug.Log("starting playback @ beat " + beat + ", offset is " + firstBeatOffset);
double startPos = GetSongPosFromBeat(beat);
time = startPos;
var startPos = GetSongPosFromBeat(beat);
if (negativeOffset)
if (musicSource.clip != null && startPos < musicSource.clip.length - offset)
{
time = startPos;
}
else
{
negativeStartTime = startPos - firstBeatOffset < 0f;
if (negativeStartTime)
time = startPos - firstBeatOffset;
// https://www.desmos.com/calculator/81ywfok6xk
double musicStartDelay = -offset - startPos;
if (musicStartDelay > 0)
{
musicSource.time = 0;
// this can break if the user changes pitch before the audio starts playing
musicScheduledTime = dspTime + musicStartDelay / SongPitch;
musicScheduledPitch = SongPitch;
musicSource.PlayScheduled(musicScheduledTime);
}
else
time = startPos;
{
musicSource.time = (float)-musicStartDelay;
musicSource.PlayScheduled(dspTime);
}
}
//TODO: make this take into account past tempo changes
songPosBeat = GetBeatFromSongPos(time - firstBeatOffset);
// Debug.Log("corrected starting playback @ beat " + songPosBeat);
songPosBeat = GetBeatFromSongPos(time);
startTime = DateTime.Now;
lastAbsTime = (DateTime.Now - startTime).TotalSeconds;
lastDspTime = AudioSettings.dspTime;
dspStart = dspTime;
startBeat = songPosBeat;
isPlaying = true;
isPaused = false;
if (SongPosLessThanClipLength(startPos))
{
if (negativeOffset)
{
var musicStartTime = startPos + firstBeatOffset;
if (musicStartTime < 0f)
{
musicSource.time = (float) startPos;
musicSource.PlayScheduled(AudioSettings.dspTime - firstBeatOffset / SongPitch);
}
else
{
musicSource.time = (float) musicStartTime;
musicSource.PlayScheduled(AudioSettings.dspTime);
}
}
else
{
if (negativeStartTime)
{
musicSource.time = (float) startPos;
}
else
{
musicSource.time = (float) startPos + firstBeatOffset;
}
musicSource.PlayScheduled(AudioSettings.dspTime);
}
}
lastAbsTime = Time.realtimeSinceStartupAsDouble;
dspStartTime = AudioSettings.dspTime;
startBeat = beat;
// GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
}
public void Pause()
{
if (!isPlaying) return;
isPlaying = false;
isPaused = true;
musicSource.Pause();
}
public void Stop(float time)
public void Stop(double time)
{
this.time = time;
songPos = time;
songPosBeat = 0;
isPlaying = false;
@ -190,31 +174,61 @@ namespace HeavenStudio
musicSource.Stop();
}
float test;
double deltaTimeReal { get {
double ret = absTime - lastAbsTime;
lastAbsTime = absTime;
return ret;
}}
double deltaTimeDsp { get {
double ret = dspTime - lastDspTime;
lastDspTime = dspTime;
return ret;
}}
public void Update()
{
if (isPlaying)
{
double absTime = Time.realtimeSinceStartupAsDouble;
double dt = (absTime - lastAbsTime) * SongPitch;
lastAbsTime = absTime;
if (AudioSettings.dspTime < musicScheduledTime && musicScheduledPitch != SongPitch)
{
if (SongPitch == 0f)
{
musicSource.Pause();
}
else
{
if (musicScheduledPitch == 0f)
musicSource.UnPause();
musicScheduledPitch = SongPitch;
time += dt;
musicScheduledTime = (AudioSettings.dspTime + (-GameManager.instance.Beatmap.data.offset - songPositionAsDouble)/(double)SongPitch);
musicSource.SetScheduledStartTime(musicScheduledTime);
}
}
absTime = (DateTime.Now - startTime).TotalSeconds;
dspTime = AudioSettings.dspTime - dspStart;
double dt = deltaTimeReal;
//todo: dspTime to sync with audio thread in case of drift
time += dt * SongPitch;
songPos = time;
songPosBeat = GetBeatFromSongPos(songPos - firstBeatOffset);
}
}
public void LateUpdate()
{
if (metronome && isPlaying)
{
if (ReportBeat(ref lastReportedBeat))
{
metronomeSound = Util.Jukebox.PlayOneShot("metronome", lastReportedBeat);
metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat);
}
else if (songPositionInBeats < lastReportedBeat)
{
@ -231,7 +245,7 @@ namespace HeavenStudio
}
}
public bool ReportBeat(ref float lastReportedBeat, float offset = 0, bool shiftBeatToOffset = true)
public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true)
{
bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f;
if (result)
@ -250,15 +264,15 @@ namespace HeavenStudio
return Mathf.Repeat((songPositionInBeats / length) + beatOffset, 1);
}
public float GetPositionFromBeat(float startBeat, float length)
public float GetPositionFromBeat(double startBeat, double length)
{
float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
float a = Mathp.Normalize(songPositionInBeats, (float)startBeat, (float)(startBeat + length));
return a;
}
public float GetBeatFromPosition(float position, float startBeat, float length)
{
return Mathp.DeNormalize(position, startBeat, startBeat + length);
return Mathp.DeNormalize(position, (float)startBeat, (float)(startBeat + length));
}
public float GetPositionFromMargin(float targetBeat, float margin)
@ -271,26 +285,26 @@ namespace HeavenStudio
return GetBeatFromPosition(position, targetBeat - margin, margin);
}
private List<DynamicBeatmap.TempoChange> GetSortedTempoChanges(DynamicBeatmap chart)
private List<RiqEntity> GetSortedTempoChanges()
{
GameManager.instance.SortEventsList();
return GameManager.instance.Beatmap.tempoChanges;
return GameManager.instance.Beatmap.TempoChanges;
}
public float GetBpmAtBeat(float beat)
public float GetBpmAtBeat(double beat)
{
var chart = GameManager.instance.Beatmap;
if (chart.tempoChanges.Count == 0)
return chart.bpm;
float bpm = chart.bpm;
if (chart.TempoChanges.Count == 0)
return 120f;
float bpm = chart.TempoChanges[0]["tempo"];
foreach (DynamicBeatmap.TempoChange t in chart.tempoChanges)
foreach (RiqEntity t in chart.TempoChanges)
{
if (t.beat > beat)
{
break;
}
bpm = t.tempo;
bpm = t["tempo"];
}
return bpm;
@ -299,13 +313,13 @@ namespace HeavenStudio
public double GetSongPosFromBeat(double beat)
{
var chart = GameManager.instance.Beatmap;
float bpm = chart.bpm;
float bpm = 120f;
double counter = 0f;
float lastTempoChangeBeat = 0f;
double lastTempoChangeBeat = 0f;
foreach (DynamicBeatmap.TempoChange t in chart.tempoChanges)
foreach (RiqEntity t in chart.TempoChanges)
{
if (t.beat > beat)
{
@ -313,7 +327,7 @@ namespace HeavenStudio
}
counter += (t.beat - lastTempoChangeBeat) * 60/bpm;
bpm = t.tempo;
bpm = t["tempo"];
lastTempoChangeBeat = t.beat;
}
@ -336,9 +350,9 @@ namespace HeavenStudio
{
double lastTempoChangeBeat = 0f;
double counterSeconds = -firstBeatOffset;
float lastBpm = GameManager.instance.Beatmap.bpm;
float lastBpm = 120f;
foreach (DynamicBeatmap.TempoChange t in GameManager.instance.Beatmap.tempoChanges)
foreach (RiqEntity t in GameManager.instance.Beatmap.TempoChanges)
{
double beatToNext = t.beat - lastTempoChangeBeat;
double secToNext = BeatsToSecs(beatToNext, lastBpm);
@ -348,7 +362,7 @@ namespace HeavenStudio
break;
lastTempoChangeBeat = t.beat;
lastBpm = t.tempo;
lastBpm = t["tempo"];
counterSeconds = nextSecs;
}
return lastTempoChangeBeat + SecsToBeats(seconds - counterSeconds, lastBpm);
@ -356,7 +370,7 @@ namespace HeavenStudio
//
// convert real seconds to beats
public float GetRestFromRealTime(float seconds)
public double GetRestFromRealTime(double seconds)
{
return seconds/pitchedSecPerBeat;
}
@ -364,7 +378,7 @@ namespace HeavenStudio
public void SetBpm(float bpm)
{
this.songBpm = bpm;
secPerBeat = 60f / songBpm;
secPerBeatAsDouble = 60.0 / songBpm;
}
public void SetVolume(float percent)
@ -374,22 +388,19 @@ namespace HeavenStudio
public float SongLengthInBeats()
{
if (!musicSource.clip) return 0;
return (float) GetBeatFromSongPos(musicSource.clip.length);
return (float)SongLengthInBeatsAsDouble();
}
public bool SongPosLessThanClipLength(float t)
public double SongLengthInBeatsAsDouble()
{
if (musicSource.clip != null)
return t < musicSource.clip.length;
else
return false;
if (!musicSource.clip) return 0;
return GetBeatFromSongPos(musicSource.clip.length - firstBeatOffset);
}
public bool SongPosLessThanClipLength(double t)
{
if (musicSource.clip != null)
return t < musicSource.clip.length;
return t < musicSource.clip.length - firstBeatOffset;
else
return false;
}

View File

@ -65,12 +65,12 @@ namespace HeavenStudio
int minus = 0;
if (GameManager.instance.Beatmap.entities.Count > 0)
if (GameManager.instance.Beatmap.Entities.Count > 0)
{
if (GameManager.instance.currentEvent - 1 >= 0) minus = 1;
SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].datamodel}");
SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].length}");
SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].datamodel}");
SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].length}");
}
}

View File

@ -3,13 +3,15 @@ using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio
{
public class EventCaller : MonoBehaviour
{
public Transform GamesHolder;
public DynamicBeatmap.DynamicEntity currentEntity = new DynamicBeatmap.DynamicEntity();
public RiqEntity currentEntity = new RiqEntity();
public string currentSwitchGame;
public delegate void EventCallback();
@ -37,15 +39,15 @@ namespace HeavenStudio
{
instance = this;
currentEntity = new DynamicBeatmap.DynamicEntity();
currentEntity = new RiqEntity();
Minigames.Init(this);
List<Minigames.Minigame> minigamesInBeatmap = new List<Minigames.Minigame>();
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
for (int i = 0; i < GameManager.instance.Beatmap.Entities.Count; i++)
{
//go through every entity in the timeline and add the game that they're from to the minigamesInBeatmap list (ignore entities from FX only categories, i.e. Game Manager and Count-Ins)
Minigames.Minigame game = GetMinigame(GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0]);
Minigames.Minigame game = GetMinigame(GameManager.instance.Beatmap.Entities[i].datamodel.Split('/')[0]);
if (!minigamesInBeatmap.Contains(game) && !FXOnlyGames().Contains(game))
{
minigamesInBeatmap.Add(game);
@ -63,7 +65,7 @@ namespace HeavenStudio
}
public void CallEvent(DynamicBeatmap.DynamicEntity entity, bool gameActive)
public void CallEvent(RiqEntity entity, bool gameActive)
{
string[] details = entity.datamodel.Split('/');
Minigames.Minigame game = minigames.Find(c => c.name == details[0]);
@ -89,7 +91,7 @@ namespace HeavenStudio
}
}
public void CallPreEvent(DynamicBeatmap.DynamicEntity entity)
public void CallPreEvent(RiqEntity entity)
{
string[] details = entity.datamodel.Split('/');
Minigames.Minigame game = minigames.Find(c => c.name == details[0]);
@ -106,10 +108,10 @@ namespace HeavenStudio
}
}
public static List<DynamicBeatmap.DynamicEntity> GetAllInGameManagerList(string gameName, string[] include)
public static List<RiqEntity> GetAllInGameManagerList(string gameName, string[] include)
{
List<DynamicBeatmap.DynamicEntity> temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
List<DynamicBeatmap.DynamicEntity> temp2 = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> temp1 = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
List<RiqEntity> temp2 = new List<RiqEntity>();
foreach (string s in include)
{
temp2.AddRange(temp1.FindAll(c => c.datamodel.Split('/')[1].Equals(s)));
@ -117,10 +119,10 @@ namespace HeavenStudio
return temp2;
}
public static List<DynamicBeatmap.DynamicEntity> GetAllInGameManagerListExclude(string gameName, string[] exclude)
public static List<RiqEntity> GetAllInGameManagerListExclude(string gameName, string[] exclude)
{
List<DynamicBeatmap.DynamicEntity> temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
List<DynamicBeatmap.DynamicEntity> temp2 = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> temp1 = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
List<RiqEntity> temp2 = new List<RiqEntity>();
foreach (string s in exclude)
{
temp2.AddRange(temp1.FindAll(c => !c.datamodel.Split('/')[1].Equals(s)));

View File

@ -4,6 +4,8 @@ using UnityEngine;
using HeavenStudio.Util;
using System.Linq;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio
{
@ -20,9 +22,9 @@ namespace HeavenStudio
Z
}
private List<DynamicBeatmap.DynamicEntity> positionEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<DynamicBeatmap.DynamicEntity> rotationEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<DynamicBeatmap.DynamicEntity> shakeEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> positionEvents = new();
private List<RiqEntity> rotationEvents = new();
private List<RiqEntity> shakeEvents = new();
/**
default cam position, for quick-resetting
@ -77,7 +79,7 @@ namespace HeavenStudio
rotEluerLast = defaultRotEluer;
}
public void OnBeatChanged(float beat)
public void OnBeatChanged(double beat)
{
ResetTransforms();
ResetAdditionalTransforms();
@ -128,7 +130,7 @@ namespace HeavenStudio
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
switch (e["axis"])
{
case (int) CameraAxis.X:
@ -176,7 +178,7 @@ namespace HeavenStudio
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
switch (e["axis"])
{
case (int) CameraAxis.X:

View File

@ -9,6 +9,8 @@ using System.Text;
using UnityEngine;
using UnityEngine.Audio;
using Jukebox;
namespace HeavenStudio
{
public class GameInitializer : MonoBehaviour
@ -34,9 +36,6 @@ namespace HeavenStudio
public bool playOnStart = false;
public bool fromCmd = false;
string json = "";
string ext = "";
private void Start()
{
string input = "";
@ -98,11 +97,8 @@ namespace HeavenStudio
if (editorGO == null)
{
OpenCmdRemix(input);
Debug.Log(json);
gameManager.txt = json;
gameManager.ext = ext;
gameManager.Init();
bool success = OpenCmdRemix(input);
gameManager.Init(success);
}
else
{
@ -110,44 +106,18 @@ namespace HeavenStudio
}
}
public void OpenCmdRemix(string path)
public bool OpenCmdRemix(string path)
{
if (path == string.Empty) return;
if (!File.Exists(path)) return;
byte[] MusicBytes;
bool loadedMusic = false;
string extension = path.GetExtension();
using var zipFile = File.Open(path, FileMode.Open);
using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read);
foreach (var entry in archive.Entries)
switch (entry.Name)
{
case "remix.json":
{
using var stream = entry.Open();
using var reader = new StreamReader(stream);
json = reader.ReadToEnd();
ext = extension;
break;
}
case "song.ogg":
{
using var stream = entry.Open();
using var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
MusicBytes = memoryStream.ToArray();
Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(MusicBytes, "music");
loadedMusic = true;
break;
}
}
if (!loadedMusic)
try
{
Conductor.instance.musicSource.clip = null;
MusicBytes = null;
string tmpDir = RiqFileHandler.ExtractRiq(path);
Debug.Log("Imported RIQ successfully!");
return true;
}
catch (System.Exception e)
{
Debug.Log($"Error importing RIQ: {e.Message}");
return false;
}
}
}

View File

@ -5,6 +5,8 @@ using System.Linq;
using UnityEngine;
using Starpelly;
using Jukebox;
using Jukebox.Legacy;
using Newtonsoft.Json;
using HeavenStudio.Games;
using HeavenStudio.Common;
@ -14,7 +16,7 @@ namespace HeavenStudio
public class GameManager : MonoBehaviour
{
[Header("Lists")]
[NonSerialized] public DynamicBeatmap Beatmap = new DynamicBeatmap();
[NonSerialized] public RiqBeatmap Beatmap = new();
private List<GameObject> preloadedGames = new List<GameObject>();
[NonSerialized] public List<GameObject> SoundObjects = new List<GameObject>();
@ -35,22 +37,22 @@ namespace HeavenStudio
[NonSerialized] public int currentEvent, currentTempoEvent, currentVolumeEvent, currentSectionEvent,
currentPreEvent, currentPreSwitch, currentPreSequence;
[NonSerialized] public float endBeat;
[NonSerialized] public double endBeat;
[NonSerialized] public float startOffset;
[NonSerialized] public bool playOnStart;
[NonSerialized] public float startBeat;
[NonSerialized] public double startBeat;
[NonSerialized] public GameObject currentGameO;
[NonSerialized] public bool autoplay;
[NonSerialized] public bool canInput = true;
[NonSerialized] public DynamicBeatmap.ChartSection currentSection, nextSection;
public float sectionProgress { get; private set; }
[NonSerialized] public RiqEntity currentSection, nextSection;
public double sectionProgress { get; private set; }
public event Action<float> onBeatChanged;
public event Action<DynamicBeatmap.ChartSection> onSectionChange;
public event Action<double> onBeatChanged;
public event Action<RiqEntity> onSectionChange;
public int BeatmapEntities()
{
return Beatmap.entities.Count + Beatmap.tempoChanges.Count + Beatmap.volumeChanges.Count + Beatmap.beatmapSections.Count;
return Beatmap.Entities.Count + Beatmap.TempoChanges.Count + Beatmap.VolumeChanges.Count + Beatmap.SectionMarkers.Count;
}
public static GameManager instance { get; private set; }
@ -101,7 +103,7 @@ namespace HeavenStudio
instance = this;
}
public void Init()
public void Init(bool preLoaded = false)
{
currentPreEvent= 0;
currentPreSwitch = 0;
@ -113,9 +115,9 @@ namespace HeavenStudio
eventCaller = this.gameObject.AddComponent<EventCaller>();
eventCaller.GamesHolder = GamesHolder.transform;
eventCaller.Init();
Conductor.instance.SetBpm(Beatmap.bpm);
Conductor.instance.SetVolume(Beatmap.musicVolume);
Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset;
Conductor.instance.SetBpm(120f);
Conductor.instance.SetVolume(100f);
Conductor.instance.firstBeatOffset = Beatmap.data.offset;
// note: serialize this shit in the inspector //
GameObject textbox = Instantiate(Resources.Load<GameObject>("Prefabs/Common/Textbox"));
@ -134,9 +136,9 @@ namespace HeavenStudio
/////
if (txt != null && ext != null && txt.Length != 0 && ext.Length != 0)
if (preLoaded)
{
LoadRemix(txt, ext);
LoadRemix(false);
}
else
{
@ -145,10 +147,10 @@ namespace HeavenStudio
SortEventsList();
if (Beatmap.entities.Count >= 1)
if (Beatmap.Entities.Count >= 1)
{
SetCurrentGame(Beatmap.entities[0].datamodel.Split(0));
SetGame(Beatmap.entities[0].datamodel.Split(0));
SetCurrentGame(Beatmap.Entities[0].datamodel.Split(0));
SetGame(Beatmap.Entities[0].datamodel.Split(0));
}
else
{
@ -163,52 +165,68 @@ namespace HeavenStudio
public void NewRemix()
{
Beatmap = new DynamicBeatmap();
Beatmap.bpm = 120f;
Beatmap.musicVolume = 100;
Beatmap.firstBeatOffset = 0f;
Beatmap = new("1", "HeavenStudio");
Beatmap.data.properties = Minigames.propertiesModel;
Beatmap.AddNewTempoChange(0, 120f);
Beatmap.AddNewVolumeChange(0, 100f);
Beatmap.data.offset = 0f;
Conductor.instance.musicSource.clip = null;
RiqFileHandler.WriteRiq(Beatmap);
}
public void LoadRemix(string json = "", string type = "riq", int version = 0)
public IEnumerator LoadMusic()
{
if (json != "")
IEnumerator load = RiqFileHandler.LoadSong();
while (true)
{
switch (type)
object current = load.Current;
try
{
case "tengoku":
case "rhmania":
Beatmap toConvert = JsonConvert.DeserializeObject<Beatmap>(json);
Beatmap = DynamicBeatmap.BeatmapConverter(toConvert);
break;
case "riq":
Beatmap = JsonConvert.DeserializeObject<DynamicBeatmap>(json);
Beatmap.PostProcess();
break;
default:
NewRemix();
if (load.MoveNext() == false)
{
break;
}
current = load.Current;
}
catch (Exception e)
{
Debug.LogError($"Failed to load music: {e.Message}");
GlobalGameManager.ShowErrorMessage("Error Loading Music", e.Message + "\n\n" + e.StackTrace);
yield break;
}
yield return current;
}
else
Conductor.instance.musicSource.clip = RiqFileHandler.StreamedAudioClip;
}
public void LoadRemix(bool editor = false)
{
try
{
NewRemix();
Beatmap = RiqFileHandler.ReadRiq();
}
catch (Exception e)
{
Debug.LogError($"Failed to load remix: {e.Message}");
GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace);
return;
}
if (!editor)
StartCoroutine(LoadMusic());
SortEventsList();
Conductor.instance.SetBpm(Beatmap.bpm);
Conductor.instance.SetVolume(Beatmap.musicVolume);
Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset;
Conductor.instance.SetBpm(Beatmap.TempoChanges[0]["tempo"]);
Conductor.instance.SetVolume(Beatmap.VolumeChanges[0]["volume"]);
Conductor.instance.firstBeatOffset = Beatmap.data.offset;
if (!playOnStart)
{
Stop(0);
}
SetCurrentEventToClosest(0);
if (Beatmap.entities.Count >= 1)
if (Beatmap.Entities.Count >= 1)
{
SetCurrentGame(Beatmap.entities[0].datamodel.Split(0));
SetGame(Beatmap.entities[0].datamodel.Split(0));
SetCurrentGame(Beatmap.Entities[0].datamodel.Split(0));
SetGame(Beatmap.Entities[0].datamodel.Split(0));
}
else
{
@ -241,14 +259,14 @@ namespace HeavenStudio
{
//seek ahead to preload games that have assetbundles
//check game switches first
var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
var gameSwitchs = Beatmap.Entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
if (currentPreSwitch < gameSwitchs.Count && currentPreSwitch >= 0)
{
if (start + seekTime >= gameSwitchs[currentPreSwitch].beat)
{
string gameName = gameSwitchs[currentPreSwitch].datamodel.Split(2);
var inf = GetGameInfo(gameName);
if (inf.usesAssetBundle && !inf.AssetsLoaded)
if (inf != null && inf.usesAssetBundle && !inf.AssetsLoaded)
{
Debug.Log($"ASYNC loading assetbundles for game {gameName}");
StartCoroutine(inf.LoadCommonAssetBundleAsync());
@ -258,18 +276,18 @@ namespace HeavenStudio
}
}
//then check game entities
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
if (currentPreEvent < Beatmap.entities.Count && currentPreEvent >= 0)
List<double> entities = Beatmap.Entities.Select(c => c.beat).ToList();
if (currentPreEvent < Beatmap.Entities.Count && currentPreEvent >= 0)
{
if (start + seekTime >= entities[currentPreEvent])
{
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentPreEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentPreEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
SortEventsByPriority(entitiesAtSameBeat);
foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat)
foreach (RiqEntity entity in entitiesAtSameBeat)
{
string gameName = entity.datamodel.Split('/')[0];
var inf = GetGameInfo(gameName);
if (inf.usesAssetBundle && !inf.AssetsLoaded)
if (inf != null && inf.usesAssetBundle && !inf.AssetsLoaded)
{
Debug.Log($"ASYNC loading assetbundles for game {gameName}");
StartCoroutine(inf.LoadCommonAssetBundleAsync());
@ -283,33 +301,30 @@ namespace HeavenStudio
public void SeekAheadAndDoPreEvent(double start)
{
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
if (currentPreSequence < Beatmap.entities.Count && currentPreSequence >= 0)
List<double> entities = Beatmap.Entities.Select(c => c.beat).ToList();
if (currentPreSequence < Beatmap.Entities.Count && currentPreSequence >= 0)
{
var seekEntity = Beatmap.entities[currentPreSequence];
var seekEntity = Beatmap.Entities[currentPreSequence];
float seekTime = EventCaller.instance.GetGameAction(
EventCaller.instance.GetMinigame(seekEntity.datamodel.Split(0)), seekEntity.datamodel.Split(1)).preFunctionLength;
if (start + seekTime >= entities[currentPreSequence])
{
float beat = seekEntity.beat;
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == seekEntity.beat);
double beat = seekEntity.beat;
var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == seekEntity.beat);
SortEventsByPriority(entitiesAtSameBeat);
foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat)
foreach (RiqEntity entity in entitiesAtSameBeat)
{
currentPreSequence++;
string gameName = entity.datamodel.Split('/')[0];
var inf = GetGameInfo(gameName);
if (inf.usesAssetBundle && inf.AssetsLoaded && !inf.SequencesPreloaded)
if (inf != null && inf.usesAssetBundle && inf.AssetsLoaded && !inf.SequencesPreloaded)
{
Debug.Log($"Preloading game {gameName}");
PreloadGameSequences(gameName);
}
else
{
eventCaller.CallPreEvent(entity);
}
eventCaller.CallPreEvent(entity);
}
}
}
@ -323,40 +338,40 @@ namespace HeavenStudio
return;
Conductor cond = Conductor.instance;
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
List<double> entities = Beatmap.Entities.Select(c => c.beat).ToList();
List<float> tempoChanges = Beatmap.tempoChanges.Select(c => c.beat).ToList();
if (currentTempoEvent < Beatmap.tempoChanges.Count && currentTempoEvent >= 0)
List<double> tempoChanges = Beatmap.TempoChanges.Select(c => c.beat).ToList();
if (currentTempoEvent < Beatmap.TempoChanges.Count && currentTempoEvent >= 0)
{
if (cond.songPositionInBeatsAsDouble >= tempoChanges[currentTempoEvent])
{
cond.SetBpm(Beatmap.tempoChanges[currentTempoEvent].tempo);
cond.SetBpm(Beatmap.TempoChanges[currentTempoEvent]["tempo"]);
currentTempoEvent++;
}
}
List<float> volumeChanges = Beatmap.volumeChanges.Select(c => c.beat).ToList();
if (currentVolumeEvent < Beatmap.volumeChanges.Count && currentVolumeEvent >= 0)
List<double> volumeChanges = Beatmap.VolumeChanges.Select(c => c.beat).ToList();
if (currentVolumeEvent < Beatmap.VolumeChanges.Count && currentVolumeEvent >= 0)
{
if (cond.songPositionInBeatsAsDouble >= volumeChanges[currentVolumeEvent])
{
cond.SetVolume(Beatmap.volumeChanges[currentVolumeEvent].volume);
cond.SetVolume(Beatmap.VolumeChanges[currentVolumeEvent]["volume"]);
currentVolumeEvent++;
}
}
List<float> chartSections = Beatmap.beatmapSections.Select(c => c.beat).ToList();
if (currentSectionEvent < Beatmap.beatmapSections.Count && currentSectionEvent >= 0)
List<double> chartSections = Beatmap.SectionMarkers.Select(c => c.beat).ToList();
if (currentSectionEvent < Beatmap.SectionMarkers.Count && currentSectionEvent >= 0)
{
if (cond.songPositionInBeatsAsDouble >= chartSections[currentSectionEvent])
{
Debug.Log("Section " + Beatmap.beatmapSections[currentSectionEvent].sectionName + " started");
currentSection = Beatmap.beatmapSections[currentSectionEvent];
Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started");
currentSection = Beatmap.SectionMarkers[currentSectionEvent];
currentSectionEvent++;
if (currentSectionEvent < Beatmap.beatmapSections.Count)
nextSection = Beatmap.beatmapSections[currentSectionEvent];
if (currentSectionEvent < Beatmap.SectionMarkers.Count)
nextSection = Beatmap.SectionMarkers[currentSectionEvent];
else
nextSection = null;
nextSection = default(RiqEntity);
onSectionChange?.Invoke(currentSection);
}
}
@ -367,13 +382,13 @@ namespace HeavenStudio
SeekAheadAndDoPreEvent(Conductor.instance.songPositionInBeatsAsDouble);
if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)
if (currentEvent < Beatmap.Entities.Count && currentEvent >= 0)
{
if (cond.songPositionInBeatsAsDouble >= entities[currentEvent])
{
// allows for multiple events on the same beat to be executed on the same frame, so no more 1-frame delay
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
var fxEntities = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentEvent].beat && EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
var entitiesAtSameBeat = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentEvent].beat && !EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
var fxEntities = Beatmap.Entities.FindAll(c => c.beat == Beatmap.Entities[currentEvent].beat && EventCaller.FXOnlyGames().Contains(EventCaller.instance.GetMinigame(c.datamodel.Split('/')[0])));
SortEventsByPriority(fxEntities);
SortEventsByPriority(entitiesAtSameBeat);
@ -385,7 +400,7 @@ namespace HeavenStudio
currentEvent++;
}
foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat)
foreach (RiqEntity entity in entitiesAtSameBeat)
{
// if game isn't loaded, preload game so whatever event that would be called will still run outside if needed
if (entity.datamodel.Split('/')[0] != currentGame)
@ -409,12 +424,12 @@ namespace HeavenStudio
}
else
{
float currectSectionStart = (float)cond.GetSongPosFromBeat(currentSection.beat);
double currectSectionStart = cond.GetSongPosFromBeat(currentSection.beat);
if (nextSection == null)
sectionProgress = (cond.songPosition - currectSectionStart) / ((float)cond.GetSongPosFromBeat(endBeat) - currectSectionStart);
if (nextSection == null)
sectionProgress = (cond.songPosition - currectSectionStart) / (cond.GetSongPosFromBeat(endBeat) - currectSectionStart);
else
sectionProgress = (cond.songPosition - currectSectionStart) / ((float)cond.GetSongPosFromBeat(nextSection.beat) - currectSectionStart);
sectionProgress = (cond.songPosition - currectSectionStart) / (cond.GetSongPosFromBeat(nextSection.beat) - currectSectionStart);
}
}
@ -429,7 +444,7 @@ namespace HeavenStudio
#region Play Events
public void Play(float beat, float delay = 0f)
public void Play(double beat, float delay = 0f)
{
bool paused = Conductor.instance.isPaused;
Debug.Log("Playing at " + beat);
@ -457,7 +472,7 @@ namespace HeavenStudio
onBeatChanged?.Invoke(beat);
}
private IEnumerator PlayCo(float beat, float delay = 0f)
private IEnumerator PlayCo(double beat, float delay = 0f)
{
yield return new WaitForSeconds(delay);
bool paused = Conductor.instance.isPaused;
@ -465,13 +480,13 @@ namespace HeavenStudio
Conductor.instance.Play(beat);
if (paused)
{
Util.Jukebox.UnpauseOneShots();
Util.SoundByte.UnpauseOneShots();
}
else
{
Conductor.instance.SetBpm(Beatmap.bpm);
Conductor.instance.SetVolume(Beatmap.musicVolume);
Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset;
Conductor.instance.SetBpm(Beatmap.TempoChanges[0]["tempo"]);
Conductor.instance.SetVolume(Beatmap.VolumeChanges[0]["volume"]);
Conductor.instance.firstBeatOffset = Beatmap.data.offset;
SetCurrentEventToClosest(beat);
KillAllSounds();
}
@ -484,11 +499,11 @@ namespace HeavenStudio
public void Pause()
{
Conductor.instance.Pause();
Util.Jukebox.PauseOneShots();
Util.SoundByte.PauseOneShots();
canInput = false;
}
public void Stop(float beat, bool restart = false, float restartDelay = 0f)
public void Stop(double beat, bool restart = false, float restartDelay = 0f)
{
Minigame miniGame = currentGameO.GetComponent<Minigame>();
if (miniGame != null)
@ -509,7 +524,7 @@ namespace HeavenStudio
Debug.Log($"== Playthrough statistics of {Beatmap["remixtitle"]} (played at {System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}) ==");
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100) : 0.00}");
Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.beatmapSections.Count}");
Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.SectionMarkers.Count}");
if (SkillStarManager.instance.IsCollected)
Debug.Log($"Skill Star collected");
else
@ -524,12 +539,14 @@ namespace HeavenStudio
// when rating screen gets added playOnStart will instead move to that scene
}
private IEnumerator WaitReadyAndPlayCo(float beat)
private IEnumerator WaitReadyAndPlayCo(double beat)
{
// wait for overlays to be ready
yield return new WaitUntil(() => OverlaysManager.OverlaysReady);
// wait for first game to be loaded
yield return new WaitUntil(() => Beatmap != null && Beatmap.entities.Count > 0);
yield return new WaitUntil(() => Beatmap != null && Beatmap.Entities.Count > 0);
//wait for audio clip to be loaded
yield return new WaitUntil(() => Conductor.instance.musicSource.clip != null);
SkillStarManager.instance.KillStar();
TimingAccuracyDisplay.instance.StopStarFlash();
@ -547,7 +564,7 @@ namespace HeavenStudio
Destroy(SoundObjects[i].gameObject);
SoundObjects.Clear();
Util.Jukebox.KillOneShots();
Util.SoundByte.KillOneShots();
}
#endregion
@ -556,12 +573,13 @@ namespace HeavenStudio
public void SortEventsList()
{
Beatmap.entities.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.tempoChanges.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.volumeChanges.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.Entities.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.TempoChanges.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.VolumeChanges.Sort((x, y) => x.beat.CompareTo(y.beat));
Beatmap.SectionMarkers.Sort((x, y) => x.beat.CompareTo(y.beat));
}
void SortEventsByPriority(List<DynamicBeatmap.DynamicEntity> entities)
void SortEventsByPriority(List<RiqEntity> entities)
{
entities.Sort((x, y) => {
Minigames.Minigame xGame = EventCaller.instance.GetMinigame(x.datamodel.Split(0));
@ -574,25 +592,33 @@ namespace HeavenStudio
}
public void SetCurrentEventToClosest(float beat)
public static double GetClosestInList(List<double> list, double compareTo)
{
if (list.Count > 0)
return list.Aggregate((x, y) => Math.Abs(x - compareTo) < Math.Abs(y - compareTo) ? x : y);
else
return double.MinValue;
}
public void SetCurrentEventToClosest(double beat)
{
SortEventsList();
onBeatChanged?.Invoke(beat);
if (Beatmap.entities.Count > 0)
if (Beatmap.Entities.Count > 0)
{
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
List<double> entities = Beatmap.Entities.Select(c => c.beat).ToList();
currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
currentPreEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
currentPreSequence = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
currentEvent = entities.IndexOf(GetClosestInList(entities, beat));
currentPreEvent = entities.IndexOf(GetClosestInList(entities, beat));
currentPreSequence = entities.IndexOf(GetClosestInList(entities, beat));
var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
var gameSwitchs = Beatmap.Entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
string newGame = Beatmap.entities[currentEvent].datamodel.Split(0);
string newGame = Beatmap.Entities[currentEvent].datamodel.Split(0);
if (gameSwitchs.Count > 0)
{
int index = gameSwitchs.FindIndex(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat));
int index = gameSwitchs.FindIndex(c => c.beat == GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat));
currentPreSwitch = index;
var closestGameSwitch = gameSwitchs[index];
if (closestGameSwitch.beat <= beat)
@ -603,7 +629,7 @@ namespace HeavenStudio
{
if (index == 0)
{
newGame = Beatmap.entities[0].datamodel.Split(0);
newGame = Beatmap.Entities[0].datamodel.Split(0);
}
else
{
@ -613,7 +639,7 @@ namespace HeavenStudio
}
else
{
newGame = Beatmap.entities[Beatmap.entities.IndexOf(closestGameSwitch) - 1].datamodel.Split(0);
newGame = Beatmap.Entities[Beatmap.Entities.IndexOf(closestGameSwitch) - 1].datamodel.Split(0);
}
}
}
@ -625,22 +651,22 @@ namespace HeavenStudio
SetGame(newGame);
}
List<DynamicBeatmap.DynamicEntity> allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "end" });
List<RiqEntity> allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "end" });
if (allEnds.Count > 0)
endBeat = allEnds.Select(c => c.beat).Min();
else
endBeat = Conductor.instance.SongLengthInBeats();
endBeat = Conductor.instance.SongLengthInBeatsAsDouble();
}
else
{
SetGame("noGame");
endBeat = Conductor.instance.SongLengthInBeats();
endBeat = Conductor.instance.SongLengthInBeatsAsDouble();
}
if (Beatmap.tempoChanges.Count > 0)
if (Beatmap.TempoChanges.Count > 0)
{
currentTempoEvent = 0;
List<float> tempoChanges = Beatmap.tempoChanges.Select(c => c.beat).ToList();
List<double> tempoChanges = Beatmap.TempoChanges.Select(c => c.beat).ToList();
//for tempo changes, just go over all of em until the last one we pass
for (int t = 0; t < tempoChanges.Count; t++)
@ -655,10 +681,10 @@ namespace HeavenStudio
// Debug.Log("currentTempoEvent is now " + currentTempoEvent);
}
if (Beatmap.volumeChanges.Count > 0)
if (Beatmap.VolumeChanges.Count > 0)
{
currentVolumeEvent = 0;
List<float> volumeChanges = Beatmap.volumeChanges.Select(c => c.beat).ToList();
List<double> volumeChanges = Beatmap.VolumeChanges.Select(c => c.beat).ToList();
for (int t = 0; t < volumeChanges.Count; t++)
{
@ -670,12 +696,12 @@ namespace HeavenStudio
}
}
currentSection = null;
nextSection = null;
if (Beatmap.beatmapSections.Count > 0)
currentSection = default(RiqEntity);
nextSection = default(RiqEntity);
if (Beatmap.SectionMarkers.Count > 0)
{
currentSectionEvent = 0;
List<float> beatmapSections = Beatmap.beatmapSections.Select(c => c.beat).ToList();
List<double> beatmapSections = Beatmap.SectionMarkers.Select(c => c.beat).ToList();
for (int t = 0; t < beatmapSections.Count; t++)
{
@ -693,7 +719,7 @@ namespace HeavenStudio
#endregion
public void SwitchGame(string game, float beat, bool flash)
public void SwitchGame(string game, double beat, bool flash)
{
if (game != currentGame)
{
@ -703,7 +729,7 @@ namespace HeavenStudio
}
}
IEnumerator SwitchGameIE(string game, float beat, bool flash)
IEnumerator SwitchGameIE(string game, double beat, bool flash)
{
if(flash == true)
{
@ -739,6 +765,7 @@ namespace HeavenStudio
{
var gameInfo = GetGameInfo(game);
//load the games' sound sequences
// TODO: this blocks the main thread, and sound sequences sould be stored in a ScriptableObject
if (gameInfo != null && gameInfo.LoadedSoundSequences == null)
gameInfo.LoadedSoundSequences = GetGame(game).GetComponent<Minigame>().SoundSequences;
}
@ -750,7 +777,7 @@ namespace HeavenStudio
{
if (gameInfo.fxOnly)
{
var gameInfos = Beatmap.entities
var gameInfos = Beatmap.Entities
.Select(x => x.datamodel.Split(0))
.Select(x => GetGameInfo(x))
.Where(x => x != null)

View File

@ -87,25 +87,22 @@ namespace HeavenStudio.Games
Tween tweenForForth;
[Header("Variables")]
public float serveBeat;
public double serveBeat;
public bool started;
public bool served;
bool babum;
bool shuttleActive;
public bool hasMissed;
public static List<float> queuedVoiceLines = new List<float>();
public static List<double> queuedVoiceLines = new();
[Header("Waypoint")]
public float wayPointZForForth;
[Header("Debug")]
public float beatShown;
public float lengthHolder;
public float lengthShown;
public double lengthHolder;
public double lengthShown;
public int wantDistance;
public bool wantSilent;
public float beatHolder;
public Transform holderPos;
void OnDestroy()
{
@ -133,11 +130,11 @@ namespace HeavenStudio.Games
if(PlayerInput.Pressed() && !IsExpectingInputNow())
{
Baxter.GetComponent<Animator>().Play("Hit");
Jukebox.PlayOneShotGame("airRally/whooshForth_Close", -1f);
SoundByte.PlayOneShotGame("airRally/whooshForth_Close", -1f);
}
var cond = Conductor.instance;
var currentBeat = cond.songPositionInBeats;
var currentBeat = cond.songPositionInBeatsAsDouble;
var hitBeat = serveBeat;
if (started)
@ -190,7 +187,7 @@ namespace HeavenStudio.Games
four
}
public void ServeObject(float beat, float targetBeat, bool type)
public void ServeObject(double beat, double targetBeat, bool type)
{
if (!shuttleActive)
{
@ -210,7 +207,7 @@ namespace HeavenStudio.Games
Forthington.GetComponent<Animator>().Play("Hit");
}
public void ReturnObject(float beat, float targetBeat, bool type)
public void ReturnObject(double beat, double targetBeat, bool type)
{
var shuttleScript = ActiveShuttle.GetComponent<Shuttlecock>();
shuttleScript.flyPos = 0f;
@ -220,7 +217,7 @@ namespace HeavenStudio.Games
shuttleScript.flyType = type;
}
public static void ForthVoice(float beat, int type, int type2)
public static void ForthVoice(double beat, int type, int type2)
{
if (GameManager.instance.currentGame == "airRally")
{
@ -311,17 +308,15 @@ namespace HeavenStudio.Games
started = start;
}
public void Rally(float beat, bool silent, float length)
public void Rally(double beat, bool silent, double length)
{
started = true;
beatShown = beat;
if (started)
{
wantSilent = silent;
serveBeat += 2f;
serveBeat += 2.0;
lengthHolder = length;
lengthShown += 2f;
beatHolder = beat;
lengthShown += 2.0;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
@ -336,9 +331,9 @@ namespace HeavenStudio.Games
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("CloseReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Close"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Close"); } }),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Close"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Close"); } }),
new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
@ -347,9 +342,9 @@ namespace HeavenStudio.Games
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Far"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Far"); } }),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Far"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Far"); } }),
new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
@ -358,9 +353,9 @@ namespace HeavenStudio.Games
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farther"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Farther"); } }),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Farther"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Farther"); } }),
new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
@ -369,9 +364,9 @@ namespace HeavenStudio.Games
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farthest"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { Jukebox.PlayOneShotGame("airRally/nya_Farthest"); } }),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
new BeatAction.Action(beat, delegate { SoundByte.PlayOneShotGame("airRally/hitForth_Farthest"); }),
new BeatAction.Action(beat, delegate { if(!(silent || babum)) { SoundByte.PlayOneShotGame("airRally/nya_Farthest"); } }),
new BeatAction.Action(beat + 1, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
}
@ -393,7 +388,7 @@ namespace HeavenStudio.Games
}
public void BaBumBumBum(float beat, bool count, int type)
public void BaBumBumBum(double beat, bool count, int type)
{
//This feels wrong, will keep until I figure out what's wrong
babum = true;
@ -518,25 +513,25 @@ namespace HeavenStudio.Games
}
else
{
ReturnObject(Conductor.instance.songPositionInBeats, caller.startBeat + caller.timer + 1f, false);
ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 1f, false);
hasMissed = false;
ActiveShuttle.GetComponent<Shuttlecock>().DoHit(e_BaBumState);
if (e_BaBumState == DistanceSound.close)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Close");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Close");
}
if (e_BaBumState == DistanceSound.far)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Far");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Far");
}
if (e_BaBumState == DistanceSound.farther)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farther");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Farther");
}
if (e_BaBumState == DistanceSound.farthest)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farthest");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Farthest");
}
}
served = false;
@ -554,25 +549,25 @@ namespace HeavenStudio.Games
}
else
{
ReturnObject(Conductor.instance.songPositionInBeats, caller.startBeat + caller.timer + 2f, true);
ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 2f, true);
hasMissed = false;
ActiveShuttle.GetComponent<Shuttlecock>().DoHit(e_BaBumState);
if (e_BaBumState == DistanceSound.close)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Close");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Close");
}
if (e_BaBumState == DistanceSound.far)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Far");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Far");
}
if (e_BaBumState == DistanceSound.farther)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farther");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Farther");
}
if (e_BaBumState == DistanceSound.farthest)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farthest");
SoundByte.PlayOneShotGame("airRally/hitBaxter_Farthest");
}
}
served = false;

View File

@ -15,8 +15,8 @@ namespace HeavenStudio.Games.Scripts_AirRally
[SerializeField] float TargetHeightLong;
[SerializeField] ParticleSystem hitEffect;
public float startBeat;
public float flyBeats;
public double startBeat;
public double flyBeats;
public bool flyType;
bool miss = false;
@ -74,7 +74,7 @@ namespace HeavenStudio.Games.Scripts_AirRally
if (miss && flyPos > 4f)
{
if (cond.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
if (cond.GetPositionFromBeat(startBeat, flyBeats + 1) >= 1.0)
{
GameObject.Destroy(gameObject);
return;
@ -106,7 +106,7 @@ namespace HeavenStudio.Games.Scripts_AirRally
public void DoNearMiss()
{
miss = true;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
transform.position = PlayerTarget.position;
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.simulated = true;

View File

@ -93,7 +93,7 @@ namespace HeavenStudio.Games
static int rightCrumbAppearThreshold = 15;
static int leftCrumbAppearThreshold = 30;
static int eatenTreats = 0;
float emotionStartBeat;
double emotionStartBeat;
float emotionLength;
string emotionAnimName;
bool crying;
@ -216,7 +216,7 @@ namespace HeavenStudio.Games
}
}
public void SetEmotion(float beat, float length, int emotion)
public void SetEmotion(double beat, float length, int emotion)
{
switch (emotion)
{
@ -270,7 +270,7 @@ namespace HeavenStudio.Games
}
}
public void SpawnTreat(float beat, bool isCake)
public void SpawnTreat(double beat, bool isCake)
{
var objectToSpawn = isCake ? cakeBase : donutBase;
var newTreat = GameObject.Instantiate(objectToSpawn, foodHolder);
@ -281,7 +281,7 @@ namespace HeavenStudio.Games
newTreat.SetActive(true);
Jukebox.PlayOneShotGame(isCake ? "blueBear/cake" : "blueBear/donut");
SoundByte.PlayOneShotGame(isCake ? "blueBear/cake" : "blueBear/donut");
SquashBag(isCake);
}

View File

@ -13,10 +13,10 @@ namespace HeavenStudio.Games.Scripts_BlueBear
const float rotSpeed = 360f;
public bool isCake;
public float startBeat;
public double startBeat;
bool flying = true;
float flyBeats;
double flyBeats;
[NonSerialized] public BezierCurve3D curve;
@ -59,11 +59,11 @@ namespace HeavenStudio.Games.Scripts_BlueBear
if (isCake)
{
Jukebox.PlayOneShotGame("blueBear/chompCake");
SoundByte.PlayOneShotGame("blueBear/chompCake");
}
else
{
Jukebox.PlayOneShotGame("blueBear/chompDonut");
SoundByte.PlayOneShotGame("blueBear/chompDonut");
}
game.Bite(isCake);

View File

@ -39,7 +39,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
if (this == game.firstSpinner) anim.DoUnscaledAnimation("Spin", 0);
else anim.DoUnscaledAnimation(forceStart ? "Spin" : animToPlay, forceStart ? 0 : game.firstSpinner.anim.GetCurrentAnimatorStateInfo(0).normalizedTime);
canBop = false;
Jukebox.PlayOneShotGame("boardMeeting/rollPrepare" + soundToPlay);
SoundByte.PlayOneShotGame("boardMeeting/rollPrepare" + soundToPlay);
float offset = 0;
switch (soundToPlay)
{
@ -55,7 +55,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
offset = 0;
break;
}
rollLoop = Jukebox.PlayOneShotGame("boardMeeting/roll" + soundToPlay, Conductor.instance.songPositionInBeats + 0.5f - Conductor.instance.GetRestFromRealTime(offset), 1, 1, true);
rollLoop = SoundByte.PlayOneShotGame("boardMeeting/roll" + soundToPlay, Conductor.instance.songPositionInBeatsAsDouble + 0.5f - Conductor.instance.GetRestFromRealTime(offset), 1, 1, true);
}
public void Stop(bool hit = true)
@ -71,7 +71,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1.5f, delegate { canBop = true; })
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1.5f, delegate { canBop = true; })
});
}

View File

@ -121,8 +121,8 @@ namespace HeavenStudio.Games
if (executives[executiveCount - 1].spinning)
{
executives[executiveCount - 1].Stop(false);
Jukebox.PlayOneShotGame("boardMeeting/miss");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame("boardMeeting/miss");
SoundByte.PlayOneShot("miss");
ScoreMiss();
}
}
@ -144,7 +144,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, float length, bool goBop, bool autoBop)
public void Bop(double beat, float length, bool goBop, bool autoBop)
{
shouldBop = autoBop;
if (goBop)
@ -162,7 +162,7 @@ namespace HeavenStudio.Games
}
}
public void AssistantStop(float beat)
public void AssistantStop(double beat)
{
assistantCanBop = false;
string twoSound = "boardMeeting/two";
@ -199,7 +199,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustAssistant, MissAssistant, Empty);
}
public void Stop(float beat, float length)
public void Stop(double beat, float length)
{
executivesCanBop = false;
List<BeatAction.Action> stops = new List<BeatAction.Action>();
@ -213,15 +213,15 @@ namespace HeavenStudio.Games
if (executiveCount < 4) ex = 4;
if (index < ex - 3)
{
Jukebox.PlayOneShotGame("boardMeeting/stopA");
SoundByte.PlayOneShotGame("boardMeeting/stopA");
}
else if (index == ex - 3)
{
Jukebox.PlayOneShotGame("boardMeeting/stopB");
SoundByte.PlayOneShotGame("boardMeeting/stopB");
}
else if (index == ex - 2)
{
Jukebox.PlayOneShotGame("boardMeeting/stopC");
SoundByte.PlayOneShotGame("boardMeeting/stopC");
}
if (index == executiveCount - 2 && !executives[executiveCount - 1].spinning)
@ -242,16 +242,16 @@ namespace HeavenStudio.Games
public void Prepare()
{
Jukebox.PlayOneShotGame("boardMeeting/prepare");
SoundByte.PlayOneShotGame("boardMeeting/prepare");
foreach (var executive in executives)
{
executive.Prepare();
}
}
public void SpinEqui(float beat, float length)
public void SpinEqui(double beat, float length)
{
if (chairLoopSound == null) chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
if (chairLoopSound == null) chairLoopSound = SoundByte.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
firstSpinner = executives[0];
List<BeatAction.Action> rolls = new List<BeatAction.Action>();
for (int i = 0; i < executiveCount; i++)
@ -287,7 +287,7 @@ namespace HeavenStudio.Games
bool forceStart = false;
if (chairLoopSound == null)
{
chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
chairLoopSound = SoundByte.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
firstSpinner = executives[start - 1];
forceStart = true;
}
@ -367,12 +367,12 @@ namespace HeavenStudio.Games
}
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame("boardMeeting/missThrough");
SoundByte.PlayOneShot("miss");
executives[executiveCount - 1].Stop(false);
return;
}
Jukebox.PlayOneShotGame("boardMeeting/stopPlayer");
SoundByte.PlayOneShotGame("boardMeeting/stopPlayer");
executives[executiveCount - 1].Stop();
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
@ -395,8 +395,8 @@ namespace HeavenStudio.Games
}
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame("boardMeeting/missThrough");
SoundByte.PlayOneShot("miss");
executives[executiveCount - 1].Stop(false);
return;
}
@ -407,7 +407,7 @@ namespace HeavenStudio.Games
Conductor.instance.pitchedSecPerBeat * 0.5f, 18, 1f);
executives[executiveCount - 1].Stop();
assistantAnim.DoScaledAnimationAsync("Stop", 0.5f);
Jukebox.PlayOneShotGame("boardMeeting/stopAllPlayer");
SoundByte.PlayOneShotGame("boardMeeting/stopAllPlayer");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.timer + caller.startBeat + 1f, delegate
@ -425,8 +425,8 @@ namespace HeavenStudio.Games
if (executives[executiveCount - 1].spinning)
{
executives[executiveCount - 1].Stop(false);
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame("boardMeeting/missThrough");
SoundByte.PlayOneShot("miss");
if (chairLoopSound != null)
{
chairLoopSound.KillLoop(0);
@ -440,8 +440,8 @@ namespace HeavenStudio.Games
if (executives[executiveCount - 1].spinning)
{
executives[executiveCount - 1].Stop(false);
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame("boardMeeting/missThrough");
SoundByte.PlayOneShot("miss");
if (chairLoopSound != null)
{
chairLoopSound.KillLoop(0);

View File

@ -8,15 +8,15 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS
using HeavenStudio.Util;
public class Blocks : MonoBehaviour
{
public float createBeat;
public double createBeat;
public float createLength;
public Animator anim;
private bool moving = true;
private BuiltToScaleDS game;
float windupBeat;
float hitBeat;
float sinkBeat;
double windupBeat;
double hitBeat;
double sinkBeat;
private void Awake()
{
@ -36,7 +36,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS
private void Update()
{
if (!moving) return;
float currentBeat = Conductor.instance.songPositionInBeats;
double currentBeat = Conductor.instance.songPositionInBeatsAsDouble;
var shooterState = game.shooterAnim.GetCurrentAnimatorStateInfo(0);
if (currentBeat > windupBeat && currentBeat < hitBeat
@ -66,7 +66,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS
private void Miss(PlayerActionEvent caller)
{
float sinkBeat = hitBeat + (createLength * 2f);
double sinkBeat = hitBeat + (createLength * 2f);
MultiSound.Play(
new MultiSound.Sound[] {
new MultiSound.Sound("builtToScaleDS/Sink", sinkBeat),
@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS
game.SpawnObject(BuiltToScaleDS.BTSObject.HitPieces);
Destroy(gameObject);
Jukebox.PlayOneShotGame("builtToScaleDS/Hit");
SoundByte.PlayOneShotGame("builtToScaleDS/Hit");
}
void NearMiss()
@ -102,7 +102,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleDS
game.SpawnObject(BuiltToScaleDS.BTSObject.MissPieces);
Destroy(gameObject);
Jukebox.PlayOneShotGame("builtToScaleDS/Crumble");
SoundByte.PlayOneShotGame("builtToScaleDS/Crumble");
}
}
}

View File

@ -6,6 +6,7 @@ using DG.Tweening;
using System;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -230,15 +231,15 @@ namespace HeavenStudio.Games
}
}
List<DynamicBeatmap.DynamicEntity> spawnedBlockEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> spawnedBlockEvents = new List<RiqEntity>();
void Update()
{
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused)
return;
var currentBeat = Conductor.instance.songPositionInBeats;
var currentBeat = Conductor.instance.songPositionInBeatsAsDouble;
var blockEvents = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "builtToScaleDS/spawn blocks");
var blockEvents = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "builtToScaleDS/spawn blocks");
for (int i = 0; i < blockEvents.Count; i++)
{
var ev = blockEvents[i];
@ -278,7 +279,7 @@ namespace HeavenStudio.Games
shootingThisFrame = true;
Shoot();
SpawnObject(BTSObject.FlyingRod);
Jukebox.PlayOneShotGame("builtToScaleDS/Boing");
SoundByte.PlayOneShotGame("builtToScaleDS/Boing");
}
if (!shootingThisFrame)
@ -292,7 +293,7 @@ namespace HeavenStudio.Games
shootingThisFrame = false;
}
public void Lights(float beat, float length, bool autoLights, bool shouldLights)
public void Lights(double beat, float length, bool autoLights, bool shouldLights)
{
autoLight = autoLights;
lighting = autoLights || shouldLights;
@ -361,7 +362,7 @@ namespace HeavenStudio.Games
firstLight = !firstLight;
}
public void SpawnBlocks(float beat, float length)
public void SpawnBlocks(double beat, float length)
{
var newBlocks = GameObject.Instantiate(movingBlocksBase, blocksHolder).GetComponent<Blocks>();
newBlocks.createBeat = beat;
@ -376,7 +377,7 @@ namespace HeavenStudio.Games
const int blockTotalFrames = 80;
const int spawnFrameOffset = -3;
List<int> criticalFrames = new List<int> { 7, 15, 23, 31, 39, 47 };
public void SetBlockTime(Blocks blocks, float spawnBeat, float length)
public void SetBlockTime(Blocks blocks, double spawnBeat, float length)
{
float spawnTimeOffset = (float)spawnFrameOffset / (float)blockFramesPerSecond;
@ -388,7 +389,7 @@ namespace HeavenStudio.Games
float speedMult = secondsToHitFrame / secondsToHitBeat;
float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - spawnBeat) + spawnTimeOffset;
float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - (float)spawnBeat) + spawnTimeOffset;
float framesPastSpawnTime = blockFramesPerSecond * speedMult * secondsPastSpawnTime;
// The only way I could deal with Unity's interpolation shenanigans without having a stroke.
@ -434,15 +435,15 @@ namespace HeavenStudio.Games
elevatorAnim.Play("MakeRod", 0, 0);
}
public void PlayPiano(float beat, float length, int semiTones)
public void PlayPiano(double beat, float length, int semiTones)
{
var pianoPitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
var pianoSource = Jukebox.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true);
var pianoPitch = SoundByte.GetPitchFromSemiTones(semiTones, true);
var pianoSource = SoundByte.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true);
pianoSource.SetLoopParams(beat + length, 0.1f);
}
public void MultiplePiano(float beat, float length, bool silent, int note1, int note2, int note3, int note4, int note5, int note6)
public void MultiplePiano(double beat, float length, bool silent, int note1, int note2, int note3, int note4, int note5, int note6)
{
if (silent) return;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()

View File

@ -19,13 +19,13 @@ namespace HeavenStudio.Games
}
public class CallAndResponseEvent
{
public float beat;
public double beat;
public float length;
public float relativeBeat; // this beat is relative to the intervalStartBeat
public double relativeBeat; // this beat is relative to the intervalStartBeat
public Dictionary<string, dynamic> DynamicData; //if you need more properties for your queued event
public string tag;
public CallAndResponseEvent(float beat, float relativeBeat, string tag, float length = 0)
public CallAndResponseEvent(double beat, double relativeBeat, string tag, float length = 0)
{
this.beat = beat;
this.length = length;
@ -73,7 +73,7 @@ namespace HeavenStudio.Games
}
}
public float intervalStartBeat = -1; // the first beat of the interval
public double intervalStartBeat = -1; // the first beat of the interval
public float intervalLength = -1; // the duration of the interval in beats
public float defaultIntervalLength; // when an event is queued and the interval has not started yet, it will use this as the interval length.
@ -93,9 +93,9 @@ namespace HeavenStudio.Games
return Conductor.instance.GetPositionFromBeat(intervalStartBeat, intervalLength - lengthOffset);
}
public float GetIntervalProgressFromBeat(float beat, float lengthOffset = 0)
public float GetIntervalProgressFromBeat(double beat, float lengthOffset = 0)
{
return Mathp.Normalize(beat, intervalStartBeat, intervalStartBeat + intervalLength - lengthOffset);
return (float)((beat - intervalStartBeat) / ((intervalStartBeat + intervalLength - lengthOffset) - intervalStartBeat));
}
/// <summary>
@ -112,7 +112,7 @@ namespace HeavenStudio.Games
/// </summary>
/// <param name="beat">The interval start beat.</param>
/// <param name="length">The length of the interval.</param>
public void StartInterval(float beat, float length)
public void StartInterval(double beat, float length)
{
if (!IntervalIsActive())
{
@ -129,7 +129,7 @@ namespace HeavenStudio.Games
/// <param name="crParams">Extra properties to add to the event.</param>
/// <param name="ignoreInterval">If true, this function will not start a new interval if the interval isn't active.</param>
/// <param name="overrideInterval">If true, overrides the current interval.</param>
public void AddEvent(float beat, float length = 0, string tag = "", List<CallAndResponseEventParam> crParams = null, bool ignoreInterval = false, bool overrideInterval = false)
public void AddEvent(double beat, float length = 0, string tag = "", List<CallAndResponseEventParam> crParams = null, bool ignoreInterval = false, bool overrideInterval = false)
{
if ((!IntervalIsActive() && !ignoreInterval) || overrideInterval)
{
@ -150,7 +150,7 @@ namespace HeavenStudio.Games
/// Check if an event exists at beat.
/// </summary>
/// <param name="beat">The beat to check.</param>
public bool EventExistsAtBeat(float beat)
public bool EventExistsAtBeat(double beat)
{
if (queuedEvents.Count == 0)
{
@ -164,7 +164,7 @@ namespace HeavenStudio.Games
/// Check if an event exists at relativeBeat.
/// </summary>
/// <param name="beat">The beat to check.</param>
public bool EventExistsAtRelativetBeat(float relativeBeat)
public bool EventExistsAtRelativetBeat(double relativeBeat)
{
if (queuedEvents.Count == 0)
{

View File

@ -98,11 +98,11 @@ namespace HeavenStudio.Games
public GameObject bg2;
// when to stop playing the catch animation
private float stopCatchLeft = 0f;
private float stopCatchRight = 0f;
private double stopCatchLeft = 0;
private double stopCatchRight = 0;
private float startSmile = 0f;
private float stopSmile = 0f;
private double startSmile = 0;
private double stopSmile = 0;
private bool bopLeft = true;
private bool bopRight = true;
@ -112,7 +112,7 @@ namespace HeavenStudio.Games
static List<QueuedFruit> queuedFruits = new List<QueuedFruit>();
struct QueuedFruit
{
public float beat;
public double beat;
public int side;
public bool smile;
public bool isPineapple;
@ -143,20 +143,20 @@ namespace HeavenStudio.Games
}
// print(stopCatchLeft + " " + stopCatchRight);
// print("current beat: " + conductor.songPositionInBeats);
if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeats)
// print("current beat: " + conductor.songPositionInBeatsAsDouble);
if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble)
{
plalinAnim.Play("idle", 0, 0);
stopCatchLeft = 0;
}
if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeats)
if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble)
{
alalinAnim.Play("idle", 0, 0);
stopCatchRight = 0;
}
if (startSmile > 0 && startSmile <= cond.songPositionInBeats)
if (startSmile > 0 && startSmile <= cond.songPositionInBeatsAsDouble)
{
//print("smile start");
plalinAnim.Play("smile", 1, 0);
@ -165,7 +165,7 @@ namespace HeavenStudio.Games
heartMessage.SetActive(true);
}
if (stopSmile > 0 && stopSmile <= cond.songPositionInBeats)
if (stopSmile > 0 && stopSmile <= cond.songPositionInBeatsAsDouble)
{
//print("smile stop");
plalinAnim.Play("stopsmile", 1, 0);
@ -201,7 +201,7 @@ namespace HeavenStudio.Games
}
}
public void DropFruit(float beat, int side, bool smile, bool isPineapple, float endSmile)
public void DropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile)
{
var objectToSpawn = isPineapple ? pineappleBase : orangeBase;
@ -217,9 +217,9 @@ namespace HeavenStudio.Games
}
//minenice: experiment to test preFunction
public static void PreDropFruit(float beat, int side, bool smile, bool isPineapple, float endSmile)
public static void PreDropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile)
{
float spawnBeat = beat - 1f;
double spawnBeat = beat - 1;
beat = beat - (isPineapple ? 2f : 1f);
if (GameManager.instance.currentGame == "catchyTune")
{
@ -250,7 +250,7 @@ namespace HeavenStudio.Games
}
}
public void DropFruitSingle(float beat, bool side, bool smile, GameObject objectToSpawn, float endSmile)
public void DropFruitSingle(double beat, bool side, bool smile, GameObject objectToSpawn, float endSmile)
{
var newFruit = GameObject.Instantiate(objectToSpawn, fruitHolder);
@ -262,7 +262,7 @@ namespace HeavenStudio.Games
newFruit.SetActive(true);
}
public void Bop(float beat, float length, int whoBops, int whoBopsAuto)
public void Bop(double beat, float length, int whoBops, int whoBopsAuto)
{
bopLeft = whoBopsAuto == (int)WhoBops.Plalin || whoBopsAuto == (int)WhoBops.Both;
bopRight = whoBopsAuto == (int)WhoBops.Alalin || whoBopsAuto == (int)WhoBops.Both;
@ -309,7 +309,7 @@ namespace HeavenStudio.Games
}
}
public void catchSuccess(bool side, bool isPineapple, bool smile, float beat, float endSmile)
public void catchSuccess(bool side, bool isPineapple, bool smile, double beat, float endSmile)
{
string anim = isPineapple ? "catchPineapple" : "catchOrange";
@ -335,9 +335,9 @@ namespace HeavenStudio.Games
public void catchMiss(bool side, bool isPineapple)
{
// not the right sound at all but need an accurate rip
Jukebox.PlayOneShotGame("catchyTune/fruitThrough");
SoundByte.PlayOneShotGame("catchyTune/fruitThrough");
float beat = Conductor.instance.songPositionInBeats;
double beat = Conductor.instance.songPositionInBeatsAsDouble;
string fruitType = isPineapple ? "Pineapple" : "Orange";
@ -355,7 +355,7 @@ namespace HeavenStudio.Games
public void catchWhiff(bool side)
{
Jukebox.PlayOneShotGame("catchyTune/whiff");
SoundByte.PlayOneShotGame("catchyTune/whiff");
whiffAnim(side);
}
@ -363,11 +363,11 @@ namespace HeavenStudio.Games
{
if (side)
{
Jukebox.PlayOneShotGame("catchyTune/barely right");
SoundByte.PlayOneShotGame("catchyTune/barely right");
}
else
{
Jukebox.PlayOneShotGame("catchyTune/barely left");
SoundByte.PlayOneShotGame("catchyTune/barely left");
}
whiffAnim(side);
@ -375,7 +375,7 @@ namespace HeavenStudio.Games
public void whiffAnim(bool side)
{
float beat = Conductor.instance.songPositionInBeats;
double beat = Conductor.instance.songPositionInBeatsAsDouble;
if (side)
{

View File

@ -11,13 +11,13 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
{
public bool isPineapple;
public float startBeat;
public double startBeat;
public Animator anim;
public bool side;
public float barelyStart = 0f;
public double barelyStart = 0f;
public bool smile;
@ -87,7 +87,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
}
}
public static void PlaySound(float startBeat, bool side, bool isPineapple)
public static void PlaySound(double startBeat, bool side, bool isPineapple)
{
string soundText = "catchyTune/";
@ -141,7 +141,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
if (state <= -1f || state >= 1f)
{
//near miss (barely)
barelyStart = Conductor.instance.songPositionInBeats;
barelyStart = Conductor.instance.songPositionInBeatsAsDouble;
game.catchBarely(side);
@ -156,7 +156,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
}
else
{
Jukebox.PlayOneShotGame(soundText + "Catch");
SoundByte.PlayOneShotGame(soundText + "Catch");
game.catchSuccess(side, isPineapple, smile, startBeat + beatLength, endSmile);
Destroy(this.gameObject);
}

View File

@ -8,6 +8,7 @@ using UnityEngine;
using UnityEngine.Rendering;
using static HeavenStudio.EntityTypes;
using static HeavenStudio.Games.CheerReaders;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -164,20 +165,20 @@ namespace HeavenStudio.Games
bool shouldBop = true;
bool canBop = true;
public bool doingCue;
float cueLength;
float cueBeat;
double cueLength;
double cueBeat;
bool shouldYay;
bool shouldDoSuccessZoom;
public bool shouldBeBlack = false;
public GameEvent bop = new GameEvent();
int currentZoomIndex;
float currentZoomCamBeat;
double currentZoomCamBeat;
float currentZoomCamLength;
private List<DynamicBeatmap.DynamicEntity> allCameraEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allCameraEvents = new List<RiqEntity>();
void OnDestroy()
{
Jukebox.KillLoop(SpinningLoop, 0.5f);
SoundByte.KillLoop(SpinningLoop, 0.5f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
@ -210,10 +211,10 @@ namespace HeavenStudio.Games
allGirls.AddRange(thirdRow);
var camEvents = EventCaller.GetAllInGameManagerList("cheerReaders", new string[] { "okItsOn" });
camEvents.AddRange(EventCaller.GetAllInGameManagerList("cheerReaders", new string[] { "okItsOnStretch" }));
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(camEvents[i]);
}
@ -238,7 +239,7 @@ namespace HeavenStudio.Games
{
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{
if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat)
if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat)
{
UpdateCameraZoom();
currentZoomIndex++;
@ -256,7 +257,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuint);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuint);
float newZoom = func(shouldDoSuccessZoom ? 4f : 1.5f, 0, normalizedZoomOutAgainBeat);
GameCamera.additionalPosition = new Vector3(0, 0, newZoom);
}
@ -269,7 +270,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuint);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
float newZoom = func(-1, shouldDoSuccessZoom ? 4f : 1.5f, normalizedZoomInBeat);
GameCamera.additionalPosition = new Vector3(0, 0, newZoom);
}
@ -282,7 +283,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuint);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
float newZoom = func(0f, 1f, normalizedZoomOutBeat);
GameCamera.additionalPosition = new Vector3(0, 0, newZoom * -1);
}
@ -292,22 +293,22 @@ namespace HeavenStudio.Games
{
player.FlipBook(false);
missPoster.SetActive(false);
Jukebox.PlayOneShotGame("cheerReaders/miss");
SoundByte.PlayOneShotGame("cheerReaders/miss");
ScoreMiss(1f);
}
if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StartSpinBook();
missPoster.SetActive(false);
SpinningLoop = Jukebox.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true);
SpinningLoop = SoundByte.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true);
ScoreMiss(1f);
}
if (PlayerInput.AltPressedUp() && !IsExpectingInputNow(InputType.STANDARD_ALT_UP))
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StopSpinBook();
Jukebox.KillLoop(SpinningLoop, 0f);
SoundByte.KillLoop(SpinningLoop, 0f);
ScoreMiss(1f);
missPoster.SetActive(true);
}
@ -326,7 +327,7 @@ namespace HeavenStudio.Games
}
else if (!cond.isPlaying)
{
Jukebox.KillLoop(SpinningLoop, 0.5f);
SoundByte.KillLoop(SpinningLoop, 0.5f);
}
}
@ -399,7 +400,7 @@ namespace HeavenStudio.Games
switch (whoSpeaks)
{
case (int)WhoSpeaks.Solo:
Jukebox.PlayOneShotGame("cheerReaders/Solo/yayS");
SoundByte.PlayOneShotGame("cheerReaders/Solo/yayS");
player.Yay(true);
foreach (var nerd in allGirls)
{
@ -407,7 +408,7 @@ namespace HeavenStudio.Games
}
break;
case (int)WhoSpeaks.Girls:
Jukebox.PlayOneShotGame("cheerReaders/Girls/yayGirls");
SoundByte.PlayOneShotGame("cheerReaders/Girls/yayGirls");
foreach (var nerd in allGirls)
{
nerd.Yay(true);
@ -415,7 +416,7 @@ namespace HeavenStudio.Games
player.Yay(false);
break;
default:
Jukebox.PlayOneShotGame("cheerReaders/All/yay");
SoundByte.PlayOneShotGame("cheerReaders/All/yay");
foreach (var nerd in allGirls)
{
nerd.Yay(true);
@ -425,7 +426,7 @@ namespace HeavenStudio.Games
}
}
public void BopToggle(float beat, float length, bool startBop, bool bopAuto)
public void BopToggle(double beat, float length, bool startBop, bool bopAuto)
{
shouldBop = bopAuto;
if (startBop)
@ -463,7 +464,7 @@ namespace HeavenStudio.Games
}
}
public void SetIsDoingCue(float beat, float length, bool shouldSwitchColor = true)
public void SetIsDoingCue(double beat, float length, bool shouldSwitchColor = true)
{
if (!doingCue) shouldYay = false;
foreach (var girl in allGirls)
@ -481,7 +482,7 @@ namespace HeavenStudio.Games
});
}
public void OneTwoThree(float beat, int whoSpeaks)
public void OneTwoThree(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
@ -609,7 +610,7 @@ namespace HeavenStudio.Games
});
}
public void ItsUpToYou(float beat, int whoSpeaks)
public void ItsUpToYou(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
@ -767,7 +768,7 @@ namespace HeavenStudio.Games
});
}
public void LetsGoReadABunchaBooks(float beat, int whoSpeaks)
public void LetsGoReadABunchaBooks(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
@ -953,7 +954,7 @@ namespace HeavenStudio.Games
});
}
public void RahRahSisBoomBaBoom(float beat, int whoSpeaks, bool consecutive)
public void RahRahSisBoomBaBoom(double beat, int whoSpeaks, bool consecutive)
{
canBop = false;
ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, JustFlipBoom, MissFlip, Nothing);
@ -1163,7 +1164,7 @@ namespace HeavenStudio.Games
});
}
public void OkItsOnStretchable(float beat, float length, int whoSpeaks, bool whistle, int posterToChoose, bool shouldHappyFace)
public void OkItsOnStretchable(double beat, float length, int whoSpeaks, bool whistle, int posterToChoose, bool shouldHappyFace)
{
canBop = false;
float actualLength = length * 0.25f;
@ -1360,7 +1361,7 @@ namespace HeavenStudio.Games
missPoster.SetActive(false);
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.FlipBook(); //Need near miss anims
return;
}
@ -1372,7 +1373,7 @@ namespace HeavenStudio.Games
missPoster.SetActive(false);
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.FlipBook(); //Need near miss anims
return;
}
@ -1385,11 +1386,11 @@ namespace HeavenStudio.Games
shouldYay = true;
if (boom)
{
Jukebox.PlayOneShotGame("cheerReaders/bookBoom");
SoundByte.PlayOneShotGame("cheerReaders/bookBoom");
}
else
{
Jukebox.PlayOneShotGame("cheerReaders/bookPlayer");
SoundByte.PlayOneShotGame("cheerReaders/bookPlayer");
}
}
@ -1398,9 +1399,9 @@ namespace HeavenStudio.Games
missPoster.SetActive(false);
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StartSpinBook();
SpinningLoop = Jukebox.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true);
SpinningLoop = SoundByte.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true);
return;
}
SuccessHoldSpin();
@ -1409,16 +1410,16 @@ namespace HeavenStudio.Games
void SuccessHoldSpin()
{
player.StartSpinBook();
Jukebox.PlayOneShotGame("cheerReaders/bookSpin");
SpinningLoop = Jukebox.PlayOneShotScheduledGame("cheerReaders/bookSpinLoop", Jukebox.GetClipLengthGame("cheerReaders/bookSpin"), 1, 1, true);
SoundByte.PlayOneShotGame("cheerReaders/bookSpin");
SpinningLoop = SoundByte.PlayOneShotScheduledGame("cheerReaders/bookSpinLoop", SoundByte.GetClipLengthGame("cheerReaders/bookSpin"), 1, 1, true);
}
void JustReleaseSpin(PlayerActionEvent caller, float state)
{
Jukebox.KillLoop(SpinningLoop, 0f);
SoundByte.KillLoop(SpinningLoop, 0f);
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StopSpinBook();
shouldDoSuccessZoom = false;
missPoster.SetActive(true);
@ -1429,7 +1430,7 @@ namespace HeavenStudio.Games
void SuccessReleaseSpin()
{
Jukebox.PlayOneShotGame("cheerReaders/bookOpen");
SoundByte.PlayOneShotGame("cheerReaders/bookOpen");
player.StopSpinBook();
shouldYay = true;
shouldDoSuccessZoom = true;
@ -1440,7 +1441,7 @@ namespace HeavenStudio.Games
{
playerMask.SetActive(false);
missPoster.SetActive(false);
Jukebox.PlayOneShotGame("cheerReaders/doingoing");
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.Miss();
shouldDoSuccessZoom = false;
foreach (var girl in allGirls)

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio.Games.Loaders
{
@ -41,7 +43,7 @@ namespace HeavenStudio.Games.Loaders
function = delegate { var e = eventCaller.currentEntity; ClappyTrio.instance.Sign(e.beat, e.length, e["ease"], e["down"]); },
parameters = new List<Param>()
{
new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the sign move with?"),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the sign move with?"),
new Param("down", true, "Down", "Should the sign go down?")
},
resizable = true
@ -96,9 +98,9 @@ namespace HeavenStudio.Games
public GameEvent bop = new GameEvent();
[SerializeField] Animator signAnim;
float signStartBeat;
double signStartBeat;
float signLength;
EasingFunction.Ease lastEase;
Util.EasingFunction.Ease lastEase;
bool signGoDown;
public static ClappyTrio instance { get; set; }
@ -112,9 +114,9 @@ namespace HeavenStudio.Games
clapSounds = null;
InitLions();
}
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
DynamicBeatmap.DynamicEntity changeLion = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat);
RiqEntity changeLion = GameManager.instance.Beatmap.Entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat);
if(changeLion != null)
{
EventCaller.instance.CallEvent(changeLion, true);
@ -126,7 +128,7 @@ namespace HeavenStudio.Games
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop) Bop(cond.songPositionInBeats);
if (shouldBop) Bop(cond.songPositionInBeatsAsDouble);
}
if (cond.isPlaying && !cond.isPaused)
{
@ -134,19 +136,19 @@ namespace HeavenStudio.Games
if (normalizedBeat > 0 && normalizedBeat <= 1)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
float newPos = func(0, 1, normalizedBeat);
signAnim.DoNormalizedAnimation(signGoDown ? "Enter" : "Exit", newPos);
}
}
}
public void Sign(float beat, float length, int ease, bool down)
public void Sign(double beat, float length, int ease, bool down)
{
Jukebox.PlayOneShotGame("clappyTrio/sign");
SoundByte.PlayOneShotGame("clappyTrio/sign");
signStartBeat = beat;
signLength = length;
lastEase = (EasingFunction.Ease)ease;
lastEase = (Util.EasingFunction.Ease)ease;
signGoDown = down;
}
@ -179,7 +181,7 @@ namespace HeavenStudio.Games
clapAction.Delete();
}
public void Clap(float beat, float length)
public void Clap(double beat, float length)
{
ClappyTrioPlayer.clapStarted = true;
ClappyTrioPlayer.canHit = true; // this is technically a lie, this just restores the ability to hit
@ -209,10 +211,10 @@ namespace HeavenStudio.Games
SetFace(i, type);
}
PlayAnimationAll("Prepare");
Jukebox.PlayOneShotGame("clappyTrio/ready");
SoundByte.PlayOneShotGame("clappyTrio/ready");
}
public void BopToggle(float beat, float length, bool startBop, bool autoBop, bool emo)
public void BopToggle(double beat, float length, bool startBop, bool autoBop, bool emo)
{
doEmotion = !emo;
shouldBop = autoBop;
@ -222,7 +224,7 @@ namespace HeavenStudio.Games
for (int i = 0; i < length; i++)
{
if (i == 0 && startBop && autoBop) continue;
float spawnBeat = beat + i;
double spawnBeat = beat + i;
bops.Add(new BeatAction.Action(spawnBeat, delegate { Bop(spawnBeat); }));
if (i == length - 1)
{
@ -233,7 +235,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat)
public void Bop(double beat)
{
if (doEmotion && emoCounter > 0)
{

View File

@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
public class ClappyTrioPlayer : MonoBehaviour
{
ClappyTrio game;
private float lastClapBeat;
private double lastClapBeat;
private float lastClapLength;
public bool clapStarted = false;
@ -32,7 +32,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
}
}
public void QueueClap(float startBeat, float length)
public void QueueClap(double startBeat, float length)
{
lastClapBeat = startBeat;
lastClapLength = length;
@ -69,12 +69,12 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
if (just)
{
clapEffect.SetActive(true);
Jukebox.PlayOneShotGame("clappyTrio/rightClap");
SoundByte.PlayOneShotGame("clappyTrio/rightClap");
}
else
{
clapEffect.SetActive(false);
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
game.misses++;
if (clapStarted)

View File

@ -155,12 +155,12 @@ namespace HeavenStudio.Games
//nothing
}
public void TossCoin(float beat, int type, bool audienceReacting)
public void TossCoin(double beat, int type, bool audienceReacting)
{
if (coin != null) return;
//Play sound and animations
Jukebox.PlayOneShotGame("coinToss/throw");
SoundByte.PlayOneShotGame("coinToss/throw");
handAnimator.Play("Throw", 0, 0);
//Game state says the hand is throwing the coin
isThrowing = true;
@ -169,7 +169,7 @@ namespace HeavenStudio.Games
{
case (int) CoinToss.CoinVariation.Cowbell:
//this was intentional. it was to avoid the throw and cowbells to go offbeat.
Jukebox.PlayOneShotGame("coinToss/cowbell1");
SoundByte.PlayOneShotGame("coinToss/cowbell1");
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("coinToss/cowbell2", beat + 1f, offset: 0.01f),
new MultiSound.Sound("coinToss/cowbell1", beat + 2f, offset: 0.01f),
@ -189,12 +189,12 @@ namespace HeavenStudio.Games
//coin.perfectOnly = true;
}
public void TossCoin(float beat)
public void TossCoin(double beat)
{
if (coin != null) return;
//Play sound and animations
Jukebox.PlayOneShotGame("coinToss/throw");
SoundByte.PlayOneShotGame("coinToss/throw");
handAnimator.Play("Throw", 0, 0);
//Game state says the hand is throwing the coin
isThrowing = true;
@ -206,8 +206,8 @@ namespace HeavenStudio.Games
public void CatchSuccess(PlayerActionEvent caller, float state)
{
Jukebox.PlayOneShotGame("coinToss/catch");
if(this.audienceReacting) Jukebox.PlayOneShot("applause");
SoundByte.PlayOneShotGame("coinToss/catch");
if(this.audienceReacting) SoundByte.PlayOneShot("applause");
handAnimator.Play("Catch_success", 0, 0);
isThrowing = false;
@ -215,8 +215,8 @@ namespace HeavenStudio.Games
public void CatchMiss(PlayerActionEvent caller)
{
Jukebox.PlayOneShot("miss");
if(this.audienceReacting) Jukebox.PlayOneShot("audience/disappointed");
SoundByte.PlayOneShot("miss");
if(this.audienceReacting) SoundByte.PlayOneShot("audience/disappointed");
handAnimator.Play("Pickup", 0, 0);
isThrowing = false;

View File

@ -4,6 +4,7 @@ using HeavenStudio.Util;
using System;
using System.Collections.Generic;
using UnityEngine;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -64,14 +65,14 @@ namespace HeavenStudio.Games
float grassWidth;
float dotsWidth = 19.2f;
private float newBeat = -1f; // So that marching can happen on beat 0.
private float marchStartBeat = -1f;
private float marchOffset;
private double newBeat = -1f; // So that marching can happen on beat 0.
private double marchStartBeat = -1f;
private double marchOffset;
private int currentMarchBeat;
private int stepCount;
private bool isStepping;
private static float inactiveStart = -1f;
private static double inactiveStart = -1f;
public bool isMarching => marchStartBeat != -1f;
@ -111,10 +112,10 @@ namespace HeavenStudio.Games
// Initialize vegetables.
var cond = Conductor.instance;
var entities = GameManager.instance.Beatmap.entities;
var entities = GameManager.instance.Beatmap.Entities;
float startBeat = cond.songPositionInBeats;
float endBeat = Single.MaxValue;
double startBeat = cond.songPositionInBeatsAsDouble;
double endBeat = double.MaxValue;
if (inactiveStart == -1f)
{
@ -123,7 +124,7 @@ namespace HeavenStudio.Games
for (int i = 0; i < marchStarts.Count; i++)
{
var sampleBeat = marchStarts[i].beat;
if (cond.songPositionInBeats <= sampleBeat + 0.25f) // 0.25-beat buffer in case the start marching event is directly next to the game switch event.
if (cond.songPositionInBeatsAsDouble <= sampleBeat + 0.25f) // 0.25-beat buffer in case the start marching event is directly next to the game switch event.
{
startBeat = sampleBeat;
break;
@ -135,7 +136,7 @@ namespace HeavenStudio.Games
// Find the beat of the next step, assuming marching started at inactiveStart.
int stepsPassed = 0;
while (inactiveStart + (stepsPassed * 2f) < cond.songPositionInBeats)
while (inactiveStart + (stepsPassed * 2f) < cond.songPositionInBeatsAsDouble)
{
stepsPassed++;
@ -210,7 +211,7 @@ namespace HeavenStudio.Games
}
}
List<DynamicBeatmap.DynamicEntity> cuedMoleSounds = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> cuedMoleSounds = new List<RiqEntity>();
private void Update()
{
var cond = Conductor.instance;
@ -219,12 +220,12 @@ namespace HeavenStudio.Games
return;
// Mole sounds.
var moleEvents = GameManager.instance.Beatmap.entities.FindAll(m => m.datamodel == "cropStomp/mole");
var moleEvents = GameManager.instance.Beatmap.Entities.FindAll(m => m.datamodel == "cropStomp/mole");
for (int i = 0; i < moleEvents.Count; i++)
{
var moleEvent = moleEvents[i];
if (moleEvent["mute"]) continue;
var timeToEvent = moleEvent.beat - cond.songPositionInBeats;
var timeToEvent = moleEvent.beat - cond.songPositionInBeatsAsDouble;
if (timeToEvent <= 4f && timeToEvent > 2f && !cuedMoleSounds.Contains(moleEvent))
{
cuedMoleSounds.Add(moleEvent);
@ -328,7 +329,7 @@ namespace HeavenStudio.Games
}
}
public void StartMarching(float beat)
public void StartMarching(double beat)
{
marchStartBeat = beat;
marchOffset = marchStartBeat % 1;
@ -348,7 +349,7 @@ namespace HeavenStudio.Games
legsAnim.Play(stompAnim, 0, 0);
Jukebox.PlayOneShotGame("cropStomp/stomp");
SoundByte.PlayOneShotGame("cropStomp/stomp");
if (shakeTween != null)
shakeTween.Kill(true);
@ -359,29 +360,29 @@ namespace HeavenStudio.Games
isStepping = true;
}
private void SpawnVeggie(float beat, float startBeat, bool isMole)
private void SpawnVeggie(double beat, double startBeat, bool isMole)
{
var newVeggie = GameObject.Instantiate(isMole ? baseMole : baseVeggie, veggieHolder).GetComponent<Veggie>();
newVeggie.targetBeat = beat;
var veggieX = (beat - startBeat) * -stepDistance / 2f;
newVeggie.transform.localPosition = new Vector3(veggieX, 0f, 0f);
newVeggie.transform.localPosition = new Vector3((float)veggieX, 0f, 0f);
newVeggie.Init();
newVeggie.gameObject.SetActive(true);
}
public static void MarchInactive(float beat)
public static void MarchInactive(double beat)
{
if (GameManager.instance.currentGame == "cropStomp") //this function is only meant for making march sounds while the game is inactive
{
return;
}
inactiveStart = beat;
DynamicBeatmap.DynamicEntity gameSwitch = GameManager.instance.Beatmap.entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp");
RiqEntity gameSwitch = GameManager.instance.Beatmap.Entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp");
if (gameSwitch == null)
return;
int length = Mathf.CeilToInt((gameSwitch.beat - beat)/2);
int length = (int)Math.Ceiling((gameSwitch.beat - beat)/2);
MultiSound.Sound[] sounds = new MultiSound.Sound[length];
for(int i = 0; i < length; i++)
{

View File

@ -8,7 +8,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
{
public class Farmer : MonoBehaviour
{
public float nextStompBeat;
public double nextStompBeat;
private CropStomp game;

View File

@ -20,15 +20,15 @@ namespace HeavenStudio.Games.Scripts_CropStomp
public BezierCurve3D curve;
private BezierCurve3D hitCurve;
public float targetBeat;
private float stompedBeat;
private float pickedBeat;
public double targetBeat;
private double stompedBeat;
private double pickedBeat;
private float pickTime = 1f;
private int veggieState = 0;
private bool boinked; // Player got barely when trying to pick.
private bool pickEligible = true;
private float landBeat;
private double landBeat;
private Tween squashTween;
@ -137,9 +137,9 @@ namespace HeavenStudio.Games.Scripts_CropStomp
var key2Pos = key2.Position;
key2.Position = new Vector3(key2Pos.x, veggieTrans.position.y + 2f, key2Pos.z);
pickedBeat = Conductor.instance.songPositionInBeats;
pickedBeat = Conductor.instance.songPositionInBeatsAsDouble;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
MissedUpdate();
}
@ -154,7 +154,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
veggieState = -1;
if (!isMole)
Jukebox.PlayOneShotGame("cropStomp/veggieMiss");
SoundByte.PlayOneShotGame("cropStomp/veggieMiss");
caller.Disable();
}
@ -231,7 +231,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
game.ScheduleInput(targetBeat, isMole ? 0.5f : 1f, InputType.STANDARD_UP, PickJust, PickMiss, Out);
targetBeat = targetBeat + (isMole ? 0.5f : 1f);
stompedBeat = cond.songPositionInBeats;
stompedBeat = cond.songPositionInBeatsAsDouble;
landBeat = targetBeat + (float)cond.SecsToBeats(Minigame.EndTime()-1, cond.GetBpmAtBeat(targetBeat));
@ -273,7 +273,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
var keyPos = key1.Position;
key1.Position = new Vector3(keyPos.x, veggieTrans.position.y, keyPos.z);
pickedBeat = Conductor.instance.songPositionInBeats;
pickedBeat = Conductor.instance.songPositionInBeatsAsDouble;
if (!isMole)
{
@ -283,7 +283,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
new BeatAction.Action(pickedBeat + pickTime, delegate { GameObject.Destroy(gameObject); })
});
Jukebox.PlayOneShotGame("cropStomp/veggieKay");
SoundByte.PlayOneShotGame("cropStomp/veggieKay");
hitCurve = game.pickCurve;
}
@ -294,7 +294,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
new BeatAction.Action(pickedBeat + pickTime, delegate { GameObject.Destroy(gameObject); })
});
Jukebox.PlayOneShotGame("cropStomp/GEUH");
SoundByte.PlayOneShotGame("cropStomp/GEUH");
hitCurve = game.moleCurve;
}

View File

@ -113,7 +113,7 @@ namespace HeavenStudio.Games
[SerializeField] private Student student;
[SerializeField] private GameObject djYellow;
private Animator djYellowAnim;
private float lastReportedBeat = 0f;
private double lastReportedBeat = 0f;
public DJYellow djYellowScript;
[Header("Properties")]
@ -121,10 +121,10 @@ namespace HeavenStudio.Games
public bool djYellowHolding;
public bool andStop;
public bool goBop;
public float beatOfInstance;
public double beatOfInstance;
private bool djYellowBopLeft;
public bool shouldBeHolding = false;
public float smileBeat = -10f;
public double smileBeat = double.MinValue;
public static DJSchool instance { get; private set; }
@ -138,26 +138,26 @@ namespace HeavenStudio.Games
}
//For inactive game purposes
static float wantBreak = Single.MinValue;
static float wantAndStop = Single.MinValue;
static float wantDJVoiceLines = Single.MinValue;
static double wantBreak = double.MinValue;
static double wantAndStop = double.MinValue;
static double wantDJVoiceLines = double.MinValue;
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
if (wantBreak != Single.MinValue)
if (wantBreak != double.MinValue)
{
BreakCmon(wantBreak, 0, false, false);
wantBreak = Single.MinValue;
wantBreak = double.MinValue;
}
else if(wantAndStop != Single.MinValue)
else if(wantAndStop != double.MinValue)
{
AndStop(wantAndStop, false, false);
wantAndStop = Single.MinValue;
wantAndStop = double.MinValue;
}
else if(wantDJVoiceLines != Single.MinValue)
else if(wantDJVoiceLines != double.MinValue)
{
VoiceLines(wantDJVoiceLines, 0);
wantDJVoiceLines = Single.MinValue;
wantDJVoiceLines = double.MinValue;
}
}
@ -168,7 +168,7 @@ namespace HeavenStudio.Games
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
// if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
@ -245,9 +245,9 @@ namespace HeavenStudio.Games
}
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble);
}
if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss
@ -287,7 +287,7 @@ namespace HeavenStudio.Games
shouldBeHolding = true;
}
public void Bop(float beat, float length, bool isBopping, bool autoBop)
public void Bop(double beat, float length, bool isBopping, bool autoBop)
{
goBop = autoBop;
if (isBopping)
@ -314,7 +314,7 @@ namespace HeavenStudio.Games
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse((normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) || djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
@ -339,7 +339,7 @@ namespace HeavenStudio.Games
}
}
public void BreakCmon(float beat, int type, bool ooh, bool doSound = true)
public void BreakCmon(double beat, int type, bool ooh, bool doSound = true)
{
if (djYellowHolding) return;
@ -404,7 +404,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void AndStop(float beat, bool ooh, bool doSound = true)
public void AndStop(double beat, bool ooh, bool doSound = true)
{
if (djYellowHolding) return;
@ -427,7 +427,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 0.5f, delegate
{
djYellow.GetComponent<Animator>().DoScaledAnimationAsync("BreakCmon", 0.5f);
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f)
{
djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
@ -450,7 +450,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void ScratchoHey(float beat, int type, bool remix4, bool cheer)
public void ScratchoHey(double beat, int type, bool remix4, bool cheer)
{
string[] sounds = new string[] { };
@ -539,7 +539,7 @@ namespace HeavenStudio.Games
{
Student.soundFX = toggle;
}
public static void VoiceLines(float beat, int type)
public static void VoiceLines(double beat, int type)
{
string[] sounds;
var sound = new MultiSound.Sound[] { };
@ -592,18 +592,19 @@ namespace HeavenStudio.Games
break;
case 4:
Jukebox.PlayOneShotGame("djSchool/yay", forcePlay: true);
SoundByte.PlayOneShotGame("djSchool/yay", forcePlay: true);
break;
}
}
#region Inactive Game Commands
public static void WarnBreakCmon(float beat, int type, bool ooh)
public static void WarnBreakCmon(double beat, int type, bool ooh)
{
string[] sounds = type switch {
0 => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" },
1 => new string[] { "djSchool/breakCmonAlt1", "djSchool/breakCmonAlt2", "djSchool/oohAlt" },
2 => new string[] { "djSchool/breakCmonLoud1", "djSchool/breakCmonLoud2", "djSchool/oohLoud" },
_ => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" },
};
List<MultiSound.Sound> sound = new List<MultiSound.Sound>()
@ -618,7 +619,7 @@ namespace HeavenStudio.Games
wantBreak = beat;
}
public static void WarnAndStop(float beat, bool ooh)
public static void WarnAndStop(double beat, bool ooh)
{
List<MultiSound.Sound> sound = new List<MultiSound.Sound>()
{

View File

@ -107,7 +107,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = false;
shouldBeHolding = true;
Jukebox.PlayOneShotGame("djSchool/recordStop");
SoundByte.PlayOneShotGame("djSchool/recordStop");
anim.DoScaledAnimationAsync("Hold", 0.5f);
tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f);
@ -124,7 +124,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
//isHolding = true;
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -145,7 +145,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = true;
Jukebox.PlayOneShotGame("djSchool/recordStop");
SoundByte.PlayOneShotGame("djSchool/recordStop");
anim.DoScaledAnimationAsync("Hold", 0.5f);
tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f);
@ -170,7 +170,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
anim.DoScaledAnimationAsync("Unhold", 0.5f);
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -190,7 +190,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public void OnHitSwipeCheer(PlayerActionEvent caller, float beat)
{
OnHitSwipe(caller, beat);
Jukebox.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f);
SoundByte.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f);
}
public void OnHitSwipe(PlayerActionEvent caller, float beat)
{
@ -202,7 +202,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = false;
shouldBeHolding = false;
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
FlashFX(false);
swiping = true;
@ -225,7 +225,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
else
{
OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1f);
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
@ -249,7 +249,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -268,7 +268,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
});
}
public void OnMissSwipeForPlayerInput(float beat)
public void OnMissSwipeForPlayerInput(double beat)
{
isHolding = false;

View File

@ -111,7 +111,7 @@ namespace HeavenStudio.Games
static List<QueuedThrow> queuedThrows = new List<QueuedThrow>();
struct QueuedThrow
{
public float beat;
public double beat;
public int direction;
public int typeL;
public int typeR;
@ -137,7 +137,7 @@ namespace HeavenStudio.Games
[SerializeField] Sprite[] ObjectTypes;
private float lastReportedBeat = 0f;
private double lastReportedBeat = 0f;
private bool birdOnScreen = false;
static bool dontBop = false;
private const string sfxNum = "dogNinja/";
@ -211,7 +211,7 @@ namespace HeavenStudio.Games
}
DogAnim.DoScaledAnimationAsync(slice, 0.5f);
Jukebox.PlayOneShotGame("dogNinja/whiff");
SoundByte.PlayOneShotGame("dogNinja/whiff");
DogAnim.SetBool("needPrepare", false);
}
@ -231,12 +231,12 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, bool bop)
public void Bop(double beat, bool bop)
{
dontBop = !bop;
}
public static void QueueObject(float beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow)
public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow)
{
int ObjSprite = 1;
if (typeL == 0 || typeR == 0) {
@ -249,14 +249,14 @@ namespace HeavenStudio.Games
if (direction is 0 or 2) {
sfxNumL += typeL < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeL);
if (typeL == 0) typeL = ObjSprite;
if (!muteThrow) Jukebox.PlayOneShotGame(sfxNumL+"1", forcePlay: true);
if (!muteThrow) SoundByte.PlayOneShotGame(sfxNumL+"1", forcePlay: true);
}
string sfxNumR = "dogNinja/";
if (direction is 1 or 2) {
sfxNumR += typeR < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeR);
if (typeR == 0) typeR = ObjSprite;
if (!(direction == 2 && typeL == typeR) && !muteThrow) Jukebox.PlayOneShotGame(sfxNumR+"1", forcePlay: true);
if (!(direction == 2 && typeL == typeR) && !muteThrow) SoundByte.PlayOneShotGame(sfxNumR+"1", forcePlay: true);
}
queuedThrows.Add(new QueuedThrow() {
@ -271,7 +271,7 @@ namespace HeavenStudio.Games
if (prepare) DogNinja.instance.DogAnim.SetBool("needPrepare", true);
}
public void ThrowObject(float beat, int direction, int typeL, int typeR, string sfxNumL, string sfxNumR)
public void ThrowObject(double beat, int direction, int typeL, int typeR, string sfxNumL, string sfxNumR)
{
// instantiate a game object and give it its variables
if (direction is 0 or 2) {
@ -299,13 +299,13 @@ namespace HeavenStudio.Games
}
}
public void CutEverything(float beat, bool sound, string customText)
public void CutEverything(double beat, bool sound, string customText)
{
// plays one anim with sfx when it's not on screen, plays a different anim with no sfx when on screen. ez
if (!birdOnScreen) {
FullBird.SetActive(true);
if (sound) {
Jukebox.PlayOneShotGame(sfxNum+"bird_flap");
SoundByte.PlayOneShotGame(sfxNum+"bird_flap");
}
BirdAnim.Play("FlyIn", 0, 0);
birdOnScreen = true;
@ -316,13 +316,13 @@ namespace HeavenStudio.Games
}
}
public void Prepare(float beat)
public void Prepare(double beat)
{
if (!DogAnim.GetBool("needPrepare")) DogAnim.DoScaledAnimationAsync("Prepare", 0.5f);
DogAnim.SetBool("needPrepare", true);
}
public void HereWeGo(float beat)
public void HereWeGo(double beat)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxNum+"here", beat),
@ -331,7 +331,7 @@ namespace HeavenStudio.Games
}, forcePlay: true);
}
public static void HereWeGoInactive(float beat)
public static void HereWeGoInactive(double beat)
{
DogNinja.instance.HereWeGo(beat);
}

View File

@ -10,12 +10,12 @@ namespace HeavenStudio.Games.Scripts_DogNinja
{
public class SpawnHalves : MonoBehaviour
{
public float startBeat;
public double startBeat;
public Vector3 objPos;
private Vector3 posModifier;
public bool lefty;
float bpmModifier;
float songPos;
double songPos;
[SerializeField] float rotSpeed;
@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja
{
game = DogNinja.instance;
bpmModifier = Conductor.instance.songBpm / 100;
songPos = Conductor.instance.songPositionInBeats;
songPos = Conductor.instance.songPositionInBeatsAsDouble;
}
private void Start()

View File

@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja
{
public class ThrowObject : MonoBehaviour
{
public float startBeat;
public double startBeat;
public int type;
public bool fromLeft;
public bool shouldSfx = true;
@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja
private Vector3 objPos;
private bool isActive = true;
private float barelyTime;
private double barelyTime;
[Header("Animators")]
Animator DogAnim;
@ -88,7 +88,7 @@ namespace HeavenStudio.Games.Scripts_DogNinja
};
DogAnim.DoScaledAnimationAsync(slice, 0.5f);
if (shouldSfx) Jukebox.PlayOneShotGame(sfxNum+"2");
if (shouldSfx) SoundByte.PlayOneShotGame(sfxNum+"2");
game.WhichLeftHalf.sprite = objectLeftHalves[type-1];
game.WhichRightHalf.sprite = objectRightHalves[type-1];
@ -109,17 +109,18 @@ namespace HeavenStudio.Games.Scripts_DogNinja
private void JustSlice()
{
isActive = false;
barelyTime = Conductor.instance.songPositionInBeats;
barelyTime = Conductor.instance.songPositionInBeatsAsDouble;
string barely = "Barely" + direction switch
{
0 => "Left",
1 => "Right",
2 => "Both",
_ => "Both",
};
DogAnim.DoScaledAnimationAsync(barely, 0.5f);
Jukebox.PlayOneShotGame("dogNinja/barely");
SoundByte.PlayOneShotGame("dogNinja/barely");
}
private void Hit(PlayerActionEvent caller, float state)

View File

@ -1,3 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -10,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
private DoubleDate game;
private SuperCurveObject.Path path;
private float pathStartBeat = float.MinValue;
private double pathStartBeat = double.MinValue;
private Conductor conductor;
private GameObject shadow;
@ -22,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Update()
{
float beat = conductor.songPositionInBeats;
float height = 0f;
if (pathStartBeat > float.MinValue)
double beat = conductor.songPositionInBeatsAsDouble;
double height = 0f;
if (pathStartBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat);
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
transform.position = pos;
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat)));
}
shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f);
}
public void Init(float beat)
public void Init(double beat)
{
game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Miss, Empty);
path = game.GetPath("BasketBallIn");
@ -55,17 +57,17 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 3f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate
{
Destroy(gameObject);
}),
});
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
if (state >= 1f || state <= -1f)
{
path = game.GetPath("BasketBallNg" + (state > 0 ? "Late" : "Early"));
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
game.Kick(false);
GetComponent<SpriteRenderer>().sortingOrder = 8;
return;
@ -76,15 +78,15 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Hit()
{
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("BasketBallJust");
game.Kick();
Jukebox.PlayOneShotGame("doubleDate/kick");
SoundByte.PlayOneShotGame("doubleDate/kick");
}
void Miss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("doubleDate/weasel_hide");
SoundByte.PlayOneShotGame("doubleDate/weasel_hide");
game.MissKick(pathStartBeat + 2.25f);
}

View File

@ -75,13 +75,13 @@ namespace HeavenStudio.Games
[SerializeField] public float shadowDepthScaleMin;
[SerializeField] public float shadowDepthScaleMax;
[SerializeField] SuperCurveObject.Path[] ballBouncePaths;
float lastGirlGacha = float.MinValue;
double lastGirlGacha = double.MinValue;
bool shouldBop = true;
bool canBop = true;
GameEvent bop = new GameEvent();
public static DoubleDate instance;
public static List<QueuedBall> queuedBalls = new List<QueuedBall>();
[NonSerialized] public float lastHitWeasel = float.MinValue;
[NonSerialized] public double lastHitWeasel = double.MinValue;
public enum BallType
{
@ -92,7 +92,7 @@ namespace HeavenStudio.Games
public struct QueuedBall
{
public float beat;
public double beat;
public BallType type;
}
@ -109,7 +109,7 @@ namespace HeavenStudio.Games
}
}
public override void OnPlay(float beat)
public override void OnPlay(double beat)
{
queuedBalls.Clear();
}
@ -169,7 +169,7 @@ namespace HeavenStudio.Games
}
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
{
Jukebox.PlayOneShotGame("doubleDate/kick_whiff");
SoundByte.PlayOneShotGame("doubleDate/kick_whiff");
Kick(true, true, false);
}
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
@ -180,7 +180,7 @@ namespace HeavenStudio.Games
canBop = go;
}
public void Bop(float beat, float length, bool goBop, bool autoBop)
public void Bop(double beat, float length, bool goBop, bool autoBop)
{
shouldBop = autoBop;
if (goBop)
@ -201,7 +201,7 @@ namespace HeavenStudio.Games
{
boyAnim.DoScaledAnimationAsync("IdleBop", 1f);
}
if (Conductor.instance.songPositionInBeats > lastGirlGacha)
if (Conductor.instance.songPositionInBeatsAsDouble > lastGirlGacha)
girlAnim.DoScaledAnimationAsync("GirlBop", 1f);
weasels.Bop();
}
@ -214,7 +214,7 @@ namespace HeavenStudio.Games
if (jump)
{
weasels.Jump();
lastGirlGacha = Conductor.instance.songPositionInBeats + 0.5f;
lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 0.5f;
girlAnim.DoScaledAnimationAsync("GirlLookUp", 0.5f);
}
else if (weaselsHappy) weasels.Happy();
@ -222,7 +222,7 @@ namespace HeavenStudio.Games
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate
{
leaves.Play();
treeAnim.DoScaledAnimationAsync("TreeRustle", 1f);
@ -237,7 +237,7 @@ namespace HeavenStudio.Games
}
}
public static void QueueSoccerBall(float beat)
public static void QueueSoccerBall(double beat)
{
if (GameManager.instance.currentGame != "doubleDate")
{
@ -251,10 +251,10 @@ namespace HeavenStudio.Games
{
instance.SpawnSoccerBall(beat);
}
Jukebox.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true);
SoundByte.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true);
}
public static void QueueBasketBall(float beat)
public static void QueueBasketBall(double beat)
{
if (GameManager.instance.currentGame != "doubleDate")
{
@ -275,7 +275,7 @@ namespace HeavenStudio.Games
}, forcePlay: true);
}
public static void QueueFootBall(float beat)
public static void QueueFootBall(double beat)
{
if (GameManager.instance.currentGame != "doubleDate")
{
@ -296,31 +296,31 @@ namespace HeavenStudio.Games
}, forcePlay: true);
}
public void SpawnSoccerBall(float beat)
public void SpawnSoccerBall(double beat)
{
SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent<SoccerBall>();
spawnedBall.Init(beat);
}
public void SpawnBasketBall(float beat)
public void SpawnBasketBall(double beat)
{
Basketball spawnedBall = Instantiate(basket, instance.transform).GetComponent<Basketball>();
spawnedBall.Init(beat);
}
public void SpawnFootBall(float beat)
public void SpawnFootBall(double beat)
{
Football spawnedBall = Instantiate(football, instance.transform).GetComponent<Football>();
spawnedBall.Init(beat);
}
public void MissKick(float beat, bool hit = false)
public void MissKick(double beat, bool hit = false)
{
lastGirlGacha = Conductor.instance.songPositionInBeats + 1.5f;
lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 1.5f;
girlAnim.DoScaledAnimationAsync("GirlSad", 0.5f);
if (hit)
{
lastHitWeasel = Conductor.instance.songPositionInBeats;
lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat - (0.25f/3f), delegate { weasels.Hit(beat); }),
@ -328,7 +328,7 @@ namespace HeavenStudio.Games
}
else
{
lastHitWeasel = Conductor.instance.songPositionInBeats;
lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.25, delegate { weasels.Hide(beat + 0.25f); }),

View File

@ -42,7 +42,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
}
}
public void Hide(float beat)
public void Hide(double beat)
{
if (notHit)
{
@ -69,7 +69,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
}
}
public void Hit(float beat)
public void Hit(double beat)
{
if (notHit)
{

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -11,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
private DoubleDate game;
private SuperCurveObject.Path path;
private float pathStartBeat = float.MinValue;
private double pathStartBeat = double.MinValue;
private Conductor conductor;
private GameObject shadow;
@ -23,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Update()
{
float beat = conductor.songPositionInBeats;
float height = 0f;
if (pathStartBeat > float.MinValue)
double beat = conductor.songPositionInBeatsAsDouble;
double height = 0f;
if (pathStartBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat);
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
transform.position = pos;
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat)));
}
shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f);
}
public void Init(float beat)
public void Init(double beat)
{
game.ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, Just, Miss, Empty);
path = game.GetPath("FootBallInNoHit"); // there's a second path for footballs that hit the weasels, use that if the weasels haven't been hit recently
@ -57,14 +58,14 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
if (state >= 1f || state <= -1f)
{
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("FootBallNg" + (state > 0 ? "Late" : "Early"));
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
game.Kick(false);
GetComponent<SpriteRenderer>().sortingOrder = 8;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 4f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate
{
Destroy(gameObject);
}),
@ -74,16 +75,16 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
Hit();
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 1f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 1f, delegate
{
shadow.SetActive(false);
GetComponent<SpriteRenderer>().sortingOrder = -5;
transform.localScale *= 0.25f;
path = game.GetPath("FootBallFall");
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats + 1f;
pathStartBeat = conductor.songPositionInBeatsAsDouble + 1f;
}),
new BeatAction.Action(conductor.songPositionInBeats + 12f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 12f, delegate
{
Destroy(gameObject);
}),
@ -93,30 +94,30 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Hit()
{
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("FootBallJust");
game.Kick(true, true, jump: true);
Jukebox.PlayOneShotGame("doubleDate/footballKick");
SoundByte.PlayOneShotGame("doubleDate/footballKick");
}
void Miss(PlayerActionEvent caller)
{
if (conductor.songPositionInBeats > game.lastHitWeasel + 2.25f)
if (conductor.songPositionInBeatsAsDouble > game.lastHitWeasel + 2.25f)
{
path = game.GetPath("FootBallIn");
float impact = GetPointTimeByTag(path, "impact");
if (impact > 0)
{
GetComponent<SpriteRenderer>().sortingOrder = 8;
Jukebox.PlayOneShotGame("doubleDate/weasel_hit", pathStartBeat + impact);
Jukebox.PlayOneShotGame("doubleDate/weasel_scream", pathStartBeat + impact);
SoundByte.PlayOneShotGame("doubleDate/weasel_hit", pathStartBeat + impact);
SoundByte.PlayOneShotGame("doubleDate/weasel_scream", pathStartBeat + impact);
game.MissKick(pathStartBeat + impact, true);
}
}
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 5f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 5f, delegate
{
Destroy(gameObject);
}),

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -11,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
private DoubleDate game;
private SuperCurveObject.Path path;
private float pathStartBeat = float.MinValue;
private double pathStartBeat = double.MinValue;
private Conductor conductor;
private GameObject shadow;
@ -23,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Update()
{
float beat = conductor.songPositionInBeats;
float height = 0f;
if (pathStartBeat > float.MinValue)
double beat = conductor.songPositionInBeatsAsDouble;
double height = 0f;
if (pathStartBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat);
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
transform.position = pos;
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat)));
}
shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f);
}
public void Init(float beat)
public void Init(double beat)
{
game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Miss, Empty);
path = game.GetPath("SoccerIn");
@ -56,17 +57,17 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 3f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate
{
Destroy(gameObject);
}),
});
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
if (state >= 1f || state <= -1f)
{
path = game.GetPath("SoccerNg" + (state > 0 ? "Late" : "Early"));
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
game.Kick(false);
GetComponent<SpriteRenderer>().sortingOrder = 8;
return;
@ -77,20 +78,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Hit()
{
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("SoccerJust");
game.Kick();
Jukebox.PlayOneShotGame("doubleDate/kick");
SoundByte.PlayOneShotGame("doubleDate/kick");
}
void Miss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("doubleDate/weasel_hide");
SoundByte.PlayOneShotGame("doubleDate/weasel_hide");
game.MissKick(pathStartBeat + 2.25f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 4f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate
{
Destroy(gameObject);
}),

View File

@ -24,7 +24,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
private bool hitting = false;
private float canBopBeat = -2f;
private double canBopBeat = -2f;
// in the future: use the MiiStudio API to render any mii from a nintendo account / MNMS / Mii Studio code?
// figure out how to call the API from unity?
@ -59,7 +59,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
animator.Play("Bop", 0, 0);
}
public void Prepare(float beat, int type)
public void Prepare(double beat, int type)
{
canBopBeat = beat;
count = type;
@ -103,13 +103,13 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
private void HitSound(bool applause)
{
Jukebox.PlayOneShotGame("drummingPractice/hit");
if (applause) Jukebox.PlayOneShot("applause");
SoundByte.PlayOneShotGame("drummingPractice/hit");
if (applause) SoundByte.PlayOneShot("applause");
}
private void MissSound()
{
Jukebox.PlayOneShotGame("drummingPractice/miss");
SoundByte.PlayOneShotGame("drummingPractice/miss");
}
public void EndHit()

View File

@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
public class DrummerHit : MonoBehaviour
{
DrummingPractice game;
public float startBeat;
public double startBeat;
public bool applause = true;
// Start is called before the first frame update
@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat+1f, delegate {
Jukebox.PlayOneShotGame("drummingPractice/drum");
SoundByte.PlayOneShotGame("drummingPractice/drum");
game.leftDrummer.Hit(true, false);
game.rightDrummer.Hit(true, false);
}),

View File

@ -109,7 +109,7 @@ namespace HeavenStudio.Games
[Header("Variables")]
float movingLength;
float movingStartBeat;
double movingStartBeat;
bool isMoving;
string moveAnim;
EasingFunction.Ease lastEase;
@ -126,9 +126,9 @@ namespace HeavenStudio.Games
SetMiis();
}
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
var changeMii = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat);
var changeMii = GameManager.instance.Beatmap.Entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat);
if(changeMii != null)
{
EventCaller.instance.CallEvent(changeMii, true);
@ -164,7 +164,7 @@ namespace HeavenStudio.Games
}
}
public void NPCDrummersEnterOrExit(float beat, float length, bool exit, int ease)
public void NPCDrummersEnterOrExit(double beat, float length, bool exit, int ease)
{
movingStartBeat = beat;
movingLength = length;
@ -177,7 +177,7 @@ namespace HeavenStudio.Games
});
}
public void SetBop(float beat, float length, bool shouldBop, bool autoBop)
public void SetBop(double beat, float length, bool shouldBop, bool autoBop)
{
goBop = autoBop;
if (shouldBop)
@ -199,7 +199,7 @@ namespace HeavenStudio.Games
rightDrummer.Bop();
}
public void Prepare(float beat, bool applause)
public void Prepare(double beat, bool applause)
{
int type = count % 2;
player.Prepare(beat, type);
@ -208,7 +208,7 @@ namespace HeavenStudio.Games
count++;
SetFaces(0);
Jukebox.PlayOneShotGame("drummingPractice/prepare");
SoundByte.PlayOneShotGame("drummingPractice/prepare");
GameObject hit = Instantiate(hitPrefab);
hit.transform.parent = hitPrefab.transform.parent;

View File

@ -209,14 +209,14 @@ namespace HeavenStudio.Games
private GameEvent noCall = new GameEvent();
private GameEvent noSpecBop = new GameEvent();
private float idolJumpStartTime = Single.MinValue;
private double idolJumpStartTime = double.MinValue;
private static int performanceType = (int) IdolPerformanceType.Normal;
private bool responseToggle = false;
private static float wantHais = Single.MinValue;
private static float wantKamone = Single.MinValue;
private static double wantHais = double.MinValue;
private static double wantKamone = double.MinValue;
private static int wantKamoneType = (int) KamoneResponseType.Through;
private static bool wantKamoneAlt = false;
private static float wantBigReady = Single.MinValue;
private static double wantBigReady = double.MinValue;
private bool hasJumped = false;
private bool goBopIdol = true;
private bool goBopSpec = true;
@ -331,22 +331,22 @@ namespace HeavenStudio.Games
}
}
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
if (wantHais != Single.MinValue)
if (wantHais != double.MinValue)
{
ContinueHais(wantHais);
wantHais = Single.MinValue;
wantHais = double.MinValue;
}
if (wantKamone != Single.MinValue)
if (wantKamone != double.MinValue)
{
ContinueKamone(wantKamone, 0, wantKamoneType, wantKamoneAlt);
wantKamone = Single.MinValue;
wantKamone = double.MinValue;
}
if (wantBigReady != Single.MinValue)
if (wantBigReady != double.MinValue)
{
ContinueBigReady(wantBigReady);
wantBigReady = Single.MinValue;
wantBigReady = double.MinValue;
}
}
@ -357,7 +357,7 @@ namespace HeavenStudio.Games
{
if (goBopIdol)
{
if (!(cond.songPositionInBeats >= noBop.startBeat && cond.songPositionInBeats < noBop.startBeat + noBop.length))
if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length))
{
idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0);
Blue.PlayAnimState("Beat");
@ -370,7 +370,7 @@ namespace HeavenStudio.Games
{
if (goBopSpec)
{
if (!(cond.songPositionInBeats >= noSpecBop.startBeat && cond.songPositionInBeats < noSpecBop.startBeat + noSpecBop.length))
if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length))
BopAll();
}
}
@ -378,7 +378,7 @@ namespace HeavenStudio.Games
//idol jumping physics
float jumpPos = cond.GetPositionFromBeat(idolJumpStartTime, 1f);
float IDOL_SHADOW_SCALE = 1.18f;
if (cond.songPositionInBeats >= idolJumpStartTime && cond.songPositionInBeats < idolJumpStartTime + 1f)
if (cond.songPositionInBeatsAsDouble >= idolJumpStartTime && cond.songPositionInBeatsAsDouble < idolJumpStartTime + 1f)
{
hasJumped = true;
float yMul = jumpPos * 2f - 1f;
@ -388,13 +388,13 @@ namespace HeavenStudio.Games
}
else
{
idolJumpStartTime = Single.MinValue;
idolJumpStartTime = double.MinValue;
ArisaRootMotion.transform.localPosition = new Vector3(0, 0);
ArisaShadow.transform.localScale = new Vector3(IDOL_SHADOW_SCALE, IDOL_SHADOW_SCALE, 1f);
}
}
public void Bop(float beat, float length, int target = (int) IdolBopType.Both, int targetAuto = (int)IdolBopType.Both)
public void Bop(double beat, float length, int target = (int) IdolBopType.Both, int targetAuto = (int)IdolBopType.Both)
{
goBopIdol = targetAuto == (int)IdolBopType.Both || targetAuto == (int)IdolBopType.Idol;
goBopSpec = targetAuto == (int)IdolBopType.Both || targetAuto == (int)IdolBopType.Spectators;
@ -430,33 +430,33 @@ namespace HeavenStudio.Games
}
}
private void DisableBop(float beat, float length)
private void DisableBop(double beat, float length)
{
noBop.length = length;
noBop.startBeat = beat;
}
private void DisableResponse(float beat, float length)
private void DisableResponse(double beat, float length)
{
noResponse.length = length;
noResponse.startBeat = beat;
}
private void DisableCall(float beat, float length)
private void DisableCall(double beat, float length)
{
noCall.length = length;
noCall.startBeat = beat;
}
private void DisableSpecBop(float beat, float length)
private void DisableSpecBop(double beat, float length)
{
float bt = Conductor.instance.songPositionInBeats;
double bt = Conductor.instance.songPositionInBeatsAsDouble;
if (bt >= noSpecBop.startBeat && bt < noSpecBop.startBeat + noSpecBop.length)
{
float thisStToNextSt = beat - noSpecBop.startBeat;
float newLen = thisStToNextSt + length;
double thisStToNextSt = beat - noSpecBop.startBeat;
double newLen = thisStToNextSt + length;
if (newLen > noSpecBop.length)
noSpecBop.length = thisStToNextSt + length;
noSpecBop.length = (float)thisStToNextSt + length;
}
else
{
@ -465,9 +465,9 @@ namespace HeavenStudio.Games
}
}
public void PlayAnim(float beat, float length, int type, int who)
public void PlayAnim(double beat, float length, int type, int who)
{
idolJumpStartTime = Single.MinValue;
idolJumpStartTime = double.MinValue;
DisableResponse(beat, length + 0.5f);
DisableBop(beat, length + 0.5f);
DisableCall(beat, length + 0.5f);
@ -529,14 +529,14 @@ namespace HeavenStudio.Games
break;
case (int)IdolAnimations.Dab:
idolAnimator.Play("IdolDab" + GetPerformanceSuffix(), -1, 0);
Jukebox.PlayOneShotGame("fanClub/arisa_dab");
SoundByte.PlayOneShotGame("fanClub/arisa_dab");
break;
default: break;
}
}
}
public void PlayAnimStage(float beat, int type)
public void PlayAnimStage(double beat, int type)
{
switch (type)
{
@ -566,7 +566,7 @@ namespace HeavenStudio.Games
spectatorMat.SetColor("_Color", new Color(117/255f, 177/255f, 209/255f, 1));
}
private void DoIdolJump(float beat, float length = 3f)
private void DoIdolJump(double beat, float length = 3f)
{
DisableBop(beat, length);
DisableResponse(beat, length);
@ -584,7 +584,7 @@ namespace HeavenStudio.Games
{
if (!responseToggle)
{
if (!(Conductor.instance.songPositionInBeats >= noResponse.startBeat && Conductor.instance.songPositionInBeats < noResponse.startBeat + noResponse.length))
if (!(Conductor.instance.songPositionInBeatsAsDouble >= noResponse.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noResponse.startBeat + noResponse.length))
{
idolAnimator.Play("IdolCrap" + GetPerformanceSuffix(), -1, 0);
Blue.PlayAnimState("Crap");
@ -595,7 +595,7 @@ namespace HeavenStudio.Games
private void DoIdolPeace(bool sync = true)
{
if (!(Conductor.instance.songPositionInBeats >= noCall.startBeat && Conductor.instance.songPositionInBeats < noCall.startBeat + noCall.length))
if (!(Conductor.instance.songPositionInBeatsAsDouble >= noCall.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noCall.startBeat + noCall.length))
{
if (sync)
idolAnimator.Play("IdolPeace" + GetPerformanceSuffix(), -1, 0);
@ -610,14 +610,14 @@ namespace HeavenStudio.Games
{
if (responseToggle)
{
if (!(Conductor.instance.songPositionInBeats >= noResponse.startBeat && Conductor.instance.songPositionInBeats < noResponse.startBeat + noResponse.length))
if (!(Conductor.instance.songPositionInBeatsAsDouble >= noResponse.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noResponse.startBeat + noResponse.length))
idolAnimator.Play("IdolResponse" + GetPerformanceSuffix(), -1, 0);
}
}
private void DoIdolCall(int part = 0, bool big = false)
{
if (!(Conductor.instance.songPositionInBeats >= noCall.startBeat && Conductor.instance.songPositionInBeats < noCall.startBeat + noCall.length))
if (!(Conductor.instance.songPositionInBeatsAsDouble >= noCall.startBeat && Conductor.instance.songPositionInBeatsAsDouble < noCall.startBeat + noCall.length))
{
if (big)
{
@ -631,7 +631,7 @@ namespace HeavenStudio.Games
}
const float HAIS_LENGTH = 4.5f;
public void CallHai(float beat, bool noSound = false, int type = 0)
public void CallHai(double beat, bool noSound = false, int type = 0)
{
responseToggle = false;
DisableBop(beat, 8f);
@ -658,25 +658,25 @@ namespace HeavenStudio.Games
PlaySoundSequence("fanClub", "crowd_hai", beat + 4f);
}
public static void WarnHai(float beat, bool noSound = false, int type = 0)
public static void WarnHai(double beat, bool noSound = false, int type = 0)
{
wantHais = beat;
}
public static void HaiSound(float beat, bool noSound = false, int type = 0)
public static void HaiSound(double beat, bool noSound = false, int type = 0)
{
if (noSound) return;
PlaySoundSequence("fanClub", "arisa_hai", beat);
}
public void ContinueHais(float beat, int type = 0)
public void ContinueHais(double beat, int type = 0)
{
CallHai(beat, true, type);
}
const float CALL_LENGTH = 2.5f;
public void CallKamone(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
public void CallKamone(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
{
bool doJump = (responseType == (int) KamoneResponseType.Jump || responseType == (int) KamoneResponseType.JumpFast);
bool isBig = (responseType == (int) KamoneResponseType.ThroughFast || responseType == (int) KamoneResponseType.JumpFast);
@ -719,14 +719,14 @@ namespace HeavenStudio.Games
PlaySoundSequence("fanClub", alt ? "crowd_iina" : "crowd_kamone", beat + 2f);
}
public static void WarnKamone(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
public static void WarnKamone(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
{
wantKamone = beat;
wantKamoneType = responseType;
wantKamoneAlt = alt;
}
public static void KamoneSound(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
public static void KamoneSound(double beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
{
if (noSound) return;
if (responseType == (int) KamoneResponseType.ThroughFast || responseType == (int) KamoneResponseType.JumpFast)
@ -739,13 +739,13 @@ namespace HeavenStudio.Games
}
}
public void ContinueKamone(float beat, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
public void ContinueKamone(double beat, int type = 0, int responseType = (int) KamoneResponseType.Through, bool alt = false)
{
CallKamone(beat, true, type, responseType, alt);
}
const float BIGCALL_LENGTH = 2.75f;
public void CallBigReady(float beat, bool noSound = false)
public void CallBigReady(double beat, bool noSound = false)
{
Prepare(beat + 1.5f);
Prepare(beat + 2f);
@ -762,23 +762,23 @@ namespace HeavenStudio.Games
});
}
public static void WarnBigReady(float beat, bool noSound = false)
public static void WarnBigReady(double beat, bool noSound = false)
{
wantBigReady = beat;
}
public static void BigReadySound(float beat, bool noSound = false)
public static void BigReadySound(double beat, bool noSound = false)
{
if (noSound) return;
PlaySoundSequence("fanClub", "crowd_big_ready", beat);
}
public void ContinueBigReady(float beat)
public void ContinueBigReady(double beat)
{
CallBigReady(beat, true);
}
public void Prepare(float beat, int type = 0)
public void Prepare(double beat, int type = 0)
{
Player.AddHit(beat, type);
}
@ -832,7 +832,7 @@ namespace HeavenStudio.Games
}
}
private void PlayOneClap(float beat, int who = -1)
private void PlayOneClap(double beat, int who = -1)
{
if (who != -1)
{
@ -845,7 +845,7 @@ namespace HeavenStudio.Games
return;
}
// Jukebox.PlayOneShotGame("fanClub/play_clap", volume: 0.08f);
Jukebox.PlayOneShotGame("fanClub/crap_impact", pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.1f);
SoundByte.PlayOneShotGame("fanClub/crap_impact", pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.1f);
BeatAction.New(Spectators[who], new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Spectators[who].GetComponent<Animator>().Play("FanClap", -1, 0); }),
@ -863,7 +863,7 @@ namespace HeavenStudio.Games
}
}
private void PlayLongClap(float beat)
private void PlayLongClap(double beat)
{
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
@ -872,7 +872,7 @@ namespace HeavenStudio.Games
});
}
private void PlayChargeClap(float beat)
private void PlayChargeClap(double beat)
{
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
@ -881,7 +881,7 @@ namespace HeavenStudio.Games
});
}
private void StartJump(int idx, float beat)
private void StartJump(int idx, double beat)
{
Spectators[idx].GetComponent<NtrIdolFan>().jumpStartTime = beat;
BeatAction.New(Spectators[idx], new List<BeatAction.Action>()
@ -891,7 +891,7 @@ namespace HeavenStudio.Games
});
}
private void PlayJump(float beat)
private void PlayJump(double beat)
{
for (int i = 0; i < Spectators.Count; i++)
{
@ -912,7 +912,7 @@ namespace HeavenStudio.Games
}
}
public void DancerTravel(float beat, float length, bool exit, bool instant)
public void DancerTravel(double beat, float length, bool exit, bool instant)
{
if (instant)
{
@ -926,7 +926,7 @@ namespace HeavenStudio.Games
}
}
public void FinalCheer(float beat)
public void FinalCheer(double beat)
{
if (noJudgement) return;
noJudgement = true;
@ -970,7 +970,7 @@ namespace HeavenStudio.Games
});
}
void StartClapLoop(float beat, int who)
void StartClapLoop(double beat, int who)
{
BeatAction.New(Spectators[who], new List<BeatAction.Action>()
{

View File

@ -25,11 +25,11 @@ namespace HeavenStudio.Games.Scripts_FanClub
public Material coreMat;
Animator anim;
float startStepBeat = float.MaxValue;
double startStepBeat = double.MaxValue;
float stepLength = 16f;
bool exiting = false;
int currentAnim = 0;
float startJumpTime = float.MinValue;
double startJumpTime = double.MinValue;
bool hasJumped = false;
const int StepCount = 8;
@ -41,14 +41,14 @@ namespace HeavenStudio.Games.Scripts_FanClub
if (cond.songPositionInBeatsAsDouble >= startStepBeat + stepLength)
{
FinishEntrance(exiting);
startStepBeat = float.MaxValue;
startStepBeat = double.MaxValue;
currentAnim = 0;
}
else if (cond.songPositionInBeatsAsDouble >= startStepBeat)
{
currentAnim = (int)((cond.songPositionInBeatsAsDouble - startStepBeat) / (stepLength / AnimCount));
float startAnimBeat = startStepBeat + (stepLength / AnimCount) * currentAnim;
float endAnimBeat = startAnimBeat + (stepLength / AnimCount);
double startAnimBeat = startStepBeat + (stepLength / AnimCount) * currentAnim;
double endAnimBeat = startAnimBeat + (stepLength / AnimCount);
float prog = (float)((cond.songPositionInBeatsAsDouble - startAnimBeat - 0.75) / (endAnimBeat - startAnimBeat));
prog = Mathf.Clamp01(prog * 4);
if (exiting)
@ -64,12 +64,12 @@ namespace HeavenStudio.Games.Scripts_FanClub
rootTransform.transform.localPosition = new Vector3(startPostion + stepDistance * currentAnim + stepDistance * prog, rootYPos);
}
if (startStepBeat == float.MaxValue)
if (startStepBeat == double.MaxValue)
{
//idol jumping physics
float jumpPos = cond.GetPositionFromBeat(startJumpTime, 1f);
float IDOL_SHADOW_SCALE = 1.18f;
if (cond.songPositionInBeats >= startJumpTime && cond.songPositionInBeats < startJumpTime + 1f)
if (cond.songPositionInBeatsAsDouble >= startJumpTime && cond.songPositionInBeatsAsDouble < startJumpTime + 1f)
{
hasJumped = true;
float yMul = jumpPos * 2f - 1f;
@ -111,7 +111,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
anim = GetComponent<Animator>();
}
public void StartEntrance(float beat, float length, bool exit) {
public void StartEntrance(double beat, float length, bool exit) {
gameObject.SetActive(true);
rootTransform.SetActive(true);
shadow.SetActive(true);
@ -156,9 +156,9 @@ namespace HeavenStudio.Games.Scripts_FanClub
coreMat.SetColor("_Color", new Color(117/255f, 177/255f, 209/255f, 1));
}
public void DoIdolJump(float beat)
public void DoIdolJump(double beat)
{
if (startStepBeat != float.MaxValue) return;
if (startStepBeat != double.MaxValue) return;
if (!gameObject.activeInHierarchy) return;
startJumpTime = beat;
@ -170,11 +170,11 @@ namespace HeavenStudio.Games.Scripts_FanClub
});
}
public void PlayAnim(float beat, float length, int type)
public void PlayAnim(double beat, float length, int type)
{
if (startStepBeat != float.MaxValue) return;
if (startStepBeat != double.MaxValue) return;
if (!gameObject.activeInHierarchy) return;
startJumpTime = float.MinValue;
startJumpTime = double.MinValue;
// DisableResponse(beat, length + 0.5f);
// DisableBop(beat, length + 0.5f);
// DisableCall(beat, length + 0.5f);
@ -223,7 +223,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
public void PlayAnimState(string state)
{
if (startStepBeat != float.MaxValue) return;
if (startStepBeat != double.MaxValue) return;
if (!gameObject.activeInHierarchy) return;
anim.Play(state, -1, 0);
}

View File

@ -21,14 +21,14 @@ namespace HeavenStudio.Games.Scripts_FanClub
[Header("Properties")]
[NonSerialized] public bool player = false;
public float jumpStartTime = Single.MinValue;
public double jumpStartTime = double.MinValue;
bool stopBeat = false;
bool stopCharge = false;
bool hasJumped = false;
float clappingStartTime = Single.MinValue;
double clappingStartTime = double.MinValue;
public void AddHit(float beat, int type = 0)
public void AddHit(double beat, int type = 0)
{
if (player)
{
@ -114,7 +114,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
}
if (PlayerInput.Pressing())
{
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge)
if (clappingStartTime != double.MinValue && cond.songPositionInBeatsAsDouble > clappingStartTime + 2f && !stopCharge)
{
animator.speed = 1f;
animator.Play("FanClapCharge", -1, 0);
@ -123,7 +123,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
}
if (PlayerInput.PressedUp())
{
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP))
if (clappingStartTime != double.MinValue && cond.songPositionInBeatsAsDouble > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP))
{
if (FanClub.instance.JudgementPaused)
{
@ -140,13 +140,13 @@ namespace HeavenStudio.Games.Scripts_FanClub
animator.speed = 1f;
animator.Play("FanFree", -1, 0);
stopBeat = false;
clappingStartTime = Single.MinValue;
clappingStartTime = double.MinValue;
}
}
}
float jumpPos = cond.GetPositionFromBeat(jumpStartTime, 1f);
if (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f)
if (cond.songPositionInBeatsAsDouble >= jumpStartTime && cond.songPositionInBeatsAsDouble < jumpStartTime + 1f)
{
hasJumped = true;
float yMul = jumpPos * 2f - 1f;
@ -161,7 +161,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
shadow.transform.localScale = new Vector3(1.4f, 1.4f, 1f);
if (hasJumped)
{
Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f/4);
SoundByte.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f/4);
if (player)
{
animator.Play("FanPrepare", -1, 0);
@ -191,14 +191,14 @@ namespace HeavenStudio.Games.Scripts_FanClub
jumpStartTime = -99f;
animator.speed = 1f;
animator.Play("FanClap", -1, 0);
Jukebox.PlayOneShotGame("fanClub/play_clap");
Jukebox.PlayOneShotGame("fanClub/crap_impact");
clappingStartTime = cond.songPositionInBeats;
SoundByte.PlayOneShotGame("fanClub/play_clap");
SoundByte.PlayOneShotGame("fanClub/crap_impact");
clappingStartTime = cond.songPositionInBeatsAsDouble;
if (doCharge)
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate {
new BeatAction.Action(cond.songPositionInBeatsAsDouble + 0.1f, delegate {
if (PlayerInput.Pressing() || autoplayRelease > 0f)
{
animator.Play("FanClapCharge", -1, 0);
@ -211,7 +211,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
{
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(cond.songPositionInBeats + autoplayRelease, delegate {
new BeatAction.Action(cond.songPositionInBeatsAsDouble + autoplayRelease, delegate {
animator.Play("FanFree", -1, 0);
stopBeat = false;
}),
@ -229,16 +229,16 @@ namespace HeavenStudio.Games.Scripts_FanClub
var cond = Conductor.instance;
animator.Play("FanJump", -1, 0);
Jukebox.PlayOneShotGame("fanClub/play_jump");
jumpStartTime = cond.songPositionInBeats;
clappingStartTime = Single.MinValue;
SoundByte.PlayOneShotGame("fanClub/play_jump");
jumpStartTime = cond.songPositionInBeatsAsDouble;
clappingStartTime = double.MinValue;
stopCharge = false;
}
public bool IsJumping()
{
var cond = Conductor.instance;
return (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f);
return (cond.songPositionInBeatsAsDouble >= jumpStartTime && cond.songPositionInBeatsAsDouble < jumpStartTime + 1f);
}
public void Bop()

View File

@ -91,7 +91,7 @@ namespace HeavenStudio.Games
}
public struct QueuedFirework
{
public float beat;
public double beat;
public bool isSparkler;
public int whereToSpawn;
public bool practice;
@ -166,7 +166,7 @@ namespace HeavenStudio.Games
stars.SetActive(!doIt);
}
public static void CountIn(float beat, int count)
public static void CountIn(double beat, int count)
{
switch (count)
{
@ -197,7 +197,7 @@ namespace HeavenStudio.Games
}
}
public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
public static void PreSpawnFirework(double beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
{
if (isSparkler)
{
@ -230,7 +230,7 @@ namespace HeavenStudio.Games
}
void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
void SpawnFirework(double beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
{
if (isSparkler && practice)
{
@ -270,9 +270,9 @@ namespace HeavenStudio.Games
spawnedRocket.Init(beat, explosionType);
}
public void SpawnBomb(float beat, bool practice, bool applause)
public void SpawnBomb(double beat, bool practice, bool applause)
{
Jukebox.PlayOneShotGame("fireworks/tamaya_4");
SoundByte.PlayOneShotGame("fireworks/tamaya_4");
if (practice)
{
MultiSound.Play(new MultiSound.Sound[]

View File

@ -12,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
public bool applause;
private bool exploded;
private Fireworks game;
private float startBeat;
private double startBeat;
private Animator anim;
void Awake()
@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
anim = GetComponent<Animator>();
}
public void Init(float beat)
public void Init(double beat)
{
game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Out, Out);
startBeat = beat;
@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
});
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("fireworks/miss");
SoundByte.PlayOneShotGame("fireworks/miss");
return;
}
@ -55,9 +55,9 @@ namespace HeavenStudio.Games.Scripts_Fireworks
void Success(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("fireworks/taikoExplode");
SoundByte.PlayOneShotGame("fireworks/taikoExplode");
game.FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f);
if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
if (applause) SoundByte.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
}
void Out(PlayerActionEvent caller) { }

View File

@ -14,7 +14,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
[SerializeField] Animator anim;
public bool isSparkler;
private Fireworks game;
public float startBeat;
public double startBeat;
public bool applause;
private bool exploded;
private float startY;
@ -63,7 +63,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
}
}
public void Init(float beat, int explosionToChoose)
public void Init(double beat, int explosionToChoose)
{
startBeat = beat;
startY = transform.position.y - offSet;
@ -89,7 +89,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
{
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("fireworks/miss");
SoundByte.PlayOneShotGame("fireworks/miss");
particleBarelyEffect.Play();
anim.gameObject.SetActive(false);
return;
@ -99,10 +99,10 @@ namespace HeavenStudio.Games.Scripts_Fireworks
void Success(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("fireworks/explode_5");
SoundByte.PlayOneShotGame("fireworks/explode_5");
selectedParticleEffect.Play();
anim.gameObject.SetActive(false);
if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
if (applause) SoundByte.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
}
void Out(PlayerActionEvent caller) { }

View File

@ -1,3 +1,4 @@
using System;
using System.Text;
using System.Collections.Generic;
using UnityEngine;
@ -99,7 +100,7 @@ namespace HeavenStudio.Games
public int alienSpeakCount;
public int translatorSpeakCount;
public bool hasMissed;
private float lastReportedBeat = 0;
private double lastReportedBeat = 0;
[Header("Components")]
[SerializeField] GameObject alien;
@ -119,7 +120,7 @@ namespace HeavenStudio.Games
[Header("Variables")]
int currentVoicelineIndex = -1;
public bool intervalStarted;
float intervalStartBeat;
double intervalStartBeat;
public float beatInterval = 4f;
public bool noHitOnce, isSpeaking;
//public int version;
@ -137,7 +138,7 @@ namespace HeavenStudio.Games
static List<QueuedSecondContactInput> queuedInputs = new List<QueuedSecondContactInput>();
struct QueuedSecondContactInput
{
public float beatAwayFromStart;
public double beatAwayFromStart;
public string dialogue;
}
@ -189,7 +190,7 @@ namespace HeavenStudio.Games
translateFailTextbox.SetActive(false);
}
public void SetIntervalStart(float beat, float interval, string outDialogue)
public void SetIntervalStart(double beat, float interval, string outDialogue)
{
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
if (!intervalStarted)
@ -231,9 +232,9 @@ namespace HeavenStudio.Games
{
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble);
}
if (PlayerInput.Pressed(true) && !IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN))
@ -248,7 +249,7 @@ namespace HeavenStudio.Games
}
else if (!noHitOnce && !missionControl.activeInHierarchy)
{
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_MISS2_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-2, 1), false));
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_MISS2_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-2, 1), false));
}
}
}
@ -291,7 +292,7 @@ namespace HeavenStudio.Games
}
public void AlienSpeak(float beat, string dialogue, int spaceNum)
public void AlienSpeak(double beat, string dialogue, int spaceNum)
{
queuedInputs.Add(new QueuedSecondContactInput()
{
@ -302,8 +303,8 @@ namespace HeavenStudio.Games
if (voiceline == currentVoicelineIndex) voiceline++;
if (voiceline > 10) voiceline = 1;
currentVoicelineIndex = voiceline;
Jukebox.PlayOneShotGame("firstContact/Bob" + voiceline, beat, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false));
Jukebox.PlayOneShotGame("firstContact/BobB");
SoundByte.PlayOneShotGame("firstContact/Bob" + voiceline, beat, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false));
SoundByte.PlayOneShotGame("firstContact/BobB");
alien.GetComponent<Animator>().DoScaledAnimationAsync("alien_talk", 0.5f);
if (UnityEngine.Random.Range(0, 5) == 0) translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_lookAtAlien_nod", 0.5f);
callDiagList.Add(dialogue);
@ -317,10 +318,10 @@ namespace HeavenStudio.Games
UpdateAlienTextbox();
}
public void AlienTurnOver(float beat, float length)
public void AlienTurnOver(double beat, float length)
{
if (queuedInputs.Count == 0) return;
Jukebox.PlayOneShotGame("firstContact/turnover");
SoundByte.PlayOneShotGame("firstContact/turnover");
alienTextbox.SetActive(false);
alien.GetComponent<Animator>().Play("alien_point", 0, 0);
@ -341,10 +342,9 @@ namespace HeavenStudio.Games
queuedInputs.Clear();
}
public void AlienSuccess(float beat)
public void AlienSuccess(double beat)
{
string animString = "";
float secondSoundOffset = 0f;
List<MultiSound.Sound> sound = new List<MultiSound.Sound>();
if (!(hasMissed || noHitOnce))
{
@ -353,8 +353,8 @@ namespace HeavenStudio.Games
new MultiSound.Sound("firstContact/successCrowd", beat),
new MultiSound.Sound("firstContact/nod", beat),
new MultiSound.Sound("firstContact/nod", beat + 0.5f),
new MultiSound.Sound("firstContact/successExtra" + UnityEngine.Random.Range(1, 3), beat + 0.5f, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 50), false)),
new MultiSound.Sound("firstContact/whistle", beat + UnityEngine.Random.Range(0.5f, 1.5f), Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 100), false), UnityEngine.Random.Range(0.4f, 1f)),
new MultiSound.Sound("firstContact/successExtra" + UnityEngine.Random.Range(1, 3), beat + 0.5f, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-50, 50), false)),
new MultiSound.Sound("firstContact/whistle", beat + UnityEngine.Random.Range(0.5f, 1.5f), SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-50, 100), false), UnityEngine.Random.Range(0.4f, 1f)),
};
animString = "alien_success";
}
@ -410,7 +410,7 @@ namespace HeavenStudio.Games
translateFailText.text = respDiagBuffer;
}
public void MissionControlDisplay(float beat, bool stay, float length)
public void MissionControlDisplay(double beat, bool stay, float length)
{
missionControl.SetActive(true);
@ -452,7 +452,7 @@ namespace HeavenStudio.Games
void FailContact()
{
Jukebox.PlayOneShotGame("firstContact/failContact");
SoundByte.PlayOneShotGame("firstContact/failContact");
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
if (!hasMissed && callDiagIndex == 0)
{
@ -466,7 +466,7 @@ namespace HeavenStudio.Games
void TrailingContact()
{
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
SoundByte.PlayOneShotGame("firstContact/slightlyFail");
translator.GetComponent<Animator>().Play("translator_eh", 0, 0);
if (!hasMissed)
{
@ -494,7 +494,7 @@ namespace HeavenStudio.Games
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
if (callDiagIndex == 0) return;
TrailingContact();
@ -502,8 +502,8 @@ namespace HeavenStudio.Games
}
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_B");
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_B");
if (hasMissed)
{
caller.isEligible = false;
@ -522,7 +522,7 @@ namespace HeavenStudio.Games
{
if (!noHitOnce)
{
Jukebox.PlayOneShotGame("firstContact/alienNoHit");
SoundByte.PlayOneShotGame("firstContact/alienNoHit");
noHitOnce = true;
}

View File

@ -37,11 +37,11 @@ namespace HeavenStudio.Games.Scripts_FirstContact
//{
// Jukebox.PlayOneShotGame("firstContact/citrusRemix/1_r");
//}
Jukebox.PlayOneShotGame("firstContact/" + RandomizerLines());
SoundByte.PlayOneShotGame("firstContact/" + RandomizerLines());
}
else
{
Jukebox.PlayOneShotGame("firstContact/failContact");
SoundByte.PlayOneShotGame("firstContact/failContact");
}
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_FirstContact
public void EhTranslation()
{
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
SoundByte.PlayOneShotGame("firstContact/slightlyFail");
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { anim.Play("translator_eh", 0, 0);}),

View File

@ -118,9 +118,9 @@ namespace HeavenStudio.Games
static List<QueuedFlip> queuedInputs = new List<QueuedFlip>();
[SerializeField] FlipperFlopFlipper flipperPlayer;
[SerializeField] List<FlipperFlopFlipper> flippers = new List<FlipperFlopFlipper>();
List<float> queuedMovements = new List<float>();
List<double> queuedMovements = new();
static List<QueuedAttention> queuedAttentions = new List<QueuedAttention>();
static List<float> queuedFlipperRollVoiceLines = new List<float>();
static List<double> queuedFlipperRollVoiceLines = new();
float lastXPos;
float currentXPos;
float lastCameraXPos;
@ -130,12 +130,12 @@ namespace HeavenStudio.Games
bool goBopFlip;
bool goBopTuck;
EasingFunction.Ease lastEase;
float walkStartBeat;
double walkStartBeat;
float walkLength;
CaptainTuckBopType currentCaptainBop;
public struct QueuedFlip
{
public float beat;
public double beat;
public float length;
public bool roll;
public int uh;
@ -146,7 +146,7 @@ namespace HeavenStudio.Games
}
public struct QueuedAttention
{
public float beat;
public double beat;
public bool mute;
public bool remix5;
}
@ -245,7 +245,7 @@ namespace HeavenStudio.Games
}
if (queuedMovements.Count > 0)
{
if (cond.songPositionInBeats >= queuedMovements[0])
if (cond.songPositionInBeatsAsDouble >= queuedMovements[0])
{
if (!isMoving)
{
@ -310,7 +310,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, float length, int whoBops, int whoBopsAuto)
public void Bop(double beat, float length, int whoBops, int whoBopsAuto)
{
goBopFlip = whoBopsAuto == (int)WhoBops.Flippers || whoBopsAuto == (int)WhoBops.Both;
goBopTuck = whoBopsAuto == (int)WhoBops.CaptainTuck || whoBopsAuto == (int)WhoBops.Both;
@ -373,7 +373,7 @@ namespace HeavenStudio.Games
}
}
public void CaptainWalk(float beat, float length, int ease)
public void CaptainWalk(double beat, float length, int ease)
{
captainTuckAnim.gameObject.SetActive(true);
isWalking = true;
@ -382,7 +382,7 @@ namespace HeavenStudio.Games
walkLength = length;
}
public static void Flipping(float beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false)
public static void Flipping(double beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false)
{
if (GameManager.instance.currentGame == "flipperFlop")
{
@ -394,7 +394,7 @@ namespace HeavenStudio.Games
}
}
public void QueueFlips(float beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false)
public void QueueFlips(double beat, float length, bool roll, int uh = 0, bool thatsIt = false, int appreciation = 0, bool heart = false, bool thatsItBarberShop = false)
{
int flopCount = 1;
int recounts = 0;
@ -446,12 +446,12 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat + i, delegate
{
Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit1");
Jukebox.PlayOneShotGame(soundToPlay);
SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit1");
SoundByte.PlayOneShotGame(soundToPlay);
captainTuckAnim.DoScaledAnimationAsync("CaptainBop", 0.5f);
captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f);
}),
new BeatAction.Action(beat + i + 0.5f, delegate { Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }),
new BeatAction.Action(beat + i + 0.5f, delegate { SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit2"); captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f); }),
});
}
else
@ -460,14 +460,14 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat + i - 0.5f, delegate
{
Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit1");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit1");
captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f);
}),
new BeatAction.Action(beat + i, delegate
{
Jukebox.PlayOneShotGame("flipperFlop/appreciation/thatsit2");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/thatsit2");
captainTuckFaceAnim.DoScaledAnimationAsync("CaptainTuckSpeakExpression", 0.5f);
Jukebox.PlayOneShotGame(soundToPlay);
SoundByte.PlayOneShotGame(soundToPlay);
captainTuckAnim.DoScaledAnimationAsync("CaptainBop", 0.5f);
}),
});
@ -494,7 +494,7 @@ namespace HeavenStudio.Games
}
CaptainTuckBop();
Jukebox.PlayOneShotGame(voiceLine);
SoundByte.PlayOneShotGame(voiceLine);
}),
});
}
@ -586,7 +586,7 @@ namespace HeavenStudio.Games
}
CaptainTuckBop();
Jukebox.PlayOneShotGame(voiceLineToPlay);
SoundByte.PlayOneShotGame(voiceLineToPlay);
}),
});
}
@ -650,7 +650,7 @@ namespace HeavenStudio.Games
}
}
public static void AppreciationVoiceLine(float beat, int appreciation, bool heart)
public static void AppreciationVoiceLine(double beat, int appreciation, bool heart)
{
if (FlipperFlop.instance.missed) return;
if (appreciation == (int)AppreciationType.Random) appreciation = UnityEngine.Random.Range(1, 6);
@ -659,7 +659,7 @@ namespace HeavenStudio.Games
case (int)AppreciationType.None:
break;
case (int)AppreciationType.Good:
Jukebox.PlayOneShotGame("flipperFlop/appreciation/good");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/good");
if (heart)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
@ -676,7 +676,7 @@ namespace HeavenStudio.Games
}
break;
case (int)AppreciationType.GoodJob:
Jukebox.PlayOneShotGame("flipperFlop/appreciation/goodjob");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/goodjob");
if (heart)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
@ -694,7 +694,7 @@ namespace HeavenStudio.Games
}
break;
case (int)AppreciationType.Nice:
Jukebox.PlayOneShotGame("flipperFlop/appreciation/nice");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/nice");
if (heart)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
@ -711,7 +711,7 @@ namespace HeavenStudio.Games
}
break;
case (int)AppreciationType.WellDone:
Jukebox.PlayOneShotGame("flipperFlop/appreciation/welldone");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/welldone");
if (heart)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
@ -729,7 +729,7 @@ namespace HeavenStudio.Games
}
break;
case (int)AppreciationType.Yes:
Jukebox.PlayOneShotGame("flipperFlop/appreciation/yes");
SoundByte.PlayOneShotGame("flipperFlop/appreciation/yes");
if (heart)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
@ -750,7 +750,7 @@ namespace HeavenStudio.Games
}
}
public void TripleFlip(float beat)
public void TripleFlip(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -778,7 +778,7 @@ namespace HeavenStudio.Games
});
}
public static void AttentionCompany(float beat, bool mute, bool remix5 = false)
public static void AttentionCompany(double beat, bool mute, bool remix5 = false)
{
if (mute)
{
@ -810,7 +810,7 @@ namespace HeavenStudio.Games
}
}
public void AttentionCompanyAnimation(float beat, bool mute, bool remix5)
public void AttentionCompanyAnimation(double beat, bool mute, bool remix5)
{
List<BeatAction.Action> speaks = new List<BeatAction.Action>()
{
@ -872,7 +872,7 @@ namespace HeavenStudio.Games
foreach (var speak in speaks)
{
if (Conductor.instance.songPositionInBeats > speak.beat)
if (Conductor.instance.songPositionInBeatsAsDouble > speak.beat)
{
speaksToRemove.Add(speak);
}
@ -889,7 +889,7 @@ namespace HeavenStudio.Games
BeatAction.New(instance.gameObject, speaks);
}
public static void FlipperRollVoiceLine(float beat, int amount, bool now)
public static void FlipperRollVoiceLine(double beat, int amount, bool now)
{
if (now)
{
@ -1012,7 +1012,7 @@ namespace HeavenStudio.Games
}
}
public void FlipperRollVoiceLineAnimation(float beat)
public void FlipperRollVoiceLineAnimation(double beat)
{
List<BeatAction.Action> speaks = new List<BeatAction.Action>()
{
@ -1026,7 +1026,7 @@ namespace HeavenStudio.Games
foreach (var speak in speaks)
{
if (Conductor.instance.songPositionInBeats > speak.beat) speaksToRemove.Add(speak);
if (Conductor.instance.songPositionInBeatsAsDouble > speak.beat) speaksToRemove.Add(speak);
}
if (speaksToRemove.Count > 0)

View File

@ -44,8 +44,8 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop
faceAnim.Play("FaceAngry", 0, 0);
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.1f, delegate { leftImpact.SetActive(false); rightImpact.SetActive(false); }),
new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceAnnoyed", 0, 0); })
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.1f, delegate { leftImpact.SetActive(false); rightImpact.SetActive(false); }),
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceAnnoyed", 0, 0); })
});
}
@ -60,13 +60,13 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop
{
if (player && hit && !barely)
{
Jukebox.PlayOneShotGame("flipperFlop/roll" + (left ? "L" : "R"));
SoundByte.PlayOneShotGame("flipperFlop/roll" + (left ? "L" : "R"));
faceAnim.Play("FaceNormal", 0, 0);
canBlink = true;
}
else if (player && barely && hit)
{
Jukebox.PlayOneShotGame("flipperFlop/tink");
SoundByte.PlayOneShotGame("flipperFlop/tink");
faceAnim.Play("FaceBarely", 0, 0);
canBlink = false;
}
@ -74,11 +74,11 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop
{
faceAnim.Play("FaceOw");
canBlink = false;
Jukebox.PlayOneShotGame("flipperFlop/failgroan");
SoundByte.PlayOneShotGame("flipperFlop/failgroan");
game.BumpIntoOtherSeal(!left);
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }),
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }),
});
}
@ -91,18 +91,18 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop
if (up && !barely)
{
faceAnim.Play("FaceNormal", 0, 0);
Jukebox.PlayOneShotGame($"flipperFlop/flipB{UnityEngine.Random.Range(1, 3)}");
SoundByte.PlayOneShotGame($"flipperFlop/flipB{UnityEngine.Random.Range(1, 3)}");
canBlink = true;
}
else if (!barely)
{
Jukebox.PlayOneShotGame($"flipperFlop/flip{UnityEngine.Random.Range(1, 3)}");
SoundByte.PlayOneShotGame($"flipperFlop/flip{UnityEngine.Random.Range(1, 3)}");
faceAnim.Play("FaceNormal", 0, 0);
canBlink = true;
}
else
{
Jukebox.PlayOneShotGame("flipperFlop/tink");
SoundByte.PlayOneShotGame("flipperFlop/tink");
faceAnim.Play("FaceBarely", 0, 0);
canBlink = false;
}
@ -114,13 +114,13 @@ namespace HeavenStudio.Games.Scripts_FlipperFlop
string shouldReverse = up ? "Reverse" : "";
string leftOrRight = left ? "Left" : "Right";
Jukebox.PlayOneShotGame("flipperFlop/failgroan", -1, 1, 0.5f);
Jukebox.PlayOneShotGame("flipperFlop/punch", -1, 1, 0.5f);
SoundByte.PlayOneShotGame("flipperFlop/failgroan", -1, 1, 0.5f);
SoundByte.PlayOneShotGame("flipperFlop/punch", -1, 1, 0.5f);
anim.DoScaledAnimationAsync(shouldReverse + "MissFlop" + leftOrRight, 0.5f);
game.BumpIntoOtherSeal(!left);
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }),
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 0.3f, delegate { faceAnim.Play("FaceGoofy"); }),
});
}
}

View File

@ -35,7 +35,7 @@ namespace HeavenStudio.Games.Loaders
new GameAction("sigh", "Sigh")
{
function = delegate { Jukebox.PlayOneShot("games/forkLifter/sigh"); }
function = delegate { SoundByte.PlayOneShot("games/forkLifter/sigh"); }
},
new GameAction("color", "Background Color")
{
@ -137,15 +137,15 @@ namespace HeavenStudio.Games
instance = this;
}
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
base.OnGameSwitch(beat);
ForkLifterHand.CheckNextFlick();
}
public void Flick(float beat, int type)
public void Flick(double beat, int type)
{
Jukebox.PlayOneShotGame("forkLifter/flick");
SoundByte.PlayOneShotGame("forkLifter/flick");
handAnim.Play("Hand_Flick", 0, 0);
ForkLifterHand.currentFlickIndex++;
GameObject fo = Instantiate(flickedObject);

View File

@ -4,6 +4,8 @@ using System.Linq;
using UnityEngine;
using HeavenStudio.Util;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio.Games.Scripts_ForkLifter
{
@ -13,17 +15,17 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
public Sprite[] fastSprites;
private List<DynamicBeatmap.DynamicEntity> allFlickEntities = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allFlickEntities = new List<RiqEntity>();
public int currentFlickIndex;
private void Awake()
{
var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < flickEntities.Count; i++)
{
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeats)
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(flickEntities[i]);
}
@ -63,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
public void Prepare()
{
Jukebox.PlayOneShotGame("forkLifter/flickPrepare");
SoundByte.PlayOneShotGame("forkLifter/flickPrepare");
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
}
}

View File

@ -72,17 +72,17 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
{
if (topbun && middleburger && bottombun)
{
Jukebox.PlayOneShotGame("forkLifter/burger");
SoundByte.PlayOneShotGame("forkLifter/burger");
}
else
{
if (currentEarlyPeasOnFork > 0 || currentLatePeasOnFork > 0)
{
Jukebox.PlayOneShotGame($"forkLifter/cough_{Random.Range(1, 3)}");
SoundByte.PlayOneShotGame($"forkLifter/cough_{Random.Range(1, 3)}");
}
else
{
Jukebox.PlayOneShotGame("forkLifter/gulp");
SoundByte.PlayOneShotGame("forkLifter/gulp");
}
}
@ -118,7 +118,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
if (p == null)
{
Jukebox.PlayOneShotGame("forkLifter/stabnohit");
SoundByte.PlayOneShotGame("forkLifter/stabnohit");
}
anim.Play("Player_Stab", 0, 0);

View File

@ -13,7 +13,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
ForkLifter game;
private Animator anim;
public float startBeat;
public double startBeat;
public int type;
@ -25,8 +25,8 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
// SCHEDULING zoom sound so it lines up with when it meets the fork.
var currentDspTime = AudioSettings.dspTime;
var cond = Conductor.instance;
var zoomStartTime = currentDspTime + (double)(cond.pitchedSecPerBeat * 2) - 0.317;
Jukebox.PlayOneShotScheduledGame("forkLifter/zoomFast", (double)zoomStartTime);
var zoomStartTime = currentDspTime + (cond.pitchedSecPerBeatAsDouble * 2) - 0.317;
SoundByte.PlayOneShotScheduledGame("forkLifter/zoomFast", zoomStartTime);
GetComponentInChildren<SpriteRenderer>().sprite = game.peaSprites[type];
@ -91,7 +91,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
ForkLifterPlayer.instance.FastEffectHit(type);
Jukebox.PlayOneShotGame("forkLifter/stab");
SoundByte.PlayOneShotGame("forkLifter/stab");
ForkLifterPlayer.instance.currentPerfectPeasOnFork++;
@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
ForkLifterPlayer.instance.FastEffectHit(type);
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
ForkLifterPlayer.instance.currentEarlyPeasOnFork++;
@ -167,7 +167,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
ForkLifterPlayer.instance.FastEffectHit(type);
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
ForkLifterPlayer.instance.currentLatePeasOnFork++;
Destroy(this.gameObject);
@ -198,7 +198,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
private void Miss(PlayerActionEvent caller)
{
Jukebox.PlayOneShot("forkLifter/disappointed");
SoundByte.PlayOneShot("forkLifter/disappointed");
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat+ 2.45f, delegate {

View File

@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub
void OnDestroy()
{
if (currentSound != null) Jukebox.KillLoop(currentSound, gameSwitchFadeOutTime);
if (currentSound != null) SoundByte.KillLoop(currentSound, gameSwitchFadeOutTime);
}
public void TogglePresence(bool disappear)
@ -74,12 +74,12 @@ namespace HeavenStudio.Games.Scripts_GleeClub
anim.SetBool("Mega", true);
anim.Play("OpenMouth", 0, 0);
shouldMegaClose = true;
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
Jukebox.PlayOneShotGame("gleeClub/LoudWailStart");
currentSound = Jukebox.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true);
if (currentSound != null) SoundByte.KillLoop(currentSound, 0f);
SoundByte.PlayOneShotGame("gleeClub/LoudWailStart");
currentSound = SoundByte.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true);
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate { UnYell(); })
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate { UnYell(); })
});
}
@ -95,8 +95,8 @@ namespace HeavenStudio.Games.Scripts_GleeClub
anim.SetBool("Mega", false);
shouldMegaClose = false;
anim.Play("OpenMouth", 0, 0);
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
currentSound = Jukebox.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true);
if (currentSound != null) SoundByte.KillLoop(currentSound, 0f);
currentSound = SoundByte.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true);
}
public void StopSinging(bool mega = false, bool playSound = true)
@ -104,8 +104,8 @@ namespace HeavenStudio.Games.Scripts_GleeClub
if (!singing || disappeared) return;
singing = false;
anim.Play(mega ? "MegaCloseMouth" : "CloseMouth", 0, 0);
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
if (playSound) Jukebox.PlayOneShotGame("gleeClub/StopWail");
if (currentSound != null) SoundByte.KillLoop(currentSound, 0f);
if (playSound) SoundByte.PlayOneShotGame("gleeClub/StopWail");
}
}
}

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -113,7 +114,7 @@ namespace HeavenStudio.Games
}
public struct QueuedSinging
{
public float startBeat;
public double startBeat;
public float length;
public int semiTones;
public int semiTonesPlayer;
@ -133,9 +134,9 @@ namespace HeavenStudio.Games
public ChorusKid playerChorusKid;
[Header("Variables")]
static List<QueuedSinging> queuedSingings = new List<QueuedSinging>();
static List<float> queuedBatons = new List<float>();
static List<double> queuedBatons = new();
bool intervalStarted;
float intervalStartBeat;
double intervalStartBeat;
float beatInterval = 4f;
public bool missed;
public static GleeClub instance;
@ -143,16 +144,16 @@ namespace HeavenStudio.Games
int startIntervalIndex;
private List<DynamicBeatmap.DynamicEntity> allIntervalEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allIntervalEvents = new List<RiqEntity>();
void Awake()
{
instance = this;
var camEvents = EventCaller.GetAllInGameManagerList("gleeClub", new string[] { "intervalStart" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(camEvents[i]);
}
@ -223,9 +224,9 @@ namespace HeavenStudio.Games
{
if (startIntervalIndex < allIntervalEvents.Count && startIntervalIndex >= 0)
{
if (Conductor.instance.songPositionInBeats >= allIntervalEvents[startIntervalIndex].beat)
if (Conductor.instance.songPositionInBeatsAsDouble >= allIntervalEvents[startIntervalIndex].beat)
{
StartInterval(allIntervalEvents[startIntervalIndex].beat, allIntervalEvents[startIntervalIndex].length);
StartInterval((float)allIntervalEvents[startIntervalIndex].beat, allIntervalEvents[startIntervalIndex].length);
startIntervalIndex++;
}
}
@ -256,22 +257,22 @@ namespace HeavenStudio.Games
public void ForceSing(int semiTones, int semiTones1, int semiTonesPlayer)
{
leftChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
middleChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones1, true);
playerChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true);
leftChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTones, true);
middleChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTones1, true);
playerChorusKid.currentPitch = SoundByte.GetPitchFromSemiTones(semiTonesPlayer, true);
leftChorusKid.StartSinging(true);
middleChorusKid.StartSinging(true);
if (!PlayerInput.Pressing() || GameManager.instance.autoplay) playerChorusKid.StartSinging(true);
else missed = true;
}
public void TogetherNow(float beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch)
public void TogetherNow(double beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch)
{
if (!playerChorusKid.disappeared) ScheduleInput(beat, 2.5f, InputType.STANDARD_UP, JustTogetherNow, Out, Out);
if (!playerChorusKid.disappeared) ScheduleInput(beat, 3.5f, InputType.STANDARD_DOWN, JustTogetherNowClose, MissBaton, Out);
float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
float pitch1 = Jukebox.GetPitchFromSemiTones(semiTones1, true);
currentYellPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true);
float pitch = SoundByte.GetPitchFromSemiTones(semiTones, true);
float pitch1 = SoundByte.GetPitchFromSemiTones(semiTones1, true);
currentYellPitch = SoundByte.GetPitchFromSemiTones(semiTonesPlayer, true);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("gleeClub/togetherEN-01", beat + 0.5f, conductorPitch),
@ -318,16 +319,16 @@ namespace HeavenStudio.Games
playerChorusKid.StopSinging(true);
}
public void StartInterval(float beat, float length)
public void StartInterval(double beat, float length)
{
intervalStartBeat = beat;
beatInterval = length;
intervalStarted = true;
}
public void Sing(float beat, float length, int semiTones, int semiTones1, int semiTonesPlayer, int closeMouth, bool repeating, int semiTonesLeft2, int semiTonesLeft3, int semiTonesMiddle2)
public void Sing(double beat, float length, int semiTones, int semiTones1, int semiTonesPlayer, int closeMouth, bool repeating, int semiTonesLeft2, int semiTonesLeft3, int semiTonesMiddle2)
{
float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
float pitch = SoundByte.GetPitchFromSemiTones(semiTones, true);
if (!intervalStarted)
{
StartInterval(beat, length);
@ -351,7 +352,7 @@ namespace HeavenStudio.Games
});
}
public void PassTurn(float beat, float length)
public void PassTurn(double beat, float length)
{
if (queuedSingings.Count == 0) return;
intervalStarted = false;
@ -359,17 +360,17 @@ namespace HeavenStudio.Games
if (!playerChorusKid.disappeared) ShowHeart(beat + length + beatInterval * 2 + 1);
foreach (var sing in queuedSingings)
{
float playerPitch = Jukebox.GetPitchFromSemiTones(sing.semiTonesPlayer, true);
float playerPitch = SoundByte.GetPitchFromSemiTones(sing.semiTonesPlayer, true);
if (!playerChorusKid.disappeared)
{
GleeClubSingInput spawnedInput = Instantiate(singInputPrefab, transform);
spawnedInput.pitch = playerPitch;
spawnedInput.Init(beat + length + sing.startBeat + beatInterval, sing.length, sing.closeMouth);
}
float pitch = Jukebox.GetPitchFromSemiTones(sing.semiTones, true);
float pitchLeft2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft2, true);
float pitchLeft3 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft3, true);
float pitchMiddle2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesMiddle2, true);
float pitch = SoundByte.GetPitchFromSemiTones(sing.semiTones, true);
float pitchLeft2 = SoundByte.GetPitchFromSemiTones(sing.semiTonesLeft2, true);
float pitchLeft3 = SoundByte.GetPitchFromSemiTones(sing.semiTonesLeft3, true);
float pitchMiddle2 = SoundByte.GetPitchFromSemiTones(sing.semiTonesMiddle2, true);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length + sing.startBeat, delegate
@ -416,7 +417,7 @@ namespace HeavenStudio.Games
queuedSingings.Clear();
}
public static void PreBaton(float beat)
public static void PreBaton(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -433,7 +434,7 @@ namespace HeavenStudio.Games
}
}
public void Baton(float beat)
public void Baton(double beat)
{
missed = false;
if (!playerChorusKid.disappeared) ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustBaton, MissBaton, Out);
@ -469,7 +470,7 @@ namespace HeavenStudio.Games
void Out(PlayerActionEvent caller) { }
public void ShowHeart(float beat)
public void ShowHeart(double beat)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()

View File

@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub
game = GleeClub.instance;
}
public void Init(float beat, float length, int close)
public void Init(double beat, float length, int close)
{
shouldClose = close != (int)GleeClub.MouthOpenClose.OnlyOpen;
shouldOpen = close != (int)GleeClub.MouthOpenClose.OnlyClose;

View File

@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.IO;
using Starpelly;
using UnityEngine;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio.Games.Global
{
public class Filter : MonoBehaviour
{
private List<DynamicBeatmap.DynamicEntity> allFilterEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allFilterEvents = new List<RiqEntity>();
private int lastFilterIndexesCount = 0; // Optimization
private List<AmplifyColorEffect> amplifies = new List<AmplifyColorEffect>(); // keeps memory of all the filters on the main camera
@ -92,14 +94,14 @@ namespace HeavenStudio.Games.Global
#region Filter
private void OnBeatChanged(float beat)
private void OnBeatChanged(double beat)
{
allFilterEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "filter" });
}
private void Update()
{
var songPosBeat = Conductor.instance.songPositionInBeats;
var songPosBeat = Conductor.instance.songPositionInBeatsAsDouble;
var filterIndexes = new List<int>();
for (int i = 0; i < allFilterEvents.Count; i++)
@ -138,17 +140,17 @@ namespace HeavenStudio.Games.Global
intensity = Mathf.Lerp(1, 0, Mathp.Normalize(intensity, 0, 100));
var blendAmount = intensity;
var endFadeInTime = Mathf.Lerp(filter.beat, filter.beat + filter.length, fadeInTime);
var startFadeOutTime = filter.beat + (Mathf.Lerp(0, filter.length, Mathf.Lerp(1, 0, fadeOutTime)));
var endFadeInTime = Mathf.Lerp((float) filter.beat, (float) filter.beat + filter.length, fadeInTime);
var startFadeOutTime = (float) filter.beat + (Mathf.Lerp(0, filter.length, Mathf.Lerp(1, 0, fadeOutTime)));
if (songPosBeat < endFadeInTime)
{
var normalizedFadeIn = Mathp.Normalize(songPosBeat, filter.beat, endFadeInTime);
var normalizedFadeIn = Mathp.Normalize((float) songPosBeat, (float) filter.beat, endFadeInTime);
blendAmount = Mathf.Lerp(1f, intensity, normalizedFadeIn);
}
else if (songPosBeat >= startFadeOutTime)
{
var normalizedFadeOut = Mathf.Clamp01(Mathp.Normalize(songPosBeat, startFadeOutTime, filter.beat + filter.length));
var normalizedFadeOut = Mathf.Clamp01(Mathp.Normalize((float) songPosBeat, startFadeOutTime, (float) filter.beat + filter.length));
blendAmount = Mathf.Lerp(intensity, 1f, normalizedFadeOut);
}

View File

@ -6,35 +6,37 @@ using UnityEngine.UI;
using HeavenStudio.Util;
using System.Linq;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio.Games.Global
{
public class Flash : MonoBehaviour
{
[NonSerialized] public float startBeat;
[NonSerialized] public double startBeat;
[NonSerialized] public float length;
[NonSerialized] public Color startColor;
[NonSerialized] public Color endColor;
[NonSerialized] public EasingFunction.Ease ease;
[NonSerialized] private EasingFunction.Function func;
[NonSerialized] public Util.EasingFunction.Ease ease;
[NonSerialized] private Util.EasingFunction.Function func;
[NonSerialized] private Image spriteRenderer;
[SerializeField] private Color currentCol;
[NonSerialized] private List<DynamicBeatmap.DynamicEntity> allFadeEvents = new List<DynamicBeatmap.DynamicEntity>();
[NonSerialized] private List<RiqEntity> allFadeEvents = new List<RiqEntity>();
private void Awake()
{
spriteRenderer = GetComponent<Image>();
spriteRenderer.color = currentCol;
func = EasingFunction.GetEasingFunction(EasingFunction.Ease.Linear);
func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.Linear);
GameManager.instance.onBeatChanged += OnBeatChanged;
}
public void OnBeatChanged(float beat)
public void OnBeatChanged(double beat)
{
allFadeEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "flash" });
// backwards-compatibility baybee
@ -44,7 +46,7 @@ namespace HeavenStudio.Games.Global
FindFadeFromBeat(beat);
}
private void FindFadeFromBeat(float beat)
private void FindFadeFromBeat(double beat)
{
Color startCol = Color.white;
Color endCol = Color.white;
@ -53,7 +55,7 @@ namespace HeavenStudio.Games.Global
if (allFadeEvents.Count > 0)
{
DynamicBeatmap.DynamicEntity startEntity = null;
RiqEntity startEntity = default(RiqEntity);
for (int i = 0; i < allFadeEvents.Count; i++)
{
@ -70,7 +72,7 @@ namespace HeavenStudio.Games.Global
}
}
if (startEntity != null)
if (!string.IsNullOrEmpty(startEntity.datamodel))
{
if (!override_)
{
@ -81,24 +83,24 @@ namespace HeavenStudio.Games.Global
endCol = new Color(colB.r, colB.g, colB.b, startEntity["valB"]);
}
SetFade(startEntity.beat, startEntity.length, startCol, endCol, (EasingFunction.Ease) startEntity["ease"]);
SetFade(startEntity.beat, startEntity.length, startCol, endCol, (Util.EasingFunction.Ease) startEntity["ease"]);
}
}
}
public void SetFade(float beat, float length, Color startCol, Color endCol, EasingFunction.Ease ease)
public void SetFade(double beat, float length, Color startCol, Color endCol, Util.EasingFunction.Ease ease)
{
this.startBeat = beat;
this.length = length;
this.startColor = startCol;
this.endColor = endCol;
this.ease = ease;
func = EasingFunction.GetEasingFunction(ease);
func = Util.EasingFunction.GetEasingFunction(ease);
}
private void Update()
{
FindFadeFromBeat(Conductor.instance.songPositionInBeats);
FindFadeFromBeat(Conductor.instance.songPositionInBeatsAsDouble);
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, length);
// normalizedBeat = Mathf.Clamp01(normalizedBeat);

View File

@ -5,6 +5,8 @@ using UnityEngine.UI;
using TMPro;
using HeavenStudio.TextboxUtilities;
using Jukebox;
using Jukebox.Legacy;
namespace HeavenStudio.Games.Global
{
@ -27,10 +29,10 @@ namespace HeavenStudio.Games.Global
Bottom,
}
private List<DynamicBeatmap.DynamicEntity> textboxEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<DynamicBeatmap.DynamicEntity> openCaptionsEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<DynamicBeatmap.DynamicEntity> idolEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<DynamicBeatmap.DynamicEntity> closedCaptionsEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> textboxEvents = new List<RiqEntity>();
private List<RiqEntity> openCaptionsEvents = new List<RiqEntity>();
private List<RiqEntity> idolEvents = new List<RiqEntity>();
private List<RiqEntity> closedCaptionsEvents = new List<RiqEntity>();
public static Textbox instance { get; private set; }
@ -83,7 +85,7 @@ namespace HeavenStudio.Games.Global
UpdateClosedCaptionsDisplay();
}
public void OnBeatChanged(float beat)
public void OnBeatChanged(double beat)
{
TextboxEnabler.SetActive(false);
OpenCaptionsEnabler.SetActive(false);

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -367,8 +368,8 @@ namespace HeavenStudio.Games
[Header("Camera Positions")]
public Transform[] CameraPosition;
Vector3 cameraPosition;
static float startCamSpecial = Single.MinValue;
static float wantsReturn = Single.MinValue;
static double startCamSpecial = double.MinValue;
static double wantsReturn = double.MinValue;
static float cameraReturnLength = 0f;
static CameraAngle cameraAngle = CameraAngle.Normal;
@ -388,13 +389,13 @@ namespace HeavenStudio.Games
[Header("Word")]
public Animator Word;
static float wordClearTime = Single.MinValue;
static double wordClearTime = double.MinValue;
const float hitVoiceOffset = 0.042f;
[Header("Backgrounds")]
static int bgType = (int) BackgroundType.Yellow;
public static int currentBgEffect = (int) BackgroundFXType.None;
static float bgFadeTime = Single.MinValue;
static double bgFadeTime = double.MinValue;
static float bgFadeDuration = 0f;
static Color bgColour = Color.white;
public SpriteRenderer BGPlane;
@ -438,7 +439,7 @@ namespace HeavenStudio.Games
public static bool WantBop = true;
public static bool WantNori = true;
public static int WantNoriType = (int) NoriMode.None;
public static float WantBgChangeStart = Single.MinValue;
public static double WantBgChangeStart = double.MinValue;
public static float WantBgChangeLength = 0f;
private void Awake()
@ -448,7 +449,7 @@ namespace HeavenStudio.Games
cameraPosition = CameraPosition[0].position;
}
public override void OnPlay(float beat)
public override void OnPlay(double beat)
{
var cond = Conductor.instance;
if (!cond.isPlaying)
@ -474,7 +475,7 @@ namespace HeavenStudio.Games
bgBloodRenderer = BGBlood.GetComponent<SpriteRenderer>();
bgRadialRenderer = BGRadial.GetComponent<SpriteRenderer>();
SetBgEffectsToLast(cond.songPositionInBeats);
SetBgEffectsToLast(cond.songPositionInBeatsAsDouble);
SetBgAndShadowCol(WantBgChangeStart, WantBgChangeLength, bgType, (int) currentShadowType, bgColour, customShadowColour, (int)currentBgEffect);
SetBgTexture(textureType, textureFilterType, filterColour, filterColour);
UpdateMaterialColour(BodyColor, HighlightColor, ItemColor);
@ -485,7 +486,7 @@ namespace HeavenStudio.Games
{
var cond = Conductor.instance;
if (!cond.isPlaying)
SetBgEffectsToLast(cond.songPositionInBeats);
SetBgEffectsToLast(cond.songPositionInBeatsAsDouble);
switch (currentBgEffect)
{
@ -499,30 +500,30 @@ namespace HeavenStudio.Games
bgEffectAnimator.Play("NoPose", -1, 0);
break;
}
if (cond.songPositionInBeats >= wordClearTime)
if (cond.songPositionInBeatsAsDouble >= wordClearTime)
{
Word.Play("NoPose");
}
if (cond.songPositionInBeats >= startCamSpecial && cond.songPositionInBeats <= wantsReturn)
if (cond.songPositionInBeatsAsDouble >= startCamSpecial && cond.songPositionInBeatsAsDouble <= wantsReturn)
{
float camX = 0f;
float camY = 0f;
float camZ = 0f;
if (cond.songPositionInBeats <= startCamSpecial + cameraReturnLength)
if (cond.songPositionInBeatsAsDouble <= startCamSpecial + cameraReturnLength)
{
float prog = cond.GetPositionFromBeat(startCamSpecial, cameraReturnLength);
camX = EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog);
camY = EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog);
camZ = EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog);
camX = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog);
camY = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog);
camZ = Util.EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog);
cameraPosition = new Vector3(camX, camY, camZ);
}
else if (cond.songPositionInBeats >= wantsReturn - cameraReturnLength)
else if (cond.songPositionInBeatsAsDouble >= wantsReturn - cameraReturnLength)
{
float prog = cond.GetPositionFromBeat(wantsReturn - cameraReturnLength, cameraReturnLength);
camX = EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog);
camY = EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog);
camZ = EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog);
camX = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog);
camY = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog);
camZ = Util.EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog);
cameraPosition = new Vector3(camX, camY, camZ);
}
else
@ -538,11 +539,11 @@ namespace HeavenStudio.Games
}
float fadeProg = cond.GetPositionFromBeat(bgFadeTime, bgFadeDuration);
if (bgFadeTime != Single.MinValue && fadeProg >= 0)
if (bgFadeTime != double.MinValue && fadeProg >= 0)
{
if (fadeProg >= 1f)
{
bgFadeTime = Single.MinValue;
bgFadeTime = double.MinValue;
bgFadeDuration = 0f;
BGPlane.color = bgColour;
filterColour = filterColourNext;
@ -561,16 +562,16 @@ namespace HeavenStudio.Games
BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0);
}
static List<DynamicBeatmap.DynamicEntity> allHits = new List<DynamicBeatmap.DynamicEntity>();
static List<DynamicBeatmap.DynamicEntity> allEnds = new List<DynamicBeatmap.DynamicEntity>();
public static int CountHitsToEnd(float fromBeat)
static List<RiqEntity> allHits = new List<RiqEntity>();
static List<RiqEntity> allEnds = new List<RiqEntity>();
public static int CountHitsToEnd(double fromBeat)
{
allHits = EventCaller.GetAllInGameManagerList("karateman", new string[] { "hit", "bulb", "kick", "combo" });
allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" });
allHits.Sort((x, y) => x.beat.CompareTo(y.beat));
allEnds.Sort((x, y) => x.beat.CompareTo(y.beat));
float endBeat = Single.MaxValue;
double endBeat = double.MaxValue;
//get the beat of the closest end event
foreach (var end in allEnds)
@ -604,26 +605,26 @@ namespace HeavenStudio.Games
return count;
}
public static void DoSpecialCamera(float beat, float length, bool returns)
public static void DoSpecialCamera(double beat, float length, bool returns)
{
if (cameraAngle == CameraAngle.Normal)
{
startCamSpecial = beat;
cameraAngle = CameraAngle.Special;
}
wantsReturn = returns ? beat + length - 0.001f : Single.MaxValue;
wantsReturn = returns ? beat + length - 0.001f : double.MaxValue;
cameraReturnLength = Mathf.Min(2f, length*0.5f);
}
public void DoWord(float beat, int type, bool doSound = true)
public void DoWord(double beat, int type, bool doSound = true)
{
Word.Play(DoWordSound(beat, type, doSound));
}
public static string DoWordSound(float beat, int type, bool doSound = true)
public static string DoWordSound(double beat, int type, bool doSound = true)
{
String word = "NoPose";
float clear = 0f;
double clear = 0f;
switch (type)
{
case (int) HitThree.HitTwo:
@ -689,18 +690,18 @@ namespace HeavenStudio.Games
}, forcePlay: true);
break;
}
if (Conductor.instance.songPositionInBeats <= clear && Conductor.instance.songPositionInBeats >= beat)
if (Conductor.instance.songPositionInBeatsAsDouble <= clear && Conductor.instance.songPositionInBeatsAsDouble >= beat)
{
wordClearTime = clear;
}
return word;
}
public void CreateItem(float beat, int type, int expression, bool muteSound = false)
public void CreateItem(double beat, int type, int expression, bool muteSound = false)
{
string outSound;
if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f)
if ((beat + 0.5f) % 1.0 == 0f)
outSound = "karateman/offbeatObjectOut";
else
outSound = "karateman/objectOut";
@ -711,7 +712,7 @@ namespace HeavenStudio.Games
CreateItemInstance(beat, "Item00", expression);
break;
case (int) HitType.Lightbulb:
if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f)
if ((beat + 0.5f) % 1.0 == 0f)
outSound = "karateman/offbeatLightbulbOut";
else
outSound = "karateman/lightbulbOut";
@ -740,13 +741,13 @@ namespace HeavenStudio.Games
CreateItemInstance(beat, "Item00", expression);
break;
}
if (!muteSound) Jukebox.PlayOneShotGame(outSound, forcePlay: true);
if (!muteSound) SoundByte.PlayOneShotGame(outSound, forcePlay: true);
}
public void CreateBulbSpecial(float beat, int type, Color c, int expression)
public void CreateBulbSpecial(double beat, int type, Color c, int expression)
{
string outSound;
if (Starpelly.Mathp.GetDecimalFromFloat(beat + 0.5f) == 0f)
if (beat + 0.5f % 1.0 == 0f)
outSound = "karateman/offbeatLightbulbOut";
else
outSound = "karateman/lightbulbOut";
@ -756,12 +757,12 @@ namespace HeavenStudio.Games
mobj.GetComponent<KarateManPot>().SetBulbColor(c);
else
mobj.GetComponent<KarateManPot>().SetBulbColor(LightBulbColors[type]);
Jukebox.PlayOneShotGame(outSound, forcePlay: true);
SoundByte.PlayOneShotGame(outSound, forcePlay: true);
}
public void Combo(float beat, int expression)
public void Combo(double beat, int expression)
{
Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);
int comboId = KarateManPot.GetNewCombo();
@ -786,9 +787,9 @@ namespace HeavenStudio.Games
}, forcePlay: true);
}
public void Kick(float beat, bool ball, int expression)
public void Kick(double beat, bool ball, int expression)
{
Jukebox.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true);
CreateItemInstance(beat, "Item05", expression, KarateManPot.ItemType.KickBarrel, content: ball);
@ -801,7 +802,7 @@ namespace HeavenStudio.Games
}, forcePlay: true);
}
public GameObject CreateItemInstance(float beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false)
public GameObject CreateItemInstance(double beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false)
{
GameObject mobj = GameObject.Instantiate(Item, ItemHolder);
KarateManPot mobjDat = mobj.GetComponent<KarateManPot>();
@ -817,9 +818,9 @@ namespace HeavenStudio.Games
return mobj;
}
void SetBgEffectsToLast(float beat)
void SetBgEffectsToLast(double beat)
{
var bgfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set background effects");
var bgfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/set background effects");
for (int i = 0; i < bgfx.Count; i++)
{
var e = bgfx[i];
@ -827,7 +828,7 @@ namespace HeavenStudio.Games
break;
SetBgEffectsUnloaded(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], e["type3"], e["type4"], e["type5"], e["colorC"], e["colorD"]);
}
var camfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/special camera");
var camfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/special camera");
DoSpecialCamera(0, 0, true);
for (int i = 0; i < camfx.Count; i++)
{
@ -836,7 +837,7 @@ namespace HeavenStudio.Games
break;
DoSpecialCamera(e.beat, e.length, e["toggle"]);
}
var objfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set object colors");
var objfx = GameManager.instance.Beatmap.Entities.FindAll(en => en.datamodel == "karateman/set object colors");
for (int i = 0; i < objfx.Count; i++)
{
var e = objfx[i];
@ -848,7 +849,7 @@ namespace HeavenStudio.Games
SetBgTexture(textureType, textureFilterType, filterColour, filterColour);
}
public static void SetBgEffectsUnloaded(float beat, float length, int newBgType, int newShadowType, Color bgCol, Color shadowCol, int bgFx, int texture, int textureFilter, Color filterCol, Color filterColNext)
public static void SetBgEffectsUnloaded(double beat, float length, int newBgType, int newShadowType, Color bgCol, Color shadowCol, int bgFx, int texture, int textureFilter, Color filterCol, Color filterColNext)
{
WantBgChangeStart = beat;
WantBgChangeLength = length;
@ -863,7 +864,7 @@ namespace HeavenStudio.Games
filterColourNext = filterColNext;
}
public void SetBgAndShadowCol(float beat, float length, int newBgType, int shadowType, Color a, Color b, int fx)
public void SetBgAndShadowCol(double beat, float length, int newBgType, int shadowType, Color a, Color b, int fx)
{
SetBgFx(fx, beat, length);
UpdateShadowColour(shadowType, b);
@ -886,7 +887,7 @@ namespace HeavenStudio.Games
filterColour = Color.LerpUnclamped(bgColour, ShadowBlendColor, 0.45f);
}
public void SetBgFx(int fx, float beat, float length)
public void SetBgFx(int fx, double beat, float length)
{
switch (fx)
{
@ -938,7 +939,7 @@ namespace HeavenStudio.Games
UpdateFilterColour(bgColour, filterColour);
}
public void SetGameplayMods(float beat, int mode, bool combo)
public void SetGameplayMods(double beat, int mode, bool combo)
{
NoriGO.SetActive(true);
Nori.SetNoriMode(beat, mode);
@ -1003,7 +1004,7 @@ namespace HeavenStudio.Games
ItemColor = objectCol;
}
public void SetParticleEffect(float beat, int type, float windStrength, float particleStrength)
public void SetParticleEffect(double beat, int type, float windStrength, float particleStrength)
{
ParticleSystem.EmissionModule emm;
switch (type)
@ -1035,10 +1036,10 @@ namespace HeavenStudio.Games
Wind.windMain = windStrength;
}
public void ToggleBop(float beat, float length, bool toggle, bool autoBop)
public void ToggleBop(double beat, float length, bool toggle, bool autoBop)
{
if (autoBop)
Joe.bop.length = Single.MaxValue;
Joe.bop.length = float.MaxValue;
else
Joe.bop.length = 0;
if (toggle)
@ -1061,7 +1062,7 @@ namespace HeavenStudio.Games
WantBop = toggle;
}
public void Prepare(float beat, float length)
public void Prepare(double beat, float length)
{
Joe.Prepare(beat, length);
}

View File

@ -16,14 +16,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public SpriteRenderer[] Shadows;
public Color BombGlowTint;
float bombGlowStart = Single.MinValue;
double bombGlowStart = double.MinValue;
float bombGlowLength = 0f;
float bombGlowIntensity;
const float bombGlowRatio = 1f;
float lastPunchTime = Single.MinValue;
float lastComboMissTime = Single.MinValue;
float lastUpperCutTime = Single.MinValue;
double lastPunchTime = double.MinValue;
double lastComboMissTime = double.MinValue;
double lastUpperCutTime = double.MinValue;
public bool inCombo = false;
public bool lockedInCombo = false;
public bool comboWaiting = false;
@ -36,15 +36,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public bool wantKick = false;
public bool inKick = false;
float lastChargeTime = Single.MinValue;
float unPrepareTime = Single.MinValue;
float noNuriJabTime = Single.MinValue;
double lastChargeTime = double.MinValue;
double unPrepareTime = double.MinValue;
double noNuriJabTime = double.MinValue;
bool canEmote = false;
public int wantFace = 0;
public bool inSpecial { get { return inCombo || lockedInCombo ||
Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f || inNuriLock; } }
public bool inNuriLock { get { return (Conductor.instance.songPositionInBeats >= noNuriJabTime && Conductor.instance.songPositionInBeats < noNuriJabTime + 1f); } }
public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } }
private void Awake()
{
@ -54,7 +54,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
var cond = Conductor.instance;
if (cond.songPositionInBeats < bombGlowStart)
if (cond.songPositionInBeatsAsDouble < bombGlowStart)
{
bombGlowIntensity = 1f;
}
@ -62,9 +62,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
float glowProg = cond.GetPositionFromBeat(bombGlowStart, bombGlowLength);
bombGlowIntensity = 1f - glowProg;
if (cond.songPositionInBeats >= bombGlowStart + bombGlowLength)
if (cond.songPositionInBeatsAsDouble >= bombGlowStart + bombGlowLength)
{
bombGlowStart = Single.MinValue;
bombGlowStart = double.MinValue;
bombGlowLength = 0f;
}
}
@ -76,25 +76,25 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (wantFace == (int) KarateMan.KarateManFaces.Surprise) wantFace = -1;
}
if (cond.songPositionInBeats >= noNuriJabTime && cond.songPositionInBeats < noNuriJabTime + 1f)
if (cond.songPositionInBeatsAsDouble >= noNuriJabTime && cond.songPositionInBeatsAsDouble < noNuriJabTime + 1f)
{
anim.DoScaledAnimation("JabNoNuri", noNuriJabTime, 1f);
bop.startBeat = noNuriJabTime + 1f;
}
else if (cond.songPositionInBeats >= noNuriJabTime + 1f && noNuriJabTime != Single.MinValue)
else if (cond.songPositionInBeatsAsDouble >= noNuriJabTime + 1f && noNuriJabTime != double.MinValue)
{
bop.startBeat = noNuriJabTime + 1f;
noNuriJabTime = Single.MinValue;
noNuriJabTime = double.MinValue;
}
if (unPrepareTime != Single.MinValue && cond.songPositionInBeats >= unPrepareTime)
if (unPrepareTime != double.MinValue && cond.songPositionInBeatsAsDouble >= unPrepareTime)
{
unPrepareTime = Single.MinValue;
unPrepareTime = double.MinValue;
anim.speed = 1f;
anim.Play("Beat", -1, 0);
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length && cond.songPositionInBeats >= unPrepareTime && !inCombo)
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo)
{
Bop();
}
@ -111,7 +111,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
anim.speed = 1f;
bop.startBeat = lastComboMissTime + 3f;
lastComboMissTime = Single.MinValue;
lastComboMissTime = double.MinValue;
inCombo = false;
inComboId = -1;
shouldComboId = -1;
@ -130,7 +130,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
anim.speed = 1f;
bop.startBeat = lastChargeTime + 1.75f;
lastChargeTime = Single.MinValue;
lastChargeTime = double.MinValue;
inKick = false;
}
}
@ -140,7 +140,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (!KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN))
{
Punch(1);
Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/swingNoHit", forcePlay: true);
}
}
@ -149,7 +149,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (!KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
{
//start a forced-fail combo sequence
ForceFailCombo(cond.songPositionInBeats);
ForceFailCombo(cond.songPositionInBeatsAsDouble);
KarateMan.instance.ScoreMiss(2);
}
}
@ -173,8 +173,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
else if (inKick && cond.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.5f && !KarateMan.instance.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_UP))
{
Kick(cond.songPositionInBeats);
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
Kick(cond.songPositionInBeatsAsDouble);
SoundByte.PlayOneShotGame("karateman/swingKick", forcePlay: true);
}
}
@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
anim.speed = 1f;
anim.Play("Beat", -1, 0);
lastChargeTime = Single.MinValue;
lastChargeTime = double.MinValue;
}
public bool Punch(int forceHand = 0)
@ -194,22 +194,22 @@ namespace HeavenStudio.Games.Scripts_KarateMan
bool straight = false;
anim.speed = 1f;
unPrepareTime = Single.MinValue;
lastChargeTime = Single.MinValue;
unPrepareTime = double.MinValue;
lastChargeTime = double.MinValue;
inKick = false;
switch (forceHand)
{
case 0:
if (cond.songPositionInBeats - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f))
if (cond.songPositionInBeatsAsDouble - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f))
{
lastPunchTime = Single.MinValue;
lastPunchTime = double.MinValue;
anim.DoScaledAnimationAsync("Straight", 0.5f);
straight = true;
}
else
{
lastPunchTime = cond.songPositionInBeats;
lastPunchTime = cond.songPositionInBeatsAsDouble;
anim.DoScaledAnimationAsync("Jab", 0.5f);
}
break;
@ -221,12 +221,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
straight = true;
break;
case 3:
lastPunchTime = Single.MinValue;
lastPunchTime = double.MinValue;
anim.DoNormalizedAnimation("JabNoNuri");
noNuriJabTime = cond.songPositionInBeats;
noNuriJabTime = cond.songPositionInBeatsAsDouble;
break;
}
bop.startBeat = cond.songPositionInBeats + 0.5f;
bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f;
return straight; //returns what hand was used to punch the object
}
@ -234,8 +234,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
if (GameManager.instance.currentGame != "karateman") return;
var cond = Conductor.instance;
bop.startBeat = cond.songPositionInBeats + 1f;
unPrepareTime = Single.MinValue;
bop.startBeat = cond.songPositionInBeatsAsDouble + 1f;
unPrepareTime = double.MinValue;
switch (seq)
{
case 0:
@ -255,7 +255,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case 4:
anim.Play("ToReady", -1, 0);
bop.startBeat = cond.songPositionInBeats + 0.5f;
bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f;
lockedInCombo = false;
comboWaiting = false;
break;
@ -264,16 +264,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
public void ComboMiss(float beat)
public void ComboMiss(double beat)
{
var cond = Conductor.instance;
lastComboMissTime = beat;
bop.startBeat = beat + 3f;
unPrepareTime = Single.MinValue;
unPrepareTime = double.MinValue;
anim.DoNormalizedAnimation("LowKickMiss");
}
public void ForceFailCombo(float beat)
public void ForceFailCombo(double beat)
{
if (inCombo) return;
BeatAction.New(gameObject, new List<BeatAction.Action>()
@ -293,10 +293,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}, forcePlay: true);
}
public void StartKickCharge(float beat)
public void StartKickCharge(double beat)
{
wantKick = true;
unPrepareTime = Single.MinValue;
unPrepareTime = double.MinValue;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {
@ -311,14 +311,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
});
}
public void Kick(float beat)
public void Kick(double beat)
{
if (!inKick) return;
//play the kick animation and reset stance
anim.speed = 1f;
bop.startBeat = beat + 1f;
unPrepareTime = Single.MinValue;
lastChargeTime = Single.MinValue;
unPrepareTime = double.MinValue;
lastChargeTime = double.MinValue;
inKick = false;
anim.DoScaledAnimationAsync("ManKick", 0.5f);
@ -355,7 +355,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.MappingMaterial.SetColor("_ColorDelta", highlightCol);
}
public void Prepare(float beat, float length)
public void Prepare(double beat, float length)
{
anim.speed = 0f;
anim.Play("Beat", -1, 0);
@ -376,12 +376,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ApplyBombGlow()
{
bombGlowStart = Single.MaxValue;
bombGlowStart = double.MaxValue;
bombGlowLength = 0f;
bombGlowIntensity = 1f;
}
public void RemoveBombGlow(float beat, float length = 0.5f)
public void RemoveBombGlow(double beat, float length = 0.5f)
{
bombGlowStart = beat;
bombGlowLength = length;

View File

@ -49,7 +49,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
public void SetNoriMode(float fromBeat, int mode, int startingNori = 0)
public void SetNoriMode(double fromBeat, int mode, int startingNori = 0)
{
float scaleFactor = 0f;
//clear all children of the holder
@ -143,7 +143,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (KarateMan.instance.NoriPerformance >= 0.6f && oldNori / MaxNori < 0.6f && !playedJust)
{
playedJust = true;
Jukebox.PlayOneShotGame("karateman/nori_just");
SoundByte.PlayOneShotGame("karateman/nori_just");
}
UpdateHeartColours();
}
@ -182,7 +182,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (KarateMan.instance.NoriPerformance < 0.6f && oldNori / MaxNori >= 0.6f)
{
playedJust = false;
Jukebox.PlayOneShotGame("karateman/nori_ng");
SoundByte.PlayOneShotGame("karateman/nori_ng");
}
UpdateHeartColours();
}
@ -194,7 +194,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (noriMode == (int) KarateMan.NoriMode.Tengoku)
{
if (Nori >= MaxNori)
Jukebox.PlayOneShotGame("karateman/nori_through");
SoundByte.PlayOneShotGame("karateman/nori_through");
playedJust = false;
Nori = 0;
foreach (Animator anim in NoriHeartAnimators)

View File

@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
public class KarateManPot : MonoBehaviour
{
public float startBeat;
public double startBeat;
public ItemType type;
public int path = 1;
@ -288,7 +288,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
transform.position = CurrentCurve.GetPoint(Mathf.Min(prog, 1f));
}
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 2f)
if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + 2f)
{
ParticleSystem p = Instantiate(HitParticles[7], transform.position, Quaternion.identity, KarateMan.instance.ItemHolder);
p.Play();
@ -317,7 +317,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case FlyStatus.Hit:
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat)
if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + curveTargetBeat)
{
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
p.Play();
@ -325,17 +325,17 @@ namespace HeavenStudio.Games.Scripts_KarateMan
GameObject.Destroy(ShadowInstance.gameObject);
GameObject.Destroy(gameObject);
Jukebox.PlayOneShotGame("karateman/bombBreak", volume: 0.25f);
SoundByte.PlayOneShotGame("karateman/bombBreak", volume: 0.25f);
return;
}
else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
else if (cond.songPositionInBeatsAsDouble >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
if (type == ItemType.KickBomb)
{
ParticleSystem p = Instantiate(HitParticles[6], ItemCurves[7].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
p.Play();
}
else if (type == ItemType.KickBall && cond.songPositionInBeats < startBeat + curveTargetBeat + 1f)
else if (type == ItemType.KickBall && cond.songPositionInBeatsAsDouble < startBeat + curveTargetBeat + 1f)
return;
GameObject.Destroy(ShadowInstance.gameObject);
@ -357,7 +357,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case FlyStatus.NG:
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat)
if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + curveTargetBeat)
{
KarateMan.instance.Joe.RemoveBombGlow(startBeat + curveTargetBeat, 1f);
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
@ -367,7 +367,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
GameObject.Destroy(gameObject);
return;
}
else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) {
else if (cond.songPositionInBeatsAsDouble >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) {
if (type == ItemType.KickBomb)
{
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[8].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
@ -393,7 +393,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
prog = cond.GetPositionFromBeat(startBeat, 1f);
Vector3 pos = new Vector3(HitPosition[1].position.x + 0.25f, HitPosition[0].position.y, HitPosition[1].position.z);
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 1f)
if (type == ItemType.Bomb && cond.songPositionInBeatsAsDouble >= startBeat + 1f)
{
KarateMan.instance.Joe.RemoveBombGlow(startBeat + 1f, 1f);
@ -404,7 +404,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
GameObject.Destroy(gameObject);
return;
}
else if (cond.songPositionInBeats >= startBeat + 3f)
else if (cond.songPositionInBeatsAsDouble >= startBeat + 3f)
{
GameObject.Destroy(ShadowInstance.gameObject);
GameObject.Destroy(gameObject);
@ -444,7 +444,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case ItemType.Bulb:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = straight ? 1f : 1.5f;;
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
if (effectTint.a == 0)
@ -468,101 +468,101 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case ItemType.Rock:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit", forcePlay: true);
p = Instantiate(HitParticles[4], HitPosition[1].position, Quaternion.identity, game.ItemHolder);
p.Play();
if (game.IsNoriActive && game.NoriPerformance >= 1f)
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
break;
case ItemType.Ball:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.Cooking:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
game.CreateItemInstance(startBeat + 1f, "Item09", 0, ItemType.CookingLid);
GetComponent<Animator>().Play("Item08", -1, 0);
if (game.IsNoriActive && game.NoriPerformance >= 1f)
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
break;
case ItemType.Alien:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/alienHit", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
if (game.IsNoriActive && game.NoriPerformance >= 1f)
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
break;
case ItemType.Bomb:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/bombHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/bombHit", forcePlay: true);
p = Instantiate(HitParticles[2], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
game.Joe.RemoveBombGlow(startBeat + 1f, 1f);
if (game.IsNoriActive && game.NoriPerformance >= 1f)
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
break;
case ItemType.TacoBell:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/tacobell", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
if (game.IsNoriActive && game.NoriPerformance >= 1f)
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
break;
case ItemType.ComboPot1:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 1.5f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.ComboPot2:
CurrentCurve = ItemCurves[0];
curveTargetBeat = 1.5f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.ComboPot3:
CurrentCurve = ItemCurves[2];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[2].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.ComboPot4:
CurrentCurve = ItemCurves[3];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[3].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.ComboPot5:
CurrentCurve = ItemCurves[4];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[4].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
p.Play();
break;
case ItemType.ComboBarrel:
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
p = Instantiate(HitParticles[0], HitPosition[5].position, Quaternion.identity, game.ItemHolder);
p.Play();
p = Instantiate(HitParticles[1], HitPosition[5].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
@ -576,7 +576,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
game.Joe.ApplyBombGlow();
game.CreateItemInstance(startBeat + 1f, "Item04", OnHitExpression, ItemType.KickBomb);
}
Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
p = Instantiate(HitParticles[0], HitPosition[1].position, Quaternion.Euler(0, 0, -5f), game.ItemHolder);
p.Play();
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
@ -584,14 +584,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case ItemType.KickBomb:
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/bombKick", forcePlay: true);
p = Instantiate(HitParticles[2], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder);
p.Play();
game.Joe.RemoveBombGlow(startBeat + 0.75f);
break;
case ItemType.KickBall:
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/bombKick", forcePlay: true);
p = Instantiate(HitParticles[1], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder);
p.Play();
break;
@ -600,18 +600,18 @@ namespace HeavenStudio.Games.Scripts_KarateMan
curveTargetBeat = straight ? 1f : 1.5f;
if (game.IsNoriActive && game.NoriPerformance < 0.6f)
{
Jukebox.PlayOneShotGame("karateman/potHit_lowNori", forcePlay: true);
Jukebox.PlayOneShotGame("karateman/potHit", volume: 0.66f, forcePlay: true);
SoundByte.PlayOneShotGame("karateman/potHit_lowNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/potHit", volume: 0.66f, forcePlay: true);
}
else
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/potHit", forcePlay: true);
p = Instantiate(HitParticles[3], HitPosition[1].position, Quaternion.identity, game.ItemHolder);
p.Play();
break;
}
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
status = FlyStatus.Hit;
}
@ -669,7 +669,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case ItemType.ComboPot2:
joe.Punch(2);
if (joe.GetComboId() != comboId)
Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true);
else
{
ItemHitEffect();
@ -687,7 +687,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
//if the button isn't held anymore make Joe spin
if (joe.GetComboId() != comboId) {
joe.ComboMiss(startBeat + 1f);
Jukebox.PlayOneShotGame("karateman/comboMiss", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/comboMiss", forcePlay: true);
joe.SetShouldComboId(-2);
}
else
@ -710,7 +710,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
void DoHitExpression(float offset)
void DoHitExpression(double offset)
{
if (OnHitExpression == (int) KarateMan.KarateManFaces.Normal)
return;
@ -733,10 +733,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
if (state <= -1f || state >= 1f) {
bool straight = joe.Punch(ItemPunchHand());
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
@ -755,9 +755,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (ItemNeedNori() && KarateMan.instance.NoriPerformance < 0.6f)
{
CreateHitMark(false);
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
status = FlyStatus.HitWeak;
Jukebox.PlayOneShotGame("karateman/hitNoNori", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/hitNoNori", forcePlay: true);
joe.Punch(3);
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z - 30f);
KarateMan.instance.Nori.DoNG();
@ -783,12 +783,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
//WHEN SCORING THIS IS A MISS
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
joe.ForceFailCombo(Conductor.instance.songPositionInBeatsAsDouble);
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
@ -821,7 +821,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true);
}),
new BeatAction.Action(startBeat + 5f, delegate {
if (joe.wantFace == -1)
@ -843,10 +843,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.SetComboId(comboId);
joe.SetShouldComboId(comboId);
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
KarateMan.instance.Nori.DoNG();
@ -870,7 +870,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true);
}),
new BeatAction.Action(startBeat + 5f, delegate {
if (joe.wantFace == -1)
@ -891,10 +891,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
bool straight = joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
@ -916,10 +916,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.SetShouldComboId(-1);
joe.ComboSequence(3);
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[5];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
@ -952,7 +952,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.SetComboId(-1);
joe.SetShouldComboId(-1);
joe.ComboSequence(3);
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/swingKick", forcePlay: true);
}
OnHit.CanHit(false);
}
@ -1009,7 +1009,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
if (GameManager.instance.currentGame != "karateman") return;
if (KarateMan.IsComboEnable && !(KarateMan.instance.Joe.inCombo || KarateMan.instance.Joe.inNuriLock))
KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeatsAsDouble);
}
public void KickChargeJustOrNg(PlayerActionEvent caller, float state)
@ -1019,10 +1019,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo || joe.inNuriLock)) {
joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
@ -1056,7 +1056,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
SoundByte.PlayOneShotGame("karateman/karate_through", forcePlay: true);
}),
new BeatAction.Action(startBeat + 5f, delegate {
if (joe.wantFace == -1)
@ -1073,12 +1073,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (GameManager.instance.currentGame != "karateman") return;
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && joe.inKick) {
joe.Kick(Conductor.instance.songPositionInBeats);
joe.Kick(Conductor.instance.songPositionInBeatsAsDouble);
if (state <= -1f || state >= 1f) {
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
CurrentCurve = ItemCurves[8];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
status = FlyStatus.NG;
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
@ -1100,7 +1100,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
ItemHitEffect();
status = FlyStatus.Hit;
CurrentCurve = ItemCurves[7];
startBeat = Conductor.instance.songPositionInBeats;
startBeat = Conductor.instance.songPositionInBeatsAsDouble;
curveTargetBeat = 3f;
KarateMan.instance.Nori.DoHit();
}

View File

@ -36,7 +36,7 @@ namespace HeavenStudio.Games.Scripts_Kitties
if (PlayerInput.Pressed() && canClap && !Kitties.instance.IsExpectingInputNow(InputType.STANDARD_DOWN))
{
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
if (spawnType != 3)
anim.Play("ClapFail", 0, 0);
else
@ -50,26 +50,26 @@ namespace HeavenStudio.Games.Scripts_Kitties
}
}
public void ScheduleClap(float beat, int type)
public void ScheduleClap(double beat, int type)
{
spawnType = type;
Kitties.instance.ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, ClapSuccessOne, ClapMissOne, ClapEmpty);
Kitties.instance.ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, ClapSuccessTwo, ClapMissTwo, ClapEmpty);
}
public void ScheduleRoll(float beat)
public void ScheduleRoll(double beat)
{
Kitties.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, SpinSuccessOne, SpinMissOne, SpinEmpty);
}
public void ScheduleRollFinish(float beat)
public void ScheduleRollFinish(double beat)
{
Debug.Log(hasSpun);
if (hasSpun)
Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_ALT_UP, SpinSuccessTwo, SpinMissTwo, SpinEmpty);
}
public void ScheduleFish(float beat)
public void ScheduleFish(double beat)
{
Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_DOWN, FishSuccess, FishMiss, FishEmpty);
}
@ -80,13 +80,13 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
if (state >= 1f || state <= -1f)
{ //todo: proper near miss feedback
Jukebox.PlayOneShotGame("kitties/ClapMiss1");
Jukebox.PlayOneShotGame("kitties/tink");
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
SoundByte.PlayOneShotGame("kitties/tink");
anim.Play("ClapMiss", 0, 0);
}
else
{
Jukebox.PlayOneShotGame("kitties/clap1");
SoundByte.PlayOneShotGame("kitties/clap1");
anim.Play("Clap1", 0, 0);
}
}
@ -94,18 +94,18 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
if (state >= 1f || state <= -1f)
{ //todo: proper near miss feedback
Jukebox.PlayOneShotGame("kitties/ClapMiss1");
Jukebox.PlayOneShotGame("kitties/tink");
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
SoundByte.PlayOneShotGame("kitties/tink");
anim.Play("FaceClapFail", 0, 0);
}
Jukebox.PlayOneShotGame("kitties/clap1");
SoundByte.PlayOneShotGame("kitties/clap1");
anim.Play("FaceClap", 0, 0);
}
}
public void ClapMissOne(PlayerActionEvent Caller)
{
Jukebox.PlayOneShotGame("kitties/ClapMiss1");
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
}
public void ClapEmpty(PlayerActionEvent Caller)
{
@ -118,13 +118,13 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
if (state >= 1f || state <= -1f)
{ //todo: proper near miss feedback
Jukebox.PlayOneShotGame("kitties/ClapMiss2");
Jukebox.PlayOneShotGame("kitties/tink");
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
SoundByte.PlayOneShotGame("kitties/tink");
anim.Play("ClapMiss", 0, 0);
}
else
{
Jukebox.PlayOneShotGame("kitties/clap2");
SoundByte.PlayOneShotGame("kitties/clap2");
anim.Play("Clap2", 0, 0);
}
}
@ -132,31 +132,31 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
if (state >= 1f || state <= -1f)
{ //todo: proper near miss feedback
Jukebox.PlayOneShotGame("kitties/ClapMiss2");
Jukebox.PlayOneShotGame("kitties/tink");
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
SoundByte.PlayOneShotGame("kitties/tink");
anim.Play("FaceClapFail", 0, 0);
}
Jukebox.PlayOneShotGame("kitties/clap2");
SoundByte.PlayOneShotGame("kitties/clap2");
anim.Play("FaceClap", 0, 0);
}
}
public void ClapMissTwo(PlayerActionEvent Caller)
{
Jukebox.PlayOneShotGame("kitties/ClapMiss2");
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
}
public void SpinSuccessOne(PlayerActionEvent caller, float beat)
{
hasSpun = true;
Jukebox.PlayOneShotGame("kitties/roll5");
SoundByte.PlayOneShotGame("kitties/roll5");
anim.Play("Rolling", 0, 0);
}
public void SpinSuccessTwo(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("kitties/roll6");
SoundByte.PlayOneShotGame("kitties/roll6");
anim.Play("RollEnd", 0, 0);
}
@ -164,8 +164,8 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
hasSpun = false;
var cond = Conductor.instance;
Jukebox.PlayOneShotGame("kitties/roll5", -1f, 1, .1f);
Jukebox.PlayOneShotGame("kitties/roll6", cond.songPositionInBeats + .75f, 1, .1f);
SoundByte.PlayOneShotGame("kitties/roll5", -1f, 1, .1f);
SoundByte.PlayOneShotGame("kitties/roll6", cond.songPositionInBeatsAsDouble + .75f, 1, .1f);
}
public void SpinMissTwo(PlayerActionEvent caller)
@ -174,7 +174,7 @@ namespace HeavenStudio.Games.Scripts_Kitties
{
RollFail();
}
Jukebox.PlayOneShotGame("kitties/roll6", -1f, 1, .3f);
SoundByte.PlayOneShotGame("kitties/roll6", -1f, 1, .3f);
}
public void SpinEmpty(PlayerActionEvent caller)
@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_Kitties
public void RollFail()
{
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
anim.Play("RollFail", 0, 0);
hasSpun = false;
}
@ -192,14 +192,14 @@ namespace HeavenStudio.Games.Scripts_Kitties
public void FishSuccess(PlayerActionEvent caller, float beat)
{
Kitties.instance.RemoveCats(false);
Jukebox.PlayOneShotGame("kitties/fish4");
SoundByte.PlayOneShotGame("kitties/fish4");
fish.Play("CaughtSuccess", 0, 0);
}
public void FishMiss(PlayerActionEvent caller)
{
Kitties.instance.RemoveCats(false);
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
fish.Play("CaughtFail", 0, 0);
}

View File

@ -127,7 +127,7 @@ namespace HeavenStudio.Games
}
public void Clap(bool isMice, bool isInverse, bool keepSpawned, float beat, int type)
public void Clap(bool isMice, bool isInverse, bool keepSpawned, double beat, int type)
{
player.ScheduleClap(beat, type);
MultiSound.Play(new MultiSound.Sound[] {
@ -215,7 +215,7 @@ namespace HeavenStudio.Games
}
}
public void Roll(bool keepSpawned, float beat)
public void Roll(bool keepSpawned, double beat)
{
if (!player.canClap)
return;
@ -265,7 +265,7 @@ namespace HeavenStudio.Games
}
}
public void CatchFish(float beat)
public void CatchFish(double beat)
{
//if (!player.canClap)
// return;
@ -438,7 +438,7 @@ namespace HeavenStudio.Games
player.canClap = false;
}
public void InstantSpawn(bool isMice, bool isInverse, float beat, int pos)
public void InstantSpawn(bool isMice, bool isInverse, double beat, int pos)
{
BeatAction.New(Cats[0], new List<BeatAction.Action>()
{

View File

@ -10,6 +10,7 @@ using System.Diagnostics;
using UnityEngine;
using UnityEngine.Rendering;
using static HeavenStudio.EntityTypes;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -101,7 +102,7 @@ namespace HeavenStudio.Games.Loaders
new Param("xPos", new EntityTypes.Float(-40f, 40f, 0f), "X Position", "Which position on the X axis should the Launch Pad travel to?"),
new Param("yPos", new EntityTypes.Float(-30f, 30f, 0f), "Y Position", "Which position on the Y axis should the Launch Pad travel to?"),
new Param("zPos", new EntityTypes.Float(-90f, 90f, 0f), "Z Position", "Which position on the Z axis should the Launch Pad travel to?"),
new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
}
},
new GameAction("rotMove", "Change Launch Pad Rotation")
@ -111,7 +112,7 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>()
{
new Param("rot", new EntityTypes.Float(-360, 360, 0), "Angle", "Which angle of rotation should the Launch Pad rotate towards?"),
new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
}
},
new GameAction("toggleStars", "Toggle Falling Stars")
@ -174,8 +175,8 @@ namespace HeavenStudio.Games
private Vector3 currentPadPos = new Vector3(0, -2.4f, 0);
private float lastPadRotation;
private float currentPadRotation;
private EasingFunction.Ease lastPosEase;
private EasingFunction.Ease lastRotEase;
private Util.EasingFunction.Ease lastPosEase;
private Util.EasingFunction.Ease lastRotEase;
public enum RocketType
{
Family = 0,
@ -186,7 +187,7 @@ namespace HeavenStudio.Games
public struct QueuedRocket
{
public RocketType type;
public float beat;
public double beat;
public float offSet;
public List<int> notes;
}
@ -196,9 +197,9 @@ namespace HeavenStudio.Games
private int currentRotIndex;
private List<DynamicBeatmap.DynamicEntity> allPosEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allPosEvents = new List<RiqEntity>();
private List<DynamicBeatmap.DynamicEntity> allRotEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allRotEvents = new List<RiqEntity>();
public static LaunchParty instance;
@ -216,10 +217,10 @@ namespace HeavenStudio.Games
instance = this;
lensFlareAnim.Play("Flashing", 0, 0);
var posEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "posMove" });
List<DynamicBeatmap.DynamicEntity> tempPosEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempPosEvents = new List<RiqEntity>();
for (int i = 0; i < posEvents.Count; i++)
{
if (posEvents[i].beat + posEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (posEvents[i].beat + posEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempPosEvents.Add(posEvents[i]);
}
@ -228,10 +229,10 @@ namespace HeavenStudio.Games
allPosEvents = tempPosEvents;
var rotEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "rotMove" });
List<DynamicBeatmap.DynamicEntity> tempRotEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempRotEvents = new List<RiqEntity>();
for (int i = 0; i < rotEvents.Count; i++)
{
if (rotEvents[i].beat + rotEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (rotEvents[i].beat + rotEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempRotEvents.Add(rotEvents[i]);
}
@ -261,7 +262,7 @@ namespace HeavenStudio.Games
{
if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0)
{
if (cond.songPositionInBeats >= allPosEvents[currentPosIndex].beat)
if (cond.songPositionInBeatsAsDouble >= allPosEvents[currentPosIndex].beat)
{
UpdateLaunchPadPos();
currentPosIndex++;
@ -284,7 +285,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastPosEase);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastPosEase);
float newPosX = func(lastPadPos.x, currentPadPos.x, normalizedBeat);
float newPosY = func(lastPadPos.y, currentPadPos.y, normalizedBeat);
@ -298,7 +299,7 @@ namespace HeavenStudio.Games
{
if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0)
{
if (cond.songPositionInBeats >= allRotEvents[currentRotIndex].beat)
if (cond.songPositionInBeatsAsDouble >= allRotEvents[currentRotIndex].beat)
{
UpdateLaunchPadRot();
currentRotIndex++;
@ -321,7 +322,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastRotEase);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastRotEase);
float newRotZ = func(lastPadRotation, currentPadRotation, normalizedBeat);
launchPadRotatable.rotation = Quaternion.Euler(0, 0, newRotZ);
@ -341,10 +342,10 @@ namespace HeavenStudio.Games
if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0)
{
lastPadPos = launchPad.position;
currentPosBeat = allPosEvents[currentPosIndex].beat;
currentPosBeat = (float)allPosEvents[currentPosIndex].beat;
currentPosLength = allPosEvents[currentPosIndex].length;
currentPadPos = new Vector3(allPosEvents[currentPosIndex]["xPos"], allPosEvents[currentPosIndex]["yPos"], allPosEvents[currentPosIndex]["zPos"]);
lastPosEase = (EasingFunction.Ease)allPosEvents[currentPosIndex]["ease"];
lastPosEase = (Util.EasingFunction.Ease)allPosEvents[currentPosIndex]["ease"];
}
}
@ -353,14 +354,14 @@ namespace HeavenStudio.Games
if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0)
{
lastPadRotation = launchPadRotatable.rotation.eulerAngles.z;
currentRotBeat = allRotEvents[currentRotIndex].beat;
currentRotBeat = (float)allRotEvents[currentRotIndex].beat;
currentRotLength = allRotEvents[currentRotIndex].length;
currentPadRotation = allRotEvents[currentRotIndex]["rot"];
lastRotEase = (EasingFunction.Ease)allRotEvents[currentRotIndex]["ease"];
lastRotEase = (Util.EasingFunction.Ease)allRotEvents[currentRotIndex]["ease"];
}
}
public void SpawnRocket(float beat, float beatOffset, RocketType type, List<int> notes)
public void SpawnRocket(double beat, float beatOffset, RocketType type, List<int> notes)
{
GameObject rocketToSpawn = rocket;
switch (type)
@ -383,7 +384,7 @@ namespace HeavenStudio.Games
List<float> pitchedNotes = new List<float>();
foreach (var note in notes)
{
pitchedNotes.Add(Jukebox.GetPitchFromSemiTones(note, true));
pitchedNotes.Add(SoundByte.GetPitchFromSemiTones(note, true));
}
rocketScript.pitches.AddRange(pitchedNotes);
switch (type)
@ -407,7 +408,7 @@ namespace HeavenStudio.Games
});
}
public static void LaunchRocket(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour)
public static void LaunchRocket(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour)
{
List<int> pitches = new List<int>()
{
@ -426,7 +427,7 @@ namespace HeavenStudio.Games
}
}
public static void LaunchPartyCracker(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix)
public static void LaunchPartyCracker(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix)
{
List<int> pitches = new List<int>()
{
@ -447,7 +448,7 @@ namespace HeavenStudio.Games
}
}
public static void LaunchBell(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine)
public static void LaunchBell(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine)
{
List<int> pitches = new List<int>()
{
@ -471,7 +472,7 @@ namespace HeavenStudio.Games
}
}
public static void LaunchBowlingPin(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven,
public static void LaunchBowlingPin(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven,
int noteEight, int noteNine, int noteTen, int noteEleven, int noteTwelve, int noteThirteen, int noteFourteen, int noteFifteen)
{
List<int> pitches = new List<int>()
@ -502,7 +503,7 @@ namespace HeavenStudio.Games
}
}
public void CreateParticles(float beat, bool toggle, float starDensity, float starSpeed, float starSpeedBack)
public void CreateParticles(double beat, bool toggle, float starDensity, float starSpeed, float starSpeedBack)
{
ParticleSystem.EmissionModule emm;
ParticleSystem.EmissionModule emm2;

View File

@ -34,8 +34,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
if (GameManager.instance.currentGame != "launchParty") Destroy(gameObject);
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN) && !noInput)
{
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
game.ScoreMiss(0.5);
@ -48,7 +48,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
noInput = false;
}
public void InitFamilyRocket(float beat)
public void InitFamilyRocket(double beat)
{
game.ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, JustFamilyRocket, Miss, Nothing);
@ -72,7 +72,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
});
}
public void InitPartyCracker(float beat)
public void InitPartyCracker(double beat)
{
game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustPartyCracker, Miss, Nothing);
@ -100,7 +100,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
});
}
public void InitBell(float beat)
public void InitBell(double beat)
{
game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustBell, Miss, Nothing);
@ -132,7 +132,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
});
}
public void InitBowlingPin(float beat)
public void InitBowlingPin(double beat)
{
game.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustBowlingPin, Miss, Nothing);
@ -181,8 +181,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
if (state >= 1f || state <= -1f)
{
number.SetActive(false);
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
anim.Play("RocketBarely" + leftOrRight, 0, 0);
BeatAction.New(gameObject, new List<BeatAction.Action>()
@ -227,8 +227,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
{
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
anim.Play("RocketBarely" + leftOrRight, 0, 0);
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }),
@ -271,8 +271,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
{
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
anim.Play("RocketBarely" + leftOrRight, 0, 0);
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }),
@ -315,8 +315,8 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
{
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
anim.Play("RocketBarely" + leftOrRight, 0, 0);
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { GameObject.Destroy(gameObject); }),
@ -346,7 +346,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void Miss(PlayerActionEvent caller)
{
noInput = true;
Jukebox.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/miss");
number.SetActive(false);
anim.Play("RocketMiss", 0, 0);
BeatAction.New(gameObject, new List<BeatAction.Action>()

View File

@ -155,7 +155,7 @@ namespace HeavenStudio.Games
[SerializeField] Material stepperMaterial;
[Header("Properties")]
static List<float> queuedInputs = new List<float>();
static List<double> queuedInputs = new();
Sprite masterSprite;
HowMissed currentMissStage;
bool lessSteppers = false;
@ -238,7 +238,7 @@ namespace HeavenStudio.Games
{
foreach (var input in queuedInputs)
{
ScheduleInput(cond.songPositionInBeats, input - cond.songPositionInBeats, InputType.STANDARD_DOWN, Just, Miss, Nothing);
ScheduleInput(cond.songPositionInBeatsAsDouble, input - cond.songPositionInBeats, InputType.STANDARD_DOWN, Just, Miss, Nothing);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(input, delegate { EvaluateMarch(); }),
@ -258,7 +258,7 @@ namespace HeavenStudio.Games
{
stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f);
}
Jukebox.PlayOneShotGame("lockstep/miss");
SoundByte.PlayOneShotGame("lockstep/miss");
ScoreMiss();
}
}
@ -269,7 +269,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, float length, bool shouldBop, bool autoBop)
public void Bop(double beat, float length, bool shouldBop, bool autoBop)
{
goBop = autoBop;
if (shouldBop)
@ -287,17 +287,17 @@ namespace HeavenStudio.Games
}
}
public void Hai(float beat)
public void Hai(double beat)
{
Jukebox.PlayOneShotGame("lockstep/switch1");
SoundByte.PlayOneShotGame("lockstep/switch1", beat);
}
public void Ho(float beat)
public void Ho(double beat)
{
Jukebox.PlayOneShotGame("lockstep/switch4");
SoundByte.PlayOneShotGame("lockstep/switch4", beat);
}
public static void OnbeatSwitch(float beat)
public static void OnbeatSwitch(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -317,7 +317,7 @@ namespace HeavenStudio.Games
});
}
public static void OffbeatSwitch(float beat)
public static void OffbeatSwitch(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -338,7 +338,7 @@ namespace HeavenStudio.Games
});
}
public static void Marching(float beat, float length)
public static void Marching(double beat, float length)
{
if (GameManager.instance.currentGame == "lockstep")
{
@ -362,7 +362,7 @@ namespace HeavenStudio.Games
public void EvaluateMarch()
{
var cond = Conductor.instance;
var beatAnimCheck = Math.Round(cond.songPositionInBeats * 2);
var beatAnimCheck = Math.Round(cond.songPositionInBeatsAsDouble * 2);
if (beatAnimCheck % 2 != 0)
{
PlayStepperAnim("OffbeatMarch", false, 0.5f);
@ -382,12 +382,12 @@ namespace HeavenStudio.Games
double beatAnimCheck = cond.songPositionInBeatsAsDouble - 0.25;
if (beatAnimCheck % 1.0 >= 0.5)
{
Jukebox.PlayOneShotGame("lockstep/tink");
SoundByte.PlayOneShotGame("lockstep/tink");
stepswitcherPlayer.DoScaledAnimationAsync("OnbeatMarch", 0.5f);
}
else
{
Jukebox.PlayOneShotGame("lockstep/tink");
SoundByte.PlayOneShotGame("lockstep/tink");
stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f);
}
return;
@ -400,12 +400,12 @@ namespace HeavenStudio.Games
double beatAnimCheck = beat - 0.25;
if (beatAnimCheck % 1.0 >= 0.5)
{
Jukebox.PlayOneShotGame($"lockstep/marchOnbeat{UnityEngine.Random.Range(1, 3)}");
SoundByte.PlayOneShotGame($"lockstep/marchOnbeat{UnityEngine.Random.Range(1, 3)}");
stepswitcherPlayer.DoScaledAnimationAsync("OnbeatMarch", 0.5f);
}
else
{
Jukebox.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}");
SoundByte.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}");
stepswitcherPlayer.DoScaledAnimationAsync("OffbeatMarch", 0.5f);
}
}
@ -417,13 +417,13 @@ namespace HeavenStudio.Games
if (beatAnimCheck % 2 != 0 && currentMissStage != HowMissed.MissedOff)
{
stepswitcherPlayer.Play("OffbeatMiss", 0, 0);
Jukebox.PlayOneShotGame("lockstep/wayOff");
SoundByte.PlayOneShotGame("lockstep/wayOff");
currentMissStage = HowMissed.MissedOff;
}
else if (beatAnimCheck % 2 == 0 && currentMissStage != HowMissed.MissedOn)
{
stepswitcherPlayer.Play("OnbeatMiss", 0, 0);
Jukebox.PlayOneShotGame("lockstep/wayOff");
SoundByte.PlayOneShotGame("lockstep/wayOff");
currentMissStage = HowMissed.MissedOn;
}
}

View File

@ -174,7 +174,7 @@ namespace HeavenStudio.Games
{
public static MarchingOrders instance;
static List<float> queuedMarches = new List<float>();
static List<double> queuedMarches = new();
[Header("Animators")]
[SerializeField] Animator Sarge;
@ -198,9 +198,9 @@ namespace HeavenStudio.Games
bool keepMarching;
private int marchOtherCount;
private int marchPlayerCount;
private float lastMissBeat;
private float lastReportedBeat;
public static float wantMarch = float.MinValue;
private double lastMissBeat;
private double lastReportedBeat;
public static double wantMarch = double.MinValue;
public enum Direction
@ -233,12 +233,12 @@ namespace HeavenStudio.Games
{
for (int i = 0; i < BackgroundRecolorable.Length; i++) BackgroundRecolorable[i].color = i == 0 ? BGColor1 : BGColor2;
if (wantMarch != float.MinValue) {
if (wantMarch != double.MinValue) {
queuedMarches.Add(wantMarch);
marchOtherCount =
marchPlayerCount = 0;
keepMarching = true;
wantMarch = float.MinValue;
wantMarch = double.MinValue;
}
if (goBop && Conductor.instance.ReportBeat(ref lastReportedBeat)) {
@ -256,7 +256,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(march + 1, delegate {
marchOtherCount++;
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Jukebox.PlayOneShotGame("marchingOrders/stepOther");
SoundByte.PlayOneShotGame("marchingOrders/stepOther");
if (keepMarching) queuedMarches.Add(march + 1);
}),
});
@ -317,8 +317,8 @@ namespace HeavenStudio.Games
void TurnSuccess(float state, string dir, bool shouldPoint = false)
{
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/turnActionPlayer");
if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss");
else SoundByte.PlayOneShotGame("marchingOrders/turnActionPlayer");
CadetHeadPlayer.DoScaledAnimationAsync("Face"+dir, 0.5f);
if (shouldPoint) CadetPlayer.DoScaledAnimationAsync("Point"+dir, 0.5f);
@ -326,35 +326,35 @@ namespace HeavenStudio.Games
public void GenericMiss(PlayerActionEvent caller)
{
if (Conductor.instance.songPositionInBeats - lastMissBeat <= 1.1f) return;
if (Conductor.instance.songPositionInBeatsAsDouble - lastMissBeat <= 1.1f) return;
Miss();
}
public void Miss()
{
lastMissBeat = Conductor.instance.songPositionInBeats;
Jukebox.PlayOneShot("miss");
lastMissBeat = Conductor.instance.songPositionInBeatsAsDouble;
SoundByte.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
}
public void MarchHit(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss");
else SoundByte.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
marchPlayerCount++;
CadetPlayer.DoScaledAnimationAsync(marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
}
public void HaltHit(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
if (state <= -1f || state >= 1f) SoundByte.PlayOneShot("nearMiss");
else SoundByte.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
CadetPlayer.DoScaledAnimationAsync("Halt", 0.5f);
}
public void BopAction(float beat, float length, bool shouldBop, bool autoBop, bool clap)
public void BopAction(double beat, float length, bool shouldBop, bool autoBop, bool clap)
{
goBop = autoBop;
shouldClap = clap;
@ -370,16 +370,16 @@ namespace HeavenStudio.Games
}
}
public void SargeAttention(float beat)
public void SargeAttention(double beat)
{
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + 0.25f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
});
}
public static void SargeMarch(float beat, bool noVoice)
public static void SargeMarch(double beat, bool noVoice)
{
if (MarchingOrders.wantMarch != float.MinValue) return;
if (MarchingOrders.wantMarch != double.MinValue) return;
MarchingOrders.wantMarch = beat + 1;
if (!noVoice) PlaySoundSequence("marchingOrders", "susume", beat);
@ -390,7 +390,7 @@ namespace HeavenStudio.Games
}
}
public void ForceMarching(float beat, float length)
public void ForceMarching(double beat, float length)
{
for (int i = 0; i < length; i++) {
ScheduleInput(beat + i - 1, 1f, InputType.STANDARD_DOWN, MarchHit, GenericMiss, Empty);
@ -398,13 +398,13 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + i, delegate {
marchOtherCount++;
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Jukebox.PlayOneShotGame("marchingOrders/stepOther");
SoundByte.PlayOneShotGame("marchingOrders/stepOther");
}),
});
}
}
public void PreMarch(float beat)
public void PreMarch(double beat)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
@ -415,7 +415,7 @@ namespace HeavenStudio.Games
});
}
public void Halt(float beat)
public void Halt(double beat)
{
keepMarching = false;
HaltSound(beat);
@ -428,7 +428,7 @@ namespace HeavenStudio.Games
});
}
public void FaceTurn(float beat, int direction, bool isFast, bool shouldPoint)
public void FaceTurn(double beat, int direction, bool isFast, bool shouldPoint)
{
// x is true if the direction is right
bool x = (direction == 0);
@ -491,12 +491,12 @@ namespace HeavenStudio.Games
}
}
public static void AttentionSound(float beat)
public static void AttentionSound(double beat)
{
PlaySoundSequence("marchingOrders", "zentai", beat - 1);
}
public static void HaltSound(float beat)
public static void HaltSound(double beat)
{
PlaySoundSequence("marchingOrders", "tomare", beat);
}

View File

@ -74,11 +74,11 @@ namespace HeavenStudio.Games
using Scripts_MeatGrinder;
public class MeatGrinder : Minigame
{
static List<float> queuedInputs = new List<float>();
static List<double> queuedInputs = new();
static List<QueuedInterval> queuedIntervals = new List<QueuedInterval>();
struct QueuedInterval
{
public float beat;
public double beat;
public float length;
}
@ -91,11 +91,11 @@ namespace HeavenStudio.Games
[Header("Variables")]
bool intervalStarted;
float intervalStartBeat;
double intervalStartBeat;
bool bossBop = true;
public float beatInterval = 4f;
public bool bossAnnoyed = false;
private float lastReportedBeat = 0f;
private double lastReportedBeat = 0f;
const string sfxName = "meatGrinder/";
public static MeatGrinder instance;
@ -130,7 +130,7 @@ namespace HeavenStudio.Games
if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) {
TackAnim.DoScaledAnimationAsync("TackEmptyHit", 0.5f);
TackAnim.SetBool("tackMeated", false);
Jukebox.PlayOneShotGame(sfxName+"whiff");
SoundByte.PlayOneShotGame(sfxName+"whiff");
if (bossAnnoyed) BossAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
@ -153,7 +153,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, float length, bool doesBop, bool autoBop)
public void Bop(double beat, float length, bool doesBop, bool autoBop)
{
bossBop = autoBop;
if (doesBop) {
@ -169,7 +169,7 @@ namespace HeavenStudio.Games
}
}
public static void PreInterval(float beat, float length)
public static void PreInterval(double beat, float length)
{
if (MeatGrinder.instance.intervalStarted || MeatGrinder.queuedIntervals.Count > 0) return;
@ -191,7 +191,7 @@ namespace HeavenStudio.Games
}
}
public void StartInterval(float beat, float length)
public void StartInterval(double beat, float length)
{
if (MeatGrinder.instance.intervalStarted) return;
@ -204,9 +204,9 @@ namespace HeavenStudio.Games
});
}
public void MeatToss(float beat)
public void MeatToss(double beat)
{
Jukebox.PlayOneShotGame(sfxName+"toss");
SoundByte.PlayOneShotGame(sfxName+"toss");
MeatToss Meat = Instantiate(MeatBase, gameObject.transform).GetComponent<MeatToss>();
Meat.startBeat = beat;
@ -215,17 +215,17 @@ namespace HeavenStudio.Games
Meat.meatType = "DarkMeat";
}
public void MeatCall(float beat)
public void MeatCall(double beat)
{
BossAnim.DoScaledAnimationAsync("BossCall", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"signal");
SoundByte.PlayOneShotGame(sfxName+"signal");
StartInterval(beat, beatInterval);
queuedInputs.Add(beat - intervalStartBeat);
}
public void PassTurn(float beat)
public void PassTurn(double beat)
{
intervalStarted = false;
foreach (var input in queuedInputs)

View File

@ -9,8 +9,8 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
{
public class MeatToss : MonoBehaviour
{
public float startBeat;
public float cueLength;
public double startBeat;
public double cueLength;
public bool cueBased;
public string meatType;
@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
private void InputActions(bool annoyBoss, string whichSfx, string whichAnim)
{
game.bossAnnoyed = annoyBoss;
Jukebox.PlayOneShotGame("meatGrinder/"+whichSfx);
SoundByte.PlayOneShotGame("meatGrinder/"+whichSfx);
game.TackAnim.DoScaledAnimationAsync(whichAnim, 0.5f);
}

View File

@ -40,8 +40,8 @@ namespace HeavenStudio.Games
/// <param name="OnBlank">Method to run whenever there's an Input while this is Scheduled (Shouldn't be used too much)</param>
/// <returns></returns>
public PlayerActionEvent ScheduleInput(
float startBeat,
float timer,
double startBeat,
double timer,
InputType inputType,
PlayerActionEvent.ActionEventCallbackState OnHit,
PlayerActionEvent.ActionEventCallback OnMiss,
@ -74,8 +74,8 @@ namespace HeavenStudio.Games
return evt;
}
public PlayerActionEvent ScheduleAutoplayInput(float startBeat,
float timer,
public PlayerActionEvent ScheduleAutoplayInput(double startBeat,
double timer,
InputType inputType,
PlayerActionEvent.ActionEventCallbackState OnHit,
PlayerActionEvent.ActionEventCallback OnMiss,
@ -86,8 +86,8 @@ namespace HeavenStudio.Games
return evt;
}
public PlayerActionEvent ScheduleUserInput(float startBeat,
float timer,
public PlayerActionEvent ScheduleUserInput(double startBeat,
double timer,
InputType inputType,
PlayerActionEvent.ActionEventCallbackState OnHit,
PlayerActionEvent.ActionEventCallback OnMiss,
@ -124,8 +124,8 @@ namespace HeavenStudio.Games
closest = toCompare;
} else
{
float t1 = closest.startBeat + closest.timer;
float t2 = toCompare.startBeat + toCompare.timer;
double t1 = closest.startBeat + closest.timer;
double t2 = toCompare.startBeat + toCompare.timer;
// Debug.Log("t1=" + t1 + " -- t2=" + t2);
@ -194,12 +194,12 @@ namespace HeavenStudio.Games
public int firstEnable = 0;
public virtual void OnGameSwitch(float beat)
public virtual void OnGameSwitch(double beat)
{
//Below is a template that can be used for handling previous entities.
//section below is if you only want to look at entities that overlap the game switch
/*
List<Beatmap.Entity> prevEntities = GameManager.instance.Beatmap.entities.FindAll(c => c.beat <= beat && c.datamodel.Split(0) == [insert game name]);
List<Beatmap.Entity> prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.beat <= beat && c.datamodel.Split(0) == [insert game name]);
foreach(Beatmap.Entity entity in prevEntities)
{
if(entity.beat + entity.length >= beat)
@ -215,12 +215,12 @@ namespace HeavenStudio.Games
}
public virtual void OnPlay(float beat)
public virtual void OnPlay(double beat)
{
}
public virtual void OnStop(float beat)
public virtual void OnStop(double beat)
{
foreach (var evt in scheduledInputs)
{
@ -246,7 +246,7 @@ namespace HeavenStudio.Games
return sameTime;
}
public static MultiSound PlaySoundSequence(string game, string name, float startBeat, params SoundSequence.SequenceParams[] args)
public static MultiSound PlaySoundSequence(string game, string name, double startBeat, params SoundSequence.SequenceParams[] args)
{
Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game);
foreach (SoundSequence.SequenceKeyValue pair in gameInfo.LoadedSoundSequences)

View File

@ -125,7 +125,7 @@ namespace HeavenStudio.Games
public class MrUpbeat : Minigame
{
static List<float> queuedInputs = new List<float>();
static List<double> queuedInputs = new();
[Header("References")]
[SerializeField] Animator metronomeAnim;
@ -180,7 +180,7 @@ namespace HeavenStudio.Games
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(input, delegate {
instance.metronomeAnim.DoScaledAnimationAsync("MetronomeGo" + dir, 0.5f);
Jukebox.PlayOneShotGame("mrUpbeat/metronome" + dir);
SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir);
ScheduleInput(input, 0.5f, InputType.STANDARD_DOWN, Success, Miss, Nothing);
if (MrUpbeat.shouldntStop) queuedInputs.Add(input + 1);
}),
@ -196,20 +196,20 @@ namespace HeavenStudio.Games
}
}
public static void Ding(float beat, bool applause, bool stopBlipping)
public static void Ding(double beat, bool applause, bool stopBlipping)
{
MrUpbeat.shouldntStop = false;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate {
MrUpbeat.isStepping = false;
Jukebox.PlayOneShotGame("mrUpbeat/ding");
if (applause) Jukebox.PlayOneShot("applause");
SoundByte.PlayOneShotGame("mrUpbeat/ding");
if (applause) SoundByte.PlayOneShot("applause");
if (stopBlipping) MrUpbeat.shouldBlip = false;
}),
});
}
public static void StartStepping(float beat, float length)
public static void StartStepping(double beat, float length)
{
if (MrUpbeat.isStepping) return;
MrUpbeat.isStepping = true;
@ -218,17 +218,17 @@ namespace HeavenStudio.Games
MrUpbeat.shouldBlip = true;
} else {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(MathF.Floor(beat), delegate {
new BeatAction.Action(Math.Floor(beat), delegate {
MrUpbeat.shouldBlip = true;
}),
});
}
MrUpbeat.shouldntStop = true;
queuedInputs.Add(MathF.Floor(beat+length));
queuedInputs.Add(Math.Floor(beat+length));
}
public static void Blipping(float beat, float length)
public static void Blipping(double beat, float length)
{
List<MultiSound.Sound> blips = new List<MultiSound.Sound>();
var switchGames = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" });
@ -242,8 +242,8 @@ namespace HeavenStudio.Games
}
}
for (int i = 0; i < switchGames[whichSwitch].beat - MathF.Floor(beat) - 0.5f; i++) {
blips.Add(new MultiSound.Sound("mrUpbeat/blip", MathF.Floor(beat) + 0.5f + i));
for (int i = 0; i < switchGames[whichSwitch].beat - Math.Floor(beat) - 0.5f; i++) {
blips.Add(new MultiSound.Sound("mrUpbeat/blip", Math.Floor(beat) + 0.5f + i));
}
MultiSound.Play(blips.ToArray(), forcePlay: true);

View File

@ -25,17 +25,17 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat
public void Blip()
{
float c = Conductor.instance.songPositionInBeats;
double c = Conductor.instance.songPositionInBeatsAsDouble;
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(MathF.Floor(c) + 0.5f, delegate {
new BeatAction.Action(Math.Floor(c) + 0.5f, delegate {
if (MrUpbeat.shouldBlip) {
Jukebox.PlayOneShotGame("mrUpbeat/blip");
SoundByte.PlayOneShotGame("mrUpbeat/blip");
blipAnim.Play("Blip"+(blipSize+1), 0, 0);
blipText.text = (blipSize == 4 && blipString != "") ? blipString : "";
if (shouldGrow && blipSize < 4) blipSize++;
}
}),
new BeatAction.Action(MathF.Floor(c) + 1f, delegate {
new BeatAction.Action(Math.Floor(c) + 1f, delegate {
Blip();
}),
});
@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat
anim.DoScaledAnimationAsync("Step", 0.5f);
letterAnim.DoScaledAnimationAsync(x ? "StepRight" : "StepLeft", 0.5f);
Jukebox.PlayOneShotGame("mrUpbeat/step");
SoundByte.PlayOneShotGame("mrUpbeat/step");
}
public void Fall()
@ -62,7 +62,7 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat
blipText.text = "";
anim.DoScaledAnimationAsync("Fall", 0.5f);
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
shadows[0].SetActive(false);
shadows[1].SetActive(false);
}

View File

@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk
public class Dumpling : MonoBehaviour
{
public Color dumplingColor;
public float startBeat;
public double startBeat;
const string sfxName = "munchyMonk/";
public bool canDestroy;
@ -47,14 +47,14 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk
{
smearSr.color = dumplingColor;
game.MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"slap");
SoundByte.PlayOneShotGame(sfxName+"slap");
game.isStaring = false;
if (state >= 1f || state <= -1f)
{
game.MonkAnim.DoScaledAnimationAsync("Barely", 0.5f);
anim.DoScaledAnimationAsync("HitHead", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"barely");
SoundByte.PlayOneShotGame(sfxName+"barely");
canDestroy = true;
game.needBlush = false;
} else {
@ -62,7 +62,7 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk
game.dumplings[0].anim.DoScaledAnimationAsync("FollowHand", 0.5f);
smearAnim.Play("SmearAppear", 0, 0);
game.needBlush = true;
Jukebox.PlayOneShotGame(sfxName+"gulp");
SoundByte.PlayOneShotGame(sfxName+"gulp");
MunchyMonk.howManyGulps++;
for (int i = 1; i <= 4; i++)
{
@ -89,8 +89,8 @@ namespace HeavenStudio.Games.Scripts_MunchyMonk
smearAnim.Play("SmearAppear", 0, 0);
anim.DoScaledAnimationAsync("HitHead", 0.5f);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxName+"slap", Conductor.instance.songPositionInBeats),
new MultiSound.Sound(sfxName+"miss", Conductor.instance.songPositionInBeats),
new MultiSound.Sound(sfxName+"slap", Conductor.instance.songPositionInBeatsAsDouble),
new MultiSound.Sound(sfxName+"miss", Conductor.instance.songPositionInBeatsAsDouble),
});
canDestroy = true;
game.needBlush = false;

View File

@ -153,7 +153,7 @@ namespace HeavenStudio.Games
static List<QueuedDumpling> queuedThrees = new List<QueuedDumpling>();
struct QueuedDumpling
{
public float beat;
public double beat;
public Color color1;
public Color color2;
public Color color3;
@ -189,7 +189,7 @@ namespace HeavenStudio.Games
[Header("Variables")]
[SerializeField] Sprite[] dumplingSprites;
public float lastReportedBeat = 0f;
public double lastReportedBeat = 0f;
public bool needBlush;
public bool isStaring;
bool monkBop = true;
@ -203,7 +203,7 @@ namespace HeavenStudio.Games
// the variables for scroll
bool scrollRampUp;
float scrollBeat;
double scrollBeat;
float scrollLength;
float scrollMod;
static float scrollModCurrent = 0;
@ -211,7 +211,7 @@ namespace HeavenStudio.Games
// the variables for the monk moving
bool isMoving;
float movingStartBeat;
double movingStartBeat;
float movingLength;
string moveAnim;
EasingFunction.Ease lastEase;
@ -256,7 +256,7 @@ namespace HeavenStudio.Games
// input stuff
if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) {
MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"slap");
SoundByte.PlayOneShotGame(sfxName+"slap");
isStaring = false;
// early input stuff
if (dumplings.Count != 0) InputFunctions(3);
@ -338,7 +338,7 @@ namespace HeavenStudio.Games
}
}
public void Bop(float beat, bool bop, bool autoBop)
public void Bop(double beat, bool bop, bool autoBop)
{
monkBop = autoBop;
if (bop) {
@ -378,7 +378,7 @@ namespace HeavenStudio.Games
public void Early(PlayerActionEvent caller) { }
public static void PreOneGoCue(float beat, Color firstColor)
public static void PreOneGoCue(double beat, Color firstColor)
{
PlaySoundSequence("munchyMonk", "one_go", beat);
@ -386,7 +386,7 @@ namespace HeavenStudio.Games
{ beat = beat, color1 = firstColor, });
}
public void OneGoCue(float beat, Color firstColor)
public void OneGoCue(double beat, Color firstColor)
{
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate {
@ -405,7 +405,7 @@ namespace HeavenStudio.Games
});
}
public static void PreTwoTwoCue(float beat, Color firstColor, Color secondColor)
public static void PreTwoTwoCue(double beat, Color firstColor, Color secondColor)
{
PlaySoundSequence("munchyMonk", "two_go", beat);
@ -416,7 +416,7 @@ namespace HeavenStudio.Games
});
}
public void TwoTwoCue(float beat, Color firstColor, Color secondColor)
public void TwoTwoCue(double beat, Color firstColor, Color secondColor)
{
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat-0.5f, delegate {
@ -443,7 +443,7 @@ namespace HeavenStudio.Games
});
}
public static void PreThreeGoCue(float beat, Color firstColor, Color secondColor, Color thirdColor)
public static void PreThreeGoCue(double beat, Color firstColor, Color secondColor, Color thirdColor)
{
PlaySoundSequence("munchyMonk", "three_go", beat);
@ -455,7 +455,7 @@ namespace HeavenStudio.Games
});
}
public void ThreeGoCue(float beat, Color firstColor, Color secondColor, Color thirdColor)
public void ThreeGoCue(double beat, Color firstColor, Color secondColor, Color thirdColor)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate {
@ -505,7 +505,7 @@ namespace HeavenStudio.Games
});
}
public void PlayMonkAnim(float beat, int whichAnim, bool vineBoom)
public void PlayMonkAnim(double beat, int whichAnim, bool vineBoom)
{
switch (whichAnim)
{
@ -520,15 +520,15 @@ namespace HeavenStudio.Games
}
// it's in zeo's video; no reason not to include it :)
if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
if (vineBoom) SoundByte.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
}
public void PlayMonkAnimInactive(bool vineBoom)
{
if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
if (vineBoom) SoundByte.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
}
public void MonkMove(float beat, float length, int goToSide, int ease)
public void MonkMove(double beat, float length, int goToSide, int ease)
{
movingStartBeat = beat;
movingLength = length;
@ -537,7 +537,7 @@ namespace HeavenStudio.Games
lastEase = (EasingFunction.Ease)ease;
}
public static void Modifiers(float beat, int inputsTilGrow, bool resetLevel, int setLevel, bool disableBaby, bool shouldBlush)
public static void Modifiers(double beat, int inputsTilGrow, bool resetLevel, int setLevel, bool disableBaby, bool shouldBlush)
{
if (MunchyMonk.inputsTilGrow != inputsTilGrow) MunchyMonk.howManyGulps = inputsTilGrow * MunchyMonk.growLevel;
if (setLevel != 0) MunchyMonk.growLevel = setLevel;
@ -555,7 +555,7 @@ namespace HeavenStudio.Games
MunchyMonk.instance.Baby.SetActive(!disableBaby);
}
public void ScrollBG(float beat, float length, float scrollSpeed, int ease)
public void ScrollBG(double beat, float length, float scrollSpeed, int ease)
{
scrollBeat = beat;
scrollLength = length;

View File

@ -16,8 +16,8 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
public bool isSqueezed;
public bool isPreparing;
public bool queuePrepare;
public float lastReportedBeat = 0f;
float lastSqueezeBeat;
public double lastReportedBeat = 0f;
double lastSqueezeBeat;
bool isActive = true;
private OctopusMachine game;
@ -42,13 +42,13 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
{
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN)) {
OctoAction("Squeeze");
Jukebox.PlayOneShotGame("nearMiss");
SoundByte.PlayOneShotGame("nearMiss");
game.hasMissed = true;
}
if (PlayerInput.PressedUp() && !game.IsExpectingInputNow(InputType.STANDARD_UP)) {
OctoAction(PlayerInput.Pressing(true) ? "Pop" : "Release");
Jukebox.PlayOneShotGame("nearMiss");
SoundByte.PlayOneShotGame("nearMiss");
game.hasMissed = true;
}
}
@ -79,6 +79,7 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
1 => "Happy",
2 => "Angry",
3 => "Oops",
_ => "Bop"
}, 0.5f);
isPreparing =
isSqueezed = false;
@ -99,8 +100,8 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
public void OctoAction(string action)
{
if (action != "Release" || (Conductor.instance.songPositionInBeats - lastSqueezeBeat) > 0.15f) Jukebox.PlayOneShotGame($"octopusMachine/{action.ToLower()}");
if (action == "Squeeze") lastSqueezeBeat = Conductor.instance.songPositionInBeats;
if (action != "Release" || (Conductor.instance.songPositionInBeatsAsDouble - lastSqueezeBeat) > 0.15f) SoundByte.PlayOneShotGame($"octopusMachine/{action.ToLower()}");
if (action == "Squeeze") lastSqueezeBeat = Conductor.instance.songPositionInBeatsAsDouble;
anim.DoScaledAnimationAsync(action, 0.5f);
isSqueezed = (action == "Squeeze");

View File

@ -188,13 +188,13 @@ namespace HeavenStudio.Games
int bopIterate = 0;
bool intervalStarted;
bool autoAction;
float intervalStartBeat;
double intervalStartBeat;
float beatInterval = 1f;
float lastReportedBeat;
double lastReportedBeat;
static List<float> queuedSqueezes = new List<float>();
static List<float> queuedReleases = new List<float>();
static List<float> queuedPops = new List<float>();
static List<double> queuedSqueezes = new();
static List<double> queuedReleases = new();
static List<double> queuedPops = new();
public static OctopusMachine instance;
@ -257,7 +257,7 @@ namespace HeavenStudio.Games
}
}
public static void Prepare(float beat, float prepBeats)
public static void Prepare(double beat, float prepBeats)
{
if (GameManager.instance.currentGame != "octopusMachine") {
OctopusMachine.queuePrepare = true;
@ -306,7 +306,7 @@ namespace HeavenStudio.Games
}
}
public void OctoAction(float beat, float length, string action)
public void OctoAction(double beat, float length, string action)
{
if (action != "Squeeze" && !octopodes[0].isSqueezed) return;
if (!intervalStarted) StartInterval(beat, length);
@ -319,7 +319,7 @@ namespace HeavenStudio.Games
queuedList.Add(beat - intervalStartBeat);
}
public void Bop(float length, int whichBop, bool singleBop, bool keepBop)
public void Bop(double length, int whichBop, bool singleBop, bool keepBop)
{
foreach (var octo in octopodes) {
if (singleBop) octo.PlayAnimation(whichBop);
@ -349,7 +349,7 @@ namespace HeavenStudio.Games
foreach (var octo in octopodes) octo.AnimationColor(octo.isSqueezed ? 1 : 0);
}
public void OctopusModifiers(float beat, float oct1x, float oct2x, float oct3x, float oct1y, float oct2y, float oct3y, bool oct1, bool oct2, bool oct3)
public void OctopusModifiers(double beat, float oct1x, float oct2x, float oct3x, float oct1y, float oct2y, float oct3y, bool oct1, bool oct2, bool oct3)
{
octopodes[0].OctopusModifiers(oct1x, oct1y, oct1);
octopodes[1].OctopusModifiers(oct2x, oct2y, oct2);
@ -361,7 +361,7 @@ namespace HeavenStudio.Games
foreach (var octo in octopodes) octo.ForceSqueeze();
}
public void StartInterval(float beat, float length)
public void StartInterval(double beat, float length)
{
intervalStartBeat = beat;
beatInterval = length;
@ -373,7 +373,7 @@ namespace HeavenStudio.Games
});
}
public void PassTurn(float beat)
public void PassTurn(double beat)
{
intervalStarted = false;
var queuedInputs = new List<BeatAction.Action>();
@ -402,19 +402,19 @@ namespace HeavenStudio.Games
private void SqueezeHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Squeeze");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss");
}
private void ReleaseHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Release");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss");
}
private void PopHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Pop");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
if (state <= -1f || state >= 1f) SoundByte.PlayOneShotGame("nearMiss");
}
private void Miss(PlayerActionEvent caller) { }

View File

@ -19,14 +19,14 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
public int row;
public int col;
float startJumpTime = Single.MinValue;
double startJumpTime = double.MinValue;
float jumpLength = 1f;
float jumpHeight = 4f;
int jumpAlt;
private bool hasJumped = false;
float startThrowTime = Single.MinValue;
double startThrowTime = double.MinValue;
float throwLength = 4f;
float throwHeight = 12f;
private bool hasThrown = false;
@ -73,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
Monkey.transform.rotation = Quaternion.Euler(0, 0, 0);
jumpAlt = 0;
}
startJumpTime = Single.MinValue;
startJumpTime = double.MinValue;
Monkey.transform.localPosition = new Vector3(0, 0);
Shadow.transform.localScale = new Vector3(1.2f, 0.8f, 1f);
}
@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
else
{
startThrowTime = Single.MinValue;
startThrowTime = double.MinValue;
if (hasThrown)
{
Projectile.transform.localPosition = new Vector3(0, 0);
@ -102,7 +102,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
}
public void Jump(float beat, int alt = 1)
public void Jump(double beat, int alt = 1)
{
startJumpTime = beat;
jumpAlt = 0;
@ -112,22 +112,22 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
}
public void Charge(float beat)
public void Charge(double beat)
{
anim.DoUnscaledAnimation("MonkeyReady");
}
public void Throw(float beat)
public void Throw(double beat)
{
anim.DoUnscaledAnimation("MonkeyThrow");
startThrowTime = beat;
Projectile.SetActive(true);
}
public void ReadySleep(float beat, int action)
public void ReadySleep(double beat, int action)
{
var cond = Conductor.instance;
startThrowTime = Single.MinValue;
startThrowTime = double.MinValue;
Projectile.transform.localPosition = new Vector3(0, 0);
Projectile.transform.rotation = Quaternion.Euler(0, 0, 0);
if (hasThrown)
@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
hasThrown = false;
}
startJumpTime = Single.MinValue;
startJumpTime = double.MinValue;
Monkey.transform.localPosition = new Vector3(0, 0);
Shadow.transform.localScale = new Vector3(1.2f, 0.8f, 1f);

View File

@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
public GameObject Projectile_Root;
public Animator anim;
float startJumpTime = Single.MinValue;
double startJumpTime = double.MinValue;
float jumpLength = 0;
float jumpHeight = 0;
bool jumpNg = false;
@ -27,7 +27,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
private bool charging = false;
private bool canCharge = true;
float startThrowTime = Single.MinValue;
double startThrowTime = double.MinValue;
float throwLength = 0;
float throwHeight = 0;
// true = throw, false = dropped ("Out")
@ -51,8 +51,8 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
if (PlayerInput.Pressed() && canJump && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_DOWN))
{
Jukebox.PlayOneShot("miss");
PlayerJump(cond.songPositionInBeats, true, false);
SoundByte.PlayOneShot("miss");
PlayerJump(cond.songPositionInBeatsAsDouble, true, false);
PajamaParty.instance.ScoreMiss();
}
if (PlayerInput.AltPressed() && canCharge)
@ -61,8 +61,8 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
if (PlayerInput.AltPressedUp() && charging && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_ALT_UP))
{
Jukebox.PlayOneShot("miss");
EndCharge(cond.songPositionInBeats, false, false);
SoundByte.PlayOneShot("miss");
EndCharge(cond.songPositionInBeatsAsDouble, false, false);
PajamaParty.instance.ScoreMiss();
}
@ -94,7 +94,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
anim.DoScaledAnimationAsync("MakoLand");
jumpNg = false;
}
startJumpTime = Single.MinValue;
startJumpTime = double.MinValue;
Player.transform.localPosition = new Vector3(0, 0);
Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f);
}
@ -118,7 +118,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
else
{
startThrowTime = Single.MinValue;
startThrowTime = double.MinValue;
Projectile_Root.transform.localPosition = new Vector3(0, 0);
if (hasThrown)
{
@ -133,7 +133,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
anim.DoUnscaledAnimation("MakoCatch");
}
//TODO: change when locales are a thing
Jukebox.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh
SoundByte.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh
Projectile.SetActive(false);
hasThrown = false;
@ -145,7 +145,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
}
public void ProjectileThrow(float beat, bool drop = false, bool ng = false)
public void ProjectileThrow(double beat, bool drop = false, bool ng = false)
{
throwNg = ng;
Projectile.SetActive(true);
@ -165,7 +165,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
}
public void PlayerJump(float beat, bool pressout = false, bool ng = false)
public void PlayerJump(double beat, bool pressout = false, bool ng = false)
{
startJumpTime = beat;
canCharge = false;
@ -184,7 +184,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
charging = true;
}
public void EndCharge(float beat, bool hit = true, bool ng = false)
public void EndCharge(double beat, bool hit = true, bool ng = false)
{
ProjectileThrow(beat, !hit, ng);
var cond = Conductor.instance;
@ -201,7 +201,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
beat + 0.5f,
delegate {
anim.DoScaledAnimationAsync("MakoPickUp");
Jukebox.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh
SoundByte.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh
Projectile.SetActive(false);
canCharge = true;
canJump = true;
@ -211,7 +211,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
}
public void PlayerThrough(float beat)
public void PlayerThrough(double beat)
{
var cond = Conductor.instance;
anim.DoScaledAnimationAsync("MakoThrough", 0.5f);
@ -231,7 +231,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
// jumping cues (timings for both are the same)
public void ScheduleJump(float beat)
public void ScheduleJump(double beat)
{
PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JumpJustOrNg, JumpThrough, JumpOut);
}
@ -243,13 +243,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
var cond = Conductor.instance;
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("miss");
PlayerJump(cond.songPositionInBeats, false, true);
SoundByte.PlayOneShot("miss");
PlayerJump(cond.songPositionInBeatsAsDouble, false, true);
}
else
{
Jukebox.PlayOneShotGame("pajamaParty/jumpJust");
PlayerJump(cond.songPositionInBeats, false, false);
SoundByte.PlayOneShotGame("pajamaParty/jumpJust");
PlayerJump(cond.songPositionInBeatsAsDouble, false, false);
}
caller.CanHit(false);
}
@ -262,13 +262,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
if (canJump)
{
var cond = Conductor.instance;
PlayerThrough(cond.songPositionInBeats);
PlayerThrough(cond.songPositionInBeatsAsDouble);
}
}
//////
// throw cue
public void ScheduleThrow(float beat)
public void ScheduleThrow(double beat)
{
PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, ChargeJustOrNg, ThrowThrough, JumpOut);
PajamaParty.instance.ScheduleInput(beat, 3f, InputType.STANDARD_ALT_UP, ThrowJustOrNg, ThrowThrough, JumpOut);
@ -277,7 +277,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
public void ChargeJustOrNg(PlayerActionEvent caller, float state) {
StartCharge();
throwNg = (state <= -1f || state >= 1f);
Jukebox.PlayOneShotGame("pajamaParty/throw4");
SoundByte.PlayOneShotGame("pajamaParty/throw4");
}
public void ThrowJustOrNg(PlayerActionEvent caller, float state)
@ -287,13 +287,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
var cond = Conductor.instance;
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("miss");
EndCharge(cond.songPositionInBeats, true, true);
SoundByte.PlayOneShot("miss");
EndCharge(cond.songPositionInBeatsAsDouble, true, true);
}
else
{
Jukebox.PlayOneShotGame("pajamaParty/throw5");
EndCharge(cond.songPositionInBeats, true, (throwNg || false));
SoundByte.PlayOneShotGame("pajamaParty/throw5");
EndCharge(cond.songPositionInBeatsAsDouble, true, (throwNg || false));
}
caller.CanHit(false);
}
@ -304,13 +304,13 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
if (canCharge)
{
var cond = Conductor.instance;
PlayerThrough(cond.songPositionInBeats);
PlayerThrough(cond.songPositionInBeatsAsDouble);
}
}
//
// sleep cue
public void StartSleepSequence(float beat, bool alt, int action)
public void StartSleepSequence(double beat, bool alt, int action)
{
if (hasJumped)
{
@ -318,12 +318,12 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
PajamaParty.instance.DoBedImpact();
jumpNg = false;
}
startJumpTime = Single.MinValue;
startJumpTime = double.MinValue;
Player.transform.localPosition = new Vector3(0, 0);
Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f);
Projectile.GetComponent<Animator>().Play("NoPose", -1, 0);
startThrowTime = Single.MinValue;
startThrowTime = double.MinValue;
Projectile_Root.transform.localPosition = new Vector3(0, 0);
Projectile.transform.rotation = Quaternion.Euler(0, 0, 0);
if (hasThrown)
@ -347,7 +347,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
anim.DoScaledAnimationAsync("MakoLand");
}
startJumpTime = Single.MinValue;
startJumpTime = double.MinValue;
Player.transform.localPosition = new Vector3(0, 0);
Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f);
@ -400,7 +400,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
anim.DoUnscaledAnimation("MakoSleepNg");
else
{
Jukebox.PlayOneShotGame("pajamaParty/siesta4");
SoundByte.PlayOneShotGame("pajamaParty/siesta4");
anim.DoScaledAnimationAsync("MakoSleepJust");
if (!longSleep)
@ -411,7 +411,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
caller.startBeat + 7f,
delegate {
anim.DoScaledAnimationAsync("MakoAwake");
Jukebox.PlayOneShotGame("pajamaParty/siestaDone");
SoundByte.PlayOneShotGame("pajamaParty/siestaDone");
}
),
});
@ -438,7 +438,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
if (canSleep)
{
anim.DoScaledAnimationAsync("MakoSleepOut", 0.5f);
Jukebox.PlayOneShotGame("pajamaParty/siestaBad");
SoundByte.PlayOneShotGame("pajamaParty/siestaBad");
caller.CanHit(false);
canSleep = false;
}

View File

@ -75,10 +75,10 @@ namespace HeavenStudio.Games
CtrPillowMonkey[,] monkeys;
//cues while unoaded
static float WantThreeJump = Single.MinValue;
static float WantFiveJump = Single.MinValue;
static float WantThrowSequence = Single.MinValue;
static float WantSleepSequence = Single.MinValue;
static double WantThreeJump = double.MinValue;
static double WantFiveJump = double.MinValue;
static double WantThrowSequence = double.MinValue;
static double WantSleepSequence = double.MinValue;
static bool WantSleepType = false;
static int WantSleepAction = (int) PajamaParty.SleepType.Normal;
@ -129,31 +129,31 @@ namespace HeavenStudio.Games
}
}
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
if (WantThreeJump != Single.MinValue)
if (WantThreeJump != double.MinValue)
{
DoThreeJump(WantThreeJump, false);
WantThreeJump = Single.MinValue;
WantThreeJump = double.MinValue;
}
if (WantFiveJump != Single.MinValue)
if (WantFiveJump != double.MinValue)
{
DoFiveJump(WantFiveJump, false);
WantFiveJump = Single.MinValue;
WantFiveJump = double.MinValue;
}
if (WantThrowSequence != Single.MinValue)
if (WantThrowSequence != double.MinValue)
{
DoThrowSequence(WantThrowSequence, false);
WantThrowSequence = Single.MinValue;
WantThrowSequence = double.MinValue;
}
if (WantSleepSequence != Single.MinValue)
if (WantSleepSequence != double.MinValue)
{
DoSleepSequence(WantSleepSequence, WantSleepType, WantSleepAction, false);
WantSleepSequence = Single.MinValue;
WantSleepSequence = double.MinValue;
}
}
public void DoThreeJump(float beat, bool doSound = true)
public void DoThreeJump(double beat, bool doSound = true)
{
Mako.ScheduleJump(beat);
if (doSound)
@ -188,7 +188,7 @@ namespace HeavenStudio.Games
});
}
public static void WarnThreeJump(float beat)
public static void WarnThreeJump(double beat)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/three1", beat),
@ -198,7 +198,7 @@ namespace HeavenStudio.Games
WantThreeJump = beat;
}
public void DoFiveJump(float beat, bool doSound = true)
public void DoFiveJump(double beat, bool doSound = true)
{
Mako.ScheduleJump(beat);
if (doSound)
@ -220,7 +220,7 @@ namespace HeavenStudio.Games
});
}
public static void WarnFiveJump(float beat)
public static void WarnFiveJump(double beat)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/five1", beat),
@ -232,7 +232,7 @@ namespace HeavenStudio.Games
WantFiveJump = beat;
}
public void DoThrowSequence(float beat, bool doSound = true)
public void DoThrowSequence(double beat, bool doSound = true)
{
Mako.ScheduleThrow(beat);
if (doSound)
@ -245,13 +245,13 @@ namespace HeavenStudio.Games
});
}
public static void WarnThrowSequence(float beat)
public static void WarnThrowSequence(double beat)
{
PlayThrowSequenceSound(beat, true);
WantThrowSequence = beat;
}
public static void PlayThrowSequenceSound(float beat, bool force = false)
public static void PlayThrowSequenceSound(double beat, bool force = false)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/throw1", beat),
@ -265,7 +265,7 @@ namespace HeavenStudio.Games
}, forcePlay: force);
}
public void DoSleepSequence(float beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal, bool doSound = true)
public void DoSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal, bool doSound = true)
{
var cond = Conductor.instance;
Mako.StartSleepSequence(beat, alt, action);
@ -280,7 +280,7 @@ namespace HeavenStudio.Games
});
}
public static void WarnSleepSequence(float beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal)
public static void WarnSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/siesta1", beat),
@ -299,7 +299,7 @@ namespace HeavenStudio.Games
Bed.GetComponent<Animator>().Play("BedImpact", -1, 0);
}
public void JumpRow(int row, float beat, int alt = 1)
public void JumpRow(int row, double beat, int alt = 1)
{
if (row > 4 || row < 0)
{
@ -314,7 +314,7 @@ namespace HeavenStudio.Games
}
}
public void JumpCol(int col, float beat, int alt = 1)
public void JumpCol(int col, double beat, int alt = 1)
{
if (col > 4 || col < 0)
{
@ -329,7 +329,7 @@ namespace HeavenStudio.Games
}
}
public void MonkeyCharge(float beat)
public void MonkeyCharge(double beat)
{
foreach (CtrPillowMonkey monkey in monkeys)
{
@ -340,7 +340,7 @@ namespace HeavenStudio.Games
}
}
public void MonkeyThrow(float beat)
public void MonkeyThrow(double beat)
{
foreach (CtrPillowMonkey monkey in monkeys)
{
@ -351,7 +351,7 @@ namespace HeavenStudio.Games
}
}
public void MonkeySleep(float beat, int action)
public void MonkeySleep(double beat, int action)
{
foreach (CtrPillowMonkey monkey in monkeys)
{

View File

@ -25,8 +25,8 @@ namespace HeavenStudio.Games
public ActionEventCallback OnDestroy; //Function to trigger whenever this event gets destroyed. /!\ Shouldn't be used for a minigame! Use OnMiss instead /!\
public float startBeat;
public float timer;
public double startBeat;
public double timer;
public bool isEligible = true;
public bool canHit = true; //Indicates if you can still hit the cue or not. If set to false, it'll guarantee a miss

View File

@ -170,8 +170,8 @@ namespace HeavenStudio.Games
bool intervalStarted;
bool shouldResetCount;
bool doingConsectiveIntervals;
float intervalStartBeat;
float playerIntervalStartBeat;
double intervalStartBeat;
double playerIntervalStartBeat;
float playerBeatInterval;
float beatInterval = 8f;
int currentStage;
@ -181,7 +181,7 @@ namespace HeavenStudio.Games
bool signExploded;
struct QueuedInput
{
public float beat;
public double beat;
public bool dpad;
}
static List<QueuedInput> queuedInputs = new List<QueuedInput>();
@ -237,7 +237,7 @@ namespace HeavenStudio.Games
currentStage = stage;
}
public void RandomPress(float beat, float length, int min, int max, int whichButtons, bool consecutive)
public void RandomPress(double beat, float length, int min, int max, int whichButtons, bool consecutive)
{
if (min > max) return;
int pressAmount = UnityEngine.Random.Range(min, max + 1);
@ -265,7 +265,7 @@ namespace HeavenStudio.Games
dpad = i % 2 != 0;
break;
}
float spawnBeat = beat + i * length;
double spawnBeat = beat + i * length;
buttonEvents.Add(new BeatAction.Action(spawnBeat, delegate { HostPressButton(spawnBeat, dpad); }));
}
}
@ -293,7 +293,7 @@ namespace HeavenStudio.Games
dpad = i % 2 != 0;
break;
}
float spawnBeat = beat + i * length;
double spawnBeat = beat + i * length;
buttonEvents.Add(new BeatAction.Action(spawnBeat, delegate { HostPressButton(spawnBeat, dpad); }));
pressAmount--;
}
@ -302,7 +302,7 @@ namespace HeavenStudio.Games
BeatAction.New(instance.gameObject, buttonEvents);
}
public void HostPressButton(float beat, bool dpad)
public void HostPressButton(double beat, bool dpad)
{
if (!intervalStarted)
{
@ -317,7 +317,7 @@ namespace HeavenStudio.Games
{
hostHead.DoScaledAnimationAsync("HostStage" + currentStage.ToString(), 0.5f);
}
Jukebox.PlayOneShotGame( dpad ? "quizShow/hostDPad" : "quizShow/hostA");
SoundByte.PlayOneShotGame( dpad ? "quizShow/hostDPad" : "quizShow/hostA");
if (dpad)
{
hostRightArmAnim.DoScaledAnimationAsync("HostRightHit", 0.5f);
@ -339,7 +339,7 @@ namespace HeavenStudio.Games
instance.hostRightArmAnim.DoScaledAnimationAsync("HostPrepare", 0.5f);
}
public void StartInterval(float beat, float interval)
public void StartInterval(double beat, float interval)
{
if (!intervalStarted)
{
@ -360,7 +360,7 @@ namespace HeavenStudio.Games
intervalStarted = true;
}
public void PassTurn(float beat, float length, bool timeUpSound, bool consecutive, bool visualClock, int audioClock)
public void PassTurn(double beat, float length, bool timeUpSound, bool consecutive, bool visualClock, int audioClock)
{
if (queuedInputs.Count == 0) return;
if (shouldPrepareArms)
@ -392,7 +392,7 @@ namespace HeavenStudio.Games
float timeUpBeat = 0f;
if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.Start)
{
Jukebox.PlayOneShotGame("quizShow/timerStart");
SoundByte.PlayOneShotGame("quizShow/timerStart");
timeUpBeat = 0.5f;
}
if (audioClock == (int)ClockAudio.End) timeUpBeat = 0.5f;
@ -403,7 +403,7 @@ namespace HeavenStudio.Games
{
if (!consecutive)
{
if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.End) Jukebox.PlayOneShotGame("quizShow/timerStop");
if (audioClock == (int)ClockAudio.Both || audioClock == (int)ClockAudio.End) SoundByte.PlayOneShotGame("quizShow/timerStop");
contesteeLeftArmAnim.DoScaledAnimationAsync("LeftRest", 0.5f);
contesteeRightArmAnim.DoScaledAnimationAsync("RightRest", 0.5f);
shouldPrepareArms = true;
@ -411,7 +411,7 @@ namespace HeavenStudio.Games
}
}
),
new BeatAction.Action(beat + length + beatInterval + timeUpBeat, delegate { if (timeUpSound && !consecutive) Jukebox.PlayOneShotGame("quizShow/timeUp"); })
new BeatAction.Action(beat + length + beatInterval + timeUpBeat, delegate { if (timeUpSound && !consecutive) SoundByte.PlayOneShotGame("quizShow/timeUp"); })
});
foreach (var input in queuedInputs)
{
@ -443,12 +443,12 @@ namespace HeavenStudio.Games
}
if (dpad)
{
Jukebox.PlayOneShotGame("quizShow/contestantDPad");
SoundByte.PlayOneShotGame("quizShow/contestantDPad");
contesteeLeftArmAnim.DoScaledAnimationAsync("LeftArmPress", 0.5f);
}
else
{
Jukebox.PlayOneShotGame("quizShow/contestantA");
SoundByte.PlayOneShotGame("quizShow/contestantA");
contesteeRightArmAnim.DoScaledAnimationAsync("RightArmHit", 0.5f);
}
pressCount++;
@ -477,7 +477,7 @@ namespace HeavenStudio.Games
{
case (int)ShouldExplode.Contestant:
if (contExploded) return;
Jukebox.PlayOneShotGame("quizShow/contestantExplode");
SoundByte.PlayOneShotGame("quizShow/contestantExplode");
firstDigitSr.color = new Color(1, 1, 1, 0);
secondDigitSr.color = new Color(1, 1, 1, 0);
contCounter.sprite = explodedCounter;
@ -486,7 +486,7 @@ namespace HeavenStudio.Games
break;
case (int)ShouldExplode.Host:
if (hostExploded) return;
Jukebox.PlayOneShotGame("quizShow/hostExplode");
SoundByte.PlayOneShotGame("quizShow/hostExplode");
hostFirstDigitSr.color = new Color(1, 1, 1, 0);
hostSecondDigitSr.color = new Color(1, 1, 1, 0);
hostCounter.sprite = explodedCounter;
@ -495,7 +495,7 @@ namespace HeavenStudio.Games
break;
case (int)ShouldExplode.Sign:
if (signExploded) return;
Jukebox.PlayOneShotGame("quizShow/signExplode");
SoundByte.PlayOneShotGame("quizShow/signExplode");
signExploded = true;
signExplosion.Play();
signAnim.Play("Exploded", 0, 0);
@ -503,14 +503,14 @@ namespace HeavenStudio.Games
}
}
public void RevealAnswer(float beat, float length)
public void RevealAnswer(double beat, float length)
{
blackOut.SetActive(true);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length, delegate
{
Jukebox.PlayOneShotGame("quizShow/answerReveal");
SoundByte.PlayOneShotGame("quizShow/answerReveal");
hostFirstDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 1)];
hostSecondDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 2)];
})
@ -523,26 +523,26 @@ namespace HeavenStudio.Games
blackOut.SetActive(false);
if (revealAnswer)
{
Jukebox.PlayOneShotGame("quizShow/answerReveal");
SoundByte.PlayOneShotGame("quizShow/answerReveal");
hostFirstDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 1)];
hostSecondDigitSr.sprite = hostNumberSprites[GetSpecificDigit(countToMatch, 2)];
}
if (pressCount == countToMatch)
{
Jukebox.PlayOneShotGame("quizShow/correct");
SoundByte.PlayOneShotGame("quizShow/correct");
contesteeHead.Play("ContesteeSmile", -1, 0);
hostHead.Play("HostSmile", -1, 0);
if (audience) Jukebox.PlayOneShotGame("quizShow/audienceCheer");
if (jingle) Jukebox.PlayOneShotGame("quizShow/correctJingle");
if (audience) SoundByte.PlayOneShotGame("quizShow/audienceCheer");
if (jingle) SoundByte.PlayOneShotGame("quizShow/correctJingle");
}
else
{
ScoreMiss();
Jukebox.PlayOneShotGame("quizShow/incorrect");
SoundByte.PlayOneShotGame("quizShow/incorrect");
contesteeHead.Play("ContesteeSad", -1, 0);
hostHead.Play("HostSad", -1, 0);
if (audience) Jukebox.PlayOneShotGame("quizShow/audienceSad");
if (jingle) Jukebox.PlayOneShotGame("quizShow/incorrectJingle");
if (audience) SoundByte.PlayOneShotGame("quizShow/audienceSad");
if (jingle) SoundByte.PlayOneShotGame("quizShow/incorrectJingle");
}
}

View File

@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
{
game.served = false;
var hitBeat = cond.songPositionInBeats;
var hitBeat = cond.songPositionInBeatsAsDouble;
var bounceBeat = game.serveBeat + game.targetBeat + 1f;
@ -60,12 +60,12 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
void NearMiss(float state)
{
MissBall();
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
game.missCurve.KeyPoints[0].Position = game.ball.transform.position;
game.missCurve.transform.localScale = new Vector3(-state, 1f, 1f);
game.missBeat = cond.songPositionInBeats;
game.missBeat = cond.songPositionInBeatsAsDouble;
game.ball.SetActive(true);
}
@ -88,7 +88,7 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Whistle", whistleBeat) });
}
public void BounceFX(float bounceBeat)
public void BounceFX(double bounceBeat)
{
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{

View File

@ -141,10 +141,10 @@ namespace HeavenStudio.Games
public bool missed;
public bool served;
public bool tossing;
public float serveBeat;
public float targetBeat;
public float tossBeat;
public float missBeat;
public double serveBeat;
public double targetBeat;
public double tossBeat;
public double missBeat;
public float tossLength;
private bool inPose;
@ -169,7 +169,7 @@ namespace HeavenStudio.Games
void Update()
{
var cond = Conductor.instance;
var currentBeat = cond.songPositionInBeats;
var currentBeat = cond.songPositionInBeatsAsDouble;
var hitBeat = serveBeat; // Beat when the last paddler hit the ball
var beatDur1 = 1f; // From paddle to table
@ -280,7 +280,7 @@ namespace HeavenStudio.Games
// Check if the opponent should swing.
if (!served && timeBeforeNextHit <= 0f)
{
var rallies = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally");
var rallies = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally");
for (int i = 0; i < rallies.Count; i++)
{
var rally = rallies[i];
@ -367,7 +367,7 @@ namespace HeavenStudio.Games
GameCamera.additionalFoV = cameraFOV;
}
public void Bop(float beat, float length, bool bop, bool bopAuto)
public void Bop(double beat, float length, bool bop, bool bopAuto)
{
goBop = bopAuto;
if (bop)
@ -399,7 +399,7 @@ namespace HeavenStudio.Games
opponentAnim.DoScaledAnimationAsync("Beat", 0.5f);
}
public void Serve(float beat, RallySpeed speed)
public void Serve(double beat, RallySpeed speed)
{
if (!ball.activeSelf)
ball.SetActive(true);
@ -416,7 +416,7 @@ namespace HeavenStudio.Games
serveBeat = beat;
rallySpeed = speed;
var bounceBeat = 0f;
double bounceBeat = 0f;
switch (rallySpeed)
{
@ -442,7 +442,7 @@ namespace HeavenStudio.Games
ScheduleInput(serveBeat, targetBeat, InputType.STANDARD_DOWN, paddlers.Just, paddlers.Miss, paddlers.Out);
}
public void Toss(float beat, float length, float height, bool firstToss = false)
public void Toss(double beat, float length, float height, bool firstToss = false)
{
// Hide trail while tossing to prevent weirdness while teleporting ball.
ballTrail.gameObject.SetActive(false);
@ -464,7 +464,7 @@ namespace HeavenStudio.Games
ball.SetActive(true);
}
private void TossUpdate(float beat, float duration)
private void TossUpdate(double beat, float duration)
{
var tossPosition = Conductor.instance.GetPositionFromBeat(beat, duration);
ball.transform.position = tossCurve.GetPoint(Mathf.Clamp(tossPosition, 0, 1));
@ -473,7 +473,7 @@ namespace HeavenStudio.Games
ball.SetActive(false);
}
public static void PlayWhistle(float beat)
public static void PlayWhistle(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -496,7 +496,7 @@ namespace HeavenStudio.Games
cameraPivot.DOScale(camZoom, len).SetEase(ease);
}
public void PrepareFastRally(float beat, RallySpeed speedChange, bool muteAudio = false)
public void PrepareFastRally(double beat, RallySpeed speedChange, bool muteAudio = false)
{
if (speedChange == RallySpeed.Fast)
{
@ -517,7 +517,7 @@ namespace HeavenStudio.Games
}
}
public static void TonkTinkTonkStretchable(float beat, float length)
public static void TonkTinkTonkStretchable(double beat, float length)
{
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>();
bool tink = false;
@ -529,13 +529,13 @@ namespace HeavenStudio.Games
MultiSound.Play(soundsToPlay.ToArray(), forcePlay: true);
}
public void SuperFastRallyStretchable(float beat, float length)
public void SuperFastRallyStretchable(double beat, float length)
{
List<BeatAction.Action> servesToPerform = new List<BeatAction.Action>();
for (int i = 0; i < length; i += 2)
{
float beatToSpawn = beat + i;
double beatToSpawn = beat + i;
servesToPerform.Add( new BeatAction.Action(beatToSpawn, delegate { Serve(beatToSpawn, RallySpeed.SuperFast); }) );
}
BeatAction.New(gameObject, servesToPerform);

View File

@ -95,7 +95,7 @@ namespace HeavenStudio.Games
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
Jukebox.PlayOneShotGame("rhythmSomen/somen_mistake");
SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake");
FrontArm.Play("ArmPluck", -1, 0);
backArm.Play("BackArmNothing", 0, 0);
hasSlurped = false;
@ -104,7 +104,7 @@ namespace HeavenStudio.Games
}
}
public void Slurp(float beat)
public void Slurp(double beat)
{
if (!missed)
{
@ -125,7 +125,7 @@ namespace HeavenStudio.Games
}
}
public void ToggleBop(float beat, float length, bool bopOrNah, bool autoBop)
public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop)
{
shouldBop = autoBop;
if (bopOrNah)
@ -143,7 +143,7 @@ namespace HeavenStudio.Games
}
}
public void DoFarCrane(float beat)
public void DoFarCrane(double beat)
{
//Far Drop Multisound
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
@ -162,7 +162,7 @@ namespace HeavenStudio.Games
}
public void DoCloseCrane(float beat)
public void DoCloseCrane(double beat)
{
//Close Drop Multisound
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
@ -181,7 +181,7 @@ namespace HeavenStudio.Games
}
public void DoBothCrane(float beat)
public void DoBothCrane(double beat)
{
//Both Drop Multisound
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
@ -205,10 +205,10 @@ namespace HeavenStudio.Games
}
public void DoBell(float beat)
public void DoBell(double beat)
{
//Bell Sound lol
Jukebox.PlayOneShotGame("rhythmSomen/somen_bell");
SoundByte.PlayOneShotGame("rhythmSomen/somen_bell");
BeatAction.New(Player, new List<BeatAction.Action>()
{
@ -224,14 +224,14 @@ namespace HeavenStudio.Games
splashEffect.Play();
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame("rhythmSomen/somen_splash");
SoundByte.PlayOneShotGame("rhythmSomen/somen_splash");
FrontArm.Play("ArmPluckNG", -1, 0);
EffectSweat.Play("BlobSweating", -1, 0);
missed = true;
return;
}
Jukebox.PlayOneShotGame("rhythmSomen/somen_catch");
Jukebox.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f);
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch");
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f);
FrontArm.Play("ArmPluckOK", -1, 0);
EffectHit.Play("HitAppear", -1, 0);
missed = false;

View File

@ -7,7 +7,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
{
public class Hair : MonoBehaviour
{
public float createBeat;
public double createBeat;
public GameObject hairSprite;
public GameObject stubbleSprite;
public GameObject missedSprite;
@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
tweezers = game.Tweezers;
}
public void StartInput(float beat, float length)
public void StartInput(double beat, double length)
{
game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out);
}

View File

@ -9,7 +9,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
{
public class LongHair : MonoBehaviour
{
public float createBeat;
public double createBeat;
public GameObject hairSprite;
public GameObject stubbleSprite;
private RhythmTweezers game;
@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
private Sound pullSound;
private float inputBeat;
private double inputBeat;
PlayerActionEvent endEvent;
@ -33,7 +33,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
tweezers = game.Tweezers;
}
public void StartInput(float beat, float length)
public void StartInput(double beat, double length)
{
inputBeat = beat + length;
game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, StartJust, StartMiss, Out);
@ -94,7 +94,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
pluckState = -1;
return;
}
pullSound = Jukebox.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}");
pullSound = SoundByte.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}");
pluckState = 1;
endEvent = game.ScheduleInput(inputBeat, 0.5f, InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP, EndJust, Out, Out);
}

View File

@ -7,7 +7,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
{
public class NoPeekingSign : MonoBehaviour
{
private float peekBeat = -1;
private double peekBeat = -1;
private bool peekRising;
private bool shouldDelete;
private Animator anim;
@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
sr = GetComponent<SpriteRenderer>();
}
public void Init(float beat, float length, int type)
public void Init(double beat, float length, int type)
{
peekBeat = beat - 1;
peekRising = true;

View File

@ -152,7 +152,7 @@ namespace HeavenStudio.Games
private struct QueuedPeek
{
public float beat;
public double beat;
public float length;
public int type;
}
@ -174,8 +174,8 @@ namespace HeavenStudio.Games
[NonSerialized] public int hairsLeft = 0;
[Header("Variables")]
private float passTurnBeat;
private float passTurnEndBeat = 2;
private double passTurnBeat;
private double passTurnEndBeat = 2;
private static List<QueuedPeek> queuedPeeks = new List<QueuedPeek>();
[Header("Sprites")]
@ -226,7 +226,7 @@ namespace HeavenStudio.Games
private List<Hair> spawnedHairs = new List<Hair>();
private List<LongHair> spawnedLongs = new List<LongHair>();
private static List<float> passedTurns = new List<float>();
private static List<double> passedTurns = new();
private void Awake()
{
@ -245,7 +245,7 @@ namespace HeavenStudio.Games
spawnedHairs.Add(hair);
hair.gameObject.SetActive(true);
hair.GetComponent<Animator>().Play("SmallAppear", 0, 1);
float rot = -58f + 116 * Mathp.Normalize(crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
hair.transform.eulerAngles = new Vector3(0, 0, rot);
hair.createBeat = crEvent.beat;
}
@ -255,7 +255,7 @@ namespace HeavenStudio.Games
spawnedLongs.Add(hair);
hair.gameObject.SetActive(true);
hair.GetComponent<Animator>().Play("LongAppear", 0, 1);
float rot = -58f + 116 * Mathp.Normalize(crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
hair.transform.eulerAngles = new Vector3(0, 0, rot);
hair.createBeat = crEvent.beat;
}
@ -275,7 +275,7 @@ namespace HeavenStudio.Games
}
}
public static void SpawnHairInactive(float beat)
public static void SpawnHairInactive(double beat)
{
if (crHandlerInstance == null)
{
@ -285,7 +285,7 @@ namespace HeavenStudio.Games
crHandlerInstance.AddEvent(beat, 0, "Hair");
}
public static void SpawnLongHairInactive(float beat)
public static void SpawnLongHairInactive(double beat)
{
if (crHandlerInstance == null)
{
@ -295,7 +295,7 @@ namespace HeavenStudio.Games
crHandlerInstance.AddEvent(beat, 0.5f, "Long");
}
public void SpawnHair(float beat)
public void SpawnHair(double beat)
{
if (crHandlerInstance.queuedEvents.Count > 0 && crHandlerInstance.queuedEvents.Find(x => x.beat == beat || (beat >= x.beat && beat <= x.beat + x.length)) != null) return;
// End transition early if the next hair is a lil early.
@ -303,7 +303,7 @@ namespace HeavenStudio.Games
crHandlerInstance.AddEvent(beat, 0, "Hair");
Jukebox.PlayOneShotGame("rhythmTweezers/shortAppear", beat);
SoundByte.PlayOneShotGame("rhythmTweezers/shortAppear", beat);
Hair hair = Instantiate(hairBase, HairsHolder.transform).GetComponent<Hair>();
spawnedHairs.Add(hair);
hair.gameObject.SetActive(true);
@ -314,14 +314,14 @@ namespace HeavenStudio.Games
hair.createBeat = beat;
}
public void SpawnLongHair(float beat)
public void SpawnLongHair(double beat)
{
if (crHandlerInstance.queuedEvents.Count > 0 && crHandlerInstance.queuedEvents.Find(x => x.beat == beat || (beat >= x.beat && beat <= x.beat + x.length)) != null) return;
StopTransitionIfActive();
crHandlerInstance.AddEvent(beat, 0.5f, "Long");
Jukebox.PlayOneShotGame("rhythmTweezers/longAppear", beat);
SoundByte.PlayOneShotGame("rhythmTweezers/longAppear", beat);
LongHair hair = Instantiate(longHairBase, HairsHolder.transform).GetComponent<LongHair>();
spawnedLongs.Add(hair);
hair.gameObject.SetActive(true);
@ -332,7 +332,7 @@ namespace HeavenStudio.Games
hair.createBeat = beat;
}
public void SetIntervalStart(float beat, float interval = 4f)
public void SetIntervalStart(double beat, float interval = 4f)
{
StopTransitionIfActive();
hairsLeft = 0;
@ -340,7 +340,7 @@ namespace HeavenStudio.Games
crHandlerInstance.StartInterval(beat, interval);
}
public static void InactiveInterval(float beat, float interval)
public static void InactiveInterval(double beat, float interval)
{
if (crHandlerInstance == null)
{
@ -349,7 +349,7 @@ namespace HeavenStudio.Games
crHandlerInstance.StartInterval(beat, interval);
}
public void PassTurn(float beat, float length)
public void PassTurn(double beat, float length)
{
if (crHandlerInstance.queuedEvents.Count > 0)
{
@ -371,7 +371,7 @@ namespace HeavenStudio.Games
}
}
public static void PrePassTurn(float beat, float length)
public static void PrePassTurn(double beat, float length)
{
if (GameManager.instance.currentGame == "rhythmTweezers")
{
@ -383,7 +383,7 @@ namespace HeavenStudio.Games
}
}
private void SetPassTurnValues(float startBeat)
private void SetPassTurnValues(double startBeat)
{
if (crHandlerInstance.intervalLength <= 0) return;
passTurnBeat = startBeat - 1f;
@ -391,11 +391,11 @@ namespace HeavenStudio.Games
}
const float vegDupeOffset = 16.7f;
public void NextVegetable(float beat, int type, Color onionColor, Color potatoColor)
public void NextVegetable(double beat, int type, Color onionColor, Color potatoColor)
{
transitioning = true;
Jukebox.PlayOneShotGame("rhythmTweezers/register", beat);
SoundByte.PlayOneShotGame("rhythmTweezers/register", beat);
Sprite nextVeggieSprite = type == 0 ? onionSprite : potatoSprite;
Color nextColor = type == 0 ? onionColor : potatoColor;
@ -456,7 +456,7 @@ namespace HeavenStudio.Games
ChangeBackgroundColor(end, beats);
}
public static void PreNoPeeking(float beat, float length, int type)
public static void PreNoPeeking(double beat, float length, int type)
{
if (GameManager.instance.currentGame == "rhythmTweezers")
{
@ -473,7 +473,7 @@ namespace HeavenStudio.Games
}
}
public void NoPeeking(float beat, float length, int type)
public void NoPeeking(double beat, float length, int type)
{
NoPeekingSign spawnedNoPeekingSign = Instantiate(noPeekingRef, transform);
spawnedNoPeekingSign.gameObject.SetActive(true);
@ -509,7 +509,7 @@ namespace HeavenStudio.Games
var tweezerAngle = -180f;
var tweezerTime = Conductor.instance.songPositionInBeats;
var unclampedAngle = -58f + 116 * Mathp.Normalize(tweezerTime, passTurnBeat + 1f, passTurnEndBeat - 1f);
var unclampedAngle = -58f + 116 * Mathp.Normalize(tweezerTime, (float)passTurnBeat + 1f, (float)passTurnEndBeat - 1f);
tweezerAngle = Mathf.Clamp(unclampedAngle, -180f, 180f);
Tweezers.transform.eulerAngles = new Vector3(0, 0, tweezerAngle);

View File

@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
if (ace)
{
Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}");
SoundByte.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}");
hair.hairSprite.SetActive(false);
hair.stubbleSprite.SetActive(true);
@ -63,8 +63,8 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
}
else
{
Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}");
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShotGame($"rhythmTweezers/shortPluck{UnityEngine.Random.Range(1, 21)}");
SoundByte.PlayOneShot("miss");
hair.hairSprite.SetActive(false);
hair.missedSprite.SetActive(true);
@ -84,7 +84,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
if (ace)
{
Jukebox.PlayOneShotGame("rhythmTweezers/longPullEnd");
SoundByte.PlayOneShotGame("rhythmTweezers/longPullEnd");
hair.hairSprite.SetActive(false);
hair.stubbleSprite.SetActive(true);

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -41,7 +42,7 @@ namespace HeavenStudio.Games.Loaders
new Param("variant", Ringside.PoseForTheFansVariant.Random, "Variant", "Which variant of the cue do you wish to play."),
new Param("keepZoomedOut", false, "Keep Zoomed Out", "Whether the camera should keep being zoomed out after the event has completed."),
new Param("newspaperBeats", new EntityTypes.Float(0, 80, 0), "Newspaper Beats", "How many beats should the newspaper stay for?"),
new Param("ease", EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"),
new Param("ease", Util.EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"),
},
defaultLength = 4f
},
@ -119,7 +120,7 @@ namespace HeavenStudio.Games
public static List<QueuedPose> queuedPoses = new List<QueuedPose>();
public struct QueuedPose
{
public float beat;
public double beat;
public bool keepZoomedOut;
public float newspaperBeats;
}
@ -149,12 +150,12 @@ namespace HeavenStudio.Games
private bool keepZoomOut;
private Sound kidsLaugh;
private int currentPose;
private EasingFunction.Ease lastEase;
private Util.EasingFunction.Ease lastEase;
private GameObject currentNewspaper;
private int currentZoomIndex;
private List<DynamicBeatmap.DynamicEntity> allCameraEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> allCameraEvents = new List<RiqEntity>();
public GameEvent bop = new GameEvent();
@ -163,7 +164,7 @@ namespace HeavenStudio.Games
void OnDestroy()
{
if (queuedPoses.Count > 0) queuedPoses.Clear();
Jukebox.KillLoop(kidsLaugh, 2f);
SoundByte.KillLoop(kidsLaugh, 2f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
@ -179,10 +180,10 @@ namespace HeavenStudio.Games
{
instance = this;
var camEvents = EventCaller.GetAllInGameManagerList("ringside", new string[] { "poseForTheFans" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(camEvents[i]);
}
@ -220,7 +221,7 @@ namespace HeavenStudio.Games
Ringside.instance.ScoreMiss(0.5);
wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f);
Jukebox.PlayOneShotGame($"ringside/confusedanswer");
SoundByte.PlayOneShotGame($"ringside/confusedanswer");
if (reporterAnim.IsPlayingAnimationName("IdleReporter")) reporterAnim.Play("IdleLate", 0, 0);
}
if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN) && !shouldNotInput)
@ -230,12 +231,12 @@ namespace HeavenStudio.Games
int randomPose = UnityEngine.Random.Range(1, 7);
wrestlerAnim.Play($"Pose{randomPose}", 0, 0);
reporterAnim.Play("FlinchReporter", 0, 0);
Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
Jukebox.PlayOneShotGame("ringside/barely");
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
SoundByte.PlayOneShotGame("ringside/barely");
wrestlerTransform.localScale = new Vector3(1.1f, 1.1f, 1f);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
new BeatAction.Action(cond.songPositionInBeatsAsDouble + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
});
}
}
@ -243,7 +244,7 @@ namespace HeavenStudio.Games
{
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{
if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat)
if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat)
{
UpdateCameraZoom();
currentZoomIndex++;
@ -265,7 +266,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
float newPosX = func(lastCamPos.x, currentCamPos.x, normalizedBeat);
float newPosY = func(lastCamPos.y, currentCamPos.y, normalizedBeat);
float newPosZ = func(lastCamPos.z + 10, currentCamPos.z + 10, normalizedBeat);
@ -292,7 +293,7 @@ namespace HeavenStudio.Games
}
public void ToggleBop(float beat, float length, bool startBopping, bool autoBop)
public void ToggleBop(double beat, float length, bool startBopping, bool autoBop)
{
shouldBop = autoBop;
if (startBopping)
@ -332,7 +333,7 @@ namespace HeavenStudio.Games
}
}
public void Question(float beat, bool alt, int questionVariant, float length = 4f)
public void Question(double beat, bool alt, int questionVariant, float length = 4f)
{
if (length <= 2f) return;
int currentQuestion = questionVariant;
@ -366,7 +367,7 @@ namespace HeavenStudio.Games
ThatTrue(beat + totalExtend, currentQuestion);
}
public void PreQuestion(float beat, int questionVariant, float length = 4f)
public void PreQuestion(double beat, int questionVariant, float length = 4f)
{
if (GameManager.instance.currentGame != "ringside") return;
if (instance == null) return;
@ -382,7 +383,7 @@ namespace HeavenStudio.Games
}
}
public void ThatTrue(float beat, int currentQuestion)
public void ThatTrue(double beat, int currentQuestion)
{
MultiSound.Play(new MultiSound.Sound[]
{
@ -396,7 +397,7 @@ namespace HeavenStudio.Games
});
}
public void BigGuy(float beat, int questionVariant)
public void BigGuy(double beat, int questionVariant)
{
int currentQuestion = questionVariant;
if (currentQuestion == (int)QuestionVariant.Random) currentQuestion = UnityEngine.Random.Range(1, 4);
@ -420,7 +421,7 @@ namespace HeavenStudio.Games
});
}
public static void PoseForTheFans(float beat, bool and, int variant, bool keepZoomedOut, float newspaperBeats)
public static void PoseForTheFans(double beat, bool and, int variant, bool keepZoomedOut, float newspaperBeats)
{
if (and)
{
@ -448,7 +449,7 @@ namespace HeavenStudio.Games
}
}
public void QueuePose(float beat, bool keepZoomedOut, float newspaperBeats)
public void QueuePose(double beat, bool keepZoomedOut, float newspaperBeats)
{
if (newspaperBeats > 0)
{
@ -496,7 +497,7 @@ namespace HeavenStudio.Games
{
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
}
else
{
@ -510,7 +511,7 @@ namespace HeavenStudio.Games
blackVoid.color = new Color(1f, 1f, 1f, 0);
Destroy(currentNewspaper); currentNewspaper = null;
lastCamPos = new Vector3(0, 0, -10);
Jukebox.KillLoop(kidsLaugh, 0.25f);
SoundByte.KillLoop(kidsLaugh, 0.25f);
keepZoomOut = false;
})
});
@ -562,7 +563,7 @@ namespace HeavenStudio.Games
{
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
}
else
{
@ -575,7 +576,7 @@ namespace HeavenStudio.Games
{
blackVoid.color = new Color(1f, 1f, 1f, 0);
Destroy(currentNewspaper); currentNewspaper = null;
Jukebox.KillLoop(kidsLaugh, 0.25f);
SoundByte.KillLoop(kidsLaugh, 0.25f);
})
});
}
@ -586,13 +587,13 @@ namespace HeavenStudio.Games
{
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{
currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat;
currentZoomCamBeat = (float)allCameraEvents[currentZoomIndex].beat;
currentCamPos = new Vector3(poseFlash.transform.position.x, poseFlash.transform.position.y, -21.5f);
lastEase = (EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"];
lastEase = (Util.EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"];
}
}
public void PoseCheck(float beat)
public void PoseCheck(double beat)
{
ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, JustPoseForTheFans, MissPose, Nothing);
}
@ -658,9 +659,9 @@ namespace HeavenStudio.Games
if (state >= 1f || state <= -1f)
{
wrestlerAnim.DoScaledAnimationAsync("Cough", 0.5f);
Jukebox.PlayOneShotGame($"ringside/cough");
SoundByte.PlayOneShotGame($"ringside/cough");
reporterAnim.Play("ExtendMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }),
@ -675,10 +676,10 @@ namespace HeavenStudio.Games
{
wrestlerAnim.DoScaledAnimationAsync("Ye", 0.5f);
reporterAnim.Play("ExtendSmile", 0, 0);
Jukebox.PlayOneShotGame($"ringside/ye{UnityEngine.Random.Range(1, 4)}");
SoundByte.PlayOneShotGame($"ringside/ye{UnityEngine.Random.Range(1, 4)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { Jukebox.PlayOneShotGame("ringside/yeCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { SoundByte.PlayOneShotGame("ringside/yeCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { flashObject.SetActive(true); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("SmileReporter", 0, 0); }),
@ -692,7 +693,7 @@ namespace HeavenStudio.Games
if (state >= 1f || state <= -1f)
{
missedBigGuy = true;
Jukebox.PlayOneShotGame($"ringside/muscles1");
SoundByte.PlayOneShotGame($"ringside/muscles1");
wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f);
return;
}
@ -702,7 +703,7 @@ namespace HeavenStudio.Games
public void SuccessBigGuyFirst()
{
missedBigGuy = false;
Jukebox.PlayOneShotGame($"ringside/muscles1");
SoundByte.PlayOneShotGame($"ringside/muscles1");
wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f);
}
@ -710,7 +711,7 @@ namespace HeavenStudio.Games
{
if (state >= 1f || state <= -1f)
{
Jukebox.PlayOneShotGame($"ringside/muscles2");
SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
if (!missedBigGuy)
{
@ -722,7 +723,7 @@ namespace HeavenStudio.Games
else
{
reporterAnim.Play("ExtendMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }),
@ -757,14 +758,14 @@ namespace HeavenStudio.Games
public void SuccessBigGuySecond(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame($"ringside/muscles2");
SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
if (!missedBigGuy)
{
reporterAnim.Play("ExtendSmile", 0, 0);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { Jukebox.PlayOneShotGame("ringside/musclesCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { SoundByte.PlayOneShotGame("ringside/musclesCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("SmileReporter", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { flashObject.SetActive(true); }),
@ -813,9 +814,9 @@ namespace HeavenStudio.Games
wrestlerTransform.localScale = new Vector3(1.2f, 1.2f, 1f);
int randomPose = UnityEngine.Random.Range(1, 7);
wrestlerAnim.Play($"Pose{randomPose}", 0, 0);
Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
reporterAnim.Play("IdleMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
@ -840,14 +841,14 @@ namespace HeavenStudio.Games
reporterAnim.Play("ExcitedReporter", 0, 0);
}
hitPose = true;
Jukebox.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}");
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}");
FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 1f);
FadeBGColor(Color.black, defaultBGColorLight, 1f);
flashParticles.Play();
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { Jukebox.PlayOneShotGame("ringside/poseCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { SoundByte.PlayOneShotGame("ringside/poseCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { flashParticles.Stop(); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { poseFlash.SetActive(true); poseFlash.GetComponent<Animator>().Play("PoseFlashing", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1.99f, delegate { poseFlash.SetActive(false); }),
@ -857,7 +858,7 @@ namespace HeavenStudio.Games
public void Miss(PlayerActionEvent caller)
{
reporterAnim.Play("ExtendMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }),
@ -873,7 +874,7 @@ namespace HeavenStudio.Games
public void MissBigGuyTwo(PlayerActionEvent caller)
{
reporterAnim.Play("ExtendMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleMiss", 0, 0); }),
@ -886,7 +887,7 @@ namespace HeavenStudio.Games
{
shouldNotInput = true;
reporterAnim.Play("IdleMiss", 0, 0);
Jukebox.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
}
public void Nothing(PlayerActionEvent caller){}

View File

@ -11,7 +11,7 @@ namespace HeavenStudio.Games.Scripts_Rockers
private Rockers game;
public void Init(int pitch, float beat, float length)
public void Init(int pitch, double beat, double length)
{
game = Rockers.instance;
this.pitch = pitch;

Some files were not shown because too many files have changed in this diff Show More