diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-06-12 16:54:59 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-06-12 16:54:59 -0400 |
commit | d6d5014337ab72a6eb8c2f93fae107c71d267649 (patch) | |
tree | 637387f4daa9114f20917a565283bd327b7d6318 /Assets/Scripts | |
parent | d64b65fed63cd4fb5cc1112fabc8850ddd1f6507 (diff) | |
download | gmtk-gamejam-d6d5014337ab72a6eb8c2f93fae107c71d267649.tar.gz gmtk-gamejam-d6d5014337ab72a6eb8c2f93fae107c71d267649.tar.zst gmtk-gamejam-d6d5014337ab72a6eb8c2f93fae107c71d267649.zip |
EnemyHoop and Hoop gamecontroler stuff
Diffstat (limited to 'Assets/Scripts')
-rw-r--r-- | Assets/Scripts/Controllers/GameController.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs index c326c4e..b39199b 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; @@ -78,6 +94,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; } } |