game: npc spawn and move fixed
npcs still trying to sit on each other
This commit is contained in:
parent
c80d5b8890
commit
27044d5906
8 changed files with 349 additions and 46 deletions
|
@ -2852,6 +2852,111 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Padding: {x: -8, y: -5, z: -8, w: -5}
|
m_Padding: {x: -8, y: -5, z: -8, w: -5}
|
||||||
m_Softness: {x: 0, y: 0}
|
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
|
--- !u!1 &385737396
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -4702,19 +4807,28 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
maleNpcs:
|
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:
|
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}
|
policeNpc: {fileID: 0}
|
||||||
spawnPoints:
|
spawnPoints:
|
||||||
- {fileID: 1126609777}
|
- {fileID: 1249617921}
|
||||||
|
npcBufferTime: 5
|
||||||
playerFree: 0
|
playerFree: 0
|
||||||
currentNpcs: []
|
currentNpcs: []
|
||||||
chairPositions:
|
chairPositions:
|
||||||
- {fileID: 9804464}
|
- {fileID: 9804464}
|
||||||
despawnPoints:
|
- {fileID: 385635434}
|
||||||
- {fileID: 711059150}
|
- {fileID: 720927106}
|
||||||
- {fileID: 1400559515}
|
despawnPoints: []
|
||||||
--- !u!1 &553967502
|
--- !u!1 &553967502
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -5376,6 +5490,111 @@ CanvasRenderer:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 714078272}
|
m_GameObject: {fileID: 714078272}
|
||||||
m_CullTransparentMesh: 1
|
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
|
--- !u!1 &721586855
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -5728,7 +5947,7 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 0bab791ccf13189449b82b8f0b70b269, type: 3}
|
m_Script: {fileID: 11500000, guid: 0bab791ccf13189449b82b8f0b70b269, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
shiftDuration: 20
|
shiftDuration: 60
|
||||||
npcSpawnArea: {fileID: 1126609776}
|
npcSpawnArea: {fileID: 1126609776}
|
||||||
--- !u!1 &741702766
|
--- !u!1 &741702766
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -8922,14 +9141,11 @@ MonoBehaviour:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1126609776}
|
m_GameObject: {fileID: 1126609776}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 5453e60feb81353409a4c7dea809cb8e, type: 3}
|
m_Script: {fileID: 11500000, guid: 5453e60feb81353409a4c7dea809cb8e, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
npcBufferTime: 2
|
|
||||||
npcSpawned: 0
|
|
||||||
npc: {fileID: 6618770541138752799, guid: 3dcfbdcf77a53b14bb7c0c3140072ea7, type: 3}
|
|
||||||
--- !u!1 &1140621511
|
--- !u!1 &1140621511
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -14684,6 +14900,7 @@ GameObject:
|
||||||
- component: {fileID: 1718507922}
|
- component: {fileID: 1718507922}
|
||||||
- component: {fileID: 1718507921}
|
- component: {fileID: 1718507921}
|
||||||
- component: {fileID: 1718507925}
|
- component: {fileID: 1718507925}
|
||||||
|
- component: {fileID: 1718507926}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Trash_PLACEHOLDER
|
m_Name: Trash_PLACEHOLDER
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -14789,6 +15006,25 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 55044b851e3222644a32ab2d912aca68, type: 3}
|
m_Script: {fileID: 11500000, guid: 55044b851e3222644a32ab2d912aca68, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
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
|
--- !u!1 &1752294637
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -17922,6 +18158,8 @@ SceneRoots:
|
||||||
- {fileID: 2142814430}
|
- {fileID: 2142814430}
|
||||||
- {fileID: 1682193527}
|
- {fileID: 1682193527}
|
||||||
- {fileID: 9804468}
|
- {fileID: 9804468}
|
||||||
|
- {fileID: 385635438}
|
||||||
|
- {fileID: 720927110}
|
||||||
- {fileID: 1871635931}
|
- {fileID: 1871635931}
|
||||||
- {fileID: 1718507924}
|
- {fileID: 1718507924}
|
||||||
- {fileID: 101598008}
|
- {fileID: 101598008}
|
||||||
|
|
Binary file not shown.
|
@ -24,7 +24,9 @@ public class Despawn : MonoBehaviour
|
||||||
if (other.CompareTag("NPC"))
|
if (other.CompareTag("NPC"))
|
||||||
{
|
{
|
||||||
GameManager.instance.currentNPC = null;
|
GameManager.instance.currentNPC = null;
|
||||||
|
/*
|
||||||
NPCSpawn.instance.npcSpawned = false;
|
NPCSpawn.instance.npcSpawned = false;
|
||||||
|
*/
|
||||||
|
|
||||||
Destroy(other.gameObject);
|
Destroy(other.gameObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,18 @@ using UnityEngine;
|
||||||
|
|
||||||
public class NPCSpawn : MonoBehaviour
|
public class NPCSpawn : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static NPCSpawn instance;
|
/*public static NPCSpawn instance;*/
|
||||||
|
|
||||||
|
/*
|
||||||
[SerializeField] private float npcBufferTime;
|
[SerializeField] private float npcBufferTime;
|
||||||
public bool npcSpawned = false;
|
*/
|
||||||
|
/*public bool npcSpawned = false;
|
||||||
|
*/
|
||||||
|
|
||||||
[SerializeField]
|
/*[SerializeField]
|
||||||
GameObject npc;
|
GameObject npc;*/
|
||||||
|
|
||||||
void Awake()
|
/*void Awake()
|
||||||
{
|
{
|
||||||
if (instance ==null)
|
if (instance ==null)
|
||||||
{
|
{
|
||||||
|
@ -22,29 +25,29 @@ public class NPCSpawn : MonoBehaviour
|
||||||
{
|
{
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void Update()
|
/*void Update()
|
||||||
{
|
{
|
||||||
if (!npcSpawned)
|
if (!npcSpawned)
|
||||||
{
|
{
|
||||||
StartCoroutine(SpawnNPCAfterWait());
|
StartCoroutine(SpawnNPCAfterWait());
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void SpawnNPC()
|
/*void SpawnNPC()
|
||||||
{
|
{
|
||||||
StopAllCoroutines();
|
StopAllCoroutines();
|
||||||
GameObject spawnedNPC = Instantiate(npc, transform.position, Quaternion.identity);
|
GameObject spawnedNPC = Instantiate(npc, transform.position, Quaternion.identity);
|
||||||
npcSpawned = true;
|
npcSpawned = true;
|
||||||
|
|
||||||
GameManager.instance.currentNPC = spawnedNPC;
|
GameManager.instance.currentNPC = spawnedNPC;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
IEnumerator SpawnNPCAfterWait()
|
/*IEnumerator SpawnNPCAfterWait()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(npcBufferTime);
|
yield return new WaitForSeconds(npcBufferTime);
|
||||||
|
|
||||||
SpawnNPC();
|
SpawnNPC();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ using UnityEngine.Serialization;
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class NpcData
|
public class NpcData
|
||||||
{
|
{
|
||||||
public string name;
|
|
||||||
public string initialStatement;
|
public string initialStatement;
|
||||||
public string question1;
|
public string question1;
|
||||||
public string question2;
|
public string question2;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Author: Lin Hengrui Ryan
|
* Author: Lin Hengrui Ryan and Livinia Poo
|
||||||
* Date: 1/2/25
|
* Date: 1/2/25
|
||||||
* Description:
|
* Description:
|
||||||
* Npc Manager
|
* Npc Manager
|
||||||
|
@ -8,18 +8,22 @@
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
public class NpcManager : MonoBehaviour
|
public class NpcManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Assign Npc Manager instance
|
/// Assign Npc Manager instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static NpcManager instance;
|
public static NpcManager instance;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Assign GameManager script
|
||||||
|
/// </summary>
|
||||||
|
private GameManager gm;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// a list of all the male npcs
|
/// a list of all the male npcs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,6 +44,11 @@ public class NpcManager : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform[] spawnPoints;
|
public Transform[] spawnPoints;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// float for time between npc spawns
|
||||||
|
/// </summary>
|
||||||
|
[SerializeField] private float npcBufferTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// a bool to check if the player is free
|
/// a bool to check if the player is free
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -58,25 +67,12 @@ public class NpcManager : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform[] despawnPoints;
|
public Transform[] despawnPoints;
|
||||||
|
|
||||||
public void spawnNpc(bool isFemale)
|
/// <summary>
|
||||||
{
|
/// flag to prevent multiple coroutines
|
||||||
var randomNpc=0;
|
/// </summary>
|
||||||
var spawnPoint = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];
|
private bool isSpawning = false;
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
void Awake()
|
||||||
|
|
||||||
|
|
||||||
public void Awake()
|
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +84,51 @@ public class NpcManager : MonoBehaviour
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gm = GameObject.Find("Game Manager").GetComponent<GameManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
9
SSLR/Assets/Scripts/UIManager.cs
Normal file
9
SSLR/Assets/Scripts/UIManager.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class UIManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject speechBubble;
|
||||||
|
}
|
11
SSLR/Assets/Scripts/UIManager.cs.meta
Normal file
11
SSLR/Assets/Scripts/UIManager.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 914a267860e9d3242a99c1e486242c3e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Add table
Reference in a new issue