diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 3f60686397f3856a1d1914727ba58136f42d0b85..de6ad479f74875a46d2cb5de4b4f62c118138602 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -72,6 +72,13 @@ public class PlayerMovement : MonoBehaviour { animator.SetBool("moving", false); } + } + private void OnTriggerEnter2D(Collider2D collision) + { + if (collision.CompareTag("factory")) + { + this.GetComponent<PlayerNature>().LooseNature(20); + } } } diff --git a/Assets/Scripts/Player/PlayerNature.cs b/Assets/Scripts/Player/PlayerNature.cs index b4ad989e1c86181ccfa689ea05bc8eab47a7d9f3..28e3e163696b135348fa8f6f97eb00053a32b256 100644 --- a/Assets/Scripts/Player/PlayerNature.cs +++ b/Assets/Scripts/Player/PlayerNature.cs @@ -44,13 +44,13 @@ public class PlayerNature : MonoBehaviour void Update() { - //toutes les x secondes => on perd un certain nombre de secondes - if (Time.time > nextActionTime) - { - nextActionTime += period; + ////toutes les x secondes => on perd un certain nombre de secondes + //if (Time.time > nextActionTime) + //{ + // nextActionTime += period; - this.LooseNature(this.TimeDamage); - } + // this.LooseNature(this.TimeDamage); + //} } // Perd un certain nombre de points de nature @@ -84,6 +84,4 @@ public class PlayerNature : MonoBehaviour instance = this; } - - }