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

This commit is contained in:
magn9775
2024-03-12 14:44:09 +01:00
4 changed files with 94 additions and 37 deletions

View File

@@ -257,6 +257,7 @@ MonoBehaviour:
IngredientIn: IngredientIn:
- {fileID: 1790468147} - {fileID: 1790468147}
- {fileID: 1714471222} - {fileID: 1714471222}
NutritionalValue: 0
--- !u!212 &143107366 --- !u!212 &143107366
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -380,7 +381,7 @@ BoxCollider2D:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.64, y: 0.64} oldSize: {x: 0.64, y: 0.64}
newSize: {x: 1, y: 1} newSize: {x: 0.64, y: 0.64}
adaptiveTilingThreshold: 0.5 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
adaptiveTiling: 0 adaptiveTiling: 0
@@ -404,6 +405,7 @@ MonoBehaviour:
IngredientIn: IngredientIn:
- {fileID: 460072661} - {fileID: 460072661}
- {fileID: 1525651426} - {fileID: 1525651426}
NutritionalValue: 0
--- !u!212 &389679694 --- !u!212 &389679694
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -450,7 +452,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -491,6 +493,7 @@ MonoBehaviour:
- {fileID: 1274549341} - {fileID: 1274549341}
- {fileID: 1420342329} - {fileID: 1420342329}
- {fileID: 885031692} - {fileID: 885031692}
NutritionalValue: 0
--- !u!212 &460072663 --- !u!212 &460072663
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -537,7 +540,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -617,7 +620,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: d5d8b548c18b7ef47985238815778a0a, type: 3} m_Sprite: {fileID: 21300000, guid: d5d8b548c18b7ef47985238815778a0a, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
@@ -638,7 +641,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: 0, y: 0, z: 0} m_LocalPosition: {x: 2.04, y: -2.51, 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: []
@@ -660,6 +663,7 @@ MonoBehaviour:
IngredientIn: IngredientIn:
- {fileID: 867381650} - {fileID: 867381650}
- {fileID: 1714471222} - {fileID: 1714471222}
NutritionalValue: 0
--- !u!61 &537514711 --- !u!61 &537514711
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -739,6 +743,7 @@ MonoBehaviour:
- {fileID: 1001436608} - {fileID: 1001436608}
- {fileID: 1274549341} - {fileID: 1274549341}
- {fileID: 1659394507} - {fileID: 1659394507}
NutritionalValue: 0
--- !u!212 &578240411 --- !u!212 &578240411
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -785,7 +790,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -997,6 +1002,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
RequiredIngredients: RequiredIngredients:
- {fileID: 537514707} - {fileID: 537514707}
NutritionalValue: 0
--- !u!1 &885031692 --- !u!1 &885031692
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1025,7 +1031,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: 2, y: 0, z: 0} m_LocalPosition: {x: 3.06, y: -2.09, 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: []
@@ -1091,6 +1097,7 @@ MonoBehaviour:
transform: {fileID: 885031693} transform: {fileID: 885031693}
IngredientIn: IngredientIn:
- {fileID: 460072661} - {fileID: 460072661}
NutritionalValue: 0
--- !u!212 &885031696 --- !u!212 &885031696
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1238,6 +1245,7 @@ MonoBehaviour:
IngredientIn: IngredientIn:
- {fileID: 1790468147} - {fileID: 1790468147}
- {fileID: 578240409} - {fileID: 578240409}
NutritionalValue: 0
--- !u!212 &1001436612 --- !u!212 &1001436612
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1347,7 +1355,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: a28e0f4904f55524ea2137416707b61b, type: 3} m_Sprite: {fileID: 21300000, guid: a28e0f4904f55524ea2137416707b61b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
@@ -1368,7 +1376,7 @@ Transform:
m_GameObject: {fileID: 1147379266} m_GameObject: {fileID: 1147379266}
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, y: 0, z: 1.1}
m_LocalScale: {x: 1.7, y: 1.7, z: 1} m_LocalScale: {x: 1.7, y: 1.7, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -1445,7 +1453,7 @@ BoxCollider2D:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.64, y: 0.64} oldSize: {x: 0.64, y: 0.64}
newSize: {x: 1, y: 1} newSize: {x: 0.64, y: 0.64}
adaptiveTilingThreshold: 0.5 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
adaptiveTiling: 0 adaptiveTiling: 0
@@ -1471,6 +1479,7 @@ MonoBehaviour:
- {fileID: 460072661} - {fileID: 460072661}
- {fileID: 578240409} - {fileID: 578240409}
- {fileID: 1525651426} - {fileID: 1525651426}
NutritionalValue: 0
--- !u!212 &1274549345 --- !u!212 &1274549345
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1517,7 +1526,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -1654,6 +1663,7 @@ MonoBehaviour:
transform: {fileID: 1420342330} transform: {fileID: 1420342330}
IngredientIn: IngredientIn:
- {fileID: 460072661} - {fileID: 460072661}
NutritionalValue: 0
--- !u!212 &1420342333 --- !u!212 &1420342333
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1811,7 +1821,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: -1
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
@@ -1821,7 +1831,7 @@ SpriteRenderer:
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 2
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!4 &1517788315 --- !u!4 &1517788315
Transform: Transform:
@@ -1832,7 +1842,7 @@ Transform:
m_GameObject: {fileID: 1517788312} m_GameObject: {fileID: 1517788312}
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.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: []
@@ -1926,6 +1936,7 @@ MonoBehaviour:
- {fileID: 1659394507} - {fileID: 1659394507}
- {fileID: 1274549341} - {fileID: 1274549341}
- {fileID: 389679690} - {fileID: 389679690}
NutritionalValue: 0
--- !u!212 &1525651429 --- !u!212 &1525651429
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1972,7 +1983,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -2049,7 +2060,7 @@ BoxCollider2D:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.64, y: 0.64} oldSize: {x: 0.64, y: 0.64}
newSize: {x: 1, y: 1} newSize: {x: 0.64, y: 0.64}
adaptiveTilingThreshold: 0.5 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
adaptiveTiling: 0 adaptiveTiling: 0
@@ -2073,6 +2084,7 @@ MonoBehaviour:
IngredientIn: IngredientIn:
- {fileID: 578240409} - {fileID: 578240409}
- {fileID: 1525651426} - {fileID: 1525651426}
NutritionalValue: 0
--- !u!212 &1659394511 --- !u!212 &1659394511
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2119,7 +2131,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -2158,6 +2170,7 @@ MonoBehaviour:
RequiredIngredients: RequiredIngredients:
- {fileID: 143107362} - {fileID: 143107362}
- {fileID: 537514707} - {fileID: 537514707}
NutritionalValue: 0
--- !u!212 &1714471224 --- !u!212 &1714471224
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2204,7 +2217,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@@ -2274,6 +2287,7 @@ MonoBehaviour:
- {fileID: 143107362} - {fileID: 143107362}
- {fileID: 1274549341} - {fileID: 1274549341}
- {fileID: 1001436608} - {fileID: 1001436608}
NutritionalValue: 0
--- !u!212 &1790468150 --- !u!212 &1790468150
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2320,7 +2334,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1

