game: implement vending machine

This commit is contained in:
Sc0rch-thinks 2024-08-15 19:04:52 +08:00
parent 12e433e0a6
commit 0c615b206c
8 changed files with 1131 additions and 137 deletions

View file

@ -11,8 +11,9 @@ GameObject:
- component: {fileID: 3450189480263887611}
- component: {fileID: 4306660149059946821}
- component: {fileID: 2487906228647857105}
- component: {fileID: 4554078824081771285}
- component: {fileID: 1012447081641753594}
- component: {fileID: 7862025667876021678}
- component: {fileID: 5663170057870431323}
m_Layer: 0
m_Name: coffee_cup
m_TagString: Untagged
@ -85,28 +86,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &4554078824081771285
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5391765043731144851}
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: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 8980752533943413279, guid: 0d98e348cc602404cbfe8967316fb5f2, type: 3}
--- !u!54 &1012447081641753594
Rigidbody:
m_ObjectHideFlags: 0
@ -134,3 +113,38 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &7862025667876021678
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5391765043731144851}
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: 0.33417338, y: 0.3543418, z: 0.33417338}
m_Center: {x: 0.000000022351742, y: -0.013673954, z: -0.000000037252903}
--- !u!114 &5663170057870431323
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5391765043731144851}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f469a2629914f0498ff63da1e473af8, type: 3}
m_Name:
m_EditorClassIdentifier:
interactionPrompt: Press [E] to drink coffee
speedBoost: 1.5

View file

