From 7b8755c3588f4b3baf9d1eb607b89dbddc4f29d3 Mon Sep 17 00:00:00 2001
From: Ny Bruker <robinhs@stud.ntnu.no>
Date: Sat, 1 Oct 2022 18:15:20 +0200
Subject: [PATCH] Swapped the player's attack to use the new ability system.

---
 MrBigsock/Assets/Code/PlayerController.cs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs
index 263181b6..d0750799 100644
--- a/MrBigsock/Assets/Code/PlayerController.cs
+++ b/MrBigsock/Assets/Code/PlayerController.cs
@@ -32,7 +32,7 @@ namespace BigSock {
 
 
 
-
+			protected IAttack _testAttack = new BasicProjectile1();
 
 			public DateTime NextTimeCanAttack { get; private set; } = DateTime.Now;
 
@@ -52,6 +52,7 @@ namespace BigSock {
 				TryPickUpItem(ItemService.SINGLETON.Get(201));
 				TryPickUpItem(ItemService.SINGLETON.Get(201));
 				TryPickUpItem(ItemService.SINGLETON.Get(202));
+				var tmp = PrefabService.SINGLETON;
 			}
 
 
@@ -98,10 +99,12 @@ namespace BigSock {
 				if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButton(0)) {
 					// Manage attack cooldown.
 					if(NextTimeCanAttack <= DateTime.Now) {
-						NextTimeCanAttack = DateTime.Now.AddSeconds(AttackCooldown);
+						//NextTimeCanAttack = DateTime.Now.AddSeconds(AttackCooldown);
+
+						//var bullet = Instantiate(attack, new Vector3(transform.position.x, transform.position.y, transform.position.z), attack.transform.rotation);
+						//bullet.GetComponent<AttackMovement>().Actor = this;
 
-						var bullet = Instantiate(attack, new Vector3(transform.position.x, transform.position.y, transform.position.z), attack.transform.rotation);
-						bullet.GetComponent<AttackMovement>().Actor = this;
+						_testAttack.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition));
 					
 					}
 				}
-- 
GitLab