Damage change, fog fix, Poisone effect postproces. triggers, scripts for posion zone modyfication

This commit is contained in:
szczuras4
2025-06-04 19:01:43 +02:00
parent 9e5e321d34
commit d76bfea09c
9 changed files with 1196 additions and 1122 deletions

View File

@@ -38,7 +38,7 @@ public class PoisonZone : MonoBehaviour
private Player currentPlayerInZone;
private float timeSinceLastDamage = 0f;
private float timeSinceLastCough = 0f;
private bool playerCurrentlyInZone = false; // Ta flaga jest kluczowa dla logiki ponownego wejœcia
private bool playerCurrentlyInZone = false;
private float currentLoopProgress = 0f;
private float currentFadeProgress = 0f;
@@ -108,7 +108,7 @@ public class PoisonZone : MonoBehaviour
}
}
if (playerCurrentlyInZone && currentPlayerInZone != null) // Upewnij siê, ¿e currentPlayerInZone nie jest null
if (playerCurrentlyInZone && currentPlayerInZone != null)
{
timeSinceLastDamage += Time.deltaTime;
if (timeSinceLastDamage >= damageInterval)
@@ -134,26 +134,22 @@ public class PoisonZone : MonoBehaviour
Player enteredPlayer = other.GetComponent<Player>();
if (enteredPlayer != null)
{
// Ta logika powinna poprawnie obs³ugiwaæ ponowne wejœcie tego samego gracza
// oraz wejœcie nowego gracza.
if (currentPlayerInZone != enteredPlayer || !playerCurrentlyInZone)
{
// Jeœli to faktycznie nowy gracz LUB ten sam gracz, ale nie by³ 'aktywny' (playerCurrentlyInZone by³o false)
if (currentPlayerInZone != enteredPlayer)
{
currentPlayerInZone = enteredPlayer; // Zaktualizuj referencjê tylko jeœli to inny gracz
currentPlayerInZone = enteredPlayer;
}
playerCurrentlyInZone = true; // Zawsze ustawiaj na true przy "aktywnym" wejœciu
playerCurrentlyInZone = true;
timeSinceLastDamage = 0f;
timeSinceLastCough = 0f;
currentLoopProgress = 0f; // Resetuj pêtlê animacji Volume
currentLoopProgress = 0f;
if (coughSound != null)
{
PlayCoughSound();
}
// Debug.Log($"{enteredPlayer.name} ENTERED/RE-ENTERED zone. playerCurrentlyInZone: {playerCurrentlyInZone}");
}
}
}
@@ -161,12 +157,9 @@ public class PoisonZone : MonoBehaviour
void OnTriggerExit(Collider other)
{
Player exitedPlayer = other.GetComponent<Player>();
// Sprawdzamy, czy to TEN gracz, który by³ aktywnie œledzony w strefie i w³aœnie opuszcza.
if (exitedPlayer != null && exitedPlayer == currentPlayerInZone && playerCurrentlyInZone)
{
playerCurrentlyInZone = false; // Oznacz, ¿e gracz (ten konkretny) ju¿ nie jest aktywnie w strefie
// Debug.Log($"{exitedPlayer.name} EXITED zone. playerCurrentlyInZone: {playerCurrentlyInZone}");
// Nie zerujemy currentPlayerInZone, aby OnTriggerEnter mog³o poprawnie wykryæ powrót tego samego gracza.
playerCurrentlyInZone = false;
}
}
@@ -177,13 +170,13 @@ public class PoisonZone : MonoBehaviour
var healthController = currentPlayerInZone.ThirdPersonController;
if (healthController != null && !healthController.isDead)
{
// Ta linia jest kluczowa dla pomijania animacji hita.
// Zak³ada, ¿e masz zmodyfikowany vDamage.cs (z polem ignoreHitEffects)
// oraz odpowiednie warunki w Player.cs i vHealthController.cs.
// >>> TUTAJ ZMIANA <<<
// U¿ywamy konstruktora vDamage(int damageAmount, bool ignoreReactionAndAllEffects)
// Przekazujemy 'true', aby zasygnalizowaæ, ¿e chcemy pomin¹æ wszystkie efekty trafienia.
vDamage damageInstance = new vDamage(damageAmount, true);
// Jeœli vDamage(int, bool) nie istnieje, a vDamage.cs jest zmodyfikowane:
// vDamage damageInstance = new vDamage(damageAmount);
// damageInstance.ignoreHitEffects = true;
// Opcjonalnie: ustaw typ obra¿eñ dla dodatkowej logiki lub debugowania
damageInstance.damageType = "Poison";
healthController.TakeDamage(damageInstance);
}