game: placing npcs in livi playground

This commit is contained in:
ryan 2025-02-07 15:44:43 +08:00
parent 8c637ce8f1
commit e0858a94de
7 changed files with 230 additions and 176 deletions

View file

@ -52,10 +52,18 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: Male1 value: Male1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -4738449573843015574, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
propertyPath: m_TagString
value: NPC
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3} - target: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: male1WithHair value: male1WithHair
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
propertyPath: m_TagString
value: NPC
objectReference: {fileID: 0}
- target: {fileID: 5866666021909216657, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3} - target: {fileID: 5866666021909216657, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
propertyPath: m_Controller propertyPath: m_Controller
value: value:
@ -70,6 +78,12 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3} - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 2866292048537355755} addedObject: {fileID: 2866292048537355755}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
insertIndex: -1
addedObject: {fileID: 7526272965874387434}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
insertIndex: -1
addedObject: {fileID: 4155463426386729222}
m_SourcePrefab: {fileID: 100100000, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 208f8e7ee2310474aa57f8901d61d5f6, type: 3}
--- !u!1 &8486445782931515160 stripped --- !u!1 &8486445782931515160 stripped
GameObject: GameObject:
@ -113,3 +127,53 @@ MonoBehaviour:
agent: {fileID: 0} agent: {fileID: 0}
desk: {fileID: 0} desk: {fileID: 0}
animator: {fileID: 0} animator: {fileID: 0}
--- !u!136 &7526272965874387434
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8486445782931515160}
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: 1
serializedVersion: 2
m_Radius: 0.41697595
m_Height: 1.6271778
m_Direction: 1
m_Center: {x: 0, y: 0.78, z: 0}
--- !u!54 &4155463426386729222
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8486445782931515160}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0

View file

