aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts/Controllers/GameController.cs
diff options
context:
space:
mode:
authorCarson Katri <carson.katri@gmail.com>2021-06-12 16:57:05 -0400
committerCarson Katri <carson.katri@gmail.com>2021-06-12 16:57:05 -0400
commit2da4072647dbf8577f8a5e2391551fbbfceef231 (patch)
tree636de5585864d64832d362117d40c93de97e5bb9 /Assets/Scripts/Controllers/GameController.cs
parent939170f625e5928d5ca86a57796aaa23f25a4fa7 (diff)
parentd6d5014337ab72a6eb8c2f93fae107c71d267649 (diff)
downloadgmtk-gamejam-2da4072647dbf8577f8a5e2391551fbbfceef231.tar.gz
gmtk-gamejam-2da4072647dbf8577f8a5e2391551fbbfceef231.tar.zst
gmtk-gamejam-2da4072647dbf8577f8a5e2391551fbbfceef231.zip
Resolve conflicts
Diffstat (limited to 'Assets/Scripts/Controllers/GameController.cs')
-rw-r--r--Assets/Scripts/Controllers/GameController.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs
index 9ae0ce8..b9f65f2 100644
--- a/Assets/Scripts/Controllers/GameController.cs
+++ b/Assets/Scripts/Controllers/GameController.cs
@@ -18,6 +18,9 @@ namespace Controllers
/// </summary>
[SerializeField] public Ball ball;
+ [SerializeField] public Hoop PlayerHoop;
+ [SerializeField] public Hoop EnemyHoop;
+
private void Awake()
{
player = new Player { isEnemy = false, controller = this };
@@ -37,6 +40,19 @@ namespace Controllers
/// </summary>
internal GameController controller;
+ internal int score;
+
+ private Vector2 lastShotPosition;
+ public void Score(Vector2 Rim) {
+ if (Vector2.Distance(lastShotPosition, Rim) >= 1)
+ {
+ score += 3;
+ Debug.Log("Three point");
+ } else
+ score += 2;
+ Debug.Log("Two point");
+ }
+
private State dribble => isEnemy ? State.EnemyDribble : State.PlayerDribble;
private State shoot => isEnemy ? State.EnemyShoot : State.PlayerShoot;
@@ -80,6 +96,7 @@ namespace Controllers
if (controller.state != dribble) return false; // We must be dribbling the ball to shoot it.
controller.state = shoot;
controller.ball.Shoot(playerTransform);
+ lastShotPosition = playerTransform.position;
return true;
}
}