From e1ed2015713043a302bf4ed963143c2965b430af Mon Sep 17 00:00:00 2001 From: "v.bloch" <v.bloch@etu.unistra.fr> Date: Tue, 30 Mar 2021 21:50:22 +0200 Subject: [PATCH] merge --- Assets/Scripts/Game/GenerateMap.cs | 3 ++ Assets/Scripts/Player/PlayerMovement.cs | 44 ++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Game/GenerateMap.cs b/Assets/Scripts/Game/GenerateMap.cs index bcc52da..f1ba2d2 100644 --- a/Assets/Scripts/Game/GenerateMap.cs +++ b/Assets/Scripts/Game/GenerateMap.cs @@ -19,6 +19,8 @@ public class GenerateMap : MonoBehaviour public List<GameObject> pUsine = new List<GameObject>(); public int nb_of_plot = 8; public Object[,] plot=new Object[3,3]; + + private GameObject player = GameObject.FindGameObjectWithTag("Player"); @@ -40,6 +42,7 @@ public class GenerateMap : MonoBehaviour void Start() { + generateVillage(); } diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index f16f217..0fb6130 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -18,7 +18,8 @@ public class PlayerMovement : MonoBehaviour private Vector3 change; private Animator animator; public PlayerState currentState; - + public int stage = 0; + public GameObject player; // Start is called before the first frame update void Start() @@ -51,6 +52,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) + { + 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) + { + 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) + { + 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) + { + GenerateMap.instance.generateUsine(1, 0); + stage++; + } } void MoveCharacter() -- GitLab