Models and prefabs for boxed up items.

This commit is contained in:
Daniel Tyomin 2024-08-19 00:25:33 +02:00
parent a90c2400eb
commit 083b37cee3
14 changed files with 406 additions and 30 deletions

View File

@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Prefab: {fileID: 4275785426082247918, guid: b4f4c7d91f7d6bc4ebc212f3d2bb13ef, type: 3}
normalClips:
- {fileID: 0}
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
defectiveClips:
- {fileID: 0}
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
DefectProbabilities: []

View File

@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: bcf4ec4eb272446d850eb3c9e72cd87f, type: 3}
m_Name: Boxed Torus
m_EditorClassIdentifier:
Prefab: {fileID: 5301951847822309914, guid: b83fa12312697144992b762dc5084341, type: 3}
normalClips:
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
defectiveClips:
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
DefectProbabilities:
- Defect: 0
Probability: 50
- Defect: 1
Probability: 10
- Defect: 2
Probability: 10
- Defect: 4
Probability: 10
- Defect: 8
Probability: 10
- Defect: 16
Probability: 10

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f11438f5cec6a24cb2a32fccc6244d1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Prefab: {fileID: 1892923323752838125, guid: 67d17fe30a51b794899db51da3f9fddb, type: 3}
normalClips:
- {fileID: 0}
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
defectiveClips:
- {fileID: 0}
- {fileID: 8300000, guid: cb37dba8505a887438f4e1c8182106a0, type: 3}
DefectProbabilities: []

View File

@ -14,9 +14,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
Prefab: {fileID: 4275785426082247918, guid: 14d16caaceafb634f87449e796c4543a, type: 3}
normalClips:
- {fileID: 0}
- {fileID: 8300000, guid: 8f2502b0ea356614faad568cc2ce8d28, type: 3}
defectiveClips:
- {fileID: 0}
- {fileID: 8300000, guid: cb37dba8505a887438f4e1c8182106a0, type: 3}
DefectProbabilities:
- Defect: 0
Probability: 50

View File

@ -0,0 +1,236 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7544640980504195214
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4308922499226473595}
- component: {fileID: 307974221925563946}
m_Layer: 0
m_Name: Collider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4308922499226473595
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7544640980504195214}
serializedVersion: 2
m_LocalRotation: {x: -0.70710707, y: -0, z: -0, w: 0.7071066}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 200, y: 200, z: 200}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6297052809674953331}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!64 &307974221925563946
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7544640980504195214}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: -4284871513378854387, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
--- !u!1 &7947812480369148219
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6297052809674953331}
- component: {fileID: 4658930109992927606}
- component: {fileID: 5301951847822309914}
- component: {fileID: -6581473434499358903}
m_Layer: 0
m_Name: Boxed Torus
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6297052809674953331
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
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: 3425455539473979036}
- {fileID: 4308922499226473595}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &4658930109992927606
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &5301951847822309914
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 813c296fdd6145aeaa5dfd4a2b2ca423, type: 3}
m_Name:
m_EditorClassIdentifier:
Type: {fileID: 0}
Defect: 0
--- !u!114 &-6581473434499358903
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f1ba88558d742b9a6f1c78794058aba, type: 3}
m_Name:
m_EditorClassIdentifier:
manager: {fileID: 0}
info:
name:
rb: {fileID: 0}
rotateAroundPoint: 0
--- !u!1 &8478189424890482192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3425455539473979036}
- component: {fileID: 2379847509244969485}
- component: {fileID: 181044875942612192}
m_Layer: 0
m_Name: Model
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3425455539473979036
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071067}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 200, y: 200, z: 200}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6297052809674953331}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2379847509244969485
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
m_Mesh: {fileID: -7032348068582697493, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
--- !u!23 &181044875942612192
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 2339d9a60c7e3604395c30980f633265, type: 2}
- {fileID: 2100000, guid: 54361f89cfee8b94d810c14a6beb11b5, type: 2}
- {fileID: 2100000, guid: 241446fb42920fe46b66d2b7e6127c28, type: 2}
- {fileID: -8449799927606533644, guid: bdea37ec281a49c45ae34b3c72e5c08d, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

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

View File

@ -321,7 +321,7 @@ GameObject:
- component: {fileID: 6036007508636776569}
- component: {fileID: 4275785426082247918}
- component: {fileID: 8393139001085453593}
- component: {fileID: 7230423446829384199}
- component: {fileID: 6470434188345047876}
m_Layer: 0
m_Name: Boxed E
m_TagString: Untagged
@ -410,7 +410,7 @@ MonoBehaviour:
Prefab: {fileID: 5823832367352199241}
- DefectType: 1024
Prefab: {fileID: 6807509591159707237}
--- !u!114 &7230423446829384199
--- !u!114 &6470434188345047876
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -419,7 +419,7 @@ MonoBehaviour:
m_GameObject: {fileID: 3486484010427172590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cf9152fd8b7951445bef5e6f0778fd53, type: 3}
m_Script: {fileID: 11500000, guid: 3f1ba88558d742b9a6f1c78794058aba, type: 3}
m_Name:
m_EditorClassIdentifier:
manager: {fileID: 0}

View File

@ -64,8 +64,8 @@ GameObject:
m_Component:
- component: {fileID: 270648843518875621}
- component: {fileID: 6036007508636776569}
- component: {fileID: 3204487457196456735}
- component: {fileID: 1892923323752838125}
- component: {fileID: 7543791872186549401}
m_Layer: 0
m_Name: Original E
m_TagString: Untagged
@ -117,23 +117,6 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &3204487457196456735
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3486484010427172590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cf9152fd8b7951445bef5e6f0778fd53, type: 3}
m_Name:
m_EditorClassIdentifier:
manager: {fileID: 0}
info:
name:
rb: {fileID: 6036007508636776569}
rotateAroundPoint: 0
--- !u!114 &1892923323752838125
MonoBehaviour:
m_ObjectHideFlags: 0
@ -148,6 +131,23 @@ MonoBehaviour:
m_EditorClassIdentifier:
Type: {fileID: 0}
Defect: 0
--- !u!114 &7543791872186549401
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3486484010427172590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f1ba88558d742b9a6f1c78794058aba, type: 3}
m_Name:
m_EditorClassIdentifier:
manager: {fileID: 0}
info:
name:
rb: {fileID: 0}
rotateAroundPoint: 0
--- !u!1 &6512547544738721002
GameObject:
m_ObjectHideFlags: 0

