Finished cooking function

This commit is contained in:
2024-03-12 15:34:00 +01:00
parent b213c4ef42
commit 25ef87c512
9 changed files with 201 additions and 12 deletions

View File

@@ -311,6 +311,90 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &228737563
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 228737564}
- component: {fileID: 228737565}
m_Layer: 0
m_Name: CookButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &228737564
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 228737563}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalScale: {x: 0, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1517788315}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &228737565
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 228737563}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &389679690
GameObject:
m_ObjectHideFlags: 0
@@ -555,13 +639,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 460072661}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4, y: 0, z: 0}
m_LocalRotation: {x: -0, y: -0, z: 0.011939, w: -0.9999287}
m_LocalPosition: {x: 4.06, y: 0.01, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1325490341}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -1.368}
--- !u!1 &537514707
GameObject:
m_ObjectHideFlags: 0
@@ -642,7 +726,7 @@ Transform:
m_GameObject: {fileID: 537514707}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.19, y: -0.12, z: 0}
m_LocalPosition: {x: 12.08, y: -4.04, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -1033,7 +1117,7 @@ Transform:
m_GameObject: {fileID: 867381650}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0.34, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -1134,7 +1218,7 @@ Transform:
m_GameObject: {fileID: 885031692}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.08, y: -0.27, z: 0}
m_LocalPosition: {x: 11.83, y: -2.66, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -1281,7 +1365,7 @@ Transform:
m_GameObject: {fileID: 1001436608}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4, y: 0, z: 0}
m_LocalPosition: {x: 11.03, y: -4.47, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -2052,7 +2136,8 @@ Transform:
m_LocalPosition: {x: -0.19, y: 3.03, z: 1}
m_LocalScale: {x: 4.0825, y: 3.375, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 228737564}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1517788316
@@ -2067,6 +2152,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 84e0c3f7dac20fb428c544f192588d80, type: 3}
m_Name:
m_EditorClassIdentifier:
FinishedDishPosition: {x: -4.66, y: 2.89, z: 0}
--- !u!50 &1517788317
Rigidbody2D:
serializedVersion: 4

View File

@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CookButton : MonoBehaviour
{
}

View File

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

View File

@@ -14,6 +14,8 @@ public class Cooking : MonoBehaviour
// }
public Vector3 FinishedDishPosition;
void CreateDish() {
List <GameObject> Ingredients = GetIngredients();
@@ -74,12 +76,19 @@ public class Cooking : MonoBehaviour
}
}
Debug.Log(BestDish.name);
// Remove ingredients and add the dish
foreach (GameObject Ingredient in Ingredients) {
Transform transform = Ingredient.GetComponent<Ingredient>().transform;
transform.position = Vector3.up * 50;
}
BestDish.transform.position = FinishedDishPosition;
}
// Keep track of ingredients going on and off the cooker.
List <GameObject> currentCollisions = new List <GameObject> ();
List <GameObject> currentCollisions = new List <GameObject>();
private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject);
CreateDish();