@ -205,67 +205,111 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039245} m_GameObject: {fileID: 1039245}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &1396610 --- !u!1 &9804464
PrefabInstance: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9804468}
- component: {fileID: 9804467}
- component: {fileID: 9804466}
- component: {fileID: 9804465}
m_Layer: 0
m_Name: seat
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &9804465
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9804464}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2 serializedVersion: 2
m_Modification: m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 0
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_Size: {x: 1, y: 1, z: 1}
m_Modifications: m_Center: {x: 0, y: 0, z: 0}
- target: {fileID: 2866292048537355755, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} --- !u!23 &9804466
propertyPath: desk MeshRenderer:
value: m_ObjectHideFlags: 0
objectReference: {fileID: 418120326} m_CorrespondingSourceObject: {fileID: 0}
- target: {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_PrefabInstance: {fileID: 0}
propertyPath: m_Name m_PrefabAsset: {fileID: 0}
value: male1WithHair m_GameObject: {fileID: 9804464}
objectReference: {fileID: 0} m_Enabled: 1
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_CastShadows: 1
propertyPath: m_LocalPosition.x m_ReceiveShadows: 1
value: 0.13746405 m_DynamicOccludee: 1
objectReference: {fileID: 0} m_StaticShadowCaster: 0
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_MotionVectors: 1
propertyPath: m_LocalPosition.y m_LightProbeUsage: 1
value: -0.00000047683716 m_ReflectionProbeUsage: 1
objectReference: {fileID: 0} m_RayTracingMode: 2
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_RayTraceProcedural: 0
propertyPath: m_LocalPosition.z m_RenderingLayerMask: 1
value: -2.7281823 m_RendererPriority: 0
objectReference: {fileID: 0} m_Materials:
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
propertyPath: m_LocalRotation.w m_StaticBatchInfo:
value: 1 firstSubMesh: 0
objectReference: {fileID: 0} subMeshCount: 0
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_StaticBatchRoot: {fileID: 0}
propertyPath: m_LocalRotation.x m_ProbeAnchor: {fileID: 0}
value: 0 m_LightProbeVolumeOverride: {fileID: 0}
objectReference: {fileID: 0} m_ScaleInLightmap: 1
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_ReceiveGI: 1
propertyPath: m_LocalRotation.y m_PreserveUVs: 0
value: 0 m_IgnoreNormalsForChartDetection: 0
objectReference: {fileID: 0} m_ImportantGI: 0
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_StitchLightmapSeams: 1
propertyPath: m_LocalRotation.z m_SelectedEditorRenderState: 3
value: 0 m_MinimumChartSize: 4
objectReference: {fileID: 0} m_AutoUVMaxDistance: 0.5
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_AutoUVMaxAngle: 89
propertyPath: m_LocalEulerAnglesHint.x m_LightmapParameters: {fileID: 0}
value: 0 m_SortingLayerID: 0
objectReference: {fileID: 0} m_SortingLayer: 0
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_SortingOrder: 0
propertyPath: m_LocalEulerAnglesHint.y m_AdditionalVertexStreams: {fileID: 0}
value: 0 --- !u!33 &9804467
objectReference: {fileID: 0} MeshFilter:
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_ObjectHideFlags: 0
propertyPath: m_LocalEulerAnglesHint.z m_CorrespondingSourceObject: {fileID: 0}
value: 0 m_PrefabInstance: {fileID: 0}
objectReference: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_RemovedComponents: [] m_GameObject: {fileID: 9804464}
m_RemovedGameObjects: [] m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
m_AddedGameObjects: [] --- !u!4 &9804468
m_AddedComponents: [] Transform:
m_SourcePrefab: {fileID: 100100000, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3} m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9804464}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.31, 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!1001 &38700534 --- !u!1001 &38700534
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1978,15 +2022,19 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
maleNpcs: maleNpcs:
- {fileID: 0} - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
femaleNpcs: femaleNpcs:
- {fileID: 0} - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
policeNpc: {fileID: 0} policeNpc: {fileID: 0}
spawnPoints: [] spawnPoints:
- {fileID: 1126609777}
playerFree: 0 playerFree: 0
currentNpcs: [] currentNpcs: []
chairPositions: [] chairPositions:
despawnPoints: [] - {fileID: 9804464}
despawnPoints:
- {fileID: 711059150}
- {fileID: 1400559515}
--- !u!1 &543859847 --- !u!1 &543859847
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5027,7 +5075,7 @@ BoxCollider:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IncludeLayers: m_IncludeLayers:
serializedVersion: 2 serializedVersion: 2
m_Bits: 0 m_Bits: 4294967295
m_ExcludeLayers: m_ExcludeLayers:
serializedVersion: 2 serializedVersion: 2
m_Bits: 0 m_Bits: 0
@ -5069,6 +5117,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
doorLeft: {fileID: 816321262} doorLeft: {fileID: 816321262}
doorRight: {fileID: 331300392} doorRight: {fileID: 331300392}
doorCloseDelay: 1.5
--- !u!1 &1318173673 --- !u!1 &1318173673
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7524,4 +7573,4 @@ SceneRoots:
- {fileID: 38700534} - {fileID: 38700534}
- {fileID: 402867245} - {fileID: 402867245}
- {fileID: 775517552} - {fileID: 775517552}
- {fileID: 1396610} - {fileID: 9804468}

View file

