Made the password checker spawn randomlu

This commit is contained in:
Pasha Bibko
2026-01-27 13:08:50 +00:00
parent 9417a3315e
commit ab2e211de7
2 changed files with 23 additions and 62 deletions

View File

@@ -853,41 +853,6 @@ MonoBehaviour:
type: 3}
<PlayerTextNameInput>k__BackingField: {fileID: 607967473}
<IDRKWhatToCallThis>k__BackingField: {fileID: 675660038}
--- !u!1 &910491141
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 910491142}
m_Layer: 5
m_Name: Overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &910491142
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 910491141}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1480201978}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!4 &1003288350 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4417313079524746681, guid: c0a03ce6c4f39224299267b83719ceb7,
@@ -1011,12 +976,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 42603e4f95b24efa85355a04450c20e2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &1480201978 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 7579812889699807472, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}
m_PrefabInstance: {fileID: 1758685209}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1484681361 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 833602854707986350, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
@@ -1129,11 +1088,7 @@ PrefabInstance:
objectReference: {fileID: 880466090}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 7579812889699807472, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}
insertIndex: -1
addedObject: {fileID: 910491142}
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e29ce1fe47a855c4e907d4312c9e9d6e, type: 3}
--- !u!114 &1758685210 stripped

View File

@@ -96,14 +96,16 @@ namespace InterfaceOff
private void FixedUpdate()
{
if (Random.Range(0, 1000) == 500)
{
PasswordField.SetActive(true);
}
/* Spawns new windows whilst active */
if (AutoSpawn)
{
/* Has a random choice for the PasswordField to show up */
if (Random.Range(0, 1000) == 500)
{
PasswordField.SetActive(true);
}
/* Calculates the current max spawn time */
const int TICKS_PER_SECOND = 20; // Unity constant
const int MIN_SPAWN_TIME = 2 * TICKS_PER_SECOND;
const int MAX_SPAWN_TIME = 5 * TICKS_PER_SECOND;
@@ -111,8 +113,6 @@ namespace InterfaceOff
int currentMaxSpawnTime = MAX_SPAWN_TIME - (int)(ScoreTracker.CurrentScore() * DifficultyManager.DifficultyEffect);
currentMaxSpawnTime = Math.Clamp(currentMaxSpawnTime, MIN_SPAWN_TIME + 1, MAX_SPAWN_TIME);
Debug.Log($"Max: [{currentMaxSpawnTime}] with difficulty [{DifficultyManager.DifficultyEffect}]");
/* Decreases the spawn counter and spawns if at 0 */
TimeTillNextSpawn = Math.Max(0, TimeTillNextSpawn - 1);
if (TimeTillNextSpawn == 0)
@@ -123,15 +123,21 @@ namespace InterfaceOff
}
}
/* Else checks if it should reload the scene */
else if (Input.GetKey(KeyCode.Space))
else
{
SceneController.ReloadScene();
}
/* Makes sure the password overlay does not interfere */
PasswordField.SetActive(false);
else if (Input.GetKey(KeyCode.Tab))
{
SceneController.Load(name: "MenuScene");
/* Else checks if it should change the active scene */
if (Input.GetKey(KeyCode.Space))
{
SceneController.ReloadScene();
}
else if (Input.GetKey(KeyCode.Tab))
{
SceneController.Load(name: "MenuScene");
}
}
}