From ec33d9f21f922366b94daafe9df049b9f46ee698 Mon Sep 17 00:00:00 2001
From: Ny Bruker <robinhs@stud.ntnu.no>
Date: Sat, 10 Dec 2022 16:33:13 +0100
Subject: [PATCH] Removed iframes from enemies. - Set the IFrameDuration on hit
 to 0 in character. - Made PlayerController override it so only players have
 it. - Also fixed bug where only default duration would be used for all
 iframes.

---
 MrBigsock/Assets/Code/Character.cs        | 6 +++---
 MrBigsock/Assets/Code/PlayerController.cs | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/MrBigsock/Assets/Code/Character.cs b/MrBigsock/Assets/Code/Character.cs
index 5a1579b6..968d7824 100644
--- a/MrBigsock/Assets/Code/Character.cs
+++ b/MrBigsock/Assets/Code/Character.cs
@@ -545,9 +545,9 @@ namespace BigSock {
 		*/
 		public TimeSpan IFrameDuration { 
 			get => _iFrameDuration; 
-			private set => _iFrameDuration = value; 
+			protected set => _iFrameDuration = value; 
 		}
-		public TimeSpan _iFrameDuration = new TimeSpan(0, 0, 0, 0, 333);
+		public TimeSpan _iFrameDuration = new TimeSpan(0, 0, 0, 0, 0);
 
 
 
@@ -676,7 +676,7 @@ namespace BigSock {
 		*/
 		public bool AddIFrames(TimeSpan amount) {
 			// Get when the IFrames would expire.
-			var nextCanTakeDamage = DateTime.Now + IFrameDuration;
+			var nextCanTakeDamage = DateTime.Now + amount;
 
 			// Only if that's later than current.
 			if(nextCanTakeDamage > NextTimeCanTakeDamage) {
diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs
index cfb1e8f6..e17bf5c1 100644
--- a/MrBigsock/Assets/Code/PlayerController.cs
+++ b/MrBigsock/Assets/Code/PlayerController.cs
@@ -63,6 +63,7 @@ namespace BigSock {
 
 		public PlayerController()
 		{
+			IFrameDuration = new TimeSpan(0, 0, 0, 0, 250);
 			//TryPickUpItem(ItemService.SINGLETON.Get(201));
 			//TryPickUpItem(ItemService.SINGLETON.Get(105));
 			//TryPickUpItem(ItemService.SINGLETON.Get(202));
-- 
GitLab