@ -958,12 +958,12 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1056860014}
- {fileID: 335017576} - {fileID: 335017576}
- {fileID: 368167159} - {fileID: 368167159}
- {fileID: 1132197014} - {fileID: 1132197014}
- {fileID: 1558064964} - {fileID: 1558064964}
- {fileID: 589608068} - {fileID: 589608068}
- {fileID: 1056860014}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &545637506 --- !u!114 &545637506
@ -979,33 +979,16 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
maleNpcs: maleNpcs:
- {fileID: 1162186098289904096, guid: b404be61a97237740821ffb3f801eb68, type: 3} - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
- {fileID: 939314035007084349, guid: b378ca729e9cce4408beb44639b2bc58, type: 3}
- {fileID: 5163734529656434887, guid: 592469d1f1c85824cb0586b51d080b18, type: 3}
- {fileID: 5439687604807156076, guid: f381ae8e8f34b8e4ca4a847775c0e60f, type: 3}
- {fileID: 3572036619537446221, guid: 06fee42127b3b4243a1d03df215365e7, type: 3}
- {fileID: 3212542082100280136, guid: d4e006b1ecd50d44984ac7e8f2fb965f, type: 3}
- {fileID: 6095755043422354155, guid: 4702ac9e34e5f4549be2d0acc2f00dae, type: 3}
- {fileID: 3475247101945908102, guid: 4478b7186cc0aad49b6185426503ea36, type: 3}
femaleNpcs: femaleNpcs:
- {fileID: 8874432443279944950, guid: 9d6c422b331360f478f55ea7828561a1, type: 3} - {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
- {fileID: 5700822135220029682, guid: 9a0e848f4199dae46b8c371c6d792998, type: 3}
- {fileID: 807456354009633900, guid: b933b12f828c2fc45b6528e41b2e8824, type: 3}
- {fileID: 3994904034570386205, guid: 921de0f680b059b448b93a8c6d33b63e, type: 3}
policeNpc: {fileID: 6846919541000073478, guid: 5744d4b3c1617fe4096b9035ee1be4e8, type: 3} policeNpc: {fileID: 6846919541000073478, guid: 5744d4b3c1617fe4096b9035ee1be4e8, type: 3}
spawnPoints: spawnPoints:
- {fileID: 1056860014} - {fileID: 1056860014}
- {fileID: 335017576}
- {fileID: 368167159}
- {fileID: 1132197014}
- {fileID: 1558064964}
- {fileID: 589608068}
playerFree: 0 playerFree: 0
currentNpcs: [] currentNpcs: []
chairPositions: chairPositions:
- {fileID: 1333249642} - {fileID: 1333249642}
- {fileID: 1333249642}
- {fileID: 1333249642}
despawnPoints: [] despawnPoints: []
--- !u!114 &545637507 --- !u!114 &545637507
MonoBehaviour: MonoBehaviour:
@ -1140,7 +1123,7 @@ Transform:
m_GameObject: {fileID: 1056860013} m_GameObject: {fileID: 1056860013}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.53231, y: 1.3681344, z: 2.4535394} m_LocalPosition: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -1377,6 +1360,7 @@ GameObject:
- component: {fileID: 1333249645} - component: {fileID: 1333249645}
- component: {fileID: 1333249644} - component: {fileID: 1333249644}
- component: {fileID: 1333249643} - component: {fileID: 1333249643}
- component: {fileID: 1333249647}
m_Layer: 0 m_Layer: 0
m_Name: Cube (2) m_Name: Cube (2)
m_TagString: Untagged m_TagString: Untagged
@ -1401,7 +1385,7 @@ BoxCollider:
m_LayerOverridePriority: 0 m_LayerOverridePriority: 0
m_IsTrigger: 0 m_IsTrigger: 0
m_ProvidesContacts: 0 m_ProvidesContacts: 0
m_Enabled: 1 m_Enabled: 0
serializedVersion: 3 serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
@ -1464,12 +1448,31 @@ Transform:
m_GameObject: {fileID: 1333249642} m_GameObject: {fileID: 1333249642}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 6.04, y: 0.268, z: -5.45} m_LocalPosition: {x: 6.04, y: 0.238, z: -5.45}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} m_LocalScale: {x: 0.40720877, y: 0.40720877, z: 0.40720877}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1333249647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1333249642}
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 &1558064963 --- !u!1 &1558064963
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1587,67 +1590,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &600650188589416568
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2866292048537355755, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: desk
value:
objectReference: {fileID: 505257119}
- target: {fileID: 8486445782931515160, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_Name
value: male1WithHair
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalPosition.x
value: 6.4546204
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalPosition.y
value: 0.04101038
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalPosition.z
value: -3.3671114
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9119289884132965794, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: beae5a92134b6f347a8cd76bfefd04da, type: 3}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1664,4 +1606,3 @@ SceneRoots:
- {fileID: 515541349} - {fileID: 515541349}
- {fileID: 505257119} - {fileID: 505257119}
- {fileID: 1333249646} - {fileID: 1333249646}
- {fileID: 600650188589416568}

