forked from cgvr/DeltaVR
add pen, animate writing when npc listening to order
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,101 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1094134314776274198
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9206972526079896025}
|
||||
- component: {fileID: 3437973267000939533}
|
||||
- component: {fileID: 5517757330251231332}
|
||||
- component: {fileID: 8182716950090654063}
|
||||
m_Layer: 0
|
||||
m_Name: Pen
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &9206972526079896025
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1094134314776274198}
|
||||
m_LocalRotation: {x: -0, y: -0.79187685, z: -0, w: 0.6106809}
|
||||
m_LocalPosition: {x: 0.09525456, y: 0.477, z: 0.119685724}
|
||||
m_LocalScale: {x: 0.26992205, y: 0.26992208, z: 0.26992205}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5657737279223690836}
|
||||
m_RootOrder: -1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &3437973267000939533
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1094134314776274198}
|
||||
m_Mesh: {fileID: 6255687079079774844, guid: 72b65c8e9212b384fa196bc7b40b6a94, type: 3}
|
||||
--- !u!23 &5517757330251231332
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1094134314776274198}
|
||||
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: -876546973899608171, guid: 72b65c8e9212b384fa196bc7b40b6a94, type: 3}
|
||||
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!114 &8182716950090654063
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1094134314776274198}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 96a5bc0230ea8fe41b253c653699fecc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1758614216652057599
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -110,10 +206,12 @@ RectTransform:
|
||||
m_GameObject: {fileID: 4663194936290788516}
|
||||
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_LocalScale: {x: 1.5292481, y: 1.5292481, z: 1.5292481}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6822286665445551211}
|
||||
- {fileID: 1530163177365118906}
|
||||
- {fileID: 9206972526079896025}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: -1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -209,13 +307,14 @@ MonoBehaviour:
|
||||
Ulrich_Order_Is_Ready
|
||||
minScaleY: 1
|
||||
maxScaleY: 2
|
||||
gain: 20
|
||||
gain: 10
|
||||
attack: 0.6
|
||||
release: 0.2
|
||||
inverted: 0
|
||||
fmodWhisperBridge: {fileID: 0}
|
||||
notepadText: {fileID: 0}
|
||||
notepad: {fileID: 0}
|
||||
notepad: {fileID: 4428142794029565387}
|
||||
notepadText: {fileID: 1672365637701508529}
|
||||
pen: {fileID: 1094134314776274198}
|
||||
backRoom: {fileID: 0}
|
||||
plate: {fileID: 0}
|
||||
backRoomMovingTime: 5
|
||||
@@ -264,8 +363,8 @@ BoxCollider:
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 5, y: 1, z: 5}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 3, y: 2, z: 3}
|
||||
m_Center: {x: 0, y: 0.25, z: 0}
|
||||
--- !u!114 &1413215456818694348
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -292,7 +391,7 @@ MonoBehaviour:
|
||||
NetworkObserver: {fileID: 0}
|
||||
<PrefabId>k__BackingField: 0
|
||||
<SpawnableCollectionId>k__BackingField: 0
|
||||
_scenePathHash: 0
|
||||
_scenePathHash: 353480863
|
||||
<SceneId>k__BackingField: 0
|
||||
<AssetPathHash>k__BackingField: 836791613782540943
|
||||
_sceneNetworkObjects:
|
||||
@@ -305,36 +404,6 @@ MonoBehaviour:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 1413215456818694348}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
@@ -447,6 +516,29 @@ MonoBehaviour:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
--- !u!114 &483845010817450077
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -564,3 +656,159 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1001 &7727616090730660173
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 5657737279223690836}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5732187690458924453, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6218887849178989702, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Notepad
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_text
|
||||
value: '
|
||||
|
||||
'
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_fontSize
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_fontAsset
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 02d225d9907048f4f8320a20fb5bed34,
|
||||
type: 2}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_fontStyle
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_fontSizeBase
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_sharedMaterial
|
||||
value:
|
||||
objectReference: {fileID: 2498710373105355017, guid: 02d225d9907048f4f8320a20fb5bed34,
|
||||
type: 2}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.7846994
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.7846994
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.7846994
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.13211383
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.332
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0.15739569
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7278887
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0.6856953
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 18.142
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 71790bfc168aa0a45ba1b3bdf8f13132, type: 3}
|
||||
--- !u!4 &1530163177365118906 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 9079884296988335863, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7727616090730660173}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1672365637701508529 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 8938359156153031932, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7727616090730660173}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4428142794029565387 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6218887849178989702, guid: 71790bfc168aa0a45ba1b3bdf8f13132,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7727616090730660173}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
Binary file not shown.
8
Assets/_PROJECT/Scripts/ModeGeneration/Cafe.meta
Normal file
8
Assets/_PROJECT/Scripts/ModeGeneration/Cafe.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c87ada50d41fde449b9fc44a22f4991
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/_PROJECT/Scripts/ModeGeneration/Cafe/PenWriter.cs
Normal file
76
Assets/_PROJECT/Scripts/ModeGeneration/Cafe/PenWriter.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class PenWriter : MonoBehaviour
|
||||
{
|
||||
[Header("Assign the transform that moves up/down (pen or tip root)")]
|
||||
public Transform pen; // If null, uses this.transform
|
||||
|
||||
[Header("Motion Settings")]
|
||||
[Min(0f)] public float minDown = 0.2f; // minimum down stroke depth (in local units)
|
||||
[Min(0f)] public float maxDown = 0.6f; // maximum down stroke depth
|
||||
[Min(0f)] public float minDur = 0.04f; // min duration per tap
|
||||
[Min(0f)] public float maxDur = 0.10f; // max duration per tap
|
||||
[Range(0f, 1f)] public float upFraction = 0.35f; // fraction of tap duration for the up motion (snappy up)
|
||||
|
||||
private Vector3 localUpAxis;
|
||||
private Vector3 baseLocalPos;
|
||||
private bool writing;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (!pen) pen = transform;
|
||||
baseLocalPos = pen.localPosition;
|
||||
localUpAxis = transform.InverseTransformDirection(Vector3.up);
|
||||
}
|
||||
|
||||
public void StartWriting()
|
||||
{
|
||||
if (writing) return;
|
||||
writing = true;
|
||||
|
||||
// Ensure any previous tweens are stopped and we reset to rest
|
||||
DOTween.Kill(pen, complete: false);
|
||||
pen.localPosition = baseLocalPos;
|
||||
|
||||
// We<57>ll add a callback that keeps enqueuing the next tap until stopped
|
||||
EnqueueNextTap();
|
||||
}
|
||||
|
||||
public void StopWriting(bool snapToRest = true)
|
||||
{
|
||||
writing = false;
|
||||
DOTween.Kill(pen);
|
||||
|
||||
if (snapToRest)
|
||||
pen.localPosition = baseLocalPos;
|
||||
else
|
||||
{
|
||||
// Smoothly return to rest
|
||||
pen.DOLocalMove(baseLocalPos, 0.08f)
|
||||
.SetEase(Ease.OutSine);
|
||||
}
|
||||
}
|
||||
|
||||
private void EnqueueNextTap()
|
||||
{
|
||||
if (!writing) return;
|
||||
|
||||
float depth = Random.Range(minDown, maxDown);
|
||||
float dur = Random.Range(minDur, maxDur);
|
||||
|
||||
Vector3 downPos = baseLocalPos - localUpAxis * depth;
|
||||
|
||||
float upDur = Mathf.Max(0.01f, dur * upFraction);
|
||||
float downDur = Mathf.Max(0.01f, dur - upDur);
|
||||
|
||||
// Down (contact), then Up (lift)
|
||||
pen.DOLocalMove(downPos, downDur).OnComplete(() =>
|
||||
{
|
||||
pen.DOLocalMove(baseLocalPos, upDur).OnComplete(() =>
|
||||
{
|
||||
if (writing) EnqueueNextTap();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96a5bc0230ea8fe41b253c653699fecc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,8 +7,9 @@ using UnityEngine.XR.Interaction.Toolkit;
|
||||
public class CafeWaiterNPC : NPCController
|
||||
{
|
||||
public FMODWhisperBridge fmodWhisperBridge;
|
||||
public TextMeshProUGUI notepadText;
|
||||
public GameObject notepad;
|
||||
public TextMeshProUGUI notepadText;
|
||||
public PenWriter pen;
|
||||
|
||||
public Transform backRoom;
|
||||
public Transform plate;
|
||||
@@ -42,6 +43,7 @@ public class CafeWaiterNPC : NPCController
|
||||
notepadOriginalRotation = notepad.transform.localRotation.eulerAngles;
|
||||
notepadFlippedRotation = notepadOriginalRotation + new Vector3(0, 180, 0);
|
||||
notepad.SetActive(false);
|
||||
pen.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
protected override void OnPlayerApproach()
|
||||
@@ -55,6 +57,7 @@ public class CafeWaiterNPC : NPCController
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
|
||||
|
||||
notepad.SetActive(true);
|
||||
pen.gameObject.SetActive(true);
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +72,8 @@ public class CafeWaiterNPC : NPCController
|
||||
if (state != 3)
|
||||
{
|
||||
notepad.SetActive(false);
|
||||
pen.StopWriting();
|
||||
pen.gameObject.SetActive(false);
|
||||
notepad.transform.localRotation = Quaternion.Euler(notepadOriginalRotation);
|
||||
state = 0;
|
||||
}
|
||||
@@ -87,6 +92,8 @@ public class CafeWaiterNPC : NPCController
|
||||
// Show transcription and ask whether it is correct
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
notepadText.text = playerText;
|
||||
pen.StopWriting();
|
||||
pen.gameObject.SetActive(false);
|
||||
notepad.transform.DOLocalRotate(notepadFlippedRotation, 0.5f).OnComplete(() =>
|
||||
{
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
@@ -98,23 +105,25 @@ public class CafeWaiterNPC : NPCController
|
||||
} else if (state == 2)
|
||||
{
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
bool positiveAnswer = playerText.ToLower().Contains("ye") || playerText.ToLower().Contains("correct") | playerText.ToLower().Contains("right");
|
||||
SpeakVoiceLine(positiveAnswer ? 2 : 3);
|
||||
// Flip notepad back
|
||||
notepad.transform.DOLocalRotate(notepadOriginalRotation, 0.5f);
|
||||
// if player answered positively, bring food, otherwise ask again
|
||||
if (playerText.ToLower().Contains("ye"))
|
||||
notepad.transform.DOLocalRotate(notepadOriginalRotation, 0.5f).OnComplete(() =>
|
||||
{
|
||||
|
||||
SpeakVoiceLine(2);
|
||||
Invoke("BringFood", 1f);
|
||||
state = 3;
|
||||
} else
|
||||
{
|
||||
SpeakVoiceLine(3);
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdated;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
|
||||
state = 1;
|
||||
}
|
||||
if (positiveAnswer)
|
||||
{
|
||||
Invoke("BringFood", 1f);
|
||||
state = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdated;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
|
||||
pen.gameObject.SetActive(true);
|
||||
state = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +132,8 @@ public class CafeWaiterNPC : NPCController
|
||||
// Only update notepad text when currently listening to player order
|
||||
if (state == 1)
|
||||
{
|
||||
pen.StartWriting();
|
||||
notepadText.text = playerText;
|
||||
|
||||
// For now, when something is transcribed, treat it as player finished speaking
|
||||
OnPlayerSpeechFinished(playerText);
|
||||
}
|
||||
// faster reaction to player answering yes/no
|
||||
else if (state == 2)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PushableButton : MonoBehaviour
|
||||
public Transform movableParts;
|
||||
public float moveDuration = 0.25f;
|
||||
public float moveAmount = 0.05f;
|
||||
public EventReference soundEffect = FMODEvents.Instance.Click;
|
||||
public EventReference soundEffect;
|
||||
|
||||
public MeshRenderer[] wires;
|
||||
public Material wireActiveMaterial;
|
||||
|
||||
Reference in New Issue
Block a user