From 4f3b502f2e592d45bcc687063cf93f13502db50a Mon Sep 17 00:00:00 2001 From: fu-majime Date: Sat, 16 Mar 2024 19:25:47 +0900 Subject: [PATCH] Fine placement --- Assets/Scripts/Games/ShootEmUp/ShootEmUp.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Games/ShootEmUp/ShootEmUp.cs b/Assets/Scripts/Games/ShootEmUp/ShootEmUp.cs index 6cb31c09b..0045b55c2 100644 --- a/Assets/Scripts/Games/ShootEmUp/ShootEmUp.cs +++ b/Assets/Scripts/Games/ShootEmUp/ShootEmUp.cs @@ -44,8 +44,16 @@ namespace HeavenStudio.Games.Loaders defaultLength = 0.5f, parameters = new List() { - new Param("x", new EntityTypes.Float(-5, 5, 0), "X"), - new Param("y", new EntityTypes.Float(-5, 5, 0), "Y"), + + new Param("fine", false, "Fine placement", "Change placement by decimals.", new List() + { + new Param.CollapseParam((x, _) => !(bool)x, new string[] { "x_int", "y_int" }), + new Param.CollapseParam((x, _) => (bool)x, new string[] { "x_float", "y_float" }), + }), + new Param("x_int", new EntityTypes.Integer(-3, 3, 0), "X (Integer)"), + new Param("y_int", new EntityTypes.Integer(-3, 3, 0), "Y (Integer)"), + new Param("x_float", new EntityTypes.Float(-8, 8, 0), "X (Decimal)"), + new Param("y_float", new EntityTypes.Float(-8, 8, 0), "Y (Decimal)"), }, }, new GameAction("passTurn", "Pass Turn") @@ -291,7 +299,8 @@ namespace HeavenStudio.Games { foreach (var evt in relevantInputs) { - var pos = new Vector2(evt["x"], evt["y"]); + Vector2 pos = new Vector2(evt["x_int"], evt["y_int"]); + if (evt["fine"]) pos = new Vector2(evt["x_float"], evt["y_float"]); SpawnEnemy(evt.beat, pos, evt.beat >= gameSwitchBeat, interval); } }