Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Assets/Scripts/Door.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand All @@ -10,14 +11,24 @@ public class Door : MonoBehaviour

void OnTriggerEnter(Collider other)
{
GameState.Instance.roomCount++;

// Load the Basic L Room scene when this is entered
// FIXME: make this adjustable room type
// Bugfix: made it so only the player can trigger the door.
if (other.tag == "Player")
{
SceneManager.LoadScene(room_name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all this needs to happen before the SceneManager.LoadScene line. I'm not positive, but I think that once it loads the next scene, it'll stop running this program.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know that. When I tested it worked for me, but I will make the adjustment when I can

GameState.Instance.roomCount++;

// Git restore upgrade - restore x% of health when leaving a room
float playerMaxHealth = Level_manager.instance.PlayerMaxHealth;
float restorePercent = 0.01f * Level_manager.instance.gitRestoreUpgradeModifier;
float restoreAmount = playerMaxHealth * restorePercent;

float newHealth = Level_manager.instance.PlayerHealth + restoreAmount;
Level_manager.instance.SetHealth(Math.Min(playerMaxHealth, newHealth));

Debug.Log("Player entered a door");
}
}
}
Expand Down