diff --git a/SSLR/Assets/Scenes/LiviPlayground.unity b/SSLR/Assets/Scenes/LiviPlayground.unity
index 69bae65..4127677 100644
--- a/SSLR/Assets/Scenes/LiviPlayground.unity
+++ b/SSLR/Assets/Scenes/LiviPlayground.unity
@@ -2852,6 +2852,111 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Padding: {x: -8, y: -5, z: -8, w: -5}
m_Softness: {x: 0, y: 0}
+--- !u!1 &385635434
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 385635438}
+ - component: {fileID: 385635437}
+ - component: {fileID: 385635436}
+ - component: {fileID: 385635435}
+ m_Layer: 0
+ m_Name: seat (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!65 &385635435
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 385635434}
+ m_Material: {fileID: 0}
+ m_IncludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ExcludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_LayerOverridePriority: 0
+ m_IsTrigger: 0
+ m_ProvidesContacts: 0
+ m_Enabled: 0
+ serializedVersion: 3
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &385635436
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 385635434}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_StaticShadowCaster: 0
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &385635437
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 385635434}
+ m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &385635438
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 385635434}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 2.101, y: 0.232, z: 3.973}
+ m_LocalScale: {x: 0.4, y: 0.4, z: 0.4}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &385737396
GameObject:
m_ObjectHideFlags: 0
@@ -4702,19 +4807,28 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
maleNpcs:
- - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
+ - {fileID: 5194893303514968177, guid: d6fdb3aad202bcb4a94a506ea6001e6a, type: 3}
+ - {fileID: 9135896169125054515, guid: a798b00ea921e8343898ff52e5991eca, type: 3}
+ - {fileID: 925545406418636384, guid: 4f5050781a4e9ac44b1d74fbfafffc3c, type: 3}
+ - {fileID: 4072881850004209407, guid: f31543151b7dd3048af80efadcec2cc2, type: 3}
+ - {fileID: 2969917783020190086, guid: 26a21da08e645a44d98892caa04cf0b2, type: 3}
+ - {fileID: 2185267836938882255, guid: 9338effa4924428488a33d614a89383b, type: 3}
+ - {fileID: 479759021627617850, guid: a3071440bdd10854488c521655a110c4, type: 3}
femaleNpcs:
- - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
+ - {fileID: 2684341282212037920, guid: 6ca4cac9baa55204bbc12dd4c3df7407, type: 3}
+ - {fileID: 296760103864809898, guid: bf5026474447d534280e7f9ca1558858, type: 3}
+ - {fileID: 6223094720403375677, guid: cd53db996f4929048b1024fafa3c314a, type: 3}
policeNpc: {fileID: 0}
spawnPoints:
- - {fileID: 1126609777}
+ - {fileID: 1249617921}
+ npcBufferTime: 5
playerFree: 0
currentNpcs: []
chairPositions:
- {fileID: 9804464}
- despawnPoints:
- - {fileID: 711059150}
- - {fileID: 1400559515}
+ - {fileID: 385635434}
+ - {fileID: 720927106}
+ despawnPoints: []
--- !u!1 &553967502
GameObject:
m_ObjectHideFlags: 0
@@ -5376,6 +5490,111 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 714078272}
m_CullTransparentMesh: 1
+--- !u!1 &720927106
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 720927110}
+ - component: {fileID: 720927109}
+ - component: {fileID: 720927108}
+ - component: {fileID: 720927107}
+ m_Layer: 0
+ m_Name: seat (2)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!65 &720927107
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 720927106}
+ m_Material: {fileID: 0}
+ m_IncludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ExcludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_LayerOverridePriority: 0
+ m_IsTrigger: 0
+ m_ProvidesContacts: 0
+ m_Enabled: 0
+ serializedVersion: 3
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &720927108
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 720927106}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_StaticShadowCaster: 0
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &720927109
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 720927106}
+ m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &720927110
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 720927106}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 3.874, y: 0.232, z: 3.973}
+ m_LocalScale: {x: 0.4, y: 0.4, z: 0.4}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &721586855
GameObject:
m_ObjectHideFlags: 0
@@ -5728,7 +5947,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0bab791ccf13189449b82b8f0b70b269, type: 3}
m_Name:
m_EditorClassIdentifier:
- shiftDuration: 20
+ shiftDuration: 60
npcSpawnArea: {fileID: 1126609776}
--- !u!1 &741702766
GameObject:
@@ -8922,14 +9141,11 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1126609776}
- m_Enabled: 1
+ m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5453e60feb81353409a4c7dea809cb8e, type: 3}
m_Name:
m_EditorClassIdentifier:
- npcBufferTime: 2
- npcSpawned: 0
- npc: {fileID: 6618770541138752799, guid: 3dcfbdcf77a53b14bb7c0c3140072ea7, type: 3}
--- !u!1 &1140621511
GameObject:
m_ObjectHideFlags: 0
@@ -14684,6 +14900,7 @@ GameObject:
- component: {fileID: 1718507922}
- component: {fileID: 1718507921}
- component: {fileID: 1718507925}
+ - component: {fileID: 1718507926}
m_Layer: 0
m_Name: Trash_PLACEHOLDER
m_TagString: Untagged
@@ -14789,6 +15006,25 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 55044b851e3222644a32ab2d912aca68, type: 3}
m_Name:
m_EditorClassIdentifier:
+--- !u!114 &1718507926
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1718507920}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 1e3fdca004f2d45fe8abbed571a8abd5, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_OverrideArea: 1
+ m_Area: 1
+ m_OverrideGenerateLinks: 0
+ m_GenerateLinks: 0
+ m_IgnoreFromBuild: 0
+ m_ApplyToChildren: 1
+ m_AffectedAgents: ffffffff
--- !u!1 &1752294637
GameObject:
m_ObjectHideFlags: 0
@@ -17922,6 +18158,8 @@ SceneRoots:
- {fileID: 2142814430}
- {fileID: 1682193527}
- {fileID: 9804468}
+ - {fileID: 385635438}
+ - {fileID: 720927110}
- {fileID: 1871635931}
- {fileID: 1718507924}
- {fileID: 101598008}
diff --git a/SSLR/Assets/Scenes/LiviPlayground/NavMesh-Game Manager.asset b/SSLR/Assets/Scenes/LiviPlayground/NavMesh-Game Manager.asset
index dab2b45..cf72cbc 100644
Binary files a/SSLR/Assets/Scenes/LiviPlayground/NavMesh-Game Manager.asset and b/SSLR/Assets/Scenes/LiviPlayground/NavMesh-Game Manager.asset differ
diff --git a/SSLR/Assets/Scripts/Despawn.cs b/SSLR/Assets/Scripts/Despawn.cs
index 7bed0ca..c841332 100644
--- a/SSLR/Assets/Scripts/Despawn.cs
+++ b/SSLR/Assets/Scripts/Despawn.cs
@@ -24,7 +24,9 @@ public class Despawn : MonoBehaviour
if (other.CompareTag("NPC"))
{
GameManager.instance.currentNPC = null;
+ /*
NPCSpawn.instance.npcSpawned = false;
+ */
Destroy(other.gameObject);
}
diff --git a/SSLR/Assets/Scripts/NPCSpawn.cs b/SSLR/Assets/Scripts/NPCSpawn.cs
index 07ba14f..256e78e 100644
--- a/SSLR/Assets/Scripts/NPCSpawn.cs
+++ b/SSLR/Assets/Scripts/NPCSpawn.cs
@@ -4,15 +4,18 @@ using UnityEngine;
public class NPCSpawn : MonoBehaviour
{
- public static NPCSpawn instance;
+ /*public static NPCSpawn instance;*/
+ /*
[SerializeField] private float npcBufferTime;
- public bool npcSpawned = false;
+ */
+ /*public bool npcSpawned = false;
+ */
- [SerializeField]
- GameObject npc;
+ /*[SerializeField]
+ GameObject npc;*/
- void Awake()
+ /*void Awake()
{
if (instance ==null)
{
@@ -22,29 +25,29 @@ public class NPCSpawn : MonoBehaviour
{
Destroy(gameObject);
}
- }
+ }*/
- void Update()
+ /*void Update()
{
if (!npcSpawned)
{
StartCoroutine(SpawnNPCAfterWait());
}
- }
+ }*/
- void SpawnNPC()
+ /*void SpawnNPC()
{
StopAllCoroutines();
GameObject spawnedNPC = Instantiate(npc, transform.position, Quaternion.identity);
npcSpawned = true;
GameManager.instance.currentNPC = spawnedNPC;
- }
+ }*/
- IEnumerator SpawnNPCAfterWait()
+ /*IEnumerator SpawnNPCAfterWait()
{
yield return new WaitForSeconds(npcBufferTime);
SpawnNPC();
- }
+ }*/
}
diff --git a/SSLR/Assets/Scripts/NpcData.cs b/SSLR/Assets/Scripts/NpcData.cs
index 4095ac0..04f180a 100644
--- a/SSLR/Assets/Scripts/NpcData.cs
+++ b/SSLR/Assets/Scripts/NpcData.cs
@@ -11,7 +11,6 @@ using UnityEngine.Serialization;
[Serializable]
public class NpcData
{
- public string name;
public string initialStatement;
public string question1;
public string question2;
diff --git a/SSLR/Assets/Scripts/NpcManager.cs b/SSLR/Assets/Scripts/NpcManager.cs
index 2c1fcea..2e9763a 100644
--- a/SSLR/Assets/Scripts/NpcManager.cs
+++ b/SSLR/Assets/Scripts/NpcManager.cs
@@ -1,5 +1,5 @@
/*
- * Author: Lin Hengrui Ryan
+ * Author: Lin Hengrui Ryan and Livinia Poo
* Date: 1/2/25
* Description:
* Npc Manager
@@ -8,17 +8,21 @@
using System;
using UnityEngine;
using System.Collections.Generic;
+using System.Collections;
using UnityEngine.Serialization;
public class NpcManager : MonoBehaviour
{
-
-
///
/// Assign Npc Manager instance
///
public static NpcManager instance;
+
+ ///
+ /// Assign GameManager script
+ ///
+ private GameManager gm;
///
/// a list of all the male npcs
@@ -39,6 +43,11 @@ public class NpcManager : MonoBehaviour
/// list of all the spawn points
///
public Transform[] spawnPoints;
+
+ ///
+ /// float for time between npc spawns
+ ///
+ [SerializeField] private float npcBufferTime;
///
/// a bool to check if the player is free
@@ -58,25 +67,12 @@ public class NpcManager : MonoBehaviour
///
public Transform[] despawnPoints;
- public void spawnNpc(bool isFemale)
- {
- var randomNpc=0;
- var spawnPoint = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];
- if (isFemale)
- {
- randomNpc = UnityEngine.Random.Range(0, femaleNpcs.Length);
- }
- else
- {
- randomNpc = UnityEngine.Random.Range(0, maleNpcs.Length);
- }
- var npc = Instantiate(isFemale ? femaleNpcs[randomNpc] : maleNpcs[randomNpc], spawnPoint.position, Quaternion.identity);
- currentNpcs.Add(npc);
-
- }
-
-
- public void Awake()
+ ///
+ /// flag to prevent multiple coroutines
+ ///
+ private bool isSpawning = false;
+
+ void Awake()
{
if (instance == null)
{
@@ -88,6 +84,51 @@ public class NpcManager : MonoBehaviour
Destroy(gameObject);
}
+ gm = GameObject.Find("Game Manager").GetComponent();
}
+ private void Update()
+ {
+ if (gm.shiftStarted)
+ {
+ if (currentNpcs.Count < 6 && !isSpawning)
+ {
+ StartCoroutine(SpawnNPCAfterWait());
+ }
+ }
+ else if (!gm.shiftStarted)
+ {
+ StopAllCoroutines();
+ }
+ }
+
+ public void SpawnNPC()
+ {
+ var randomNpc=0;
+ bool isFemale = UnityEngine.Random.value > 0.5f;
+ var spawnPoint = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];
+ if (isFemale)
+ {
+ randomNpc = UnityEngine.Random.Range(0, femaleNpcs.Length);
+ }
+ else
+ {
+ randomNpc = UnityEngine.Random.Range(0, maleNpcs.Length);
+ }
+ var npc = Instantiate(isFemale ? femaleNpcs[randomNpc] : maleNpcs[randomNpc], spawnPoint.position, Quaternion.identity);
+ currentNpcs.Add(npc);
+ Debug.Log($"NPC Spawned! Total NPCS: {currentNpcs.Count}");
+ }
+
+ IEnumerator SpawnNPCAfterWait()
+ {
+ isSpawning = true;
+ yield return new WaitForSeconds(npcBufferTime);
+
+ if(currentNpcs.Count < 6)
+ {
+ SpawnNPC();
+ }
+ isSpawning = false;
+ }
}
diff --git a/SSLR/Assets/Scripts/UIManager.cs b/SSLR/Assets/Scripts/UIManager.cs
new file mode 100644
index 0000000..ad01c4d
--- /dev/null
+++ b/SSLR/Assets/Scripts/UIManager.cs
@@ -0,0 +1,9 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using TMPro;
+
+public class UIManager : MonoBehaviour
+{
+ public GameObject speechBubble;
+}
diff --git a/SSLR/Assets/Scripts/UIManager.cs.meta b/SSLR/Assets/Scripts/UIManager.cs.meta
new file mode 100644
index 0000000..dfe645f
--- /dev/null
+++ b/SSLR/Assets/Scripts/UIManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 914a267860e9d3242a99c1e486242c3e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: