diff --git a/Assets/Resources/Games/builtToScaleRvl.prefab b/Assets/Resources/Games/builtToScaleRvl.prefab
index 0795f35bc..b9e7c25af 100644
--- a/Assets/Resources/Games/builtToScaleRvl.prefab
+++ b/Assets/Resources/Games/builtToScaleRvl.prefab
@@ -848,7 +848,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
anim:
- beat: 0
+ startBeat: 0
+ targetBeat: 0
+ lengthBeat: 1
+ endTime: 0
CorrectionPos: {x: 0, y: 0, z: 0}
--- !u!1 &3874033564999961301
GameObject:
@@ -1015,7 +1018,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
anim: left
- beat: 0
+ startBeat: 0
+ targetBeat: 0
+ lengthBeat: 1
+ endTime: 0
CorrectionPos: {x: -1.05, y: -0.35, z: 0}
--- !u!1 &4297759502551424643
GameObject:
@@ -1896,7 +1902,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
anim: right
- beat: 0
+ startBeat: 0
+ targetBeat: 0
+ lengthBeat: 1
+ endTime: 0
CorrectionPos: {x: 1.05, y: 0.35, z: 0}
--- !u!1 &6653269419284669817
GameObject:
@@ -2376,7 +2385,24 @@ MonoBehaviour:
- {fileID: 7974195531122437616}
- {fileID: 1415654153951215528}
- {fileID: 8876360381322288673}
+ - {fileID: 7732616979370467335}
+ - {fileID: 4733386687323095054}
+ - {fileID: 7142933854593701553}
+ - {fileID: 7110902958981490997}
+ - {fileID: 1007345949211835958}
+ - {fileID: 4720133106070728448}
+ - {fileID: 6518252185505850527}
+ - {fileID: 6608112072489973098}
+ - {fileID: 8318125649010820945}
+ - {fileID: 5373921079827997255}
+ - {fileID: 6115912429990493611}
+ - {fileID: 9069944594757536811}
+ - {fileID: 663361784237137429}
- {fileID: 5864016952948325823}
+ isShoot: 0
+ Squares: []
+ time: 0
+ shootTime: 2147483647
--- !u!95 &863865117502866643
Animator:
serializedVersion: 5
@@ -2479,7 +2505,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 2807044864243222978, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
propertyPath: m_Name
- value: 01curve
+ value: 01curveIn
objectReference: {fileID: 0}
- target: {fileID: 8266772254636404776, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
propertyPath: m_RootOrder
@@ -2689,6 +2715,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
+--- !u!114 &4720133106070728448 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 5239190577309937025, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
+ m_PrefabInstance: {fileID: 663172772084171393}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &8902888103906226857 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8266772254636404776, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
@@ -2703,7 +2740,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 2163235865272922153, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
propertyPath: m_Name
- value: 04curve
+ value: 04curveIn
objectReference: {fileID: 0}
- target: {fileID: 5352671577355782595, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
propertyPath: m_RootOrder
@@ -2756,6 +2793,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5352671577355782595, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
m_PrefabInstance: {fileID: 980176682254719041}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &9069944594757536811 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 8089771091315561578, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
+ m_PrefabInstance: {fileID: 980176682254719041}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1001 &1058256478984044433
PrefabInstance:
m_ObjectHideFlags: 0
@@ -2765,7 +2813,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 4276990550886444728, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
propertyPath: m_Name
- value: 35curve
+ value: 35curveIn
objectReference: {fileID: 0}
- target: {fileID: 8004925964111632210, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
propertyPath: m_RootOrder
@@ -2813,6 +2861,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+--- !u!114 &6608112072489973098 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 6132517591490841339, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+ m_PrefabInstance: {fileID: 1058256478984044433}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &7041548894936082627 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8004925964111632210, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
@@ -2894,7 +2953,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 942254975755547679, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
propertyPath: m_Name
- value: 03curve
+ value: 03curveIn
objectReference: {fileID: 0}
- target: {fileID: 6439679169686523381, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
propertyPath: m_RootOrder
@@ -2947,6 +3006,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6439679169686523381, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
m_PrefabInstance: {fileID: 1170263691098543885}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &8318125649010820945 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 7156914238255812700, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
+ m_PrefabInstance: {fileID: 1170263691098543885}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1001 &1351119202435238174
PrefabInstance:
m_ObjectHideFlags: 0
@@ -3020,6 +3090,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
+--- !u!114 &6518252185505850527 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 5239190577309937025, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
+ m_PrefabInstance: {fileID: 1351119202435238174}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &6951686805690579254 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8266772254636404776, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
@@ -3082,6 +3163,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+--- !u!114 &5373921079827997255 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 6132517591490841339, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+ m_PrefabInstance: {fileID: 2274059417958017212}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &8113271276155977710 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8004925964111632210, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
@@ -3096,7 +3188,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 2807044864243222978, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
propertyPath: m_Name
- value: 45curve
+ value: 45curveIn
objectReference: {fileID: 0}
- target: {fileID: 8266772254636404776, guid: cadf711cd33934d419a06e0a8767025e, type: 3}
propertyPath: m_RootOrder
@@ -3169,7 +3261,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 942254975755547679, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
propertyPath: m_Name
- value: 25curve
+ value: 25curveIn
objectReference: {fileID: 0}
- target: {fileID: 6439679169686523381, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
propertyPath: m_RootOrder
@@ -3217,6 +3309,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
+--- !u!114 &6115912429990493611 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 7156914238255812700, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
+ m_PrefabInstance: {fileID: 4013378413297855991}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &7992821099441364994 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6439679169686523381, guid: ce784ec9dee7b5b418f3ec1d1afd2cf7, type: 3}
@@ -3426,6 +3529,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8771097448283656725, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
m_PrefabInstance: {fileID: 5814753693728328001}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &4733386687323095054 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 1225675845979703631, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
+ m_PrefabInstance: {fileID: 5814753693728328001}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1001 &6404641555396064461
PrefabInstance:
m_ObjectHideFlags: 0
@@ -3435,7 +3549,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 4276990550886444728, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
propertyPath: m_Name
- value: 02curve
+ value: 02curveIn
objectReference: {fileID: 0}
- target: {fileID: 8004925964111632210, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
propertyPath: m_RootOrder
@@ -3483,6 +3597,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+--- !u!114 &1007345949211835958 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 6132517591490841339, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
+ m_PrefabInstance: {fileID: 6404641555396064461}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &4032672539816403871 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8004925964111632210, guid: c5e47b6edcad17b4482b3f68bce5f9eb, type: 3}
@@ -3617,6 +3742,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8771097448283656725, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
m_PrefabInstance: {fileID: 8224335769394667518}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &7142933854593701553 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 1225675845979703631, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
+ m_PrefabInstance: {fileID: 8224335769394667518}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1001 &8272041747263409850
PrefabInstance:
m_ObjectHideFlags: 0
@@ -3752,6 +3888,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8771097448283656725, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
m_PrefabInstance: {fileID: 8335451667020914810}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &7110902958981490997 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 1225675845979703631, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
+ m_PrefabInstance: {fileID: 8335451667020914810}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1001 &8365237312297721842
PrefabInstance:
m_ObjectHideFlags: 0
@@ -3838,7 +3985,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 2163235865272922153, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
propertyPath: m_Name
- value: 15curve
+ value: 15curveIn
objectReference: {fileID: 0}
- target: {fileID: 5352671577355782595, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
propertyPath: m_RootOrder
@@ -3886,6 +4033,17 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
+--- !u!114 &663361784237137429 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 8089771091315561578, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
+ m_PrefabInstance: {fileID: 8750529213226846847}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!4 &3690873091745874876 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5352671577355782595, guid: 1dfe615f81f29cc4ebc353061ed98c3a, type: 3}
@@ -3953,3 +4111,14 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8771097448283656725, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
m_PrefabInstance: {fileID: 8812910723893193032}
m_PrefabAsset: {fileID: 0}
+--- !u!114 &7732616979370467335 stripped
+MonoBehaviour:
+ m_CorrespondingSourceObject: {fileID: 1225675845979703631, guid: 46042d87f1d1f8545a3a73b09e6592af, type: 3}
+ m_PrefabInstance: {fileID: 8812910723893193032}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs
index 58fe4c139..7d07a54f3 100644
--- a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs
+++ b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs
@@ -25,13 +25,12 @@ namespace HeavenStudio.Games.Loaders
resizable = true,
parameters = new List()
{
- new Param("direction", BuiltToScaleRvl.Direction.Left, "Direction", "Set the direction in which the stick will come out."),
+ new Param("direction", BuiltToScaleRvl.Direction.Left, "Direction", "Set the direction in which the rod will come out."),
new Param("id", new EntityTypes.Integer(0, 4, 0), "Rod ID", "Set the ID of the rod to spawn. Rods with the same ID cannot spawn at the same time."),
},
},
new GameAction("shoot rod", "Shoot Rod")
{
- // function = delegate { var e = eventCaller.currentEntity; BuiltToScaleRvl.instance.ShootRod(e.beat, e["id"]); },
defaultLength = 1f,
parameters = new List()
{
@@ -47,6 +46,15 @@ namespace HeavenStudio.Games.Loaders
new Param("id", new EntityTypes.Integer(0, 4, 0), "Rod ID", "Set the ID of the rod to out."),
},
},
+ new GameAction("custom bounce", "Custom Bounce")
+ {
+ defaultLength = 1f,
+ parameters = new List()
+ {
+ new Param("target", BuiltToScaleRvl.Target.First, "Target", "Set the target in which the rod will bounce."),
+ new Param("id", new EntityTypes.Integer(0, 4, 0), "Rod ID", "Set the ID of the rod to bounce."),
+ },
+ },
}, new List() { "rvl", "normal" }, "rvlbuilt", "en", new List() { });
}
}
@@ -64,10 +72,20 @@ namespace HeavenStudio.Games
[SerializeField] GameObject baseAssembled;
public Transform widgetHolder;
+ const double WIDGET_SEEK_TIME = 16.0;
+
public enum Direction {
Left,
Right,
}
+ public enum Target {
+ OuterLeft,
+ First,
+ Second,
+ Third,
+ Fourth,
+ OuterRight,
+ }
public static BuiltToScaleRvl instance;
@@ -86,15 +104,14 @@ namespace HeavenStudio.Games
new("NtrBuiltAltFlickAltPress", new int[] { IAAltDownCat, IAFlickCat, IAAltDownCat },
IA_PadAltPress, IA_TouchFlick, IA_BatonAltPress);
- // 1.05(3,1)
private void Awake()
{
instance = this;
}
- private double gameStartBeat = double.MinValue;
- private double gameEndBeat = double.MaxValue;
+ private double gameStartBeat = double.MinValue, gameEndBeat = double.MaxValue;
public static List queuedRods = new List();
+ List scheduledWidgets = new List();
public List spawnedRods = new List();
public struct QueuedRod
@@ -106,18 +123,38 @@ namespace HeavenStudio.Games
public int id;
}
+ struct ScheduledWidget
+ {
+ public double beat;
+ public double length;
+ public int currentPos;
+ public int nextPos;
+ public int id;
+ public CustomBounceItem[] bounceItems;
+ public int endTime;
+ public bool isShoot;
+ }
+
+ struct ScheduledSquare
+ {
+ public double targetBeat;
+ public double lengthBeat;
+ }
+
+ public class CustomBounceItem
+ {
+ public int time = -1;
+ public int pos;
+ }
+
public override void OnPlay(double beat)
{
queuedRods.Clear();
- gameStartBeat = beat;
- var firstEnd = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(x => x.beat > gameStartBeat);
- gameEndBeat = firstEnd?.beat ?? gameEndBeat;
+ OnBeginning(beat);
}
public override void OnGameSwitch(double beat)
{
- gameStartBeat = beat;
- var firstEnd = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(x => x.beat > gameStartBeat);
- gameEndBeat = firstEnd?.beat ?? gameEndBeat;
+ OnBeginning(beat);
}
private void OnDestroy() {
queuedRods.Clear();
@@ -126,6 +163,26 @@ namespace HeavenStudio.Games
evt.Disable();
}
}
+ private void OnBeginning(double beat)
+ {
+ gameStartBeat = beat;
+ var firstEnd = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(x => x.beat > gameStartBeat);
+ gameEndBeat = firstEnd?.beat ?? gameEndBeat;
+
+ scheduledWidgets.Clear();
+ // foreach (var evt in events)
+ // {
+ // if (evt.length == 0) continue;
+ // int patternDivisions = (int)Math.Ceiling(evt.length / WIDGET_SEEK_TIME);
+ // var pattern = new ScheduledPattern
+ // {
+ // beat = evt.beat + (PATTERN_SEEK_TIME * i),
+ // length = Math.Min(evt.length - (PATTERN_SEEK_TIME * i), PATTERN_SEEK_TIME),
+ // type = patternType
+ // };
+ // scheduledSquares.Add(pattern);
+ // }
+ }
void Update()
{
@@ -191,27 +248,33 @@ namespace HeavenStudio.Games
newRod.nextPos = nextPos;
newRod.ID = id;
+ List bounceItems = CalcRodBounce(beat, length, id);
+ AddBounceOutSides(beat, length, currentPos, nextPos, id, ref bounceItems);
+
bool isShoot;
- double rodEndBeat = CalcRodEndBeat(beat, length, currentPos, nextPos, id, out isShoot);
- newRod.endBeat = rodEndBeat;
+ int rodEndTime = CalcRodEndTime(beat, length, currentPos, nextPos, id, ref bounceItems, out isShoot);
+ newRod.customBounce = bounceItems.ToArray();
+ newRod.shootTime = rodEndTime;
newRod.isShoot = isShoot;
- if (rodEndBeat != double.MaxValue)
+ if (isShoot)
{
- newRod.Squares = SpawnSquare(beat, rodEndBeat, id);
+ double rodEndBeat = beat + length * rodEndTime;
+ SoundByte.PlayOneShotGame("builtToScaleRvl/prepare", rodEndBeat - 2*length);
+ newRod.Squares = SpawnSquare(rodEndBeat, id);
}
newRod.Init();
newRod.gameObject.SetActive(true);
}
- private Square[] SpawnSquare(double startBeat, double endBeat, int id)
+ private Square[] SpawnSquare(double targetBeat, int id)
{
var newLeftSquare = Instantiate(baseLeftSquare, widgetHolder).GetComponent();
var newRightSquare = Instantiate(baseRightSquare, widgetHolder).GetComponent();
- newLeftSquare.startBeat = startBeat;
- newRightSquare.startBeat = startBeat;
- newLeftSquare.endBeat = endBeat;
- newRightSquare.endBeat = endBeat;
+ newLeftSquare.startBeat = this.gameStartBeat;
+ newRightSquare.startBeat = this.gameStartBeat;
+ newLeftSquare.targetBeat = targetBeat;
+ newRightSquare.targetBeat = targetBeat;
newLeftSquare.gameObject.SetActive(true);
newRightSquare.gameObject.SetActive(true);
newLeftSquare.Init();
@@ -226,66 +289,104 @@ namespace HeavenStudio.Games
newAssembled.SetActive(true);
}
- private double CalcRodEndBeat(double beat, double length, int currentPos, int nextPos, int id, out bool isShoot)
+ private List CalcRodBounce(double beat, double length, int id)
+ {
+ var bounceItems = new List();
+ var events = EventCaller.GetAllInGameManagerList("builtToScaleRvl", new string[] { "custom bounce" }).FindAll(x => x.beat > beat && x["id"] == id);
+
+ foreach(var evt in events)
+ {
+ var bounceEventTime = (int)Math.Ceiling((evt.beat-beat)/length);
+ bounceItems.Add(new CustomBounceItem{
+ time = bounceEventTime,
+ pos = evt["target"] switch {
+ (int)Target.OuterLeft => -1,
+ (int)Target.First => 0,
+ (int)Target.Second => 1,
+ (int)Target.Third => 2,
+ (int)Target.Fourth => 3,
+ (int)Target.OuterRight => 4,
+ _ => throw new System.NotImplementedException()
+ },
+ });
+ }
+ return bounceItems;
+ }
+
+ private void AddBounceOutSides(double beat, double length, int currentPos, int nextPos, int id, ref List bounceItems)
+ {
+ var firstOut = EventCaller.GetAllInGameManagerList("builtToScaleRvl", new string[] { "out sides" }).Find(x => x.beat > beat && x["id"] == id);
+ if (firstOut is not null)
+ {
+ int earliestOutTime = (int)Math.Ceiling((firstOut.beat - beat)/length);
+ int current = currentPos, next = nextPos;
+ int outTime;
+ var bounceItemsArray = bounceItems.ToArray();
+ for (int time = 0; ; time++) {
+ if (current is 0 or 3 && time >= earliestOutTime) {
+ bounceItems.Add(new CustomBounceItem{
+ time = time,
+ pos = current switch {
+ 0 => -1,
+ 3 => 4,
+ _ => throw new System.NotImplementedException()
+ },
+ });
+ break;
+ }
+ int following = getFollowingPos(current, next, time+1, bounceItemsArray);
+ current = next;
+ next = following;
+ }
+ }
+ }
+
+ private int CalcRodEndTime(double beat, double length, int currentPos, int nextPos, int id, ref List bounceItems, out bool isShoot)
{
isShoot = false;
+ int earliestEndTime = int.MaxValue;
var firstShoot = EventCaller.GetAllInGameManagerList("builtToScaleRvl", new string[] { "shoot rod" }).Find(x => x.beat > beat && x["id"] == id);
- if (firstShoot is null)
- return double.MaxValue;
- double shootEventBeat = firstShoot.beat;
-
- if (EventCaller.GetAllInGameManagerList("builtToScaleRvl", new string[] { "out sides" }).Any(x => x.beat > beat && x.beat < shootEventBeat && x["id"] == id))
- return double.MaxValue;
+ if (firstShoot is not null)
+ {
+ earliestEndTime = (int)Math.Ceiling((firstShoot.beat - beat)/length);
+ isShoot = true;
+ }
- var n = (int)Math.Ceiling((shootEventBeat-beat)/length);
+ bounceItems = bounceItems.FindAll(x => x.time < earliestEndTime);
+ bounceItems.Sort((x, y) => x.time.CompareTo(y.time));
+ var bounceOutSide = bounceItems.Find(x => x.pos is -1 or 4);
+ if (bounceOutSide is not null)
+ {
+ earliestEndTime = bounceOutSide.time;
+ isShoot = false;
+ }
+ if (!isShoot) return earliestEndTime;
+
int current = currentPos, next = nextPos;
- int shootTiming;
- for (int i = 0; ; i++) {
- if (current == 2 && i >= n) {
- shootTiming = i;
+ int shootTime;
+ var bounceItemsArray = bounceItems.ToArray();
+ for (int time = 0; ; time++) {
+ if (current == 2 && time >= earliestEndTime) {
+ shootTime = time;
break;
}
- int following = getFollowingPos(current, next);
+ int following = getFollowingPos(current, next, time+1, bounceItemsArray);
current = next;
next = following;
}
- isShoot = true;
- return beat + length * shootTiming;
+ return shootTime;
}
- int getFollowingPos(int currentPos, int nextPos)
+ public static int getFollowingPos(int currentPos, int nextPos, int nextTime, CustomBounceItem[] bounceItems)
{
+ var bounce = Array.Find(bounceItems, x => x.time == nextTime);
+ if (bounce is not null) return bounce.pos;
+
if (nextPos == 0) return 1;
else if (nextPos == 3) return 2;
- else if (currentPos < nextPos) return nextPos + 1;
+ else if (currentPos <= nextPos) return nextPos + 1;
else if (currentPos > nextPos) return nextPos - 1;
return nextPos;
}
-
- public void ShootRod(double beat, int id)
- {
- // var newLeftSquare = Instantiate(baseLeftSquare, widgetHolder).GetComponent();
- // var newRightSquare = Instantiate(baseRightSquare, widgetHolder).GetComponent();
- // newLeftSquare.beat = beat;
- // newRightSquare.beat = beat;
- // newLeftSquare.Init();
- // newRightSquare.Init();
- // newLeftSquare.gameObject.SetActive(true);
- // newRightSquare.gameObject.SetActive(true);
- var rod = spawnedRods.Find(x => x.ID == id);
- if (rod is not null)
- {
- rod.PreShoot(beat);
- }
- }
-
- public void OutRod(double beat, int id)
- {
- var rod = spawnedRods.Find(x => x.ID == id);
- if (rod is not null)
- {
- rod.PreOut(beat);
- }
- }
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs b/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs
index 41ce30e31..dcabe3596 100644
--- a/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs
+++ b/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -8,17 +9,37 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
using HeavenStudio.Util;
public class Rod : MonoBehaviour
{
- public double startBeat, lengthBeat, currentBeat, endBeat;
+ public double startBeat, lengthBeat, currentBeat;
public int currentPos, nextPos;
public int ID;
public BezierCurve3D[] curve;
+ static readonly Dictionary<(int, int), int> curveMap = new Dictionary<(int, int), int> {
+ {(-1, 0), 0}, {(0, -1), 0}, // 01
+ {(0, 1), 1}, {(1, 0), 1}, // 12
+ {(1, 2), 2}, {(2, 1), 2}, // 23
+ {(2, 3), 3}, {(3, 2), 3}, // 34
+ {(3, 4), 4}, {(4, 3), 4}, // 45
+ {(0, 0), 5}, // 11
+ {(1, 1), 6}, // 22
+ {(2, 2), 7}, // 33
+ {(3, 3), 8}, // 44
+ {(-1, 1), 9}, {(1, -1), 9}, // 02
+ {(0, 2), 10}, {(2, 0), 10}, // 13
+ {(1, 3), 11}, {(3, 1), 11}, // 24
+ {(2, 4), 12}, {(4, 2), 12}, // 35
+ {(-1, 2), 13}, {(2, -1), 13}, // 03
+ {(0, 3), 10}, {(3, 0), 14}, // 14
+ {(1, 4), 11}, {(4, 1), 15}, // 25
+ {(-1, 3), 16}, {(3, -1), 16}, // 04
+ {(0, 4), 17}, {(4, 0), 17}, // 15
+ };
private BezierCurve3D currentCurve;
private Animator rodAnim;
public bool isShoot = false;
public Square[] Squares;
- private bool isPreShoot = false;
- private bool isPreOut = false;
- private bool isMiss = false;
+ private bool isMiss = false;
+ public int time, shootTime = int.MaxValue;
+ public BuiltToScaleRvl.CustomBounceItem[] customBounce;
private BuiltToScaleRvl game;
@@ -27,6 +48,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
game = BuiltToScaleRvl.instance;
rodAnim = GetComponent();
currentBeat = startBeat;
+ time = 0;
BounceRecursion(startBeat, lengthBeat, currentPos, nextPos);
setParameters(currentPos, nextPos);
}
@@ -48,15 +70,16 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
private void BounceRecursion(double beat, double length, int currentPos, int nextPos)
{
- int futurePos = getFuturePos(currentPos, nextPos);
if (currentPos < 0 || currentPos > 3) {
BeatAction.New(this, new List()
{
new BeatAction.Action(beat, delegate
{
this.currentBeat = beat;
+ this.time++;
setParameters(currentPos, nextPos);
- BounceRecursion(beat + length, length, nextPos, futurePos);
+ int followingPos = BuiltToScaleRvl.getFollowingPos(currentPos, nextPos, time, customBounce);
+ BounceRecursion(beat + length, length, nextPos, followingPos);
})
});
} else if (nextPos < 0 || nextPos > 3) {
@@ -74,6 +97,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
game.blockAnims[currentPos].Play("bounce", 0, 0);
this.currentBeat = beat;
+ this.time++;
setParameters(currentPos, nextPos);
}),
new BeatAction.Action(beat + length, delegate
@@ -98,6 +122,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
game.blockAnims[currentPos].Play("bounce", 0, 0);
this.currentBeat = beat;
+ this.time++;
setParameters(currentPos, nextPos);
}),
new BeatAction.Action(beat + length, delegate
@@ -105,8 +130,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
game.blockAnims[currentPos].Play("idle", 0, 0);
})
});
- if (isShoot && beat + length == endBeat) {
- SoundByte.PlayOneShotGame("builtToScaleRvl/prepare");
+ if (isShoot && time + 1 == shootTime) {
SoundByte.PlayOneShotGame("builtToScaleRvl/playerRetract", beat);
BeatAction.New(this, new List()
{
@@ -133,8 +157,10 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
game.blockAnims[currentPos].Play("bounce", 0, 0);
this.currentBeat = beat;
+ this.time++;
setParameters(currentPos, nextPos);
- BounceRecursion(beat + length, length, nextPos, futurePos);
+ int followingPos = BuiltToScaleRvl.getFollowingPos(currentPos, nextPos, time, customBounce);
+ BounceRecursion(beat + length, length, nextPos, followingPos);
}),
new BeatAction.Action(beat + length, delegate
{
@@ -143,14 +169,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
});
}
}
- int getFuturePos(int currentPos, int nextPos)
- {
- if (nextPos == 0) return isPreOut ? -1 : 1;
- else if (nextPos == 3) return isPreOut ? 4 : 2;
- else if (currentPos < nextPos) return nextPos + 1;
- else if (currentPos > nextPos) return nextPos - 1;
- return nextPos;
- }
+
void setParameters(int currentPos, int nextPos)
{
this.currentPos = currentPos;
@@ -162,27 +181,58 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
rodAnim.SetFloat("speed", -1f);
}
+ currentCurve = curve[curveMap[(currentPos, nextPos)]];
if ((currentPos==-1 && nextPos==0) || (currentPos==0 && nextPos==-1)) {
- currentCurve = curve[0];
+ currentCurve = curve[0]; // 01
} else if ((currentPos==0 && nextPos==1) || (currentPos==1 && nextPos==0)) {
- currentCurve = curve[1];
+ currentCurve = curve[1]; // 12
} else if ((currentPos==1 && nextPos==2) || (currentPos==2 && nextPos==1)) {
- currentCurve = curve[2];
+ currentCurve = curve[2]; // 23
} else if ((currentPos==2 && nextPos==3) || (currentPos==3 && nextPos==2)) {
- currentCurve = curve[3];
+ currentCurve = curve[3]; // 34
} else if ((currentPos==3 && nextPos==4) || (currentPos==4 && nextPos==3)) {
- currentCurve = curve[4];
+ currentCurve = curve[4]; // 45
+ }
+ else if ((currentPos==0 && nextPos==0)) {
+ currentCurve = curve[5]; // 11
+ } else if ((currentPos==1 && nextPos==1)) {
+ currentCurve = curve[6]; // 22
+ } else if ((currentPos==2 && nextPos==2)) {
+ currentCurve = curve[7]; // 33
+ } else if ((currentPos==3 && nextPos==3)) {
+ currentCurve = curve[8]; // 44
+ }
+ else if ((currentPos==-1 && nextPos==1) || (currentPos==1 && nextPos==-1)) {
+ currentCurve = curve[9]; // 02
+ } else if ((currentPos==0 && nextPos==2) || (currentPos==2 && nextPos==0)) {
+ currentCurve = curve[10]; // 13
+ } else if ((currentPos==1 && nextPos==3) || (currentPos==3 && nextPos==1)) {
+ currentCurve = curve[11]; // 24
+ } else if ((currentPos==2 && nextPos==4) || (currentPos==4 && nextPos==2)) {
+ currentCurve = curve[12]; // 35
+ }
+ else if ((currentPos==-1 && nextPos==2) || (currentPos==2 && nextPos==-1)) {
+ currentCurve = curve[13]; // 03
+ } else if ((currentPos==0 && nextPos==3) || (currentPos==3 && nextPos==0)) {
+ currentCurve = curve[14]; // 14
+ } else if ((currentPos==1 && nextPos==4) || (currentPos==4 && nextPos==1)) {
+ currentCurve = curve[15]; // 25
+ }
+ else if ((currentPos==-1 && nextPos==3) || (currentPos==3 && nextPos==-1)) {
+ currentCurve = curve[16]; // 04
+ } else if ((currentPos==0 && nextPos==4) || (currentPos==4 && nextPos==0)) {
+ currentCurve = curve[17]; // 15
}
}
public void BounceOnHit(PlayerActionEvent caller, float state)
{
- int futurePos = getFuturePos(this.currentPos, this.nextPos);
- BounceRecursion(currentBeat + lengthBeat, lengthBeat, nextPos, futurePos);
+ int followingPos = BuiltToScaleRvl.getFollowingPos(this.currentPos, this.nextPos, this.time, this.customBounce);
+ BounceRecursion(currentBeat + lengthBeat, lengthBeat, nextPos, followingPos);
}
public void BounceOnMiss(PlayerActionEvent caller)
{
- currentCurve = curve[5];
+ currentCurve = curve[^1]; // miss
currentBeat = Conductor.instance.songPositionInBeats;
rodAnim.SetFloat("speed", -1f);
isMiss = true;
@@ -194,21 +244,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
})
});
}
-
- public void PreShoot(double beat)
- {
- isPreShoot = true;
- }
-
- public void PreOut(double beat)
- {
- isPreOut = true;
- }
- public void ShootRod(double beat)
- {
- SoundByte.PlayOneShotGame("builtToScaleRvl/prepare", beat);
- }
-
+
public void ShootOnHit(PlayerActionEvent caller, float state)
{
SoundByte.PlayOneShotGame("builtToScaleRvl/shoot");
diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/Square.cs b/Assets/Scripts/Games/BuiltToScaleRvl/Square.cs
index 2a46e7ac7..eeb58aa93 100644
--- a/Assets/Scripts/Games/BuiltToScaleRvl/Square.cs
+++ b/Assets/Scripts/Games/BuiltToScaleRvl/Square.cs
@@ -11,7 +11,8 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
public class Square : MonoBehaviour
{
public string anim;
- public double startBeat, endBeat, lengthBeat = 1;
+ public double startBeat, targetBeat, lengthBeat = 1;
+ public int endTime;
public Vector3 CorrectionPos;
private Animator squareAnim;
@@ -21,11 +22,10 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
{
game = BuiltToScaleRvl.instance;
squareAnim = GetComponent();
- var n = (int)Math.Floor((endBeat - startBeat)/lengthBeat);
- transform.position = transform.position - n*CorrectionPos;
- double beat = endBeat - lengthBeat * n;
- Debug.Log(beat);
- squareAnim.Play(anim, 0, 0);
+ var endTime = (int)Math.Ceiling((targetBeat - startBeat)/lengthBeat);
+ transform.position = transform.position - endTime * CorrectionPos;
+ double beat = targetBeat - lengthBeat * endTime;
+ squareAnim.Play(anim, 0, (beat==0 ? 0 : 1));
Recursion(beat, lengthBeat);
}