Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 5 additions & 13 deletions Assets/Scripts/Map Control/RoomSystem/Altar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class Altar : InteractableObject
private bool isPlayerNearby = false;
public GameObject interactionCanvas;

private PlayerHealth healthManager;

void Start()
{

Expand All @@ -26,19 +28,9 @@ void Update()

public override void Interact(Player player)
{
if (availableItems.Count > 0)
{

string item = availableItems[0];
player.AddItemToInventory(item); // Ajouter l'objet à l'inventaire du joueur
playerReceivedItems.Add(item); // Ajouter à la liste des objets reçus
availableItems.RemoveAt(0); // Retirer l'objet de la liste des objets disponibles
Debug.Log("L'autel vous a donné : " + item);
}
else
{
Debug.Log("L'autel n'a plus rien à vous offrir.");
}
healthManager = FindObjectOfType<PlayerHealth>();
healthManager.Heal(1);
Destroy(transform.parent.gameObject);
}

private void OnTriggerEnter2D(Collider2D collision)
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Player/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ async void Start()

try
{
LoadEnvVariables();
var socketUrl = Environment.GetEnvironmentVariable("SOCKET_URL");

var socketUrl = "https://api.godbless.loule.me/";
var uri = new Uri(socketUrl);
clientSocket = SocketManager.Instance.ClientSocket;
if (clientSocket == null)
Expand All @@ -98,7 +98,7 @@ async void Start()
}
try
{
env.TryParseEnvironmentVariable("SOCKET_URL", out string socketUrl);
var socketUrl = "https://api.godbless.loule.me/";
var uri = new Uri(socketUrl);
clientSocket = SocketManager.Instance.ClientSocket;

Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/SocketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ private void LoadEnvVariables()
private async Task SetupSocket()
{

LoadEnvVariables();
// LoadEnvVariables();

try
{
var socketUrl = Environment.GetEnvironmentVariable("SOCKET_URL");
var socketUrl = "https://api.godbless.loule.me/";
var uri = new Uri(socketUrl);
ClientSocket = new SocketIOUnity(uri);

Expand All @@ -75,7 +75,7 @@ private async Task SetupSocket()

try
{
env.TryParseEnvironmentVariable("SOCKET_URL", out string socketUrl);
var socketUrl = "https://api.godbless.loule.me/";
var uri = new Uri(socketUrl);
ClientSocket = new SocketIOUnity(uri);

Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/UI/PlayerHealth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class PlayerHealth : MonoBehaviour
{
public int maxHealth = 5; // Points de vie maximum
public static int maxHealth = 5; // Points de vie maximum
private int currentHealth;

public GameObject heartPrefab;
Expand Down Expand Up @@ -48,7 +48,9 @@ public void Heal(int amount)
currentHealth += amount;
if (currentHealth > maxHealth)
{
if (maxHealth == 7){
currentHealth = maxHealth;
} else maxHealth +=1;
}
UpdateHealthBar();
}
Expand Down