View file

@ -18,7 +18,10 @@ public class Door : MonoBehaviour
[SerializeField] private GameObject doorLeft; [SerializeField] private GameObject doorLeft;
[SerializeField] private GameObject doorRight; [SerializeField] private GameObject doorRight;
/// <summary>
/// a value to control delay the door closing
/// </summary>
public float doorCloseDelay = 0.75f;
private bool doorOpened = false; private bool doorOpened = false;
/// <summary> /// <summary>
@ -39,6 +42,7 @@ public class Door : MonoBehaviour
/// <param name="other"></param> /// <param name="other"></param>
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
{ {
Debug.Log(other.name);
if (!doorOpened && (other.CompareTag("Player") || other.CompareTag("NPC"))) if (!doorOpened && (other.CompareTag("Player") || other.CompareTag("NPC")))
{ {
OpenDoor(); OpenDoor();
@ -61,7 +65,7 @@ public class Door : MonoBehaviour
doorRight.transform.eulerAngles = currentRightRotation; doorRight.transform.eulerAngles = currentRightRotation;
doorOpened = true; doorOpened = true;
StartCoroutine(CloseDoorAfterDelay(0.75f)); StartCoroutine(CloseDoorAfterDelay(doorCloseDelay));
} }
/// <summary> /// <summary>

View file

@ -33,16 +33,13 @@ public class NpcMovementRework : MonoBehaviour
{ {
animator.SetFloat(Speed, 0); animator.SetFloat(Speed, 0);
} }
} }
public void Start() public void Start()
{ {
agent = gameObject.GetComponent<NavMeshAgent>(); agent = gameObject.GetComponent<NavMeshAgent>();
animator = gameObject.GetComponent<Animator>(); animator = gameObject.GetComponent<Animator>();
var sitCoro = SitDown(); StartCoroutine(SitDown());
StartCoroutine(sitCoro);
} }
@ -52,40 +49,34 @@ public class NpcMovementRework : MonoBehaviour
} }
public IEnumerator SitDown() public IEnumerator SitDown()
{ {
var i = Random.Range(0, NpcManager.instance.chairPositions.Length); var i = Random.Range(0, NpcManager.instance.chairPositions.Length);
Debug.Log(i);
var pos = NpcManager.instance.chairPositions[i]; var pos = NpcManager.instance.chairPositions[i];
agent.SetDestination(pos.transform.position);
var sittingPosition = pos.transform.position+new Vector3(0,0.5f,0); var sittingPosition = pos.transform.position;
sittingPosition.y = 0;
agent.SetDestination(sittingPosition);
while (true) while (true)
{ {
var dist= Vector3.Distance(pos.transform.position,gameObject.transform.position); var dist= Vector3.Distance(sittingPosition,gameObject.transform.position);
if (dist <0.5) // Debug.Log(dist);
if (dist < 0.05f)
{ {
agent.SetDestination(gameObject.transform.position); agent.SetDestination(gameObject.transform.position);
animator.SetBool(IsSitting, true);
gameObject.transform.rotation = pos.transform.rotation; gameObject.transform.rotation = pos.transform.rotation;
gameObject.transform.position=sittingPosition; break;
animator.SetBool(IsSitting,true); }
yield break; yield return 0;
}
} }
yield return new WaitForEndOfFrame();
}
}
public void Despawn() public void Despawn()
{ {
var random= Random.Range(0, NpcManager.instance.despawnPoints.Length); var random = Random.Range(0, NpcManager.instance.despawnPoints.Length);
agent.SetDestination(NpcManager.instance.despawnPoints[random].position); agent.SetDestination(NpcManager.instance.despawnPoints[random].position);
} }
} }

View file

@ -75,6 +75,11 @@ public class NpcManager : MonoBehaviour
// currentNpcs.SetValue(npc,currentNpcs.Length); // currentNpcs.SetValue(npc,currentNpcs.Length);
} }
private void Start()
{
spawnNpc(false, spawnPoints[0]);
}
public void Awake() public void Awake()
{ {
if (instance == null) if (instance == null)