From 256e985944dc5dd715bf085ee4e0ade7e1385641 Mon Sep 17 00:00:00 2001 From: "nyvlemacul@gmail.com" <nyvlemacul@gmail.com> Date: Tue, 30 Mar 2021 09:29:13 +0200 Subject: [PATCH] correction script generateMap --- Assets/Scripts/Game/GenerateMap.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Game/GenerateMap.cs b/Assets/Scripts/Game/GenerateMap.cs index 6928a24..4bc5ad7 100644 --- a/Assets/Scripts/Game/GenerateMap.cs +++ b/Assets/Scripts/Game/GenerateMap.cs @@ -6,6 +6,11 @@ public class GenerateMap : MonoBehaviour { //Les 8 prefabs public GameObject[] maps = new GameObject[8]; + public GameObject[] shopFactory = new GameObject[8]; + + + public Object[] objects=new Object[8]; + public int where; //Les coordonées x dans l'ordre private int[] xs=new int[]{-17,0,17,-17,0,17,-17,0}; @@ -23,11 +28,17 @@ public class GenerateMap : MonoBehaviour { for(int i=0;i<8;i++) { - Instantiate(maps[i], new Vector3(xs[i], ys[i], 0), Quaternion.identity); + objects[i]=Instantiate(maps[i], new Vector3(xs[i], ys[i], 0), Quaternion.identity); } } + public void generateShopFactory() + { + Destroy(objects[where]); + Instantiate(shopFactory[where], new Vector3(xs[where], ys[where], 0), Quaternion.identity); + + } void Update() { -- GitLab