Merge branch 'master' of git@ooftooft.net:Let-Him-Cook.git

This commit is contained in:
magn9775
2024-03-12 16:06:55 +01:00
10 changed files with 359 additions and 29 deletions

5
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"recommendations": [
"visualstudiotoolsforunity.vstuc"
]
}

10
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
}
]
}

60
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,60 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.vs": true,
"**/.gitmodules": true,
"**/.vsconfig": true,
"**/*.booproj": true,
"**/*.pidb": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.pdf": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.wav": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"build/": true,
"Build/": true,
"Library/": true,
"library/": true,
"obj/": true,
"Obj/": true,
"Logs/": true,
"logs/": true,
"ProjectSettings/": true,
"UserSettings/": true,
"temp/": true,
"Temp/": true
},
"dotnet.defaultSolution": "Let-Him-Cook.sln"
}

View File

@@ -177,7 +177,7 @@ GameObject:
- component: {fileID: 143107364} - component: {fileID: 143107364}
m_Layer: 0 m_Layer: 0
m_Name: Rice m_Name: Rice
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -325,7 +325,7 @@ GameObject:
- component: {fileID: 389679692} - component: {fileID: 389679692}
m_Layer: 0 m_Layer: 0
m_Name: Onion m_Name: Onion
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -555,13 +555,13 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 460072661} m_GameObject: {fileID: 460072661}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: 0.011939, w: -0.9999287}
m_LocalPosition: {x: 4, y: 0, z: 0} m_LocalPosition: {x: 4.06, y: 0.01, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1} m_LocalScale: {x: 2, y: 2, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1325490341} m_Father: {fileID: 1325490341}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -1.368}
--- !u!1 &537514707 --- !u!1 &537514707
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -576,7 +576,7 @@ GameObject:
- component: {fileID: 537514711} - component: {fileID: 537514711}
m_Layer: 0 m_Layer: 0
m_Name: Chimken m_Name: Chimken
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -642,7 +642,7 @@ Transform:
m_GameObject: {fileID: 537514707} m_GameObject: {fileID: 537514707}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.04, y: -2.51, z: 0} m_LocalPosition: {x: 1.97, y: -0.06, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -1033,7 +1033,7 @@ Transform:
m_GameObject: {fileID: 867381650} m_GameObject: {fileID: 867381650}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 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_LocalScale: {x: 2, y: 2, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -1120,7 +1120,7 @@ GameObject:
- component: {fileID: 885031694} - component: {fileID: 885031694}
m_Layer: 0 m_Layer: 0
m_Name: Egg m_Name: Egg
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -1134,7 +1134,7 @@ Transform:
m_GameObject: {fileID: 885031692} m_GameObject: {fileID: 885031692}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 3.06, y: -2.09, z: 0} m_LocalPosition: {x: -0.01, y: -0.03, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -1267,7 +1267,7 @@ GameObject:
- component: {fileID: 1001436610} - component: {fileID: 1001436610}
m_Layer: 0 m_Layer: 0
m_Name: Tomato m_Name: Tomato
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -1281,7 +1281,7 @@ Transform:
m_GameObject: {fileID: 1001436608} m_GameObject: {fileID: 1001436608}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4, y: 0, z: 0} m_LocalPosition: {x: 3.84, y: -0.11, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -1499,7 +1499,7 @@ GameObject:
- component: {fileID: 1274549343} - component: {fileID: 1274549343}
m_Layer: 0 m_Layer: 0
m_Name: Beef m_Name: Beef
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -1790,7 +1790,7 @@ GameObject:
- component: {fileID: 1420342331} - component: {fileID: 1420342331}
m_Layer: 0 m_Layer: 0
m_Name: Milk m_Name: Milk
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -2052,7 +2052,8 @@ Transform:
m_LocalPosition: {x: -0.19, y: 3.03, z: 1} m_LocalPosition: {x: -0.19, y: 3.03, z: 1}
m_LocalScale: {x: 4.0825, y: 3.375, z: 1} m_LocalScale: {x: 4.0825, y: 3.375, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 1639705739}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1517788316 --- !u!114 &1517788316
@@ -2067,6 +2068,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 84e0c3f7dac20fb428c544f192588d80, type: 3} m_Script: {fileID: 11500000, guid: 84e0c3f7dac20fb428c544f192588d80, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
FinishedDishPosition: {x: -4.66, y: 2.89, z: 0}
--- !u!50 &1517788317 --- !u!50 &1517788317
Rigidbody2D: Rigidbody2D:
serializedVersion: 4 serializedVersion: 4
@@ -2210,7 +2212,7 @@ GameObject:
- component: {fileID: 1575942283} - component: {fileID: 1575942283}
m_Layer: 0 m_Layer: 0
m_Name: Flour m_Name: Flour
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -2343,6 +2345,178 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 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 --- !u!1 &1659394507
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2357,7 +2531,7 @@ GameObject:
- component: {fileID: 1659394509} - component: {fileID: 1659394509}
m_Layer: 0 m_Layer: 0
m_Name: Toast m_Name: Toast
m_TagString: Untagged m_TagString: Ingredient
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@@ -2625,7 +2799,7 @@ MonoBehaviour:
RequiredIngredients: RequiredIngredients:
- {fileID: 143107362} - {fileID: 143107362}
- {fileID: 537514707} - {fileID: 537514707}
NutritionalValue: 0 NutritionalValue: 25
--- !u!212 &1714471224 --- !u!212 &1714471224
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -0,0 +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();
}
}

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,14 +14,23 @@ public class Cooking : MonoBehaviour
// } // }
void CreateDish() { public Vector3 FinishedDishPosition;
public void CreateDish() {
List <GameObject> Ingredients = GetIngredients(); List <GameObject> Ingredients = GetIngredients();
List <GameObject> AllDishes = new List <GameObject>(); List <GameObject> AllDishes = new List <GameObject>();
// Find all dishes ingredients can make // Find all dishes ingredients can make
if (Ingredients.Count < 1) {
return;
}
foreach (GameObject Ingredient in Ingredients) { foreach (GameObject Ingredient in Ingredients) {
Debug.Log(Ingredient.name);
List <GameObject> Dishes = Ingredient.GetComponent<Ingredient>().IngredientIn; List <GameObject> Dishes = Ingredient.GetComponent<Ingredient>().IngredientIn;
foreach (GameObject Dish in Dishes) { foreach (GameObject Dish in Dishes) {
@@ -29,8 +38,9 @@ public class Cooking : MonoBehaviour
} }
} }
List <GameObject> PossibleDishes = new List <GameObject>();
List <GameObject> PossibleDishes = new List <GameObject>();
// Find the dishes, where all ingredients exist // Find the dishes, where all ingredients exist
foreach (GameObject Dish in AllDishes) { foreach (GameObject Dish in AllDishes) {
@@ -51,10 +61,49 @@ public class Cooking : MonoBehaviour
} }
} }
foreach (GameObject Dish in PossibleDishes) { // No dishes possible
Debug.Log(Dish);
if (PossibleDishes.Count < 1) {
return;
} }
GameObject BestDish = null;
foreach (GameObject Dish in PossibleDishes) {
if (BestDish == null) {
BestDish = Dish;
continue;
}
int CurrentNutritionalValue = Dish.GetComponent<Dish>().NutritionalValue;
int BestNutrionnalValue = BestDish.GetComponent<Dish>().NutritionalValue;
if (CurrentNutritionalValue > BestNutrionnalValue) {
BestDish = 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;
}
BestDish.transform.position = FinishedDishPosition;
} }
@@ -63,14 +112,20 @@ public class Cooking : MonoBehaviour
List <GameObject> currentCollisions = new List <GameObject>(); List <GameObject> currentCollisions = new List <GameObject>();
private void OnTriggerEnter2D(Collider2D other) { private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject); currentCollisions.Add (other.gameObject);
CreateDish();
} }
private void OnTriggerExit2D(Collider2D other) { private void OnTriggerExit2D(Collider2D other) {
currentCollisions.Remove (other.gameObject); currentCollisions.Remove (other.gameObject);
} }
List <GameObject> GetIngredients() 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;
} }

View File

@@ -3,7 +3,7 @@
"com.unity.collab-proxy": "2.2.0", "com.unity.collab-proxy": "2.2.0",
"com.unity.feature.2d": "2.0.0", "com.unity.feature.2d": "2.0.0",
"com.unity.ide.rider": "3.0.24", "com.unity.ide.rider": "3.0.24",
"com.unity.ide.visualstudio": "2.0.18", "com.unity.ide.visualstudio": "2.0.22",
"com.unity.test-framework": "1.1.33", "com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6", "com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.5", "com.unity.timeline": "1.7.5",

View File

@@ -152,7 +152,7 @@
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.ide.visualstudio": { "com.unity.ide.visualstudio": {
"version": "2.0.18", "version": "2.0.22",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {

View File

@@ -3,7 +3,8 @@
--- !u!78 &1 --- !u!78 &1
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: [] tags:
- Ingredient
layers: layers:
- Default - Default
- TransparentFX - TransparentFX