Cooker collision

This commit is contained in:
2024-03-06 09:12:00 +01:00
parent e4e75988d2
commit 24948de762
3 changed files with 66 additions and 8 deletions

View File

@@ -251,7 +251,7 @@ BoxCollider2D:
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
@@ -383,7 +383,7 @@ SpriteRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1147379266}
m_Enabled: 1
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
@@ -454,6 +454,8 @@ GameObject:
- component: {fileID: 1517788315}
- component: {fileID: 1517788314}
- component: {fileID: 1517788313}
- component: {fileID: 1517788316}
- component: {fileID: 1517788317}
m_Layer: 0
m_Name: Cooker
m_TagString: Untagged
@@ -490,7 +492,7 @@ BoxCollider2D:
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
@@ -513,7 +515,7 @@ SpriteRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312}
m_Enabled: 0
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
@@ -573,6 +575,45 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1517788316
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84e0c3f7dac20fb428c544f192588d80, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!50 &1517788317
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312}
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!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0

View File

@@ -8,11 +8,26 @@ public class Cooking : MonoBehaviour
void GetIngredients()
{
// foreach (GameObject ingredient in currentCollisions) {
// Debug.Log(ingredient.name);
// }
return currentCollisions
}
void Update()
{
GetIngredients()
GetIngredients();
}
// Keep track of ingredients going on and off the cooker.
List <GameObject> currentCollisions = new List <GameObject> ();
private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject);
}
private void OnTriggerExit2D(Collider2D other) {
currentCollisions.Remove (other.gameObject);
}
}