Add Alot of stuff, Computer, repairStation, Whole game, Many things!

This commit is contained in:
2024-11-18 06:31:28 +01:00
parent 19b7964f83
commit a2091c3cf2
430 changed files with 55285 additions and 715 deletions

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="TrivialIfJS" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
Assets/Audio.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 12df34c1f7c101f41b9f97fccb27121f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 3f7efa6095e46064e8849d07700b7c40
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: bfb08039f7cc2844785d8bf4c8891af1
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 096c003e405725142bfb76b9fb54537c
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 12a36da580bcbcb449990a80c9471853
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,139 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3096247509938969863
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2579693046821952761}
- component: {fileID: 8028199953353550877}
- component: {fileID: 4734145443259180329}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2579693046821952761
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3096247509938969863}
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: 3973078567107739988}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8028199953353550877
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3096247509938969863}
m_CullTransparentMesh: 1
--- !u!114 &4734145443259180329
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3096247509938969863}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: New Text
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3582750950399662834
GameObject:
m_ObjectHideFlags: 0
@@ -9,6 +143,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 6564429125302780662}
- component: {fileID: 2626769806097928812}
- component: {fileID: 323721399381893304}
- component: {fileID: 7484184910861808735}
m_Layer: 0
m_Name: Customer
m_TagString: Untagged
@@ -29,16 +166,379 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4680687846769661018}
- {fileID: 4013785496967212353}
- {fileID: 8019979993914469277}
- {fileID: 2353741547831399736}
- {fileID: 3973078567107739988}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2626769806097928812
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3582750950399662834}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b50833c62b5f59644a29221ccb3ffb18, type: 3}
m_Name:
m_EditorClassIdentifier:
_minWaitTime: 5
_maxWaitTime: 10
_buyChance: 0.3
_buyChanceIncrease: 0.2
_buyChanceDecrease: 0.3
_objectHolder: {fileID: 2353741547831399736}
--- !u!195 &323721399381893304
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3582750950399662834}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.4
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 2
m_BaseOffset: 0
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!114 &7484184910861808735
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3582750950399662834}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 165e0ca2b8b0b3a40b36b5b46e91dca9, type: 3}
m_Name:
m_EditorClassIdentifier:
_customerNomal: {fileID: 6838593136780136478}
_customerAngry: {fileID: 6763356380254657486}
--- !u!1 &3951142034581684682
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2353741547831399736}
m_Layer: 0
m_Name: ItemHandle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2353741547831399736
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3951142034581684682}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.831, z: 0.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6564429125302780662}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6763356380254657486
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8019979993914469277}
m_Layer: 0
m_Name: Angry
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8019979993914469277
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6763356380254657486}
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:
- {fileID: 2334956513988168255}
m_Father: {fileID: 6564429125302780662}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6796302241985326907
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3973078567107739988}
- component: {fileID: 5021036160212185713}
- component: {fileID: 6049552928424139037}
- component: {fileID: 1392404261179993453}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3973078567107739988
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6796302241985326907}
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:
- {fileID: 2579693046821952761}
m_Father: {fileID: 6564429125302780662}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 960, y: 540}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &5021036160212185713
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6796302241985326907}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &6049552928424139037
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6796302241985326907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
--- !u!114 &1392404261179993453
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6796302241985326907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &6838593136780136478
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4013785496967212353}
m_Layer: 0
m_Name: Normal
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4013785496967212353
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6838593136780136478}
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:
- {fileID: 4680687846769661018}
m_Father: {fileID: 6564429125302780662}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2877193134574579156
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 8019979993914469277}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.49999988
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalRotation.x
value: 0.49999988
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.50000024
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalRotation.z
value: 0.5000001
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 90
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 90
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: -1684107799473140416, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 1aa713fc36ad6ad409f0167b1bd7e2ca, type: 2}
- target: {fileID: 919132149155446097, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_Name
value: Customer (1)
objectReference: {fileID: 0}
- target: {fileID: 6317578925029434746, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 1aa713fc36ad6ad409f0167b1bd7e2ca, type: 2}
- target: {fileID: 8100320773420232829, guid: b89594669d2f8c447924e07361919e00,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 1aa713fc36ad6ad409f0167b1bd7e2ca, type: 2}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b89594669d2f8c447924e07361919e00, type: 3}
--- !u!4 &2334956513988168255 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}
m_PrefabInstance: {fileID: 2877193134574579156}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5152009883973645233
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 6564429125302780662}
m_TransformParent: {fileID: 4013785496967212353}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: b89594669d2f8c447924e07361919e00,
type: 3}

View File

