From abeb9f28b90bdd816d48e58ef988ffdda555b5f3 Mon Sep 17 00:00:00 2001 From: Ciakon Date: Wed, 28 Feb 2024 09:45:13 +0100 Subject: [PATCH] Moving Chimken --- Assets/Scenes/Noahs kælder.unity | 139 ++++++++++++++++++++++++++++++- Assets/Scripts/Ingredient.cs | 26 +++++- Assets/Scripts/Table.cs | 18 ++++ Assets/Scripts/Table.cs.meta | 11 +++ 4 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 Assets/Scripts/Table.cs create mode 100644 Assets/Scripts/Table.cs.meta diff --git a/Assets/Scenes/Noahs kælder.unity b/Assets/Scenes/Noahs kælder.unity index fcde943..683ce25 100644 --- a/Assets/Scenes/Noahs kælder.unity +++ b/Assets/Scenes/Noahs kælder.unity @@ -134,6 +134,7 @@ GameObject: - component: {fileID: 537514709} - component: {fileID: 537514708} - component: {fileID: 537514710} + - component: {fileID: 537514711} m_Layer: 0 m_Name: Chimken m_TagString: Untagged @@ -202,8 +203,8 @@ Transform: m_GameObject: {fileID: 537514707} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.11, y: -1.22, z: 0} - m_LocalScale: {x: 2, y: 2, z: 1} + m_LocalPosition: {x: -6.04, y: 4.25, z: 0} + m_LocalScale: {x: 2, y: 2, z: 2} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -220,7 +221,52 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: bc5b15c2c5f208b4d95341de4aa7e2f6, type: 3} m_Name: m_EditorClassIdentifier: - transform: {x: 0, y: 0, z: 0} + transform: {fileID: 537514709} +--- !u!61 &537514711 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 537514707} + 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!1 &675419354 GameObject: m_ObjectHideFlags: 0 @@ -299,7 +345,7 @@ Transform: m_GameObject: {fileID: 675419354} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.97, y: 1.69, z: 0} + m_LocalPosition: {x: 0.01, y: 2.51, z: 0} m_LocalScale: {x: 3, y: 3, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -397,6 +443,90 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1422303514 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1422303516} + - component: {fileID: 1422303515} + m_Layer: 0 + m_Name: Table + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1422303515 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1422303514} + 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: -5177388603050735206, guid: 8884154dfe85442a3a3578be807dbcdf, type: 3} + m_Color: {r: 0.6698113, g: 0.3803051, b: 0.2506526, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 2 + m_Size: {x: 13.661447, y: 2.1655843} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1422303516 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1422303514} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.0029, y: -4.1014, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -404,3 +534,4 @@ SceneRoots: - {fileID: 759826130} - {fileID: 537514709} - {fileID: 675419356} + - {fileID: 1422303516} diff --git a/Assets/Scripts/Ingredient.cs b/Assets/Scripts/Ingredient.cs index 7262e14..fe1f290 100644 --- a/Assets/Scripts/Ingredient.cs +++ b/Assets/Scripts/Ingredient.cs @@ -5,8 +5,10 @@ using UnityEngine; public class Ingredient : MonoBehaviour { // Start is called before the first frame update - //Vector3 mousePosition = Input.mousePosition; - public Vector3 transform; + Vector3 mousePosition; + public Transform transform; + bool isMoving = false; + //public GameObject table; void Start() { @@ -15,6 +17,24 @@ public class Ingredient : MonoBehaviour // Update is called once per frame void Update() { - //transform.position = Input + if (isMoving) + { + Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); + transform.position = new Vector3 (mousePosition.x, mousePosition.y, transform.position.z); + //Debug.Log(table.Bounds.Contains(mousePosition)); + } + + + } + + void OnMouseUp() + { + if (isMoving) + + + + isMoving = false; + else + isMoving = true; } } diff --git a/Assets/Scripts/Table.cs b/Assets/Scripts/Table.cs new file mode 100644 index 0000000..5cf563f --- /dev/null +++ b/Assets/Scripts/Table.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Table : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/Table.cs.meta b/Assets/Scripts/Table.cs.meta new file mode 100644 index 0000000..f6925c2 --- /dev/null +++ b/Assets/Scripts/Table.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ff11aa56b668504fa25b3bbeafe65f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: