game: adding sitting to npcs
This commit is contained in:
parent
a5b1d8aa33
commit
dcc84d251e
8 changed files with 60441 additions and 25 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,55 @@
|
||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1101 &-3167120869644477374
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: isSitting
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 7722866433551739582}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.9544073
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &-1887386449021145652
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: isSitting
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -1189191462116768978}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.96428573
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &-1189191462116768978
|
--- !u!1102 &-1189191462116768978
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
@ -10,7 +60,8 @@ AnimatorState:
|
||||||
m_Name: Blend Tree
|
m_Name: Blend Tree
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions:
|
||||||
|
- {fileID: -3167120869644477374}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
m_IKOnFeet: 0
|
m_IKOnFeet: 0
|
||||||
|
@ -38,12 +89,15 @@ AnimatorStateMachine:
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -1189191462116768978}
|
m_State: {fileID: -1189191462116768978}
|
||||||
m_Position: {x: 30, y: 190, z: 0}
|
m_Position: {x: 30, y: 190, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 7722866433551739582}
|
||||||
|
m_Position: {x: 280, y: 190, z: 0}
|
||||||
m_ChildStateMachines: []
|
m_ChildStateMachines: []
|
||||||
m_AnyStateTransitions: []
|
m_AnyStateTransitions: []
|
||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions: {}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
m_AnyStatePosition: {x: 300, y: 120, z: 0}
|
||||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
@ -63,6 +117,12 @@ AnimatorController:
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: isSitting
|
||||||
|
m_Type: 4
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
|
@ -107,3 +167,30 @@ BlendTree:
|
||||||
m_UseAutomaticThresholds: 0
|
m_UseAutomaticThresholds: 0
|
||||||
m_NormalizedBlendValues: 0
|
m_NormalizedBlendValues: 0
|
||||||
m_BlendType: 0
|
m_BlendType: 0
|
||||||
|
--- !u!1102 &7722866433551739582
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: sitting
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: -1887386449021145652}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400000, guid: e984e1750f91ce946add2d72deec9486, type: 2}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
|
59006
SSLR/Assets/NpcModels/sitting.anim
Normal file
59006
SSLR/Assets/NpcModels/sitting.anim
Normal file
File diff suppressed because it is too large
Load diff
8
SSLR/Assets/NpcModels/sitting.anim.meta
Normal file
8
SSLR/Assets/NpcModels/sitting.anim.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e984e1750f91ce946add2d72deec9486
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -936,7 +936,7 @@ MonoBehaviour:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 545637503}
|
m_GameObject: {fileID: 545637503}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: e8dc8c9a0f5dd0243895dc3a63323b85, type: 3}
|
m_Script: {fileID: 11500000, guid: e8dc8c9a0f5dd0243895dc3a63323b85, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
|
@ -1002,6 +1002,10 @@ MonoBehaviour:
|
||||||
- {fileID: 589608068}
|
- {fileID: 589608068}
|
||||||
playerFree: 0
|
playerFree: 0
|
||||||
currentNpcs: []
|
currentNpcs: []
|
||||||
|
chairPositions:
|
||||||
|
- {fileID: 1333249642}
|
||||||
|
- {fileID: 1333249642}
|
||||||
|
- {fileID: 1333249642}
|
||||||
--- !u!114 &545637507
|
--- !u!114 &545637507
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1422,6 +1426,111 @@ MonoBehaviour:
|
||||||
m_Teleporting:
|
m_Teleporting:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
|
--- !u!1 &1333249642
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1333249646}
|
||||||
|
- component: {fileID: 1333249645}
|
||||||
|
- component: {fileID: 1333249644}
|
||||||
|
- component: {fileID: 1333249643}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Cube (2)
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!65 &1333249643
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1333249642}
|
||||||
|
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: 3
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &1333249644
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1333249642}
|
||||||
|
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 &1333249645
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1333249642}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &1333249646
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1333249642}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 6.04, y: 0.268, z: -5.45}
|
||||||
|
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1558064963
|
--- !u!1 &1558064963
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1475,19 +1584,19 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 1
|
value: 0.9880131
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0
|
value: 0.15437005
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
@ -1495,7 +1604,7 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
value: 0
|
value: 17.761
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
@ -1582,7 +1691,6 @@ MonoBehaviour:
|
||||||
m_Bits: 128
|
m_Bits: 128
|
||||||
roamingPoint: {x: 0, y: 0, z: 0}
|
roamingPoint: {x: 0, y: 0, z: 0}
|
||||||
animator: {fileID: 1876687163}
|
animator: {fileID: 1876687163}
|
||||||
chairPosition: []
|
|
||||||
--- !u!95 &1876687163 stripped
|
--- !u!95 &1876687163 stripped
|
||||||
Animator:
|
Animator:
|
||||||
m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: 1d353017ec9105348b92bcc4587d73db, type: 3}
|
||||||
|
@ -1690,3 +1798,4 @@ SceneRoots:
|
||||||
- {fileID: 305375505}
|
- {fileID: 305375505}
|
||||||
- {fileID: 515541349}
|
- {fileID: 515541349}
|
||||||
- {fileID: 505257119}
|
- {fileID: 505257119}
|
||||||
|
- {fileID: 1333249646}
|
||||||
|
|
|
@ -83,7 +83,7 @@ FirebaseGet(); }
|
||||||
User = result.Model;
|
User = result.Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void FirebaseGet()
|
public void FirebaseGet()
|
||||||
{
|
{
|
||||||
FirebaseDatabase.DefaultInstance.RootReference.Child("stories").GetValueAsync().ContinueWith(task =>
|
FirebaseDatabase.DefaultInstance.RootReference.Child("stories").GetValueAsync().ContinueWith(task =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.AI;
|
using UnityEngine.AI;
|
||||||
|
|
||||||
|
@ -23,18 +23,19 @@ public class NpcMovementRework : MonoBehaviour
|
||||||
public LayerMask despawnArea;
|
public LayerMask despawnArea;
|
||||||
public Vector3 roamingPoint;
|
public Vector3 roamingPoint;
|
||||||
public Animator animator;
|
public Animator animator;
|
||||||
public Transform[] chairPosition;
|
private static readonly int IsSitting = Animator.StringToHash("isSitting");
|
||||||
|
private static readonly int Speed = Animator.StringToHash("Speed");
|
||||||
|
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (agent.velocity.magnitude > 0.1)
|
if (agent.velocity.magnitude > 0.1)
|
||||||
{
|
{
|
||||||
animator.SetFloat("Speed", 1);
|
animator.SetFloat(Speed, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
animator.SetFloat("Speed", 0);
|
animator.SetFloat(Speed, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ public class NpcMovementRework : MonoBehaviour
|
||||||
{
|
{
|
||||||
agent = gameObject.GetComponent<NavMeshAgent>();
|
agent = gameObject.GetComponent<NavMeshAgent>();
|
||||||
animator = gameObject.GetComponent<Animator>();
|
animator = gameObject.GetComponent<Animator>();
|
||||||
|
var sitCoro = SitDown();
|
||||||
|
StartCoroutine(sitCoro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,17 +62,35 @@ public class NpcMovementRework : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeASeat()
|
public IEnumerator SitDown()
|
||||||
{
|
{
|
||||||
|
var i = Random.Range(0, NpcManager.instance.chairPositions.Length);
|
||||||
|
Debug.Log(i);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GoToSeat()
|
var pos = NpcManager.instance.chairPositions[i];
|
||||||
|
|
||||||
|
agent.SetDestination(pos.transform.position);
|
||||||
|
|
||||||
|
var sittingPosition = pos.transform.position+new Vector3(0,0.5f,0);
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
var i = UnityEngine.Random.Range(0, chairPosition.Length);
|
var dist= Vector3.Distance(pos.transform.position,gameObject.transform.position);
|
||||||
agent.SetDestination(chairPosition[i].position);
|
if (dist <0.5)
|
||||||
|
{
|
||||||
|
agent.SetDestination(gameObject.transform.position);
|
||||||
|
gameObject.transform.position=sittingPosition;
|
||||||
|
gameObject.transform.rotation = pos.transform.rotation;
|
||||||
|
animator.SetBool(IsSitting,true);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForEndOfFrame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -52,6 +51,8 @@ public class NpcManager : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject[] currentNpcs;
|
public GameObject[] currentNpcs;
|
||||||
|
|
||||||
|
public GameObject[] chairPositions;
|
||||||
|
|
||||||
public void spawnNpc(bool isFemale, Transform spawnPoint)
|
public void spawnNpc(bool isFemale, Transform spawnPoint)
|
||||||
{
|
{
|
||||||
var randomNpc=0;
|
var randomNpc=0;
|
||||||
|
@ -66,4 +67,18 @@ public class NpcManager : MonoBehaviour
|
||||||
var npc = Instantiate(isFemale ? femaleNpcs[randomNpc] : maleNpcs[randomNpc], spawnPoint.position, Quaternion.identity);
|
var npc = Instantiate(isFemale ? femaleNpcs[randomNpc] : maleNpcs[randomNpc], spawnPoint.position, Quaternion.identity);
|
||||||
// currentNpcs.SetValue(npc,currentNpcs.Length);
|
// currentNpcs.SetValue(npc,currentNpcs.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Awake()
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue