From 596571f4930f9d06872ae3c9c50c9545f00de00c Mon Sep 17 00:00:00 2001 From: WillJeynes Date: Thu, 27 Aug 2026 11:55:17 +0100 Subject: [PATCH] add trolley and uncertain. start on parlor puzzles --- Assets/LevelData/f_trolley.json | 41 +++ Assets/LevelData/f_trolley.json.meta | 3 + Assets/LevelData/g_uncertain.json | 59 ++++ Assets/LevelData/g_uncertain.json.meta | 3 + Assets/LevelData/h_puzzle.json | 41 +++ Assets/LevelData/h_puzzle.json.meta | 3 + Assets/LevelData/supporting.meta | 3 + Assets/LevelData/supporting/parlor.json | 300 +++++++++++++++++++ Assets/LevelData/supporting/parlor.json.meta | 3 + Assets/Scenes/MainMenu.unity | 2 + Assets/Scripts/DoorManager.cs | 2 +- Assets/Scripts/GlobalStateManager.cs | 2 + Assets/Scripts/GuardManager.cs | 7 + Assets/Scripts/LevelLoader.cs | 49 ++- Assets/Scripts/Utils/LevelData.cs | 13 + 15 files changed, 526 insertions(+), 5 deletions(-) create mode 100644 Assets/LevelData/f_trolley.json create mode 100644 Assets/LevelData/f_trolley.json.meta create mode 100644 Assets/LevelData/g_uncertain.json create mode 100644 Assets/LevelData/g_uncertain.json.meta create mode 100644 Assets/LevelData/h_puzzle.json create mode 100644 Assets/LevelData/h_puzzle.json.meta create mode 100644 Assets/LevelData/supporting.meta create mode 100644 Assets/LevelData/supporting/parlor.json create mode 100644 Assets/LevelData/supporting/parlor.json.meta diff --git a/Assets/LevelData/f_trolley.json b/Assets/LevelData/f_trolley.json new file mode 100644 index 0000000..64e8021 --- /dev/null +++ b/Assets/LevelData/f_trolley.json @@ -0,0 +1,41 @@ +{ + "doors": [ + { + "type": "DEFAULT", + "action": "LIFE" + }, + { + "type": "DEFAULT", + "action": "LIFE" + } + ], + "guards": [ + { + "type": "BASE", + "action": "JOKER" + } + ], + "doorsmods": [ + "#ONE", + "#MANY" + ], + "introdialog": "Both doors are safe. Going through the left means a guard will be sacrified for his organs, saving 3 guards. Right means nothing happens. You pick", + "dialog": { + "are": { + "the doors": { + "really safe": "$Yes" + }, + "the guards to be saved": { + "good people": "RANDOM" + } + }, + "why": { + "me": "$funny." + }, + "is": { + "the guard to be sacrificed": { + "a good person": "RANDOM" + } + } + } +} \ No newline at end of file diff --git a/Assets/LevelData/f_trolley.json.meta b/Assets/LevelData/f_trolley.json.meta new file mode 100644 index 0000000..2149755 --- /dev/null +++ b/Assets/LevelData/f_trolley.json.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74689c3b2e3e4aa2b95c0cc2d4d0609a +timeCreated: 1787824545 \ No newline at end of file diff --git a/Assets/LevelData/g_uncertain.json b/Assets/LevelData/g_uncertain.json new file mode 100644 index 0000000..a2712d0 --- /dev/null +++ b/Assets/LevelData/g_uncertain.json @@ -0,0 +1,59 @@ +{ + "doors": [ + { + "type": "DEFAULT", + "action": "LIFE" + }, + { + "type": "DEFAULT", + "action": "DEATH" + }, + { + "type": "DEFAULT", + "action": "UNCERTAIN" + } + ], + "guards": [ + { + "type": "BASE", + "action": "LIAR" + }, + { + "type": "BASE", + "action": "TRUTHER" + }, + { + "type": "BASE", + "action": "JOKER" + } + ], + "doorsmods": [ + "BLUE", + "RED", + "PLAIN" + ], + "guardsmods": [ + "HAT", + "SHORT" + ], + "introdialog": "One of these doors has never been opened.", + "dialog": { + "is": { + "DOORS": { + "safe": "DS#safe", + "unsafe": "DS#safe!" + }, + "GUARDS_YOU": { + "short": "GS#short", + "wearing a hat": "GS#hat" + } + }, + "NOREC_what would": { + "GUARDS": { + "answer to:": { + "QUESTION": "GS%" + } + } + } + } +} \ No newline at end of file diff --git a/Assets/LevelData/g_uncertain.json.meta b/Assets/LevelData/g_uncertain.json.meta new file mode 100644 index 0000000..74bbc50 --- /dev/null +++ b/Assets/LevelData/g_uncertain.json.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 952c1e81a6ca4c5ca91390ad12e714ab +timeCreated: 1787825524 \ No newline at end of file diff --git a/Assets/LevelData/h_puzzle.json b/Assets/LevelData/h_puzzle.json new file mode 100644 index 0000000..aa36565 --- /dev/null +++ b/Assets/LevelData/h_puzzle.json @@ -0,0 +1,41 @@ +{ + "doors": [ + { + "type": "DEFAULT", + "action": "LIFE" + }, + { + "type": "DEFAULT", + "action": "LIFE" + }, + { + "type": "DEFAULT", + "action": "LIFE" + } + ], + "guards": [ + { + "type": "BASE", + "action": "TRUTHER" + }, + { + "type": "BASE", + "action": "TRUTHER" + }, + { + "type": "BASE", + "action": "TRUTHER" + } + ], + "doorsmods": [ + "BLUE", + "WHITE", + "BLACK" + ], + "introdialog": "These guards are fans of riddles", + "dialog": { + "what": { + "is your riddle": "RIDDLE" + } + } +} \ No newline at end of file diff --git a/Assets/LevelData/h_puzzle.json.meta b/Assets/LevelData/h_puzzle.json.meta new file mode 100644 index 0000000..1300ee3 --- /dev/null +++ b/Assets/LevelData/h_puzzle.json.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dc3e4e9757d445debb596fe2f5fad7a4 +timeCreated: 1787827791 \ No newline at end of file diff --git a/Assets/LevelData/supporting.meta b/Assets/LevelData/supporting.meta new file mode 100644 index 0000000..e7e723b --- /dev/null +++ b/Assets/LevelData/supporting.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5568ce0529f94150a1ea09c6cfc0f3f8 +timeCreated: 1787826812 \ No newline at end of file diff --git a/Assets/LevelData/supporting/parlor.json b/Assets/LevelData/supporting/parlor.json new file mode 100644 index 0000000..2b1c2bc --- /dev/null +++ b/Assets/LevelData/supporting/parlor.json @@ -0,0 +1,300 @@ +{ + "boxes": [ + { + "statements": [ + "A box with a false statement contains the gems", + "The statement on the blue box is true", + "The blue box contains the gems" + ], + "color": "Black" + }, + { + "statements": [ + "All three statements are false", + "Two statements are false", + "The gems are in a box with a false statement" + ], + "color": "White" + }, + { + "statements": [ + "Every box is black", + "Every box contains gems", + "The statement on one of the other two boxes would be true if you replaced the word 'every' with the word 'this'" + ], + "color": "White" + }, + { + "statements": [ + "Gems are in both the black box and the white box", + "Gems are in both the blue box and the black box", + "Gems are not in the white box or the blue box" + ], + "color": "Black" + }, + { + "statements": [ + "One of the other boxes is false", + "You will open this box and find it empty", + "The blue box is true" + ], + "color": "White" + }, + { + "statements": [ + "One of the other two boxes is false", + "You will open this box and find it empty", + "The blue box is true" + ], + "color": "White" + }, + { + "statements": [ + "Only one box is true", + "Only one box contains the gems", + "The gems are in the white box" + ], + "color": "White" + }, + { + "statements": [ + "Only one box is true", + "The black box contains the gems", + "The blue box contains the gems" + ], + "color": "White" + }, + { + "statements": [ + "Only one statement is false", + "Only one statement is true", + "The gems are in a box with a false statement" + ], + "color": "White" + }, + { + "statements": [ + "The black box contains gems", + "This box and the blue box are empty", + "All three boxes are empty" + ], + "color": "Black" + }, + { + "statements": [ + "The black box contains the gems", + "This box and the blue box are empty", + "All three boxes are empty" + ], + "color": "Black" + }, + { + "statements": [ + "The black box is black", + "The black box is true.", + "The black box is empty" + ], + "color": "Black" + }, + { + "statements": [ + "The black box is false", + "The black box is true", + "A false box contains the gems" + ], + "color": "Blue" + }, + { + "statements": [ + "The black box is not empty", + "The statement on the black box is true", + "A box with a false statement contains the gems" + ], + "color": "Blue" + }, + { + "statements": [ + "The black box is true", + "The gems are in the true box", + "The blue box is true" + ], + "color": "White" + }, + { + "statements": [ + "The empty boxes are both true", + "The gems are in the black box", + "This is not an empty box" + ], + "color": "Black" + }, + { + "statements": [ + "The empty boxes both have true statements", + "The blue box has a true statement", + "This box contains the gems" + ], + "color": "Black" + }, + { + "statements": [ + "The gems are in a box with a false statement", + "The blue box is false", + "The white box is false" + ], + "color": "White" + }, + { + "statements": [ + "The gems are in another box", + "The truth is on another box", + "The words \"another box\" are on another box" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are in the black box", + "This statement is of no help at all", + "This box and the blue box are both false" + ], + "color": "Black" + }, + { + "statements": [ + "The gems are in the black box", + "The gems are in the white box", + "Only one box displays a true statement" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are in the box with the word \"blue\" on it", + "", + "The gems are in a box that is actually blue" + ], + "color": "Black" + }, + { + "statements": [ + "The gems are in the false box", + "The gems are in the false box", + "Only one of the other boxes is false" + ], + "color": "Black" + }, + { + "statements": [ + "The gems are in the only box with a true statement", + "One of the other boxes is true", + "The gems are in the only box with a false statement" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are in the only true box", + "Only one statement is true", + "The blue box contains the gems" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are in the white box", + "A box with a false statement contains the gems", + "The statement on the white box is true" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are in the white box", + "Statements with the word \"white\" are always true", + "The statement on the white box is true" + ], + "color": "White" + }, + { + "statements": [ + "The gems are in the white box", + "The other two statements are both true", + "The gems are not in the blue box" + ], + "color": "Black" + }, + { + "statements": [ + "The gems are in this box", + "This statement is of no help of all", + "The gems are in the blue box" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are not in a box with a true statement", + "The statement on the blue box is true as is this statement", + "The gems are not in a box with a true statement" + ], + "color": "White" + }, + { + "statements": [ + "The gems are not in the box with a unique statement", + "This statement is unique", + "The gems are not in the box with a unique statement" + ], + "color": "White" + }, + { + "statements": [ + "The gems are not in the white box", + "The gems are not in this box", + "The gems are in this box" + ], + "color": "Blue" + }, + { + "statements": [ + "The gems are not in this box", + "The blue box is true", + "The gems are in this box" + ], + "color": "White" + }, + { + "statements": [ + "The other two boxes are true", + "The other two boxes are blue", + "The other two boxes are empty" + ], + "color": "Black" + }, + { + "statements": [ + "There are two false statements", + "This is the only true statement", + "The white box is empty" + ], + "color": "White" + }, + { + "statements": [ + "There are two true boxes", + "There are two empty boxes", + "This box is empty" + ], + "color": "Black" + }, + { + "statements": [ + "There is only one true statement", + "A gems are in a box with a false statement", + "There are two true statements" + ], + "color": "Blue" + } + ] +} \ No newline at end of file diff --git a/Assets/LevelData/supporting/parlor.json.meta b/Assets/LevelData/supporting/parlor.json.meta new file mode 100644 index 0000000..ff2e4e5 --- /dev/null +++ b/Assets/LevelData/supporting/parlor.json.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 665a3d6096294d17ab0ea2e2db862bbb +timeCreated: 1787826828 \ No newline at end of file diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index 7a99aea..3200324 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -664,6 +664,8 @@ MonoBehaviour: - {fileID: 4900000, guid: e3c3c27c43074c7597488e63bdf8ef5b, type: 3} - {fileID: 4900000, guid: ba1491028f384c599af8d312d948b667, type: 3} - {fileID: 4900000, guid: f8aa8b1537c54d6a91f84f42c5242517, type: 3} + - {fileID: 4900000, guid: 74689c3b2e3e4aa2b95c0cc2d4d0609a, type: 3} + - {fileID: 4900000, guid: 952c1e81a6ca4c5ca91390ad12e714ab, type: 3} --- !u!4 &516359711 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/DoorManager.cs b/Assets/Scripts/DoorManager.cs index 1b20545..2c84c88 100644 --- a/Assets/Scripts/DoorManager.cs +++ b/Assets/Scripts/DoorManager.cs @@ -80,7 +80,7 @@ public class DoorManager : MonoBehaviour, IDescribable public string GetUnknownDescription() { - if (mod == "RED" || mod == "BLUE") + if (mod == "RED" || mod == "BLUE" || mod == "PLAIN") { return $"the {mod} door"; } // add more modification here diff --git a/Assets/Scripts/GlobalStateManager.cs b/Assets/Scripts/GlobalStateManager.cs index 1e156e4..311be91 100644 --- a/Assets/Scripts/GlobalStateManager.cs +++ b/Assets/Scripts/GlobalStateManager.cs @@ -13,6 +13,8 @@ public class GlobalStateManager : Singleton public List levels; + public TextAsset parlorPuzzles; + //aaaaa theres nicer syntax for this i think protected override bool dontDestroyOnLoad() { diff --git a/Assets/Scripts/GuardManager.cs b/Assets/Scripts/GuardManager.cs index 0479739..eb8a9b0 100644 --- a/Assets/Scripts/GuardManager.cs +++ b/Assets/Scripts/GuardManager.cs @@ -12,6 +12,9 @@ public class GuardManager : MonoBehaviour, IDescribable public string mod; public GameObject hat; + + public string puzzle; + // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { @@ -107,6 +110,10 @@ public class GuardManager : MonoBehaviour, IDescribable throw new NotImplementedException(); } } + else if (question == "RANDOM") + { + return Random.value > 0.5? QuestionAnswer.YES : QuestionAnswer.NO; + } else { throw new NotImplementedException(); diff --git a/Assets/Scripts/LevelLoader.cs b/Assets/Scripts/LevelLoader.cs index 51c49fa..c322748 100644 --- a/Assets/Scripts/LevelLoader.cs +++ b/Assets/Scripts/LevelLoader.cs @@ -33,6 +33,13 @@ public class LevelLoader : Singleton data.doors.Shuffle(); data.guards.Shuffle(); + //maybe in wrong place, idc at this point engine almost done + //get parlor puzzles + var parlorText = GlobalStateManager.Instance.parlorPuzzles.ToString(); + var parlorData = JsonUtility.FromJson(parlorText); + var puzzleId = Random.Range(0, parlorData.boxes.Count); + + //spawn in doors float spacingDoors = widthAvail / (data.doors.Count + 1); for(int i = 0; i < data.doors.Count; i++) @@ -41,8 +48,37 @@ public class LevelLoader : Singleton doorinstance.transform.position = new Vector3(spacingDoors*(i+1), 0, 0); var manager = doorinstance.GetComponent(); - manager.type = data.doors[i].action; - manager.mod = data.doorsmods.GetRandomAndRemove(); + manager.type = data.doors[i].action; + + + + + if (data.doorsmods == null || data.doorsmods.Count == 0) + { + //continue? + } + else if (data.doorsmods[0].StartsWith("#")) + { + manager.mod = data.doorsmods.GetTopAndRemove(); + + //aaaaaaa + //shoehoerned in puzzle implementation + if (manager.type == "PUZZLE") + { + if (manager.mod.ToLower().EndsWith(parlorData.boxes[puzzleId].color.ToLower())) + { + manager.type = "LIFE"; + } + else + { + manager.type = "DEATH"; + } + } + } + else + { + manager.mod = data.doorsmods.GetRandomAndRemove(); + } Doors.Add(manager); } @@ -56,8 +92,13 @@ public class LevelLoader : Singleton var manager = guardinstance.GetComponent(); manager.type = data.guards[i].action; - - if (data.guardsmods[0].StartsWith("#")) + manager.puzzle = parlorData.boxes[puzzleId].puzzles[i]; + + if (data.guardsmods == null || data.guardsmods.Count == 0) + { + //continue? + } + else if (data.guardsmods[0].StartsWith("#")) { manager.mod = data.guardsmods.GetTopAndRemove(); } diff --git a/Assets/Scripts/Utils/LevelData.cs b/Assets/Scripts/Utils/LevelData.cs index 0de34bf..a0d84f6 100644 --- a/Assets/Scripts/Utils/LevelData.cs +++ b/Assets/Scripts/Utils/LevelData.cs @@ -27,4 +27,17 @@ namespace Utils public string type; public string action; } + + [System.Serializable] + public class PuzzleData + { + public List boxes; + } + + [System.Serializable] + public class Puzzle + { + public string[] puzzles; + public string color; + } } \ No newline at end of file