Skip to content
Snippets Groups Projects
Commit 54a91112 authored by colin's avatar colin
Browse files

Fix_Obstacles

parent e1d3efe2
1 merge request!87Fix Obstacles
......@@ -25,7 +25,16 @@ public class DragDropM : MonoBehaviour, IDragHandler, IDropHandler
public void OnDrag(PointerEventData eventData)
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
if (Ui.nbObst == 0)
{
Destroy(this.gameObject);
Ui.nbObst++;
}
else
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
}
}
......
......@@ -25,7 +25,15 @@ public class DragDropS : MonoBehaviour, IDragHandler, IDropHandler
public void OnDrag(PointerEventData eventData)
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
if (Ui.nbObst == 0)
{
Destroy(this.gameObject);
Ui.nbObst++;
}
else
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
}
}
......
......@@ -23,9 +23,16 @@ public class DragDropW : MonoBehaviour, IDragHandler, IDropHandler
public void OnDrag(PointerEventData eventData)
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
if (Ui.nbObst == 0)
{
Destroy(this.gameObject);
Ui.nbObst++;
}
else
{
rectransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
}
}
public void OnDrop(PointerEventData eventData)
......
......@@ -27,6 +27,11 @@ public class DiffScale : MonoBehaviour
Ui.difficulty = 0;
}
if (Ui.nbObst < 0)
{
Ui.nbObst = 0;
}
textshowed = GameObject.Find("nbobstacle").GetComponent<TMP_Text>();
textshowed.GetComponent<TMP_Text>().text = "Obstacles restants : " + Ui.nbObst.ToString();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment