From d64b65fed63cd4fb5cc1112fabc8850ddd1f6507 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Sat, 12 Jun 2021 16:42:21 -0400 Subject: PlayerHoop log on hit --- Assets/Scenes/Main.unity | 77 ++++++++++++++++++++++++++++++++- Assets/Scripts/Controllers/Hoop.cs | 19 ++++++++ Assets/Scripts/Controllers/Hoop.cs.meta | 3 ++ 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 Assets/Scripts/Controllers/Hoop.cs create mode 100644 Assets/Scripts/Controllers/Hoop.cs.meta diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 8979071..0e8dd51 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -298,6 +298,77 @@ Transform: m_CorrespondingSourceObject: {fileID: 2106494524751008833, guid: b2939f2eae52d074b81e81fccdde88f9, type: 3} m_PrefabInstance: {fileID: 1402386184} m_PrefabAsset: {fileID: 0} +--- !u!1 &614591299 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2106494524751008836, guid: b2939f2eae52d074b81e81fccdde88f9, type: 3} + m_PrefabInstance: {fileID: 1402386184} + m_PrefabAsset: {fileID: 0} +--- !u!61 &614591300 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 614591299} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.005651191, y: -0.104769394} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 0.32, y: 0.32} + newSize: {x: 0.32, y: 0.32} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 0.14921531, y: 0.030544288} + m_EdgeRadius: 0 +--- !u!61 &614591301 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 614591299} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.0056511946, y: 0.005704716} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 0.32, y: 0.32} + newSize: {x: 0.32, y: 0.32} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 0.14921531, y: 0.050745383} + m_EdgeRadius: 0 +--- !u!114 &614591307 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 614591299} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 40e5d6a883d14c7fb60913ec2fc3009c, type: 3} + m_Name: + m_EditorClassIdentifier: + Rim: {fileID: 614591300} + Net: {fileID: 614591301} --- !u!1001 &700993592 PrefabInstance: m_ObjectHideFlags: 0 @@ -315,11 +386,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5143626018439341592, guid: 2485406c33a7d4f5481ce936cc9b162e, type: 3} propertyPath: m_LocalPosition.x - value: 3.5 + value: 0.23 objectReference: {fileID: 0} - target: {fileID: 5143626018439341592, guid: 2485406c33a7d4f5481ce936cc9b162e, type: 3} propertyPath: m_LocalPosition.y - value: 5.5 + value: 5.17 objectReference: {fileID: 0} - target: {fileID: 5143626018439341592, guid: 2485406c33a7d4f5481ce936cc9b162e, type: 3} propertyPath: m_LocalPosition.z @@ -496,6 +567,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ball: {fileID: 707826158} + PlayerHoop: {fileID: 614591307} + EnemyHoop: {fileID: 0} --- !u!4 &1189511746 stripped Transform: m_CorrespondingSourceObject: {fileID: 6095859834264611321, guid: c64ad9b908cb44602b3d13a74aef751f, type: 3} diff --git a/Assets/Scripts/Controllers/Hoop.cs b/Assets/Scripts/Controllers/Hoop.cs new file mode 100644 index 0000000..58f7130 --- /dev/null +++ b/Assets/Scripts/Controllers/Hoop.cs @@ -0,0 +1,19 @@ +using System; +using UnityEngine; + +namespace Controllers +{ + public class Hoop : MonoBehaviour + { + [SerializeField] private BoxCollider2D Rim; + [SerializeField] private BoxCollider2D Net; + + private void OnTriggerEnter2D(Collider2D other) + { + if (other.GetComponent() == null) return; + + if (Rim.IsTouching(other) && Net.IsTouching(other)) + Debug.Log("Swish!"); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Controllers/Hoop.cs.meta b/Assets/Scripts/Controllers/Hoop.cs.meta new file mode 100644 index 0000000..29125c3 --- /dev/null +++ b/Assets/Scripts/Controllers/Hoop.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 40e5d6a883d14c7fb60913ec2fc3009c +timeCreated: 1623524972 \ No newline at end of file -- cgit v1.2.3-56-ge451