View File

@@ -4,37 +4,82 @@ using UnityEngine;
public class Cooking : MonoBehaviour public class Cooking : MonoBehaviour
{ {
void CheckDishes() // void CheckDishes()
{ // {
foreach (GameObject ingredient in currentCollisions) { // foreach (GameObject ingredient in currentCollisions) {
Debug.Log(ingredient.name); // Debug.Log(ingredient.name);
Debug.Log(ingredient.GetComponent<Ingredient>().NutritionalValue); // Debug.Log(ingredient.GetComponent<Ingredient>().NutritionalValue);
} // }
} // }
void CreateDish() {
List <GameObject> Ingredients = GetIngredients();
List <GameObject> AllDishes = new List <GameObject>();
// Find all dishes ingredients can make
foreach (GameObject Ingredient in Ingredients) {
List <GameObject> Dishes = Ingredient.GetComponent<Ingredient>().IngredientIn;
foreach (GameObject Dish in Dishes) {
AllDishes.Add(Dish);
}
}
List <GameObject> PossibleDishes = new List <GameObject>();
// Find the dishes, where all ingredients exist
foreach (GameObject Dish in AllDishes) {
List <GameObject> RequiredIngredients = Dish.GetComponent<Dish>().RequiredIngredients;
int NumberOfIngredients = RequiredIngredients.Count;
int IngredientsFulfilled = 0;
foreach (GameObject Ingredient in Ingredients) {
if (RequiredIngredients.Contains(Ingredient)) {
IngredientsFulfilled++;
}
}
if (IngredientsFulfilled == NumberOfIngredients) {
PossibleDishes.Add(Dish);
}
}
foreach (GameObject Dish in PossibleDishes) {
Debug.Log(Dish);
}
}
// Keep track of ingredients going on and off the cooker. // 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) { private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject); currentCollisions.Add (other.gameObject);
CheckDishes(); CreateDish();
} }
private void OnTriggerExit2D(Collider2D other) { private void OnTriggerExit2D(Collider2D other) {
currentCollisions.Remove (other.gameObject); currentCollisions.Remove (other.gameObject);
} }
void Update()
{
GetIngredients();
}
List <GameObject> GetIngredients() List <GameObject> GetIngredients()
{ {
return currentCollisions; return currentCollisions;
} }
// void Update()
// {
// GetIngredients();
// }
} }

View File

@@ -5,6 +5,7 @@ using UnityEngine;
public class Dish : MonoBehaviour public class Dish : MonoBehaviour
{ {
public List <GameObject> RequiredIngredients; public List <GameObject> RequiredIngredients;
public int NutritionalValue;
// Start is called before the first frame update // Start is called before the first frame update

View File

@@ -33,9 +33,6 @@ public class Ingredient : MonoBehaviour
void OnMouseUp() void OnMouseUp()
{ {
if (isMoving) if (isMoving)
isMoving = false; isMoving = false;
else else
isMoving = true; isMoving = true;