You can cook
This commit is contained in:
@@ -177,7 +177,7 @@ GameObject:
|
||||
- component: {fileID: 143107364}
|
||||
m_Layer: 0
|
||||
m_Name: Rice
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -311,90 +311,6 @@ 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
|
||||
@@ -409,7 +325,7 @@ GameObject:
|
||||
- component: {fileID: 389679692}
|
||||
m_Layer: 0
|
||||
m_Name: Onion
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -660,7 +576,7 @@ GameObject:
|
||||
- component: {fileID: 537514711}
|
||||
m_Layer: 0
|
||||
m_Name: Chimken
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -726,7 +642,7 @@ Transform:
|
||||
m_GameObject: {fileID: 537514707}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 12.08, y: -4.04, z: 0}
|
||||
m_LocalPosition: {x: 1.97, y: -0.06, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -1204,7 +1120,7 @@ GameObject:
|
||||
- component: {fileID: 885031694}
|
||||
m_Layer: 0
|
||||
m_Name: Egg
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -1218,7 +1134,7 @@ Transform:
|
||||
m_GameObject: {fileID: 885031692}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 11.83, y: -2.66, z: 0}
|
||||
m_LocalPosition: {x: -0.01, y: -0.03, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -1351,7 +1267,7 @@ GameObject:
|
||||
- component: {fileID: 1001436610}
|
||||
m_Layer: 0
|
||||
m_Name: Tomato
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -1365,7 +1281,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1001436608}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 11.03, y: -4.47, z: 0}
|
||||
m_LocalPosition: {x: 3.84, y: -0.11, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -1583,7 +1499,7 @@ GameObject:
|
||||
- component: {fileID: 1274549343}
|
||||
m_Layer: 0
|
||||
m_Name: Beef
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -1874,7 +1790,7 @@ GameObject:
|
||||
- component: {fileID: 1420342331}
|
||||
m_Layer: 0
|
||||
m_Name: Milk
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -2137,7 +2053,7 @@ Transform:
|
||||
m_LocalScale: {x: 4.0825, y: 3.375, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 228737564}
|
||||
- {fileID: 1639705739}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1517788316
|
||||
@@ -2296,7 +2212,7 @@ GameObject:
|
||||
- component: {fileID: 1575942283}
|
||||
m_Layer: 0
|
||||
m_Name: Flour
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -2429,6 +2345,178 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1639705738
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1639705739}
|
||||
- component: {fileID: 1639705740}
|
||||
- component: {fileID: 1639705741}
|
||||
- component: {fileID: 1639705742}
|
||||
- component: {fileID: 1639705743}
|
||||
m_Layer: 0
|
||||
m_Name: CookButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1639705739
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639705738}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.033, y: -0.604, z: -1}
|
||||
m_LocalScale: {x: 0.4, y: 0.4, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1517788315}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1639705740
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639705738}
|
||||
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: 21300000, guid: 5c352ce85017d554694d2fe2623b1f8a, 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!114 &1639705741
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639705738}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30e28733a4100f84e806c42e84c6d4ba, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Button: {fileID: 1639705738}
|
||||
--- !u!61 &1639705742
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639705738}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 0.64, y: 0.64}
|
||||
newSize: {x: 1, y: 1}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.64, y: 0.64}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!50 &1639705743
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639705738}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 7
|
||||
--- !u!1 &1659394507
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2443,7 +2531,7 @@ GameObject:
|
||||
- component: {fileID: 1659394509}
|
||||
m_Layer: 0
|
||||
m_Name: Toast
|
||||
m_TagString: Untagged
|
||||
m_TagString: Ingredient
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -2711,7 +2799,7 @@ MonoBehaviour:
|
||||
RequiredIngredients:
|
||||
- {fileID: 143107362}
|
||||
- {fileID: 537514707}
|
||||
NutritionalValue: 0
|
||||
NutritionalValue: 25
|
||||
--- !u!212 &1714471224
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class CookButton : MonoBehaviour
|
||||
{
|
||||
public GameObject Button;
|
||||
|
||||
void OnMouseUp() {
|
||||
Debug.Log("L");
|
||||
Button.GetComponentInParent<Cooking>().CreateDish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,21 @@ public class Cooking : MonoBehaviour
|
||||
|
||||
public Vector3 FinishedDishPosition;
|
||||
|
||||
void CreateDish() {
|
||||
public void CreateDish() {
|
||||
List <GameObject> Ingredients = GetIngredients();
|
||||
|
||||
List <GameObject> AllDishes = new List <GameObject>();
|
||||
|
||||
// Find all dishes ingredients can make
|
||||
|
||||
if (Ingredients.Count < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (GameObject Ingredient in Ingredients) {
|
||||
|
||||
Debug.Log(Ingredient.name);
|
||||
|
||||
List <GameObject> Dishes = Ingredient.GetComponent<Ingredient>().IngredientIn;
|
||||
|
||||
foreach (GameObject Dish in Dishes) {
|
||||
@@ -76,8 +83,22 @@ public class Cooking : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Remove ingredients and add the dish
|
||||
// Find used ingredients
|
||||
List <GameObject> IngredientsInDish = BestDish.GetComponent<Dish>().RequiredIngredients;
|
||||
List <GameObject> UsedIngredients = new();
|
||||
List <GameObject> UnusedIngredients = new();
|
||||
|
||||
foreach (GameObject Ingredient in Ingredients) {
|
||||
if (IngredientsInDish.Contains(Ingredient)) {
|
||||
UsedIngredients.Add(Ingredient);
|
||||
}
|
||||
else {
|
||||
UnusedIngredients.Add(Ingredient);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove ingredients and add the dish
|
||||
foreach (GameObject Ingredient in UsedIngredients) {
|
||||
Transform transform = Ingredient.GetComponent<Ingredient>().transform;
|
||||
transform.position = Vector3.up * 50;
|
||||
}
|
||||
@@ -91,14 +112,20 @@ public class Cooking : MonoBehaviour
|
||||
List <GameObject> currentCollisions = new List <GameObject>();
|
||||
private void OnTriggerEnter2D(Collider2D other) {
|
||||
currentCollisions.Add (other.gameObject);
|
||||
CreateDish();
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D other) {
|
||||
currentCollisions.Remove (other.gameObject);
|
||||
}
|
||||
List <GameObject> GetIngredients()
|
||||
{
|
||||
return currentCollisions;
|
||||
List <GameObject> Ingredients = new List <GameObject>();
|
||||
|
||||
foreach (GameObject collision in currentCollisions) {
|
||||
if (collision.tag == "Ingredient") {
|
||||
Ingredients.Add(collision);
|
||||
}
|
||||
}
|
||||
return Ingredients;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user