@@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-3385930777553547782
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CustomerAngry
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.78867924, g: 0.08184399, b: 0.08184399, a: 1}
- _Color: {r: 0.78867924, g: 0.08184395, b: 0.08184395, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1aa713fc36ad6ad409f0167b1bd7e2ca
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +1,206 @@
using System.Collections;
using System.Collections.Generic;
using System;
using Customer;
using UnityEngine;
using UnityEngine.AI;
using static Customer.MoodState;
using Random = UnityEngine.Random;
public class CustomerController : MonoBehaviour {
NavMeshAgent _navMeshAgent;
private Transform _target;
public class CustomerController : MonoBehaviour, IObjectParentHolder {
private NavMeshAgent _navMeshAgent;
private Vector3 _target;
public SellCounter TargetCounter { get; private set; }
[Header("WaitTime")] [SerializeField] private float _minWaitTime = 5.0f;
[SerializeField] private float _maxWaitTime = 10.0f;
[Header("BuyChace")] [SerializeField] private float _buyChance = 0.5f;
[SerializeField] private float _buyChanceIncrease = 0.1f;
[SerializeField] private float _buyChanceDecrease = 0.1f;
[SerializeField] private Transform _objectHolder;
private Object _currentObject;
private float _waitTime;
private CustomerVisibleController _visibleController;
public MoodState State => _visibleController.GetState();
private Vector3 _exitPosition;
public event Action<SellCounter, CustomerController> OnCustomerLeft;
private CustomerState _state = CustomerState.GoingToCounter;
//enum
public enum CustomerState {
GoingToCounter,
WaitingToBuy,
Buying,
WalkingToExit
}
private void Awake() {
_navMeshAgent = GetComponent<NavMeshAgent>();
_visibleController = GetComponent<CustomerVisibleController>();
_visibleController.SetState(Normal);
}
private void Update() {
_target = PlayerController.Instance.transform;
_navMeshAgent.SetDestination(_target.position);
switch (_state) {
case CustomerState.GoingToCounter:
if (_navMeshAgent.remainingDistance <= _navMeshAgent.stoppingDistance) {
OnDestinationReached();
}
break;
case CustomerState.WaitingToBuy:
WaitToBuy();
break;
case CustomerState.Buying:
BuyItem();
break;
case CustomerState.WalkingToExit:
CheckIfReachedExit();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void CheckIfReachedExit() {
if (_navMeshAgent.remainingDistance <= _navMeshAgent.stoppingDistance) {
Debug.Log("Bye :p");
CustomerManager.Instance.CustomerDies(this);
Destroy(this.gameObject);
}
}
private bool ShouldBuyItem() {
//This should be a function that checks if a customer should buy an item
//For example, if the item is worth 10 bucks, and the player sets the price to 20, the customer should not buy it since its too expensive
//if an item is prices higher then X% of the base price, the customer should not buy it
Object obj = TargetCounter.GetObject();
if (obj == null) {
Debug.LogError("Counter has no object");
return false;
}
float price = obj.ObjectSo.basePrice;
float sellPrice = TargetCounter.GetSellingPrice();
bool isBroken = obj.IsBroken;
float difference = Mathf.Abs(price - sellPrice);
float percentage = difference / price;
//Log this for now
Debug.Log("Difference: " + difference + " Percentage: " + percentage);
//Random differnece between 0.1 and 0.2;
float diff = Random.Range(_buyChanceDecrease, _buyChanceIncrease);
var calculatedBuyChance = _buyChance;
if (isBroken) {
//Customer should be less likely to buy broken items
calculatedBuyChance -= 0.1f;
}
if (percentage > calculatedBuyChance + diff) {
return false;
}
return true;
}
public void SetDestination(Vector3 position) {
_target = position;
_navMeshAgent.SetDestination(_target);
}
public void SetTargetCounter(SellCounter counter) {
TargetCounter = counter;
float angle = Random.Range(0, 360);
Vector3 offset = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle));
this.SetDestination(counter.transform.position + offset);
}
private void BuyItem() {
if (TargetCounter == null) {
Debug.LogError("Customer has no target counter");
return;
}
if (!ShouldBuyItem()) {
Debug.Log("Customer should not buy item");
this.SetDestination(_exitPosition);
_state = CustomerState.WalkingToExit;
_visibleController.SetState(Angry);
SoundFXController.Instance.PlayVillagerAngryFX();
return;
}
Debug.Log("Customer bought item: " + TargetCounter.GetObject().ObjectSo.objectName + " for: " +
TargetCounter.GetSellingPrice());
_visibleController.SetState(Normal);
TargetCounter.SellItem(this);
SoundFXController.Instance.PlayItemBoughtFX();
SoundFXController.Instance.PlayVillagerHappyFX();
this.SetDestination(_exitPosition);
_state = CustomerState.WalkingToExit;
OnCustomerLeft?.Invoke(TargetCounter, this); //Notify the customer manager that the customer left
}
private void OnDestinationReached() {
//should tell the counter there is a customer waiting;
Debug.Log("Customer reached destination for Counter: " + TargetCounter.name);
_state = CustomerState.WaitingToBuy;
_waitTime = Random.Range(_minWaitTime, _maxWaitTime);
}
void OnDrawGizmosSelected() {
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(_target, 0.5f);
}
void WaitToBuy() {
_waitTime -= Time.deltaTime;
if (_waitTime <= 0) {
_state = CustomerState.Buying;
}
}
public Transform GetHolderTransform() {
return _objectHolder;
}
public void SetObject(Object obj) {
_currentObject = obj;
}
public Object GetObject() {
return _currentObject;
}
public void ClearObject() {
_currentObject = null;
}
public bool HasObject() {
return _currentObject != null;
}
public void SetExitPosition(Vector3 position) {
_exitPosition = position;
}
public void SetState(CustomerState state) {
_state = state;
}
}

View File

@@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-3385930777553547782
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CustomerHappy
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 80f72f7a775ddda49827bbbee4cde94a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine;
using static CustomerController;
using Random = UnityEngine.Random;
public class CustomerManager : MonoBehaviour {
public static CustomerManager Instance { get; private set; }
[SerializeField] private GameObject _customerPrefab;
[SerializeField] private Transform _customerSpawnPoint;
[SerializeField] private float _timeToNextCustomerMin = 5;
[SerializeField] private float _timeToNextCustomerMax = 10;
private List<SellCounter> _sellCounters = new List<SellCounter>();
private List<SellCounter> AvailableCounters { get; } = new List<SellCounter>();
private readonly List<CustomerController> _customers = new List<CustomerController>();
private int _newCustomerNeeded; // 0 = no new ones needed, > 0 = new one needed
private float _timeToNextCustomer;
//Args for the event
public class OnCustomerLeftArgs : EventArgs {
public bool Angry;
}
public event EventHandler<OnCustomerLeftArgs> OnCustomerLeft;
// Start is called before the first frame update
private void Start() {
// Find all sellingCounters in the scene
if (Instance != null) {
Debug.LogError("What? 2 CustomerManagers crazy!!!");
}
Instance = this;
var sellCounters = FindObjectsOfType<SellCounter>();
foreach (var sellCounter in sellCounters) {
sellCounter.OnCounterStartSelling += CounterStartedSelling;
_sellCounters?.Add(sellCounter);
}
}
private void CounterStartedSelling(object sender, [NotNull] SellCounter.OnCounterStartSellingArgs e) {
if (e == null) throw new ArgumentNullException(nameof(e));
// Spawn a customer at the spawn point
_newCustomerNeeded += 1;
AvailableCounters.Add(e.SellCounter);
}
private void SpawnCustomer(SellCounter target) {
var customer = Instantiate(_customerPrefab, _customerSpawnPoint.position, Quaternion.identity);
var customerController = customer.GetComponent<CustomerController>();
customerController.SetTargetCounter(target);
customerController.SetExitPosition(_customerSpawnPoint.position);
customerController.OnCustomerLeft += CustomerLeft;
_customers.Add(customerController);
}
private void CustomerLeft(SellCounter sellCounter, CustomerController customerController) {
if (customerController.State == Customer.MoodState.Angry) {
//Customer left angry, should dispach a new customer to the counter
_newCustomerNeeded += 1;
if (!AvailableCounters.Contains(sellCounter)) {
AvailableCounters.Add(sellCounter);
}
else {
Debug.LogError("This should not happen, the counter is already in the available list");
}
}
OnCustomerLeft?.Invoke(this, new OnCustomerLeftArgs { Angry = customerController.State == Customer.MoodState.Angry });
}
// Update is called once per frame
private void Update() {
if(AvailableCounters.Count == 0) return;
if (_newCustomerNeeded > 0) {
_timeToNextCustomer -= Time.deltaTime;
if (_timeToNextCustomer <= 0) {
_newCustomerNeeded--;
_timeToNextCustomer = Random.Range(_timeToNextCustomerMin, _timeToNextCustomerMax);
SellCounter target = AvailableCounters[Random.Range(0, AvailableCounters.Count)];
SpawnCustomer(target);
AvailableCounters.Remove(target);
}
}
}
public void StoppedSelling(SellCounter sellCounter) {
if (AvailableCounters.Contains(sellCounter)) {
AvailableCounters.Remove(sellCounter);
}
//Check if any customer has this counter as an target
foreach (var customerController in _customers) {
if (customerController.TargetCounter != sellCounter) continue;
customerController.SetDestination(_customerSpawnPoint.position);
customerController.SetState(CustomerState.WalkingToExit);
}
}
public void CustomerDies([NotNull] CustomerController customerController) {
if (customerController == null) return;
if (_customers.Contains(customerController)) {
_customers.Remove(customerController);
}
}
}

View File

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

View File

@@ -0,0 +1,42 @@
using UnityEngine;
namespace Customer {
public enum MoodState {
Normal,
Angry
}
public class CustomerVisibleController : MonoBehaviour
{
[SerializeField] private GameObject _customerNomal;
[SerializeField] private GameObject _customerAngry;
private MoodState _state = MoodState.Normal;
private void SetNormal() {
_customerNomal.SetActive(true);
_customerAngry.SetActive(false);
}
private void SetAngry() {
_customerNomal.SetActive(false);
_customerAngry.SetActive(true);
}
public void SetState(MoodState state) {
_state = state;
switch (_state) {
case MoodState.Normal:
SetNormal();
break;
case MoodState.Angry:
SetAngry();
break;
}
}
public MoodState GetState() {
return _state;
}
}
}

View File

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

8
Assets/GameScrips.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2023cb372da1ff5489034e880f8c2777
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,141 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameController : MonoBehaviour {
public static GameController Instance { get; private set; }
[SerializeField] private MainHUDController _mainHudController;
[SerializeField] private DayEndHUDController _dayEndHudController;
[SerializeField] private GameObject _playerGameObject;
private float _money = 0; //The money the player has
private int _charisma = 0; //The charisma of the player, 0 - 100;
//Time stuff
[SerializeField] private int _hoursPerDay = 8; //9 - 17
[SerializeField] private int _realLifeMinutes = 5;
private float _time; //The actual time in gameHours
private float _timeScale;
private float _elapsedTime;
//End of day variables
private float _gains;
private float _rent;
private float _profit;
private float _startingMoney;
private bool _dayEnded = false;
public enum LooseCondition {
Bankrupt,
Charisma
}
public float Money {
get => _money;
//Set the money and update the HUD
set {
_money = value;
_mainHudController.SetMoneyText(_money);
}
}
public int Charisma {
get => _charisma;
set {
_charisma = value;
_mainHudController.SetCharisma(_charisma);
}
}
public void Reset() {
//Start a new day
_time = 0;
_dayEnded = false;
_gains = 0;
_rent = 0;
_profit = 0;
_startingMoney = Money;
HUDManager.Instance.HideCurrentHUD();
_playerGameObject.SetActive(true);
}
private void Awake() {
if (Instance != null) {
Debug.LogError("What? 2 GameControllers crazy!!!");
}
Instance = this;
}
private void CustomerLeft(object sender, CustomerManager.OnCustomerLeftArgs e) {
if (e.Angry) {
//Customer left angry
Charisma -= 10;
if(Charisma <= 0) {
GameOver(LooseCondition.Charisma);
}
}
else {
if (_charisma + 10 <= 100) {
_charisma += 10;
}
}
}
private void Start() {
Money = 100;
Charisma = 50;
_timeScale = (float)_hoursPerDay / (_realLifeMinutes * 60);
Reset();
CustomerManager.Instance.OnCustomerLeft += CustomerLeft;
}
private void DayEnd() {
_playerGameObject.SetActive(false);
HUDManager.Instance.ShowDayEndHUD();
_gains = _money - _startingMoney;
_rent = 10;
_profit = _gains - _rent;
_money += _profit; //Add the profit to the money, also includes rent
_mainHudController.SetMoneyText(_money);
HUDManager.Instance.GetDayEndController().DayEnd(_gains, _rent, _profit);
}
private void Update() {
if (!_dayEnded) {
Debug.Log("Time: " + _time + " Elapsed Time: " + _elapsedTime + " TimeScale: " + _timeScale);
_elapsedTime += UnityEngine.Time.deltaTime * _timeScale;
if (_elapsedTime >= 1) {
_time += 1;
_elapsedTime = 0;
}
int hours = (int)_time;
_mainHudController.SetTime(hours + 9); //Offset by 9 so it starts at 9 am
if (_time >= _hoursPerDay) {
//End the day
Debug.Log("Day Ended");
_dayEnded = true;
DayEnd();
}
}
}
public static void GameOver(LooseCondition condition) {
SceneManager.LoadScene(condition == LooseCondition.Bankrupt ? "Bankrupt" : "Charisma");
}
}

View File

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

View File

@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TutorialController : MonoBehaviour
{
public List<GameObject> _uiElements = new List<GameObject>();
[SerializeField] private ComputerBehaviour _computerBehaviour;
[SerializeField] private ObjectSO _item;
private SellCounter[] _counters;
private int _currentElement = 0;
// Start is called before the first frame update
private void Awake() { //Use Awake instead of Start to ensure that all the data is set before adding events
_counters = FindObjectsOfType<SellCounter>();
_computerBehaviour.OnBuyItem += ItemBought;
foreach (var counter in _counters) {
counter.OnCounterStartSelling += ItemOnSellingPedestal;
}
}
private void Start() {
_computerBehaviour.SetItem(_item, true);
}
private void ItemBought(object sender, System.EventArgs e) {
_computerBehaviour.OnBuyItem -= ItemBought;
Next();
}
private void ItemOnSellingPedestal(object sender, System.EventArgs e) {
foreach (var counter in _counters) {
counter.OnCounterStartSelling -= ItemOnSellingPedestal;
}
CustomerManager.Instance.OnCustomerLeft += CustomerLeft;
Next();
}
private void CustomerLeft(object sender, System.EventArgs e) {
CustomerManager.Instance.OnCustomerLeft -= CustomerLeft;
StartCoroutine(Countdown());
Next();
}
//20 Seconds after the customer leaves
private IEnumerator Countdown() {
yield return new WaitForSeconds(20);
Next();
}
private void OnEnable() {
_uiElements[_currentElement].SetActive(true);
}
private void Next() {
_uiElements[_currentElement].SetActive(false);
_currentElement++;
if (_currentElement >= _uiElements.Count) {
//End of tutorial
Debug.Log("End of tutorial");
this.gameObject.SetActive(false);
return;
}
_uiElements[_currentElement].SetActive(true);
}
}

View File

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

View File

@@ -0,0 +1,8 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class BankruptScreenController : MonoBehaviour {
public void Restart() {
SceneManager.LoadScene("MainMenu");
}
}

View File

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

View File

@@ -1,6 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Template name="SellEntry" src="project://database/Assets/HUD/ComputerScreen/SellEntry.uxml?fileID=9197481963319205126&amp;guid=21f89b660ed43af43ae41053197365d0&amp;type=3#SellEntry" />
<ui:VisualElement style="flex-grow: 1; background-color: rgb(255, 255, 255); width: 75%; align-self: center; margin-top: 50px; margin-bottom: 50px; flex-direction: row;">
<ui:VisualElement name="Doeze" style="flex-grow: 1; background-color: rgb(255, 255, 255); width: 75%; align-self: center; margin-top: 50px; margin-bottom: 50px; flex-direction: row;">
<ui:Instance template="SellEntry" name="SellEntry" />
<ui:Instance template="SellEntry" name="SellEntry" />
<ui:Instance template="SellEntry" name="SellEntry" />

View File

@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UIElements;
public class ComputerScreenController : MonoBehaviour {
private UIDocument _uiDocument;
private void OnEnable() {
_uiDocument = GetComponent<UIDocument>();
var root = _uiDocument.rootVisualElement;
}
}

View File

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

View File

@@ -2,6 +2,7 @@
<ui:VisualElement name="VisualElement" style="flex-grow: 1; width: initial; margin-top: 30px; margin-right: 30px; margin-bottom: 30px; margin-left: 30px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px;">
<ui:Label tabindex="-1" text="ITEMNAME" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ItemName" style="align-self: auto; -unity-text-align: upper-center; font-size: 70%; margin-top: 15px; margin-right: 15px; margin-bottom: 15px; margin-left: 15px;" />
<ui:VisualElement name="ItemImage" style="flex-grow: 1; width: auto; height: auto; background-image: url(&quot;project://database/Assets/HUD/ComputerScreen/prototype.png?fileID=2800000&amp;guid=ad0f7eac80567534ab59a2864d336793&amp;type=3#prototype&quot;); -unity-background-scale-mode: scale-to-fit;" />
<ui:Label tabindex="-1" text="Price: 2 barkie" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PriceLabel" style="align-items: center; align-self: auto; -unity-text-align: upper-center; font-size: 43px;" />
<ui:Button text="Buy" parse-escape-sequences="true" display-tooltip-when-elided="true" name="BuyButton" style="margin-top: 50px; margin-bottom: 50px; padding-bottom: 20px; padding-top: 20px; margin-right: 25px; margin-left: 25px; font-size: 54px;" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,32 @@
using TMPro;
using UnityEngine;
public class DayEndHUDController : MonoBehaviour {
[SerializeField] private TextMeshProUGUI _gainsText;
[SerializeField] private TextMeshProUGUI _rentText;
[SerializeField] private TextMeshProUGUI _profitText;
[SerializeField] private TextMeshProUGUI _buttonText;
public void DayEnd(float gains, float rent, float profit) {
_gainsText.text = "Gains: " + gains + "$";
_rentText.text = "Rent: " + rent + "$";
_profitText.text = "Profit: " + profit + "$";
//Check if the user is bankrupt
if (GameController.Instance.Money < 0) {
_buttonText.text = "Game Over";
}
else {
_buttonText.text = "Next Day";
}
}
public void ConfirmEnd() {
GameController.Instance.Reset();
if (GameController.Instance.Money < 0) {
GameController.GameOver(GameController.LooseCondition.Bankrupt);
}
}
}

View File

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

95
Assets/HUD/HUDManager.cs Normal file
View File

@@ -0,0 +1,95 @@
using UnityEngine;
public class HUDManager : MonoBehaviour {
public static HUDManager Instance { get; private set; }
[SerializeField] private GameObject _computerHUD;
[SerializeField] private GameObject _sellScreenHUD;
[SerializeField] private GameObject _miniGameHud;
[SerializeField] private GameObject _dayEndHUD;
[SerializeField] private GameObject _repairHUD;
private GameObject _currentHUD;
public bool IsUiOpen => _currentHUD != null;
private void Awake() {
if (Instance != null) {
Debug.LogError("What? 2 HudManagers crazy!!!");
}
Instance = this;
}
private void Update() {
CheckClose();
}
public void ShowComputerHUD() {
ShowHUD(_computerHUD);
}
public void ShowSellScreenHUD(SellCounter counter) {
ShowHUD(_sellScreenHUD);
}
public void ShowDayEndHUD() {
ShowHUD(_dayEndHUD);
}
private void ShowHUD(GameObject hud) {
if (_currentHUD != null) {
_currentHUD.SetActive(false);
}
_currentHUD = hud;
_currentHUD.SetActive(true);
}
public void HideCurrentHUD() {
if (_currentHUD != null) {
_currentHUD.SetActive(false);
_currentHUD = null;
}
}
private void CheckClose() {
if (!Input.GetKeyDown(KeyCode.Escape)) return;
if (_currentHUD == null) return;
HideCurrentHUD();
}
public void SellItem(SellCounter counter, Object sellingObject) {
Debug.Log(_sellScreenHUD.GetComponent<SellScreenController>());
this.ShowSellScreenHUD(counter);
_sellScreenHUD.GetComponent<SellScreenController>().SetItem(counter, sellingObject);
}
public void BuyItem(ComputerBehaviour computerBehaviour, ObjectSO objectSo, bool isBroken) {
this.ShowMinigameHUD();
this._miniGameHud.GetComponent<MinigameScreenController>().BuyItem(computerBehaviour, objectSo, isBroken);
}
private void ShowMinigameHUD() {
ShowHUD(_miniGameHud);
}
public DayEndHUDController GetDayEndController() {
return _dayEndHUD.GetComponent<DayEndHUDController>();
}
public void UpdateItem(ObjectSO objectToSell, bool isBroken) {
this._miniGameHud.GetComponent<MinigameScreenController>().UpdateItem(objectToSell, isBroken);
}
public void ShowRepairHUD() {
ShowHUD(_repairHUD);
}
public void SetRepairHudItem(RepairStationBehaviour repairStationBehaviour, Object @object, float timeToFix,
float costToFix) {
_repairHUD.GetComponent<RepairHudController>().SetObject(repairStationBehaviour, @object, timeToFix, costToFix);
}
}

View File

@@ -3,9 +3,13 @@
<ui:VisualElement name="VisualElement" style="flex-grow: 1; width: 75%; align-self: center; margin-right: 0; margin-left: 0; padding-top: 0; padding-bottom: 0; background-color: rgb(255, 255, 255); padding-right: 0; padding-left: 0; height: auto; cursor: initial; margin-top: 50px; margin-bottom: 50px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-top-width: 10px; border-right-width: 10px; border-bottom-width: 10px; border-left-width: 10px;">
<ui:Label tabindex="-1" text="ITEMNAME" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ItemName" style="font-size: 93px; height: auto; width: auto; -unity-text-align: upper-center; margin-top: 30px; justify-content: flex-start;" />
<ui:VisualElement style="flex-grow: 1; flex-direction: row; -unity-text-align: upper-center; align-items: center; justify-content: center; align-self: auto;">
<ui:Label tabindex="-1" text="Paid Price:" parse-escape-sequences="true" display-tooltip-when-elided="true" style="font-size: 50px; height: auto; width: auto; -unity-text-align: middle-center; margin-top: 0; justify-content: flex-start; white-space: nowrap;" />
<ui:Label tabindex="-1" text="Avg selling price: " parse-escape-sequences="true" display-tooltip-when-elided="true" style="font-size: 50px; height: auto; width: auto; -unity-text-align: middle-center; margin-top: 0; justify-content: flex-start; white-space: nowrap;" />
<ui:Label tabindex="-1" text="100 Barkie" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PriceLabel" style="font-size: 50px;" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1; flex-direction: row; -unity-text-align: upper-center; align-items: center; justify-content: center; align-self: auto;">
<ui:Label tabindex="-1" text="You paid: " parse-escape-sequences="true" display-tooltip-when-elided="true" style="font-size: 50px; height: auto; width: auto; -unity-text-align: middle-center; margin-top: 0; justify-content: flex-start; white-space: nowrap;" />
<ui:Label tabindex="-1" text="100 Barkie" parse-escape-sequences="true" display-tooltip-when-elided="true" name="YouPaid" style="font-size: 50px;" />
</ui:VisualElement>
<ui:TextField picking-mode="Ignore" label="Your Price" value="20" name="YourPriceInputfield" password="false" keyboard-type="DecimalPad" style="flex-direction: column; margin-right: 150px; margin-left: 150px; font-size: 48px; -unity-text-align: upper-center; margin-top: 100px; align-self: auto;" />
<ui:Button text="Place for Sale" parse-escape-sequences="true" display-tooltip-when-elided="true" name="SellButton" style="margin-right: 150px; margin-left: 150px; padding-bottom: 50px; padding-top: 50px; margin-top: 105px; -unity-text-align: middle-center; justify-content: flex-start; align-items: stretch; align-self: auto; font-size: 72px; margin-bottom: 105px;" />
</ui:VisualElement>

View File

@@ -1,7 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UIElements.Button;
@@ -10,41 +7,57 @@ public class SellScreenController : MonoBehaviour {
private UIDocument _document;
private Label _itemNameLabel;
private Label _avgPriceLabel;
private Label _paidPriceLabel;
private TextField _YourPriceInputfield;
private TextField _yourPriceInputfield;
private SellCounter _counter;
private Object _sellingObject;
//Becase we set the gameobject to active false, we need to use Awake
private void Awake() {
//Because we set the gameobject to active false, we need to use OnEnable
private void OnEnable() {
_document = GetComponent<UIDocument>();
_itemNameLabel = _document.rootVisualElement.Q<Label>("ItemName");
_document.rootVisualElement.Q<Button>("SellButton").clicked += SellItem;
_paidPriceLabel = _document.rootVisualElement.Q<Label>("PriceLabel");
_YourPriceInputfield = _document.rootVisualElement.Q<TextField>("YourPrice");
_avgPriceLabel = _document.rootVisualElement.Q<Label>("PriceLabel");
_paidPriceLabel = _document.rootVisualElement.Q<Label>("YouPaid");
_yourPriceInputfield = _document.rootVisualElement.Q<TextField>("YourPriceInputfield");
if (_itemNameLabel == null) {
Debug.LogError("Item name not found");
}
}
//on sleep
private void OnDisable() {
// _document.rootVisualElement.Q<Button>("SellButton").clicked -= SellItem;
_counter = null;
_sellingObject = null;
_itemNameLabel.text = "";
_paidPriceLabel.text = "";
_avgPriceLabel.text = "";
_yourPriceInputfield.value = "";
}
//TODO: ask how to do this, since the gameobjec that renders the ui is not active
public void SetItem(SellCounter counter, Object @object) {
_counter = counter;
_sellingObject = @object;
_paidPriceLabel.text = @object.ObjectSo.basePrice.ToString();
_paidPriceLabel.text = @object.PaidPrice.ToString();
_avgPriceLabel.text = @object.ObjectSo.basePrice.ToString();
_itemNameLabel.text = @object.ObjectSo.objectName;
}
public void SellItem() {
_counter.ConfirmSell(_sellingObject);
HUDManager.Instance.HideCurrentHUD();
//Sell the item
//Trigger an event that the item was sold
private void SellItem() {
Debug.Log("Selling: " + _itemNameLabel.text);
Debug.Log("Selling for: " + _yourPriceInputfield.text);
_counter.ConfirmSell(_sellingObject, float.Parse(_yourPriceInputfield.text));
HUDManager.Instance.HideCurrentHUD();
}
}

View File

@@ -0,0 +1,23 @@
using TMPro;
using UnityEngine;
using Slider = UnityEngine.UI.Slider;
public class MainHUDController : MonoBehaviour {
[SerializeField] private TextMeshProUGUI _moneyText;
[SerializeField] private TextMeshProUGUI _timeText;
[SerializeField] private Slider _charismaSlider;
public void SetMoneyText(float money) {
_moneyText.text = money + "$";
}
public void SetTime(int hour) {
_timeText.text = "Current Time: " + hour.ToString() + ":00";
}
public void SetCharisma(int charisma) {
//map 0-100 to 0-1
_charismaSlider.value = charisma / 100f;
}
}

View File

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

View File

@@ -0,0 +1,14 @@
using UnityEngine;
public class MainMenuController : MonoBehaviour {
public void StartGame() {
// Load the game scene
UnityEngine.SceneManagement.SceneManager.LoadScene("Main");
}
public void QuitGame() {
// Quit the game
Application.Quit();
}
}

View File

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

View File

@@ -0,0 +1,192 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
public class MinigameScreenController : MonoBehaviour {
[SerializeField] private Button _raiseButton;
[SerializeField] private Slider _currentBetSlider;
[SerializeField] private TextMeshProUGUI _currentBetText;
[SerializeField] private List<TextMeshProUGUI> _otherBidders;
[SerializeField] private List<string> _otherBiddersNames;
[SerializeField] private TextMeshProUGUI _currentItemLabel;
[SerializeField] private TextMeshProUGUI _basePriceLabel;
[SerializeField] private TextMeshProUGUI _buyInPriceLabel;
[SerializeField] private TextMeshProUGUI _brokenLabel;
[SerializeField] private float _buyInPrice = 5; //The price it costs to buy in to the auction
[SerializeField] private float _raiseSpeed = 10;
private bool _isRunning = false;
private bool _didRun = false;
private float _currentBet = 0;
private float _maxBet = 50;
private const float MinBet = 0;
[SerializeField] private ObjectSO _currentObject;
private bool _isBroken = false;
private readonly List<float> _otherBiddersPrices = new List<float>();
//This is the computer that the player is interacting with
private ComputerBehaviour _computerBehaviour;
private void Start() {
_currentBetSlider.minValue = MinBet;
_maxBet = _currentObject.basePrice * 2;
_currentBetSlider.maxValue = _maxBet;
_buyInPriceLabel.text = _buyInPrice.ToString() + "$";
foreach (TextMeshProUGUI textMeshProUGUI in _otherBidders) {
textMeshProUGUI.text = "0$";
}
_currentBetText.text = _currentBet.ToString() + "$";
}
private void OnEnable() {
_raiseButton.onClick.AddListener(StartRaise);
}
private void OnDisable() {
_raiseButton.onClick.RemoveListener(StartRaise);
_computerBehaviour = null;
}
private void StartRaise() {
if (_didRun == false) {
if (_isRunning == false) {
GameController.Instance.Money -= _buyInPrice;
_isRunning = true;
StartCoroutine(RaiseBet());
}
else {
_isRunning = false;
StopCoroutine(RaiseBet());
StopRaise();
Debug.Log("Current bet: " + _currentBet);
}
}
else {
Debug.Log("already ran for this item");
}
}
private void StopRaise() {
_isRunning = false;
//Calculate the other bidders
//check if ur the highest bidder
//if not, check if the other bidders are higher than the current bet
_didRun = true;
foreach (var textMeshProUGUI in _otherBidders) {
float basePrice = _currentObject.basePrice;
if (_isBroken) {
basePrice *= 0.5f;
}
float randomPrice = Random.Range(-12.0f, -2.0f);
randomPrice = Mathf.Round(randomPrice * 100) / 100;
float finalPrice = basePrice + randomPrice;
finalPrice = Mathf.Round(finalPrice * 100) / 100;
finalPrice = Mathf.Max(finalPrice, 0);
_otherBiddersPrices.Add(finalPrice);
textMeshProUGUI.text = finalPrice.ToString() + "$";
}
//Check if the player is the highest bidder
bool playerIsHighest = true;
foreach(var price in _otherBiddersPrices) {
if (price > _currentBet) {
playerIsHighest = false;
}
}
if (playerIsHighest) {
Debug.Log("Player is the highest bidder");
_currentBetText.color = Color.green;
GameController.Instance.Money += _buyInPrice;
_computerBehaviour.ConfirmBuy(_currentObject, _currentBet, _isBroken);
SoundFXController.Instance.PlayItemBoughtFX();
}
else {
Debug.Log("Player is not the highest bidder");
_currentBetText.color = Color.red;
}
}
public void Reset() {
_didRun = false;
_currentBet = 0;
_currentBetText.color = Color.white;
_currentBetText.text = _currentBet.ToString() + "$";
_currentBetSlider.value = _currentBet;
foreach (var textMeshProUGUI in _otherBidders) {
textMeshProUGUI.text = "0$";
}
_otherBiddersPrices.Clear();
}
private IEnumerator RaiseBet() {
while (_isRunning) {
//Round to 2 decimals
_currentBet += _raiseSpeed * Time.deltaTime;
_currentBet = Mathf.Round(_currentBet * 100) / 100;
_currentBetSlider.value = _currentBet;
_currentBetText.text = _currentBet.ToString() + "$";
if (_currentBet >= _maxBet) {
StopRaise();
}
yield return null;
}
}
public void BuyItem(ComputerBehaviour computerBehaviour, ObjectSO objectSo, bool isBroken) {
this.UpdateItem(objectSo, isBroken);
_computerBehaviour = computerBehaviour;
}
public void UpdateItem(ObjectSO objectToSell, bool isBroken) {
_currentObject = objectToSell;
Reset();
float actualBasePrice = objectToSell.basePrice;
_brokenLabel.text = isBroken ? "Broken" : "Not Broken";
_isBroken = isBroken;
if (isBroken) {
actualBasePrice *= 0.5f;
_maxBet = actualBasePrice * 2;
}
_currentItemLabel.text = objectToSell.objectName;
float playerMoney = GameController.Instance.Money;
_maxBet = Mathf.Min(_maxBet, playerMoney);
_maxBet = objectToSell.basePrice * 2;
_currentBetSlider.maxValue = _maxBet;
//Here we lower the price if the item is broken
_currentBetSlider.maxValue = _maxBet;
_basePriceLabel.text = actualBasePrice.ToString() + "$";
_basePriceLabel.color = isBroken ? Color.red : Color.black;
}
}

View File

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

View File

@@ -1,15 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BaseCounter : MonoBehaviour, IObjectParentHolder, IInteractable {
//This could be private, but since this should be only inherticed I will leave it as protected
//This could be private, but since this should be only inherited I will leave it as protected
[SerializeField] protected Transform _counterObjectHandle;
protected Object _currentObject;
public virtual void Interact() {
public virtual void Interact(InteractionBehaviour interactionBehaviour) {
Debug.LogError("Interact not implemented");
}

View File

@@ -1,9 +1,58 @@
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class ComputerBehaviour : MonoBehaviour, IInteractable {
public void Interact() {
HUDManager.Instance.ShowComputerHUD();
[SerializeField] private List<ObjectSO> _objectsToSell = new List<ObjectSO>();
[SerializeField] private EmptyCounter _destinationCounter;
[Range(0, 100)]
[SerializeField] private int _brokenChance = 10;
private ObjectSO _objectToSell;
private bool _isBroken = false;
public event EventHandler OnBuyItem;
private void Start() {
_objectToSell = GetRandomObject();
_isBroken = GetRandomBroken();
}
private ObjectSO GetRandomObject() {
return _objectsToSell[Random.Range(0, _objectsToSell.Count)];
}
private bool GetRandomBroken() {
return Random.Range(0, 100) < _brokenChance;
}
public void Interact(InteractionBehaviour interactionBehaviour) {
if (_destinationCounter.HasObject() || HUDManager.Instance.IsUiOpen) {
return;
}
HUDManager.Instance.BuyItem(this, _objectToSell, _isBroken);
}
public void SkipItem() {
_objectToSell = GetRandomObject();
_isBroken = GetRandomBroken();
HUDManager.Instance.UpdateItem(_objectToSell, _isBroken);
}
public void ConfirmBuy(ObjectSO objectSo, float price, bool isBroken) {
_destinationCounter.SetItem(objectSo, price, isBroken);
OnBuyItem?.Invoke(this, EventArgs.Empty);
GameController.Instance.Money -= price;
_objectToSell = GetRandomObject();
_isBroken = GetRandomBroken();
}
public void SetItem(ObjectSO item, bool isBroken) {
_objectToSell = item;
_isBroken = isBroken;
HUDManager.Instance.UpdateItem(_objectToSell, _isBroken);
}
}

View File

@@ -1,6 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EmptyCounter : BaseCounter {
@@ -8,16 +5,26 @@ public class EmptyCounter : BaseCounter {
[SerializeField] private ObjectSO _objectSo;
[SerializeField] private bool _shouldSpawnOnInteract;
public void SetItem(ObjectSO objectSo, float price = 0, bool isBroken = false) {
//Set the item on the counter
if(_currentObject != null) {
Destroy(_currentObject.gameObject);
}
Transform objectTransform = Instantiate(objectSo.prefab, _counterObjectHandle);
Object obj = objectTransform.GetComponent<Object>();
obj.ObjectSo = objectSo;
obj.PaidPrice = price;
obj.IsBroken = isBroken;
obj.setObjectParent(this);
}
public override void Interact() {
InteractionBehaviour interactionBehaviour = PlayerController.Instance.InteractionBehaviour;
if (_shouldSpawnOnInteract) {
public override void Interact(InteractionBehaviour interactionBehaviour) {
if (_shouldSpawnOnInteract) { //Debug
if (_currentObject == null) {
Transform objectTransform = Instantiate(_objectSo.prefab, _counterObjectHandle);
objectTransform.GetComponent<Object>().setObjectParent(this);
}
}
if (!HasObject()) {
@@ -44,6 +51,5 @@ public class EmptyCounter : BaseCounter {
GetObject().setObjectParent(interactionBehaviour);
}
}
}
}

View File

@@ -3,5 +3,5 @@ using System.Collections.Generic;
using UnityEngine;
public interface IInteractable {
void Interact();
void Interact(InteractionBehaviour interactionBehaviour);
}

View File

@@ -1,18 +1,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SellCounter : BaseCounter {
private bool _isSelling = false;
private Object _currentObject;
protected void Awake() {
private float _sellingPrice;
public event EventHandler<OnCounterStartSellingArgs> OnCounterStartSelling; //Event to notify that the counter is selling an item
public class OnCounterStartSellingArgs : EventArgs {
public SellCounter SellCounter;
}
public override void Interact() {
InteractionBehaviour interactionBehaviour = PlayerController.Instance.InteractionBehaviour;
public override void Interact(InteractionBehaviour interactionBehaviour) {
if (!_isSelling) {
//This counter is not selling an item yet
if (interactionBehaviour.HasObject()) {
@@ -20,6 +19,7 @@ public class SellCounter : BaseCounter {
Object obj = interactionBehaviour.GetObject();
//Check if the object is sellable
if (obj.TryGetComponent(out Object objectComponent)) {
Debug.Log("Player has something and it is sellable");
HUDManager.Instance.SellItem(this, objectComponent);
}
else {
@@ -27,15 +27,42 @@ public class SellCounter : BaseCounter {
}
}
}
else {
//Player wants to pick up the item
if (interactionBehaviour.HasObject()) {
//Player is holding something, cant pickup
return;
}
else {
//Player has nothing
//Take the object
GetObject().setObjectParent(interactionBehaviour);
_isSelling = false;
CustomerManager.Instance.StoppedSelling(this);
}
}
}
//Gets called if an item is being sold on this counter
//This should prevent the counter thinking it's selling something if the user cancels the UI sell
public void ConfirmSell(Object obj) {
public void ConfirmSell(Object obj, float price) {
_isSelling = true;
obj.setObjectParent(this);
_currentObject = obj;
}
_sellingPrice = price;
OnCounterStartSelling?.Invoke(this, new OnCounterStartSellingArgs {SellCounter = this});
}
public void SellItem(CustomerController customerController) {
this.GetObject().setObjectParent(customerController);
_isSelling = false;
GameController.Instance.Money += _sellingPrice;
}
public float GetSellingPrice() {
return _sellingPrice;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ad75288b402035b45975e26a9673d503
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: c79fbf3e474cc0443a6cb2d787bae6f4
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 665e921fe56a2564fab1c57bc66ac235
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -46,6 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_objectSo: {fileID: 11400000, guid: 95ac2dd676ce1124cbe08fb0f93a469d, type: 2}
_renderer: {fileID: 4733085246706066730}
--- !u!1001 &9128524179368309733
PrefabInstance:
m_ObjectHideFlags: 0
@@ -129,6 +130,12 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 63ee18274ed815a4b95b7f98a25a2fdb, type: 3}
--- !u!23 &4733085246706066730 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: -4683669308469848369, guid: 63ee18274ed815a4b95b7f98a25a2fdb,
type: 3}
m_PrefabInstance: {fileID: 9128524179368309733}
m_PrefabAsset: {fileID: 0}
--- !u!4 &8729578191719666702 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 63ee18274ed815a4b95b7f98a25a2fdb,

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 32721baecfb9ffa47b605334e9ff1edd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,5 +13,8 @@ MonoBehaviour:
m_Name: ClockSO
m_EditorClassIdentifier:
prefab: {fileID: 600119133444492642, guid: 6dd337db560127d44a9cf001a4880dc4, type: 3}
icon: {fileID: 21300000, guid: 32721baecfb9ffa47b605334e9ff1edd, type: 3}
objectName: Clock
basePrice: 20
timeToFix: 30
costToFix: 10

View File

@@ -46,6 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_objectSo: {fileID: 11400000, guid: 0d57452a7bc2cab4dbeb3a5cfaf867ea, type: 2}
_renderer: {fileID: 3023525168953944742}
--- !u!1001 &4482257827004511778
PrefabInstance:
m_ObjectHideFlags: 0
@@ -134,6 +135,12 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d2f4542dfcd5cc547ad313871caa50ea, type: 3}
--- !u!23 &3023525168953944742 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: -7511558181221131132, guid: d2f4542dfcd5cc547ad313871caa50ea,
type: 3}
m_PrefabInstance: {fileID: 4482257827004511778}
m_PrefabAsset: {fileID: 0}
--- !u!4 &4160926673609167305 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: d2f4542dfcd5cc547ad313871caa50ea,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 7a01da17578523e4c916a851a7fc523f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,5 +13,8 @@ MonoBehaviour:
m_Name: CrossSO
m_EditorClassIdentifier:
prefab: {fileID: 663674327062162412, guid: 99ff51431c2321f459a856ec4dbc7e33, type: 3}
icon: {fileID: 21300000, guid: 7a01da17578523e4c916a851a7fc523f, type: 3}
objectName: Cross
basePrice: 30
timeToFix: 60
costToFix: 10

View File

@@ -5,14 +5,43 @@ using UnityEngine;
public class Object : MonoBehaviour {
[SerializeField] private ObjectSO _objectSo;
[SerializeField] private Renderer _renderer;
private IObjectParentHolder _objectParent;
private float _paidPrice;
private bool _isBroken;
public ObjectSO ObjectSo {
get => _objectSo;
set => _objectSo = value;
}
public float PaidPrice {
get => _paidPrice;
set => _paidPrice = value;
}
//When its broken it should be a diff color
public bool IsBroken {
get => _isBroken;
set {
_isBroken = value;
GetComponent<Object>().SetBroken(value);
}
}
private void SetBroken(bool value) {
//Set to red if broken
if (value) {
_renderer.material.color = Color.red;
}
else {
_renderer.material.color = Color.white;
}
}
public IObjectParentHolder getObjectParent() {
return _objectParent;
}
@@ -25,6 +54,7 @@ public class Object : MonoBehaviour {
this._objectParent = objectParent;
if (objectParent.HasObject()) {
Debug.LogError("Parent has already something on it?");
Debug.Break();
}
objectParent.SetObject(this);

View File

@@ -6,6 +6,9 @@ using UnityEngine;
public class ObjectSO : ScriptableObject {
public Transform prefab;
public Sprite icon;
public string objectName;
public float basePrice;
public float timeToFix;
public float costToFix;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: f8f65acae8892694db8909e693def550
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -46,6 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_objectSo: {fileID: 11400000, guid: 7ecabddf3cead304496d5ce6cb57d28c, type: 2}
_renderer: {fileID: 5801010335665224790}
--- !u!1001 &5134316380515164370
PrefabInstance:
m_ObjectHideFlags: 0
@@ -125,3 +126,9 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 5134316380515164370}
m_PrefabAsset: {fileID: 0}
--- !u!23 &5801010335665224790 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: -7511558181221131132, guid: 621767c85be304c468cc33197debdce7,
type: 3}
m_PrefabInstance: {fileID: 5134316380515164370}
m_PrefabAsset: {fileID: 0}

View File

@@ -13,5 +13,8 @@ MonoBehaviour:
m_Name: VaseSO
m_EditorClassIdentifier:
prefab: {fileID: 5647610188194629348, guid: 9753e4f66533d84429c8dd6d05eded59, type: 3}
icon: {fileID: 21300000, guid: f8f65acae8892694db8909e693def550, type: 3}
objectName: Vase
basePrice: 10
timeToFix: 15
costToFix: 10

View File

@@ -5,8 +5,6 @@ using UnityEngine;
public class BasicCharacter : MonoBehaviour {
protected MovementBehaviour _movementBehaviour;
//Kinda not the best but it's fine for now
//TODO: Fix this, (ask teacher)
protected InteractionBehaviour _interactionBehaviour;
public InteractionBehaviour InteractionBehaviour {
get => _interactionBehaviour;

View File

@@ -43,7 +43,6 @@ public class InteractionBehaviour : MonoBehaviour, IObjectParentHolder {
RaycastHit hit;
Debug.DrawRay(origin, transform.forward * _interactionDistance, Color.red);
if (Physics.Raycast(origin, transform.forward, out hit, _interactionDistance, _interactionLayer)) {
// Debug.Log("Hitting something!");
GameObject hitObject = hit.transform.gameObject;
//Check if the object has a component that has the IInteractable interface
if (hitObject.TryGetComponent(out IInteractable interactable)) {
@@ -64,7 +63,7 @@ public class InteractionBehaviour : MonoBehaviour, IObjectParentHolder {
public void Interact() {
if (_lastInteractedObject == null) return;
if (_lastInteractedObject.TryGetComponent(out IInteractable interactable)) {
interactable.Interact();
interactable.Interact(this);
}
}

View File

@@ -3,39 +3,32 @@ using System.Collections.Generic;
using UnityEngine;
public class MovementBehaviour : MonoBehaviour {
[SerializeField]
private float _movementSpeed = 10.0f;
[SerializeField] private float _movementSpeed = 10.0f;
[SerializeField]
private float _rotationSpeed = 10.0f;
[SerializeField] private float _rotationSpeed = 10.0f;
[Header("Player")]
[Header("Player")] [SerializeField] private float _playerHeight = 1.0f;
[SerializeField]
private float _playerHeight = 1.0f;
[SerializeField]
private float _playerRadius = 0.5f;
[SerializeField] private float _playerRadius = 0.5f;
private Vector3 _desiredMovementDirection = Vector3.zero;
public Vector3 desiredMovementDirection
{
public Vector3 desiredMovementDirection {
get => _desiredMovementDirection;
set => _desiredMovementDirection = value;
}
public Vector3 desiredLookDirection
{
public Vector3 desiredLookDirection {
get => _desiredMovementDirection;
set => _desiredMovementDirection = value;
}
private void Update()
{
private void Update() {
HandleMovement();
HandleRotation();
}
private void HandleMovement()
{
private void HandleMovement() {
Vector3 movement = _desiredMovementDirection.normalized;
float moveDistance = _movementSpeed * Time.deltaTime;
bool canMove = !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * _playerHeight,
@@ -45,22 +38,25 @@ public class MovementBehaviour : MonoBehaviour {
// Cannot goto movedir
Vector3 moveX = new Vector3(movement.x, 0, 0);
canMove = movement.x != 0 && !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * _playerHeight,
canMove = movement.x != 0 && !Physics.CapsuleCast(transform.position,
transform.position + Vector3.up * _playerHeight,
_playerRadius, moveX, moveDistance);
if (canMove) {
movement = moveX;
} else {
}
else {
Vector3 moveZ = new Vector3(0, 0, movement.z);
canMove = movement.z != 0 && !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * _playerHeight,
canMove = movement.z != 0 && !Physics.CapsuleCast(transform.position,
transform.position + Vector3.up * _playerHeight,
_playerRadius, moveZ, moveDistance);
if (canMove) {
movement = moveZ;
}
}
}
if (canMove) {
// movement *= _movementSpeed * Time.deltaTime;
transform.position += movement * moveDistance;
@@ -71,5 +67,4 @@ public class MovementBehaviour : MonoBehaviour {
transform.forward =
Vector3.Slerp(transform.forward, _desiredMovementDirection, Time.deltaTime * _rotationSpeed);
}
}

View File

@@ -49,7 +49,7 @@ public class PlayerController : BasicCharacter {
Debug.LogError("No HUDManager found");
return;
}
if (!_hudManager.isUiOpen) {
if (!_hudManager.IsUiOpen) {
HandleMovementInput();
HandleInteraction();
}

View File

@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class RepairHudController : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI _currentItemText;
[SerializeField] private TextMeshProUGUI _timeToFixText;
[SerializeField] private TextMeshProUGUI _costToFixText;
private Object _currentObject;
RepairStationBehaviour _repairStationBehaviour;
public void SetObject(RepairStationBehaviour repairStationBehaviour, Object obj, float timeToFix, float costToFix) {
_currentObject = obj;
_repairStationBehaviour = repairStationBehaviour;
_currentItemText.text = obj.ObjectSo.objectName;
_timeToFixText.text = timeToFix.ToString();
_costToFixText.text = costToFix.ToString();
}
//Callback for if the player quits the UI without clicking the repair button
public void ConfirmRepair() {
_repairStationBehaviour.ConfirmRepair();
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 653667bc4a6562d41b2095317d8fbd23
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: d728921fa4a4d2446be1fb1b87a1a878
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,612 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &62176300570049532
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2046146644449888409}
- component: {fileID: 6582079854724259149}
- component: {fileID: 2213412398773883478}
- component: {fileID: 6946879296685399775}
m_Layer: 6
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2046146644449888409
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62176300570049532}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.0014826993, y: 0.0014826993, z: 0.0014826993}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1451888745119520098}
m_Father: {fileID: 4937760406900905638}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.26, y: 3}
m_SizeDelta: {x: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &6582079854724259149
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62176300570049532}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &2213412398773883478
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62176300570049532}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
--- !u!114 &6946879296685399775
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62176300570049532}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &572171676890786415
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4937760406900905638}
- component: {fileID: 6079782165355761549}
- component: {fileID: 5744184893894917981}
m_Layer: 6
m_Name: RepairStation
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4937760406900905638
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 572171676890786415}
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:
- {fileID: 4157468081526885917}
- {fileID: 3147454232780766927}
- {fileID: 498909047210525245}
- {fileID: 2046146644449888409}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &6079782165355761549
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 572171676890786415}
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: 2.7237866, y: 0.9763216, z: 1}
m_Center: {x: -0.009471297, y: 0.49014264, z: 0}
--- !u!114 &5744184893894917981
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 572171676890786415}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1173d8e2d275c70448ebe94c450c31dc, type: 3}
m_Name:
m_EditorClassIdentifier:
_holderTransform: {fileID: 498909047210525245}
_countDownText: {fileID: 2740249763822589059}
--- !u!1 &1133374250568294806
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3147454232780766927}
- component: {fileID: 4088207247976796740}
m_Layer: 6
m_Name: Selected
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3147454232780766927
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1133374250568294806}
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: 1
m_Children:
- {fileID: 7691752505328966038}
m_Father: {fileID: 4937760406900905638}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4088207247976796740
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1133374250568294806}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd462d6bbde539b4987457700c5ee2ce, type: 3}
m_Name:
m_EditorClassIdentifier:
_baseCounter: {fileID: 572171676890786415}
_visualCounterSelected: {fileID: 7058627749571380012}
--- !u!1 &2164805764800573059
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 498909047210525245}
m_Layer: 6
m_Name: ObjectHolder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &498909047210525245
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2164805764800573059}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4937760406900905638}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &3067453128187277624
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1451888745119520098}
- component: {fileID: 3371928671818121491}
- component: {fileID: 2740249763822589059}
m_Layer: 6
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1451888745119520098
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3067453128187277624}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 7.851831, y: 7.851831, z: 7.851831}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2046146644449888409}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -27, y: -139}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3371928671818121491
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3067453128187277624}
m_CullTransparentMesh: 1
--- !u!114 &2740249763822589059
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3067453128187277624}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 00:00
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 35.34
m_fontSizeBase: 35.34
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1001 &4483599837728745974
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 4937760406900905638}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8391222552659086748, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: -4683669308469848369, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 9f74a13152dad544abedc7538eb3182c, type: 2}
- target: {fileID: -1461304994638716399, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 74117f645ca87544896e430b75e9a316, type: 2}
- target: {fileID: -516098083770646512, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Name
value: RepairStation
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d728921fa4a4d2446be1fb1b87a1a878, type: 3}
--- !u!4 &4157468081526885917 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
m_PrefabInstance: {fileID: 4483599837728745974}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7868951127321476733
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 3147454232780766927}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalScale.x
value: 1.01
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalScale.y
value: 1.01
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalScale.z
value: 1.01
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8391222552659086748, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: -4683669308469848369, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: dfc08c90188302847afb04f628582097, type: 2}
- target: {fileID: -1461304994638716399, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: dfc08c90188302847afb04f628582097, type: 2}
- target: {fileID: -516098083770646512, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Name
value: RepairStation (1)
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d728921fa4a4d2446be1fb1b87a1a878, type: 3}
--- !u!1 &7058627749571380012 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
m_PrefabInstance: {fileID: 7868951127321476733}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7691752505328966038 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: d728921fa4a4d2446be1fb1b87a1a878,
type: 3}
m_PrefabInstance: {fileID: 7868951127321476733}
m_PrefabAsset: {fileID: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ee90e0919a5724d45bfa188b5192afb7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class RepairStationBehaviour : MonoBehaviour, IInteractable, IObjectParentHolder {
[SerializeField] private Transform _holderTransform;
[SerializeField] private TextMeshProUGUI _countDownText;
private Object _object;
private float _timeToFix;
private float _costToFix;
private double _countDown;
private bool _fixedCurrentObject = false;
InteractionBehaviour _interactionBehaviour;
public void Interact(InteractionBehaviour interactionBehaviour) {
_interactionBehaviour = interactionBehaviour;
if (interactionBehaviour.HasObject()) {
//Player has an object
//Check if its broken
Object obj = interactionBehaviour.GetObject();
if (obj.IsBroken) {
//Object needs fixing
HUDManager.Instance.ShowRepairHUD();
_timeToFix = obj.ObjectSo.timeToFix;
_costToFix = obj.ObjectSo.costToFix;
//Add a random deviation to the time and cost
_timeToFix += Random.Range(-10f, 5f);
_costToFix += Random.Range(-2f, 15f);
//Round to 1 decimal
_timeToFix = (float) System.Math.Round(_timeToFix, 1);
_costToFix = (float) System.Math.Round(_costToFix, 1);
HUDManager.Instance.SetRepairHudItem(this, obj, _timeToFix, _costToFix);
}
} else if (_fixedCurrentObject && this.HasObject()) {
//Player has nothing and the object is fixed
//Give the object to the player
_object.setObjectParent(_interactionBehaviour);
ClearObject();
}
}
public void ConfirmRepair() {
_interactionBehaviour.GetObject().setObjectParent(this);
_countDown = _timeToFix;
_countDownText.gameObject.SetActive(true);
//Remove the cost from the player
GameController.Instance.Money -= _costToFix;
HUDManager.Instance.HideCurrentHUD();
}
private void Update() {
if (_countDown > 0) {
_countDown -= Time.deltaTime;
_countDownText.text = _countDown.ToString("F2");
if (_countDown <= 0) {
//Repair done
_object.IsBroken = false;
_fixedCurrentObject = true;
SoundFXController.Instance.PlayOvenDoneFX();
_countDownText.gameObject.SetActive(false);
}
}
}
#region Counter stuff
public Transform GetHolderTransform() {
return _holderTransform;
}
public void SetObject(Object obj) {
_object = obj;
}
public Object GetObject() {
return _object;
}
public void ClearObject() {
_object = null;
}
public bool HasObject() {
return _object != null;
}
#endregion
}

View File

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

1183
Assets/Scenes/Bankrupt.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1f73e106f86b06744ac259ff0d672d03
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1183
Assets/Scenes/Charisma.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 494e20cf114a5d34e8d874dd7f4c1bee
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

1572
Assets/Scenes/MainMenu.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 635f6122ca30ae14fadcafa53d3a914d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundFXController : MonoBehaviour
{
public static SoundFXController Instance { get; private set; }
[SerializeField] private Transform _audioDestination;
[SerializeField] private AudioClip _itemBoughtClip;
[SerializeField] private AudioClip _ovenDoneClip;
[SerializeField] private AudioClip _villagerHappyClip;
[SerializeField] private AudioClip _villagerAngryClip;
private void Awake() {
if (Instance != null) {
Debug.LogError("What? 2 SoundFXController crazy!!!");
}
Instance = this;
}
public void PlayItemBoughtFX() {
AudioSource.PlayClipAtPoint(_itemBoughtClip, _audioDestination.position);
}
public void PlayOvenDoneFX() {
float volume = 0.5f;
AudioSource.PlayClipAtPoint(_ovenDoneClip, _audioDestination.position, volume);
}
public void PlayVillagerHappyFX() {
AudioSource.PlayClipAtPoint(_villagerHappyClip, _audioDestination.position);
}
public void PlayVillagerAngryFX() {
AudioSource.PlayClipAtPoint(_villagerAngryClip, _audioDestination.position);
}
// Update is called once per frame
void Update()
{
}
}

View File

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

8
Assets/TextMesh Pro.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f54d1bd14bd3ca042bd867b519fee8cc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8e7e8f5a82a3a134e91c54efd2274ea9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1b8d251f9af63b746bf2f7ffe00ebb9b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6ab70aee4d56447429c680537fbf93ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
Digitized data copyright (c) 2010 Google Corporation
with Reserved Font Arimo, Tinos and Cousine.
Copyright (c) 2012 Red Hat, Inc.
with Reserved Font Name Liberation.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6e59c59b81ab47f9b6ec5781fa725d2c
timeCreated: 1484171296
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e3265ab4bf004d28a9537516768c1c75
timeCreated: 1484171297
licenseType: Pro
TrueTypeFontImporter:
serializedVersion: 2
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
use2xBehaviour: 0
fontNames: []
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 243e06394e614e5d99fab26083b707fa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 731f1baa9d144a9897cb1d341c2092b8
folderAsset: yes
timeCreated: 1442040525
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More