aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts/Controllers/Player/PlayerSegment.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Controllers/Player/PlayerSegment.cs')
-rw-r--r--Assets/Scripts/Controllers/Player/PlayerSegment.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Assets/Scripts/Controllers/Player/PlayerSegment.cs b/Assets/Scripts/Controllers/Player/PlayerSegment.cs
index 0e8a969..67b3ecf 100644
--- a/Assets/Scripts/Controllers/Player/PlayerSegment.cs
+++ b/Assets/Scripts/Controllers/Player/PlayerSegment.cs
@@ -11,16 +11,20 @@ namespace Controllers.Player
internal bool moveleft;
internal bool moveright;
-
+
+ [Header("Controls")]
[SerializeField] public Control left;
[SerializeField] public Control right;
+ [Header("Settings")]
[SerializeField] public Vector3 forceOrigin;
-
[SerializeField] public float height;
[SerializeField] public bool isRoot;
[SerializeField] public bool isTop;
+ [Header("References")]
+ [SerializeField] private GameController game;
+ [SerializeField] private bool callFoulOnContact;
[SerializeField] public Transform flipper;
public Rigidbody2D Rigidbody => _rigidbody != null ? _rigidbody : _rigidbody = GetComponent<Rigidbody2D>();
@@ -41,6 +45,12 @@ namespace Controllers.Player
transform.position + (height * forceOrigin));
}
}
+
+ private void OnCollisionEnter2D(Collision2D other)
+ {
+ if (callFoulOnContact && game.player.HasBall && other.gameObject.CompareTag("Ground"))
+ game.player.Foul("LOOSE BALL FOUL");
+ }
}
[Serializable]