Finish the puzzling. Add the cup level

This commit is contained in:
WillJeynes
2026-08-27 12:54:16 +01:00
parent 596571f493
commit 3ca0c5330f
13 changed files with 403 additions and 183 deletions
+7 -7
View File
@@ -2,15 +2,15 @@
"doors": [ "doors": [
{ {
"type": "DEFAULT", "type": "DEFAULT",
"action": "LIFE" "action": "PUZZLE"
}, },
{ {
"type": "DEFAULT", "type": "DEFAULT",
"action": "LIFE" "action": "PUZZLE"
}, },
{ {
"type": "DEFAULT", "type": "DEFAULT",
"action": "LIFE" "action": "PUZZLE"
} }
], ],
"guards": [ "guards": [
@@ -28,14 +28,14 @@
} }
], ],
"doorsmods": [ "doorsmods": [
"BLUE", "#BLUE",
"WHITE", "#WHITE",
"BLACK" "#BLACK"
], ],
"introdialog": "These guards are fans of riddles", "introdialog": "These guards are fans of riddles",
"dialog": { "dialog": {
"what": { "what": {
"is your riddle": "RIDDLE" "is your statement": "RIDDLE"
} }
} }
} }
+56
View File
@@ -0,0 +1,56 @@
{
"doors": [
{
"type": "DEFAULT",
"action": "DEATH"
},
{
"type": "DEFAULT",
"action": "DEATH"
},
{
"type": "DEFAULT",
"action": "LIFE"
}
],
"guards": [
{
"type": "BASE",
"action": "LIAR"
},
{
"type": "BASE",
"action": "TRUTHER"
}
],
"guardsmods": [
"HAT",
"SHORT"
],
"doorsmods": [
"#LEFT",
"#CENTER",
"#RIGHT"
],
"globalmod": "CUP",
"introdialog": "These doors get restless after every question asked",
"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%"
}
}
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3f7768c50f1e44d6b0965af3ba420fde
timeCreated: 1787829244
+170 -170
View File
@@ -1,300 +1,300 @@
{ {
"boxes": [ "boxes": [
{ {
"color": "Black",
"statements": [ "statements": [
"A box with a false statement contains the gems", "A door with a false statement leads to safety",
"The statement on the blue box is true", "What the guard at the blue door says is true",
"The blue box contains the gems" "The blue door leads to safety"
], ]
"color": "Black"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"All three statements are false", "All three statements are false",
"Two statements are false", "Two statements are false",
"The gems are in a box with a false statement" "Safety lies behind a door with a false statement"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"Every box is black", "Every door is black",
"Every box contains gems", "Every door leads to safety",
"The statement on one of the other two boxes would be true if you replaced the word 'every' with the word 'this'" "What the guard at one of the other two doors says would be true if you replaced the word 'every' with the word 'this'"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"Gems are in both the black box and the white box", "Safety lies behind both the black door and the white door",
"Gems are in both the blue box and the black box", "Safety lies behind both the blue door and the black door",
"Gems are not in the white box or the blue box" "Safety does not lie behind the white door or the blue door"
], ]
"color": "Black"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"One of the other boxes is false", "One of the other guards is lying",
"You will open this box and find it empty", "You will open this door and find death waiting",
"The blue box is true" "The guard at the blue door is telling the truth"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"One of the other two boxes is false", "One of the other two guards is lying",
"You will open this box and find it empty", "You will open this door and find death waiting",
"The blue box is true" "The guard at the blue door is telling the truth"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"Only one box is true", "Only one guard is telling the truth",
"Only one box contains the gems", "Only one door leads to safety",
"The gems are in the white box" "Safety lies behind the white door"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"Only one box is true", "Only one guard is telling the truth",
"The black box contains the gems", "The black door leads to safety",
"The blue box contains the gems" "The blue door leads to safety"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"Only one statement is false", "Only one statement is false",
"Only one statement is true", "Only one statement is true",
"The gems are in a box with a false statement" "Safety lies behind a door with a false statement"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The black box contains gems", "The black door leads to safety",
"This box and the blue box are empty", "This door and the blue door lead to death",
"All three boxes are empty" "All three doors lead to death"
], ]
"color": "Black"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The black box contains the gems", "The black door leads to safety",
"This box and the blue box are empty", "This door and the blue door lead to death",
"All three boxes are empty" "All three doors lead to death"
], ]
"color": "Black"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The black box is black", "The black door is black",
"The black box is true.", "The guard at the black door is telling the truth.",
"The black box is empty" "The black door leads to death"
], ]
"color": "Black"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The black box is false", "The guard at the black door is lying",
"The black box is true", "The guard at the black door is telling the truth",
"A false box contains the gems" "A false door leads to safety"
], ]
"color": "Blue"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The black box is not empty", "The black door does not lead to death",
"The statement on the black box is true", "What the guard at the black door says is true",
"A box with a false statement contains the gems" "A door with a false statement leads to safety"
], ]
"color": "Blue"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The black box is true", "The guard at the black door is telling the truth",
"The gems are in the true box", "Safety lies behind the true door",
"The blue box is true" "The guard at the blue door is telling the truth"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The empty boxes are both true", "The guards at the deadly doors are both telling the truth",
"The gems are in the black box", "Safety lies behind the black door",
"This is not an empty box" "This is not a deadly door"
], ]
"color": "Black"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The empty boxes both have true statements", "The guards at the deadly doors are both telling the truth",
"The blue box has a true statement", "The guard at the blue door is telling the truth",
"This box contains the gems" "This door leads to safety"
], ]
"color": "Black"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The gems are in a box with a false statement", "Safety lies behind a door with a false statement",
"The blue box is false", "The guard at the blue door is lying",
"The white box is false" "The guard at the white door is lying"
], ]
"color": "White"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in another box", "Safety lies behind another door",
"The truth is on another box", "The truth is spoken by another door",
"The words \"another box\" are on another box" "The words \"another door\" are spoken by another door"
], ]
"color": "Blue"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The gems are in the black box", "Safety lies behind the black door",
"This statement is of no help at all", "This statement is of no help at all",
"This box and the blue box are both false" "This guard and the guard at the blue door are both lying"
], ]
"color": "Black"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in the black box", "Safety lies behind the black door",
"The gems are in the white box", "Safety lies behind the white door",
"Only one box displays a true statement" "Only one guard is telling the truth"
], ]
"color": "Blue"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The gems are in the box with the word \"blue\" on it", "Safety lies behind the door with the word \"blue\" on it",
"", "",
"The gems are in a box that is actually blue" "Safety lies behind a door that is actually blue"
], ]
"color": "Black"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The gems are in the false box", "Safety lies behind the false door",
"The gems are in the false box", "Safety lies behind the false door",
"Only one of the other boxes is false" "Only one of the other guards is lying"
], ]
"color": "Black"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in the only box with a true statement", "Safety lies behind the only door with a true statement",
"One of the other boxes is true", "One of the other guards is telling the truth",
"The gems are in the only box with a false statement" "Safety lies behind the only door with a false statement"
], ]
"color": "Blue"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in the only true box", "Safety lies behind the only true door",
"Only one statement is true", "Only one statement is true",
"The blue box contains the gems" "The blue door leads to safety"
], ]
"color": "Blue"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in the white box", "Safety lies behind the white door",
"A box with a false statement contains the gems", "A door with a false statement leads to safety",
"The statement on the white box is true" "What the guard at the white door says is true"
], ]
"color": "Blue"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The gems are in the white box", "Safety lies behind the white door",
"Statements with the word \"white\" are always true", "Statements with the word \"white\" are always true",
"The statement on the white box is true" "What the guard at the white door says is true"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The gems are in the white box", "Safety lies behind the white door",
"The other two statements are both true", "The other two statements are both true",
"The gems are not in the blue box" "Safety does not lie behind the blue door"
], ]
"color": "Black"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are in this box", "Safety lies behind this door",
"This statement is of no help of all", "This statement is of no help of all",
"The gems are in the blue box" "Safety lies behind the blue door"
], ]
"color": "Blue"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The gems are not in a box with a true statement", "Safety does not lie behind a door with a true statement",
"The statement on the blue box is true as is this statement", "What the guard at the blue door says is true as is this statement",
"The gems are not in a box with a true statement" "Safety does not lie behind a door with a true statement"
], ]
"color": "White"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The gems are not in the box with a unique statement", "Safety does not lie behind the door with a unique statement",
"This statement is unique", "This statement is unique",
"The gems are not in the box with a unique statement" "Safety does not lie behind the door with a unique statement"
], ]
"color": "White"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"The gems are not in the white box", "Safety does not lie behind the white door",
"The gems are not in this box", "Safety does not lie behind this door",
"The gems are in this box" "Safety lies behind this door"
], ]
"color": "Blue"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"The gems are not in this box", "Safety does not lie behind this door",
"The blue box is true", "The guard at the blue door is telling the truth",
"The gems are in this box" "Safety lies behind this door"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"The other two boxes are true", "The other two guards are telling the truth",
"The other two boxes are blue", "The other two doors are blue",
"The other two boxes are empty" "The other two doors lead to death"
], ]
"color": "Black"
}, },
{ {
"color": "White",
"statements": [ "statements": [
"There are two false statements", "There are two false statements",
"This is the only true statement", "This is the only true statement",
"The white box is empty" "The white door leads to death"
], ]
"color": "White"
}, },
{ {
"color": "Black",
"statements": [ "statements": [
"There are two true boxes", "There are two truthful guards",
"There are two empty boxes", "There are two deadly doors",
"This box is empty" "This door leads to death"
], ]
"color": "Black"
}, },
{ {
"color": "Blue",
"statements": [ "statements": [
"There is only one true statement", "There is only one true statement",
"A gems are in a box with a false statement", "Safety lies behind a door with a false statement",
"There are two true statements" "There are two true statements"
], ]
"color": "Blue"
} }
] ]
} }
+3
View File
@@ -666,6 +666,9 @@ MonoBehaviour:
- {fileID: 4900000, guid: f8aa8b1537c54d6a91f84f42c5242517, type: 3} - {fileID: 4900000, guid: f8aa8b1537c54d6a91f84f42c5242517, type: 3}
- {fileID: 4900000, guid: 74689c3b2e3e4aa2b95c0cc2d4d0609a, type: 3} - {fileID: 4900000, guid: 74689c3b2e3e4aa2b95c0cc2d4d0609a, type: 3}
- {fileID: 4900000, guid: 952c1e81a6ca4c5ca91390ad12e714ab, type: 3} - {fileID: 4900000, guid: 952c1e81a6ca4c5ca91390ad12e714ab, type: 3}
- {fileID: 4900000, guid: dc3e4e9757d445debb596fe2f5fad7a4, type: 3}
- {fileID: 4900000, guid: 3f7768c50f1e44d6b0965af3ba420fde, type: 3}
parlorPuzzles: {fileID: 4900000, guid: 665a3d6096294d17ab0ea2e2db862bbb, type: 3}
--- !u!4 &516359711 --- !u!4 &516359711
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+53
View File
@@ -368,6 +368,58 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 28945337} m_GameObject: {fileID: 28945337}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &111963511
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 111963513}
- component: {fileID: 111963512}
m_Layer: 0
m_Name: CupShuffle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &111963512
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111963511}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aac4d07d6a79b7b379cd8e5dd08ad7ec, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
cups:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
numberOfSwaps: 6
swapDuration: 0.5
arcHeight: 1
delayBetweenSwaps: 0.1
--- !u!4 &111963513
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111963511}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 20.10972, y: -1.9, z: 4.50587}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &141379855 --- !u!1 &141379855
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -7172,3 +7224,4 @@ SceneRoots:
- {fileID: 1008838629} - {fileID: 1008838629}
- {fileID: 537607019} - {fileID: 537607019}
- {fileID: 604863488} - {fileID: 604863488}
- {fileID: 111963513}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Collections;
using System.Linq;
using UnityEngine;
using Utils;
using Random = UnityEngine.Random;
public class CupShuffle : Singleton<CupShuffle>
{
public GameObject[] cups = new GameObject[3]; // assign 3 GameObjects in Inspector
public int numberOfSwaps = 6; // how many swaps in the shuffle
public float swapDuration = 0.5f; // time per swap
public float arcHeight = 1.0f; // how high objects hop during swap
public float delayBetweenSwaps = 0.1f;
private Vector3[] positions = new Vector3[3]; // the 3 fixed slot positions
private int[] slotOccupant = new int[3]; // which cup index currently sits in slot i
public void StartShuffle()
{
cups = LevelLoader.Instance.Doors.ConvertAll((item) => item.gameObject).ToArray();
// Record starting positions as the 3 fixed slots
for (int i = 0; i < 3; i++)
{
positions[i] = cups[i].transform.position;
slotOccupant[i] = i; // cup i starts in slot i
}
StartCoroutine(ShuffleRoutine());
}
IEnumerator ShuffleRoutine()
{
for (int s = 0; s < numberOfSwaps; s++)
{
// Pick two different slots to swap
int slotA = Random.Range(0, 3);
int slotB;
do { slotB = Random.Range(0, 3); } while (slotB == slotA);
yield return StartCoroutine(SwapSlots(slotA, slotB));
yield return new WaitForSeconds(delayBetweenSwaps);
}
var sorted = cups.ToList();
sorted.Sort((a,b) => Mathf.RoundToInt(a.transform.position.x - b.transform.position.x));
sorted[0].GetComponent<DoorManager>().mod = "#LEFT";
sorted[1].GetComponent<DoorManager>().mod = "#CENTER";
sorted[2].GetComponent<DoorManager>().mod = "#RIGHT";
}
IEnumerator SwapSlots(int slotA, int slotB)
{
GameObject objA = cups[slotOccupant[slotA]];
GameObject objB = cups[slotOccupant[slotB]];
Vector3 startA = positions[slotA];
Vector3 startB = positions[slotB];
Vector3 endA = positions[slotB];
Vector3 endB = positions[slotA];
float t = 0f;
while (t < swapDuration)
{
t += Time.deltaTime;
float normalized = Mathf.Clamp01(t / swapDuration);
float ease = Mathf.SmoothStep(0f, 1f, normalized);
// Arc offset (sine curve peaks at the midpoint of the move)
float arc = Mathf.Sin(ease * Mathf.PI) * arcHeight;
objA.transform.position = Vector3.Lerp(startA, endA, ease) + Vector3.up * arc;
objB.transform.position = Vector3.Lerp(startB, endB, ease) + Vector3.up * arc;
yield return null;
}
// Snap to exact final positions
objA.transform.position = endA;
objB.transform.position = endB;
// Update which cup occupies which slot
int temp = slotOccupant[slotA];
slotOccupant[slotA] = slotOccupant[slotB];
slotOccupant[slotB] = temp;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: aac4d07d6a79b7b379cd8e5dd08ad7ec
+7 -3
View File
@@ -248,13 +248,17 @@ public class DialogManager : Singleton<DialogManager>
var response = FullQuestionCopt; var response = FullQuestionCopt;
if (!FullQuestion.Contains("$")) if (FullQuestion == "RIDDLE")
{
response = currentGuard.puzzle;
}
else if (!FullQuestion.Contains("$"))
{ {
//now get a response from the guard being questioned //now get a response from the guard being questioned
response = currentGuard.Answer(FullQuestion).ToRandomString(); response = currentGuard.Answer(FullQuestion).ToRandomString();
} }
response = response.Replace("$", ""); response = response.Replace("$", "");
string responsePrefix = ""; string responsePrefix = "";
+7 -1
View File
@@ -83,7 +83,13 @@ public class DoorManager : MonoBehaviour, IDescribable
if (mod == "RED" || mod == "BLUE" || mod == "PLAIN") if (mod == "RED" || mod == "BLUE" || mod == "PLAIN")
{ {
return $"the {mod} door"; return $"the {mod} door";
} // add more modification here }
if (mod == "#LEFT" || mod == "#CENTER" || mod == "#RIGHT")
{
return $"the {mod.Replace("#","")} door";
}
// add more modification here
return "the door"; return "the door";
} }
+1 -1
View File
@@ -92,7 +92,7 @@ public class LevelLoader : Singleton<LevelLoader>
var manager = guardinstance.GetComponent<GuardManager>(); var manager = guardinstance.GetComponent<GuardManager>();
manager.type = data.guards[i].action; manager.type = data.guards[i].action;
manager.puzzle = parlorData.boxes[puzzleId].puzzles[i]; manager.puzzle = parlorData.boxes[puzzleId].statements[i];
if (data.guardsmods == null || data.guardsmods.Count == 0) if (data.guardsmods == null || data.guardsmods.Count == 0)
{ {
+6
View File
@@ -25,6 +25,8 @@ public class SpeechManager : Singleton<SpeechManager>
public string Status = "TALKING"; public string Status = "TALKING";
private int counter = 0;
void Start() void Start()
{ {
playerPanel = transform.FindChildRecursive("PLAYERPANEL").gameObject; playerPanel = transform.FindChildRecursive("PLAYERPANEL").gameObject;
@@ -53,6 +55,10 @@ public class SpeechManager : Singleton<SpeechManager>
{ {
AudioManager.Instance.PlaySound("Select"); AudioManager.Instance.PlaySound("Select");
gameObject.SetActive(false); gameObject.SetActive(false);
if (counter++ > 0 && LevelLoader.Instance.GlobalModifier == "CUP")
{
CupShuffle.Instance.StartShuffle();
}
} }
} }
+1 -1
View File
@@ -37,7 +37,7 @@ namespace Utils
[System.Serializable] [System.Serializable]
public class Puzzle public class Puzzle
{ {
public string[] puzzles; public string[] statements;
public string color; public string color;
} }
} }