@ -1,5 +1,102 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1358045017409589959
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5973604269356802910}
- component: {fileID: 2323459793124826805}
- component: {fileID: 4976625236689441702}
- component: {fileID: 4703643897800651679}
m_Layer: 0
m_Name: collider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5973604269356802910
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358045017409589959}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6391465596979396704}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &2323459793124826805
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358045017409589959}
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.7943573, y: 2.750698, z: 0.21220095}
m_Center: {x: -0.023476655, y: -0.07492697, z: 0.39390785}
--- !u!65 &4976625236689441702
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358045017409589959}
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: 0.0964391, y: 2.7618012, z: 1.0460393}
m_Center: {x: -0.8373415, y: -0.041695595, z: -0.011721579}
--- !u!65 &4703643897800651679
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358045017409589959}
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: 0.103384055, y: 2.7472115, z: 1}
m_Center: {x: 0.82100767, y: -0.069419265, z: 0.0000000026939064}
--- !u!1 &4027162384237968457
GameObject:
m_ObjectHideFlags: 0
@ -118,6 +215,322 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &8877167348595898487
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4253549584679047119}
- component: {fileID: 8561971390960482224}
- component: {fileID: 7054420748797681103}
- component: {fileID: 7769502133044647931}
- component: {fileID: 5963713163928205172}
- component: {fileID: 8927643385905276691}
m_Layer: 0
m_Name: Prism
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4253549584679047119
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
serializedVersion: 2
m_LocalRotation: {x: -0, y: 0.7107528, z: -0, w: 0.7034419}
m_LocalPosition: {x: 0.8338876, y: -1.4489818, z: -0.5311682}
m_LocalScale: {x: 0.6391037, y: 1, z: 1.5651999}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6391465596979396704}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!114 &8561971390960482224
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8233d90336aea43098adf6dbabd606a2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_MeshFormatVersion: 2
m_Faces:
- m_Indexes: 020000000100000000000000
m_SmoothingGroup: 0
m_Uv:
m_UseWorldSpace: 0
m_FlipU: 0
m_FlipV: 0
m_SwapUV: 0
m_Fill: 1
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Rotation: 0
m_Anchor: 9
m_Material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_SubmeshIndex: 0
m_ManualUV: 0
elementGroup: 0
m_TextureGroup: -1
- m_Indexes: 050000000400000003000000050000000600000004000000
m_SmoothingGroup: 0
m_Uv:
m_UseWorldSpace: 0
m_FlipU: 0
m_FlipV: 0
m_SwapUV: 0
m_Fill: 1
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Rotation: 0
m_Anchor: 9
m_Material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_SubmeshIndex: 0
m_ManualUV: 0
elementGroup: 0
m_TextureGroup: -1
- m_Indexes: 090000000800000007000000
m_SmoothingGroup: 0
m_Uv:
m_UseWorldSpace: 0
m_FlipU: 0
m_FlipV: 0
m_SwapUV: 0
m_Fill: 1
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Rotation: 0
m_Anchor: 9
m_Material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_SubmeshIndex: 0
m_ManualUV: 0
elementGroup: 0
m_TextureGroup: -1
- m_Indexes: 0c0000000b0000000a0000000c0000000d0000000b000000
m_SmoothingGroup: 0
m_Uv:
m_UseWorldSpace: 0
m_FlipU: 0
m_FlipV: 0
m_SwapUV: 0
m_Fill: 1
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Rotation: 0
m_Anchor: 9
m_Material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_SubmeshIndex: 0
m_ManualUV: 0
elementGroup: 0
m_TextureGroup: -1
- m_Indexes: 0e0000000f000000100000000f0000001100000010000000
m_SmoothingGroup: 0
m_Uv:
m_UseWorldSpace: 0
m_FlipU: 0
m_FlipV: 0
m_SwapUV: 0
m_Fill: 1
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Rotation: 0
m_Anchor: 9
m_Material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_SubmeshIndex: 0
m_ManualUV: 0
elementGroup: 0
m_TextureGroup: -1
m_SharedVertices:
- m_Vertices: 000000000b0000000e000000
- m_Vertices: 01000000030000000f000000
- m_Vertices: 02000000050000000d000000
- m_Vertices: 040000000700000011000000
- m_Vertices: 06000000090000000c000000
- m_Vertices: 080000000a00000010000000
m_SharedTextures: []
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: -1.53492, y: 0, z: 0}
- {x: -1.5268323, y: 1.1741894, z: -0.0000001058146}
- {x: -1.53492, y: 0, z: 0}
- {x: -1.53492, y: 0, z: -1.0859528}
- {x: -1.5268323, y: 1.1741894, z: -0.0000001058146}
- {x: -1.5268328, y: 1.1741894, z: -1.0859537}
- {x: -1.53492, y: 0, z: -1.0859528}
- {x: 0, y: 0, z: -1.0859528}
- {x: -1.5268328, y: 1.1741894, z: -1.0859537}
- {x: 0, y: 0, z: -1.0859528}
- {x: 0, y: 0, z: 0}
- {x: -1.5268328, y: 1.1741894, z: -1.0859537}
- {x: -1.5268323, y: 1.1741894, z: -0.0000001058146}
- {x: 0, y: 0, z: 0}
- {x: -1.53492, y: 0, z: 0}
- {x: 0, y: 0, z: -1.0859528}
- {x: -1.53492, y: 0, z: -1.0859528}
m_Textures0:
- {x: 0, y: 0}
- {x: 1.53492, y: 0}
- {x: 1.5268323, y: 1.1741894}
- {x: 0, y: -0.010572039}
- {x: 1.0859528, y: -0.010572039}
- {x: 0.0000001058146, y: 1.1636453}
- {x: 1.0859537, y: 1.1636453}
- {x: -1.53492, y: 0.00000088200864}
- {x: 0, y: 0.00000088200864}
- {x: -1.5268328, y: 1.1741903}
- {x: 0, y: -1.0859528}
- {x: 0, y: 0}
- {x: -1.9261203, y: -1.0859537}
- {x: -1.9261199, y: -0.0000001058146}
- {x: 0, y: 0}
- {x: 1.53492, y: 0}
- {x: 0, y: -1.0859528}
- {x: 1.53492, y: -1.0859528}
m_Textures2: []
m_Textures3: []
m_Tangents:
- {x: -1, y: 0, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
- {x: 0, y: 0, z: -1, w: -1}
- {x: -0.00000021954766, y: -9.787695e-17, z: -1, w: -1}
- {x: -0.00000021954766, y: -9.787695e-17, z: -1, w: -1}
- {x: -0.00000043909532, y: -1.9574815e-16, z: -1, w: -1}
- {x: 1, y: 0, z: 0, w: -1}
- {x: 1, y: 0, z: 0, w: -1}
- {x: 1, y: 0, z: 0, w: -1}
- {x: 0.79269856, y: -0.60961384, z: 0, w: -1}
- {x: 0.7926985, y: -0.60961384, z: 3.9887226e-15, w: -1}
- {x: 0.7926985, y: -0.60961384, z: 3.9887226e-15, w: -1}
- {x: 0.7926985, y: -0.60961396, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
- {x: -1, y: 0, z: 0, w: -1}
m_Colors: []
m_UnwrapParameters:
m_HardAngle: 88
m_PackMargin: 20
m_AngleError: 8
m_AreaError: 15
m_PreserveMeshAssetOnDestroy: 0
assetGuid:
m_Mesh: {fileID: 0}
m_VersionIndex: 2530
m_IsSelectable: 1
m_SelectedFaces:
m_SelectedEdges: []
m_SelectedVertices:
--- !u!114 &7054420748797681103
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1ca002da428252441b92f28d83c8a65f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Shape:
rid: 2795044668747546627
m_Size: {x: -1.53492, y: 1.1741894, z: -1.0859528}
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
m_PivotLocation: 1
m_PivotPosition: {x: 0, y: 0, z: 0}
m_UnmodifiedMeshVersion: 2371
m_ShapeBox:
m_Center: {x: -0.76746, y: 0.5870947, z: -0.5429764}
m_Extent: {x: 0.76746, y: 0.5870947, z: 0.5429764}
references:
version: 2
RefIds:
- rid: 2795044668747546627
type: {class: Prism, ns: UnityEngine.ProBuilder.Shapes, asm: Unity.ProBuilder}
data:
--- !u!23 &7769502133044647931
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
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 &5963713163928205172
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
m_Mesh: {fileID: 0}
--- !u!64 &8927643385905276691
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8877167348595898487}
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: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 0}
--- !u!1001 &3874289107487947999
PrefabInstance:
m_ObjectHideFlags: 0
@ -131,6 +544,11 @@ PrefabInstance:
propertyPath: m_StaticEditorFlags
value: 2147483647
objectReference: {fileID: 0}
- target: {fileID: 5310480670608927571, guid: 699551d9af9a03f43ae97592f34d6c94,
type: 3}
propertyPath: m_IsTrigger
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6710388089020521919, guid: 699551d9af9a03f43ae97592f34d6c94,
type: 3}
propertyPath: m_StaticEditorFlags
@ -219,6 +637,14 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 4092757969255272651}
- targetCorrespondingSourceObject: {fileID: 7887827639382949055, guid: 699551d9af9a03f43ae97592f34d6c94,
type: 3}
insertIndex: -1
addedObject: {fileID: 4253549584679047119}
- targetCorrespondingSourceObject: {fileID: 7887827639382949055, guid: 699551d9af9a03f43ae97592f34d6c94,
type: 3}
insertIndex: -1
addedObject: {fileID: 5973604269356802910}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 699551d9af9a03f43ae97592f34d6c94, type: 3}
--- !u!4 &6391465596979396704 stripped

