Skip to content
Snippets Groups Projects
Commit ec33d9f2 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

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.
parent f2d7b183
No related branches found
No related tags found
1 merge request!92Fixed code formatting.
...@@ -545,9 +545,9 @@ namespace BigSock { ...@@ -545,9 +545,9 @@ namespace BigSock {
*/ */
public TimeSpan IFrameDuration { public TimeSpan IFrameDuration {
get => _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 { ...@@ -676,7 +676,7 @@ namespace BigSock {
*/ */
public bool AddIFrames(TimeSpan amount) { public bool AddIFrames(TimeSpan amount) {
// Get when the IFrames would expire. // Get when the IFrames would expire.
var nextCanTakeDamage = DateTime.Now + IFrameDuration; var nextCanTakeDamage = DateTime.Now + amount;
// Only if that's later than current. // Only if that's later than current.
if(nextCanTakeDamage > NextTimeCanTakeDamage) { if(nextCanTakeDamage > NextTimeCanTakeDamage) {
......
...@@ -63,6 +63,7 @@ namespace BigSock { ...@@ -63,6 +63,7 @@ namespace BigSock {
public PlayerController() public PlayerController()
{ {
IFrameDuration = new TimeSpan(0, 0, 0, 0, 250);
//TryPickUpItem(ItemService.SINGLETON.Get(201)); //TryPickUpItem(ItemService.SINGLETON.Get(201));
//TryPickUpItem(ItemService.SINGLETON.Get(105)); //TryPickUpItem(ItemService.SINGLETON.Get(105));
//TryPickUpItem(ItemService.SINGLETON.Get(202)); //TryPickUpItem(ItemService.SINGLETON.Get(202));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment