diff --git a/Assets/Scenes/sceneRaffael.unity b/Assets/Scenes/sceneRaffael.unity index 0261c0fb337313b2286d7038821867b7889aea66..514f2d0bc9bb6adf323f7afa49c1cef1d5a4d686 100644 --- a/Assets/Scenes/sceneRaffael.unity +++ b/Assets/Scenes/sceneRaffael.unity @@ -2538,6 +2538,10 @@ PrefabInstance: propertyPath: natureBar value: objectReference: {fileID: 593755023} + - target: {fileID: -6286016664533736427, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3} + propertyPath: currentNature + value: 100 + objectReference: {fileID: 0} - target: {fileID: 1206561506436264872, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3} propertyPath: m_SortingOrder value: 1000 @@ -2550,6 +2554,10 @@ PrefabInstance: propertyPath: m_Offset.y value: -0.17818928 objectReference: {fileID: 0} + - target: {fileID: 1206561506436264875, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3} + propertyPath: player + value: + objectReference: {fileID: 1925386457} - target: {fileID: 1206561506436264879, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3} propertyPath: m_RootOrder value: 0 @@ -16646,6 +16654,11 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 898c167cc2238f346bdccf7faa612453, type: 3} +--- !u!1 &1925386457 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1206561506436264884, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3} + m_PrefabInstance: {fileID: 612936001} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1928427715 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Game/GenerateMap.cs b/Assets/Scripts/Game/GenerateMap.cs index bcc52da3cd13580cb9cd4b5473344bfc232361de..d0716d7b8a11c4b2f3ccda005ffe597552c26523 100644 --- a/Assets/Scripts/Game/GenerateMap.cs +++ b/Assets/Scripts/Game/GenerateMap.cs @@ -19,8 +19,7 @@ public class GenerateMap : MonoBehaviour public List<GameObject> pUsine = new List<GameObject>(); public int nb_of_plot = 8; public Object[,] plot=new Object[3,3]; - - + //Les coordonées x dans l'ordre private int[] xs=new int[]{-17,0,17}; //colonne @@ -40,6 +39,7 @@ public class GenerateMap : MonoBehaviour void Start() { + generateVillage(); } diff --git a/Assets/Scripts/Inventory/Border.cs b/Assets/Scripts/Inventory/Border.cs index aa127050d5973456f2b7dfd027d6dfa43afa2e06..5df5a44c8d4c613b3f78472e494a957faa86afd6 100644 --- a/Assets/Scripts/Inventory/Border.cs +++ b/Assets/Scripts/Inventory/Border.cs @@ -6,6 +6,7 @@ public class Border : MonoBehaviour { public Item itemNeeded; public BoxCollider2D forestCollider; + private GameObject player = GameObject.FindGameObjectWithTag("Player"); private void OnCollisionEnter2D(Collision2D collision) { @@ -15,27 +16,31 @@ public class Border : MonoBehaviour Debug.Log("JE TOUCHE LA BORDEER"); if (Inventory.instance.hasItem(itemNeeded)) { - Debug.Log("Je possède l'item nécessaire"); + Debug.Log("Je poss?de l'item n?cessaire"); forestCollider.enabled = false; } else { - Debug.Log("Je n'ai pas l'item nécessaire"); + Debug.Log("Je n'ai pas l'item n?cessaire"); switch (itemNeeded.id) { case 1: Dialog.instance.setSituation("borderChaussure"); + player.GetComponent<PlayerMovement>().ispassed[0] = true; break; case 2: Dialog.instance.setSituation("borderBaton"); + player.GetComponent<PlayerMovement>().ispassed[1] = true; break; case 3: Dialog.instance.setSituation("borderRechaud"); + player.GetComponent<PlayerMovement>().ispassed[2] = true; break; case 4: Dialog.instance.setSituation("borderTente"); + player.GetComponent<PlayerMovement>().ispassed[3] = true; break; } } diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index f16f217ce0e0649b1d07ae7d598c4eb9f5719b0a..1083a51822f0a5995c929f54f21092e572838f79 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -18,7 +18,9 @@ public class PlayerMovement : MonoBehaviour private Vector3 change; private Animator animator; public PlayerState currentState; - + public int stage = 0; + public GameObject player; + public bool[] ispassed; // Start is called before the first frame update void Start() @@ -51,6 +53,47 @@ public class PlayerMovement : MonoBehaviour pos.x = Mathf.Clamp01(pos.x); pos.y = Mathf.Clamp01(pos.y); transform.position = Camera.main.ViewportToWorldPoint(pos); + + if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 0) + { + GenerateMap.instance.generateBoutique(0, 1, "chaussure"); + stage++; + } + else if (stage == 1 && ispassed[0] == true) + { + GenerateMap.instance.generateUsine(1, 1); + stage++; + } + else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 2) + { + GenerateMap.instance.generateBoutique(0, 2, "baton"); + stage++; + } + else if (stage == 3 && ispassed[1] == true) + { + GenerateMap.instance.generateUsine(1, 2); + stage++; + } + else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 4) + { + GenerateMap.instance.generateBoutique(2, 0, "rechaud"); + stage++; + } + else if (stage == 5 && ispassed[2] == true) + { + GenerateMap.instance.generateUsine(2, 1); + stage++; + } + else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 6) + { + GenerateMap.instance.generateBoutique(0, 0, "tente"); + stage++; + } + else if (stage == 7 && ispassed[3] == true) + { + GenerateMap.instance.generateUsine(1, 0); + stage++; + } } void MoveCharacter()