This commit is contained in:
happy44300
2018-08-13 17:49:35 +02:00
parent fd82e16cdc
commit a2f210b246
6 changed files with 86 additions and 15 deletions
+16
View File
@@ -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<Mission>().GetMissionText();
ArretDéfilement = false;
}
}
+18 -2
View File
@@ -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,
+1 -1
View File
@@ -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;
+6 -1
View File
@@ -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<Pokedex>().PokeDescription(int.Parse(transform.parent.name.Substring(6, 2)) - 1);
}
public void OnPointerExit(PointerEventData eventData)
{
GameObject.Find("GameManager").GetComponent<Pokedex>().UpdateMissionText();
}
}
+43 -9
View File
@@ -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<string, int> Objectifs = new Dictionary<string, int>();
public int MinArbre = 1;
public int MaxArbre = 4;
private void Start()
{
items = GetComponent<InventoryManager>().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<string,int> 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();
}
}
+2 -2
View File
@@ -20,9 +20,9 @@ public enum TreeType
AppleTree,
ChameleonTree,
TribbleTree,
Lol,
Unamed0,
SwapTree,
Nop,
Unamed1,
ThirstyTree,
Cactus,
};