View file

@ -97,7 +97,7 @@ LightmapSettings:
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
m_LightingSettings: {fileID: 321492943}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
@ -122,6 +122,471 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!43 &108056851
Mesh:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pb_Mesh-4302036
serializedVersion: 11
m_SubMeshes:
- serializedVersion: 2
firstByte: 0
indexCount: 24
topology: 0
baseVertex: 0
firstVertex: 0
vertexCount: 18
localAABB:
m_Center: {x: -0.76746, y: 0.5870947, z: -0.54297686}
m_Extent: {x: 0.76746, y: 0.5870947, z: 0.54297686}
m_Shapes:
vertices: []
shapes: []
channels: []
fullWeights: []
m_BindPose: []
m_BoneNameHashes:
m_RootBoneNameHash: 0
m_BonesAABB: []
m_VariableBoneCountWeights:
m_Data:
m_MeshCompression: 0
m_IsReadable: 1
m_KeepVertices: 1
m_KeepIndices: 1
m_IndexFormat: 0
m_IndexBuffer: 0200010000000500040003000500060004000900080007000c000b000a000c000d000b000e000f0010000f0011001000
m_VertexData:
serializedVersion: 3
m_VertexCount: 18
m_Channels:
- stream: 0
offset: 0
format: 0
dimension: 3
- stream: 0
offset: 12
format: 0
dimension: 3
- stream: 0
offset: 24
format: 0
dimension: 4
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 40
format: 0
dimension: 2
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
m_DataSize: 864
_typelessdata: 000000000000000000000000000000006c86c1330000803f000080bf0000000000000000000080bf00000000000000004278c4bf0000000000000000000000006c86c1330000803f000080bf0000000000000000000080bf4278c43f000000003e6fc3bfd74b963f313ce3b3000000006c86c1330000803f000080bf0000000000000000000080bf3e6fc33fd74b963f4278c4bf000000000000000072fe7fbf0eb2e13b000000000000000000000000000080bf000080bf0000000058362dbc4278c4bf0000000080008bbf72fe7fbf5bb0e13b5fbb6b34cdbc6bb45bb0e1a4000080bf000080bf80008b3f58362dbc3e6fc3bfd74b963f313ce3b372fe7fbf5bb0e13b5fbb6b34cdbc6bb45bb0e1a4000080bf000080bf313ce33354f2943f426fc3bfd74b963f88008bbf72fe7fbfa8aee13b5fbbeb34cdbcebb4a8ae61a5000080bf000080bf88008b3f54f2943f4278c4bf0000000080008bbf00000000d2055ab5000080bf0000803f0000000000000000000080bf4278c4bf2cc36c35000000000000000080008bbf00000000d2055ab5000080bf0000803f0000000000000000000080bf000000002cc36c35426fc3bfd74b963f88008bbf00000000d2055ab5000080bf0000803f0000000000000000000080bf426fc3bfde4b963f000000000000000080008bbfa60f1c3f4aee4a3f000000004bee4a3fa70f1cbf00000000000080bf0000000080008bbf000000000000000000000000a80f1c3f4aee4a3f79b50fb44aee4a3fa70f1cbf79b58f27000080bf0000000000000000426fc3bfd74b963f88008bbfa80f1c3f4aee4a3f79b50fb44aee4a3fa70f1cbf79b58f27000080bf1c8bf6bf88008bbf3e6fc3bfd74b963f313ce3b3a90f1c3f4aee4a3f79b58fb44aee4a3fa90f1cbf00000000000080bf198bf6bf313ce3b300000000000000000000000000000000000080bf00000000000080bf0000000000000000000080bf00000000000000004278c4bf000000000000000000000000000080bf00000000000080bf0000000000000000000080bf4278c43f00000000000000000000000080008bbf00000000000080bf00000000000080bf0000000000000000000080bf0000000080008bbf4278c4bf0000000080008bbf00000000000080bf00000000000080bf0000000000000000000080bf4278c43f80008bbf
m_CompressedMesh:
m_Vertices:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_UV:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Normals:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Tangents:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Weights:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_NormalSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_TangentSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_FloatColors:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_BoneIndices:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_Triangles:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_UVInfo: 0
m_LocalAABB:
m_Center: {x: -0.76746, y: 0.5870947, z: -0.54297686}
m_Extent: {x: 0.76746, y: 0.5870947, z: 0.54297686}
m_MeshUsageFlags: 0
m_CookingOptions: 30
m_BakedConvexCollisionMesh:
m_BakedTriangleCollisionMesh:
m_MeshMetrics[0]: 1.0000001
m_MeshMetrics[1]: 1
m_MeshOptimizationFlags: 1
m_StreamData:
serializedVersion: 2
offset: 0
size: 0
path:
--- !u!850595691 &321492943
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
serializedVersion: 6
m_GIWorkflowMode: 1
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 1
m_BakeBackend: 1
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 2
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 2
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_FinalGather: 0
m_FinalGatherRayCount: 256
m_FinalGatherFiltering: 1
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentImportanceSampling: 1
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
m_NumRaysToShootPerTexel: -1
m_RespectSceneVisibilityWhenBakingGI: 0
--- !u!1 &495639317
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 495639321}
- component: {fileID: 495639320}
- component: {fileID: 495639319}
- component: {fileID: 495639322}
m_Layer: 0
m_Name: floor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &495639319
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495639317}
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 &495639320
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495639317}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &495639321
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495639317}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5.1523085, y: 1.1149, z: 5.642636}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &495639322
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495639317}
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: 10, y: 2.220446e-16, z: 10}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1001 &509022281
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalPosition.x
value: 9.442036
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalPosition.y
value: -3.8085034
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalPosition.z
value: 6.5059056
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalRotation.w
value: -0.0051695993
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.9999867
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -180.592
objectReference: {fileID: 0}
- target: {fileID: 418930537151431345, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4027162384237968457, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_Name
value: vending_machine_sparks
objectReference: {fileID: 0}
- target: {fileID: 5963713163928205172, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 108056851}
- target: {fileID: 8561971390960482224, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 108056851}
- target: {fileID: 8927643385905276691, guid: d3f382324a5d1d548835e558d7b03653,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 108056851}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3f382324a5d1d548835e558d7b03653, type: 3}
--- !u!1 &740698633
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 740698635}
- component: {fileID: 740698634}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &740698634
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 740698633}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f6e55d96ef14d65979aabb99a0d5f1a, type: 3}
m_Name:
m_EditorClassIdentifier:
guiInteractionPromptObject: {fileID: 0}
guiHudObject: {fileID: 0}
guiCompletedMenuObject: {fileID: 0}
player: {fileID: 1946935280}
--- !u!4 &740698635
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 740698633}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.101932526, y: 1.7449999, z: 0.06387043}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1574903494
GameObject:
m_ObjectHideFlags: 0
@ -132,6 +597,7 @@ GameObject:
m_Component:
- component: {fileID: 1574903496}
- component: {fileID: 1574903495}
- component: {fileID: 1574903497}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
@ -216,101 +682,119 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1675560304
--- !u!114 &1574903497
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1574903494}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 3
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_LightLayerMask: 1
m_RenderingLayers: 1
m_CustomShadowLayers: 0
m_ShadowLayerMask: 1
m_ShadowRenderingLayers: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0
--- !u!1001 &1860146320
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalPosition.x
value: -0.101932526
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalPosition.y
value: 1.02
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.06387043
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1344234060038513868, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: raycastLayers.m_Bits
value: 951
objectReference: {fileID: 0}
- target: {fileID: 1475518765439445092, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: GroundLayers.m_Bits
value: 641
objectReference: {fileID: 0}
- target: {fileID: 7550015751290207618, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
propertyPath: m_Name
value: player
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: fede53ad5812a1046bf12a85cacb875a, type: 3}
--- !u!1 &1946935280 stripped
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 4465937683457646742, guid: fede53ad5812a1046bf12a85cacb875a,
type: 3}
m_PrefabInstance: {fileID: 1860146320}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1675560307}
- component: {fileID: 1675560306}
- component: {fileID: 1675560305}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1675560305
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1675560304}
m_Enabled: 1
--- !u!20 &1675560306
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1675560304}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1675560307
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1675560304}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1675560307}
- {fileID: 1574903496}
- {fileID: 495639321}
- {fileID: 1860146320}
- {fileID: 509022281}
- {fileID: 740698635}

