diff --git a/Assets/Pokedex.cs b/Assets/Pokedex.cs index 5c57160..89cf7da 100644 --- a/Assets/Pokedex.cs +++ b/Assets/Pokedex.cs @@ -9,6 +9,8 @@ public class Pokedex : MonoBehaviour public TextMeshProUGUI PokeText; public int PokeTemps = 10; private bool PokeBool = false; + public bool ArretDéfilement = false; + public async void PokeDescription(int PokeNumero) { @@ -19,11 +21,25 @@ public class Pokedex : MonoBehaviour PokeBool = true; for (int i = 0; i < PokeSubDescription.Length; i++) { + if (ArretDéfilement == true) + { + ArretDéfilement = false; + PokeBool = false; + return; + } PokeText.text += PokeSubDescription[i]; await Task.Delay(PokeTemps); + } PokeBool = false; } } + public void UpdateMissionText() + { + ArretDéfilement = true; + + PokeText.text = GetComponent().GetMissionText(); + ArretDéfilement = false; + } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 9d46024..652b281 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -9008,7 +9008,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -318.71, y: -147.2} + m_AnchoredPosition: {x: -321.4, y: -105.8} m_SizeDelta: {x: 343.8, y: 202.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1181635282 stripped @@ -9340,7 +9340,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -318.71, y: -145} + m_AnchoredPosition: {x: -321.4, y: -103.600006} m_SizeDelta: {x: 404.5, y: 248.3} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1475634576 @@ -13232,6 +13232,7 @@ GameObject: - component: {fileID: 1724986184} - component: {fileID: 1724986183} - component: {fileID: 1724986185} + - component: {fileID: 1724986186} m_Layer: 0 m_Name: GameManager m_TagString: Untagged @@ -13613,6 +13614,21 @@ MonoBehaviour: m_EditorClassIdentifier: PokeText: {fileID: 1169353273} PokeTemps: 2 + "ArretD\xE9filement": 0 +--- !u!114 &1724986186 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1724986182} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b4b4a071451fb1c47af7fedbbf6a4179, type: 3} + m_Name: + m_EditorClassIdentifier: + difficulte: 3 + MinArbre: 1 + MaxArbre: 4 --- !u!1 &1774186325 stripped GameObject: m_CorrespondingSourceObject: {fileID: 1472403156812664, guid: 89e9215b05511f648b3306ce05aae35f, diff --git a/Assets/Script/InventoryManager.cs b/Assets/Script/InventoryManager.cs index cf00156..f49289c 100644 --- a/Assets/Script/InventoryManager.cs +++ b/Assets/Script/InventoryManager.cs @@ -14,7 +14,7 @@ public class InventoryManager : MonoBehaviour [Space] public GameObject[] slots; - public TreeItem[] items = new TreeItem[12]; + public TreeItem[] items = new TreeItem[15]; public Plot[] plots = new Plot[25]; private int draggedPosition = -1; diff --git a/Assets/Script/InventorySlot.cs b/Assets/Script/InventorySlot.cs index 1e08961..eb0cac4 100644 --- a/Assets/Script/InventorySlot.cs +++ b/Assets/Script/InventorySlot.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.EventSystems; -public class InventorySlot : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler +public class InventorySlot : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler { public void OnPointerDown(PointerEventData eventData) { @@ -13,4 +13,9 @@ public class InventorySlot : MonoBehaviour, IPointerDownHandler, IPointerEnterHa GameObject.Find("GameManager").GetComponent().PokeDescription(int.Parse(transform.parent.name.Substring(6, 2)) - 1); } + + public void OnPointerExit(PointerEventData eventData) + { + GameObject.Find("GameManager").GetComponent().UpdateMissionText(); + } } diff --git a/Assets/Script/Mission.cs b/Assets/Script/Mission.cs index 53d8c4a..4e4f90e 100644 --- a/Assets/Script/Mission.cs +++ b/Assets/Script/Mission.cs @@ -1,16 +1,50 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using TMPro; public class Mission : MonoBehaviour { - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } + string Missiontext = null; + TreeItem[] items; + public float difficulte; + private Dictionary Objectifs = new Dictionary(); + public int MinArbre = 1; + public int MaxArbre = 4; + private void Start() + { + items = GetComponent().items; + if(items == null) + { + Debug.Log("eroor"); + } + //Debug.Log(items[0].type); + GenerateMission(); + } + public void GenerateMission() + { + + for (int i = 0; i < difficulte; i++) + { + Objectifs.Add(ChoisirUnTypeDarbre(), Random.Range(MinArbre, MaxArbre)); + } + foreach (KeyValuePair i in Objectifs) + { + Missiontext = Missiontext + "Place" + i.Key + i.Value; + } + + + //ChoisirUnTypeDarbre() + //Random.Range(MinArbre, MaxArbre) + + + } + public string GetMissionText() + { + return Missiontext; + } + public string ChoisirUnTypeDarbre() + { + return items[Random.Range(0, items.Length)].ToString(); + } } diff --git a/Assets/Script/TreeItem.cs b/Assets/Script/TreeItem.cs index 2bcd546..f5f77d8 100644 --- a/Assets/Script/TreeItem.cs +++ b/Assets/Script/TreeItem.cs @@ -20,9 +20,9 @@ public enum TreeType AppleTree, ChameleonTree, TribbleTree, - Lol, + Unamed0, SwapTree, - Nop, + Unamed1, ThirstyTree, Cactus, }; \ No newline at end of file