From 95f785d4ef190038242ffe2fc26a6db4b737f676 Mon Sep 17 00:00:00 2001 From: Raffael Di Pietro <maxou4170@gmail.com> Date: Tue, 30 Mar 2021 16:24:57 +0200 Subject: [PATCH] Affichage de l'item vendu sur la boutique --- Assets/Prefabs/tent.prefab | 28 +++++++--------------------- Assets/Scripts/Game/GenerateMap.cs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Assets/Prefabs/tent.prefab b/Assets/Prefabs/tent.prefab index 5230643..97b773d 100644 --- a/Assets/Prefabs/tent.prefab +++ b/Assets/Prefabs/tent.prefab @@ -10,7 +10,7 @@ GameObject: m_Component: - component: {fileID: 2594227356551208515} - component: {fileID: 7604435187626042244} - - component: {fileID: 3737178317091432126} + - component: {fileID: 4313274779673652663} m_Layer: 0 m_Name: tent m_TagString: Untagged @@ -83,8 +83,8 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!60 &3737178317091432126 -PolygonCollider2D: +--- !u!61 &4313274779673652663 +BoxCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -96,7 +96,7 @@ PolygonCollider2D: m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} + m_Offset: {x: 0.0000009536743, y: -1.9999735} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} @@ -106,20 +106,6 @@ PolygonCollider2D: drawMode: 0 adaptiveTiling: 0 m_AutoTiling: 0 - m_Points: - m_Paths: - - - {x: 4.625, y: -3.6875} - - {x: 4.125, y: -3.5} - - {x: 4.625, y: 0.4375} - - {x: 4.625, y: 2.75} - - {x: 3.5625, y: 2.6875} - - {x: 0.5, y: 5} - - {x: -0.3125, y: 5} - - {x: -3.9375, y: 2.625} - - {x: -4.4375, y: 2.5625} - - {x: -4.625, y: 2.375} - - {x: -4.625, y: 1.125} - - {x: -4.125, y: 0.9375} - - {x: -4.625, y: -2.5625} - - {x: -4.625, y: -5} - - {x: 4.625, y: -5} + serializedVersion: 2 + m_Size: {x: 8.993399, y: 7.271563} + m_EdgeRadius: 0 diff --git a/Assets/Scripts/Game/GenerateMap.cs b/Assets/Scripts/Game/GenerateMap.cs index feb9f5e..a5adbd6 100644 --- a/Assets/Scripts/Game/GenerateMap.cs +++ b/Assets/Scripts/Game/GenerateMap.cs @@ -54,6 +54,8 @@ public class GenerateMap : MonoBehaviour public void generateBoutique(int column, int line, string objetVente) { + float xOffset = 0; + float yOffset = 0; Destroy(plot[column, line]); Item itemToSell = null; @@ -63,18 +65,26 @@ public class GenerateMap : MonoBehaviour case "chaussure": itemToSell = chaussures; goToSell = GO_chaussures; + xOffset = 0; + yOffset = 6.1F; break; case "baton": itemToSell = baton; goToSell = GO_baton; + xOffset = 0; + yOffset = 0; break; case "réchaud": itemToSell = rechaud; goToSell = GO_rechaud; + xOffset = 0; + yOffset = 0; break; case "tente": itemToSell = tente; goToSell = GO_tente; + xOffset = 2.7F; + yOffset = 2.27F; break; } if (itemToSell && goToSell) @@ -84,6 +94,9 @@ public class GenerateMap : MonoBehaviour shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().sellItem = itemToSell; shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().itemForSale.Add(goToSell); plot[column, line] = shop; + float x = shop.transform.position.x + xOffset; + float y = shop.transform.position.y + yOffset; + Instantiate(goToSell, new Vector3(x, y, 0), Quaternion.identity); } else Debug.LogError("Mauvais paramètre pour objetVente"); -- GitLab