View file

@ -0,0 +1,27 @@
/*
* author: ryan lin
* date: 15/8/2024
* description: script to handle coffee power up behaviour
*/
public class CoffeePowerUp : CommonInteractable
{
/// <summary>
/// how much to increase the player's speed by in m/2
/// </summary>
public float speedBoost;
/// <summary>
/// the interaction prompt for the player
/// </summary>
public string InteractionPrompt => "Press [E] to drink coffee";
/// <summary>
/// to call the add speed function from the game manager
/// </summary>
public override void Interact()
{
GameManager.Instance.AddSpeed(speedBoost);
Destroy(gameObject);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f469a2629914f0498ff63da1e473af8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,6 +5,7 @@
*/
using System;
using StarterAssets;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
@ -50,6 +51,11 @@ public enum DisplayState
/// </summary>
[SerializeField] private GameObject guiCompletedMenuObject;
/// <summary>
/// reference to the player object
/// </summary>
public GameObject player;
/// <summary>
/// float to keep track of the elapsed play/run/speeder time
/// </summary>
@ -84,12 +90,7 @@ public enum DisplayState
/// property to check if the game is paused based on the current <c>DisplayState</c>
/// </summary>
public bool Paused => _state != DisplayState.Game;
/// <summary>
/// a property to check how many coffees the player has had
/// </summary>
public int hadCoffee = 0;
/// <summary>
/// function to set doesn't destroy on load and checks for multiple instances
/// </summary>
@ -500,4 +501,14 @@ public void ProperlyEndRun()
};
timeScore.text = $"Score: {score}";
}
/// <summary>
/// increases the player's speed
/// </summary>
/// <param name="speedBoost">the amount of speed boosts it increases</param>
public void AddSpeed(float speedBoost)
{
player.GetComponent<ThirdPersonController>().MoveSpeed += speedBoost;
player.GetComponent<ThirdPersonController>().SprintSpeed += speedBoost;
}
}

View file

@ -1,8 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
/*
* author: ryan lin
* date: 15/8/2024
* description: script to handle vending machine behaviour
*/
using UnityEngine;
using UnityEngine.Serialization;
using Random = System.Random;
@ -12,15 +14,25 @@ public class VendingMachine : CommonInteractable
/// prefab to spawn when the player interacts with the vending machine
/// </summary>
public GameObject coffee;
/// <summary>
/// the amount of stock the vending machine has
/// the instance of the coffee prefab
/// </summary>
private GameObject _instance;
/// <summary>
/// the amount of stock the vending machine has
/// </summary>
private int _stock;
private GameObject _instance;
/// <summary>
/// to get the number of stocks the vending machine has
/// </summary>
public void Start()
{
var rand = new Random();
_stock = rand.Next(1, 3);
_stock = rand.Next(0, 4);
interactionPrompt = _stock == 0 ? "Out of stock" : "Press [E] to buy coffee";
}
/// <summary>
@ -28,12 +40,11 @@ public void Start()
/// </summary>
public override void Interact()
{
if (_stock > 0)
{
_instance = Instantiate(coffee, transform.position, Quaternion.identity);
_instance.GetComponent<Rigidbody>().AddForce(Vector3.up * 5, ForceMode.Impulse);
_instance.GetComponent<Rigidbody>().AddForce(Vector3.forward * 5, ForceMode.Impulse);
_stock--;
}
if (_stock <= 0) return;
_instance = Instantiate(coffee, transform.position, transform.rotation);
_stock--;
//to change the interaction prompt if the vending machine is out of stock
if (_stock == 0)
interactionPrompt = "Out of stock";
}
}

View file

@ -91,6 +91,11 @@
"key": "editor.selectMode",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.lastMeshSelectMode",
"value": "{\"m_Value\":4}"
},
{
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.rectSelectModifier",
@ -104,7 +109,7 @@
{
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "ShapeBuilder.ActiveShapeIndex",
"value": "{\"m_Value\":1}"
"value": "{\"m_Value\":5}"
},
{
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
@ -124,7 +129,7 @@
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize",
"value": "{\"m_Value\":{\"x\":22.76988410949707,\"y\":0.0,\"z\":13.705402374267579}}"
"value": "{\"m_Value\":{\"x\":-1.5349199771881104,\"y\":1.1741894483566285,\"z\":-1.0859527587890626}}"
},
{
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
@ -160,6 +165,11 @@
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Plane",
"value": "{}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Prism",
"value": "{}"
}
]
}