View File

@ -66,7 +66,7 @@ GameObject:
- component: {fileID: 6036007508636776569}
- component: {fileID: 4275785426082247918}
- component: {fileID: 8393139001085453593}
- component: {fileID: 7230423446829384199}
- component: {fileID: 1452030678369129413}
m_Layer: 0
m_Name: Produced E
m_TagString: Untagged
@ -152,7 +152,7 @@ MonoBehaviour:
Prefab: {fileID: 5823832367352199241}
- DefectType: 1024
Prefab: {fileID: 6807509591159707237}
--- !u!114 &7230423446829384199
--- !u!114 &1452030678369129413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -161,7 +161,7 @@ MonoBehaviour:
m_GameObject: {fileID: 3486484010427172590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cf9152fd8b7951445bef5e6f0778fd53, type: 3}
m_Script: {fileID: 11500000, guid: 3f1ba88558d742b9a6f1c78794058aba, type: 3}
m_Name:
m_EditorClassIdentifier:
manager: {fileID: 0}

View File

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class DoubleConverter: MonoBehaviour, IResetable
{
public ProductSpawner Spawner;
public List<Product> inputProducts;
public ProductType expectedReagent;
public Transform outputPoint;
public ProductType conversionProduct;
public int CurrentHealth;
public int MaxHealth;
public float conversionDuration = 5f;
private float _conversionTimer;
public Transform refuseLauncher;
public float launchPower = 10f;
public void OnTriggerEnter(Collider other)
{
var product = other.GetComponentInParent<Product>();
if (product)
{
product.gameObject.SetActive(false);
inputProducts.Add(product);
}
}
public void Start()
{
ResetMachine();
}
public void ResetMachine()
{
_conversionTimer = conversionDuration;
CurrentHealth = MaxHealth;
inputProducts.Clear();
}
public void Update()
{
if (CurrentHealth <= 0)
{
return;
}
if (inputProducts.Count == 0)
{
return;
}
if (_conversionTimer <= 0f)
{
var currentProduct = inputProducts[0];
if (inputProducts[0].Type == expectedReagent)
{
Spawner.SpawnProduct(conversionProduct);
inputProducts.RemoveAt(0);
Destroy(currentProduct);
}
else
{
Expel(inputProducts[0]);
inputProducts.RemoveAt(0);
}
_conversionTimer = conversionDuration;
}
_conversionTimer -= Time.deltaTime;
}
private void Expel(Product product)
{
product.transform.position = refuseLauncher.position;
product.transform.rotation = refuseLauncher.rotation;
product.gameObject.SetActive(true);
product.GetComponent<Rigidbody>().velocity = launchPower * refuseLauncher.forward;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 21ca672126964be89347e6086e077f6b
timeCreated: 1724019415