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

@@ -81998,6 +81998,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -82013,6 +82014,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -82028,6 +82030,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 9202663234700498133}
@@ -104885,6 +104888,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -104900,6 +104904,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -104915,6 +104920,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 3157817243778252271}
@@ -105773,6 +105779,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
hitProperties:
hitDamageTags:
- Enemy
@@ -118353,6 +118360,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -118368,6 +118376,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -118383,6 +118392,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 3157817242016584094}
@@ -135308,6 +135318,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -135323,6 +135334,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -135338,6 +135350,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 3157817244105814045}
@@ -135484,6 +135497,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
layerToCollide:
serializedVersion: 2

View File

@@ -854,6 +854,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -869,6 +870,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -884,6 +886,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 4367795707781829252}
@@ -3615,6 +3618,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -3630,6 +3634,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -3645,6 +3650,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 4367795705692615431}
@@ -6820,6 +6826,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -6835,6 +6842,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -6850,6 +6858,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 4367795706479253541}
@@ -8693,6 +8702,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
minDamage:
damageValue: 15
staminaBlockCost: 5
@@ -8708,6 +8718,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
maxDamage:
damageValue: 15
staminaBlockCost: 5
@@ -8723,6 +8734,7 @@ MonoBehaviour:
reaction_id: 0
damageType:
force: {x: 0, y: 0, z: 0}
ignoreAllHitEffects: 0
overrideDamageSender: {fileID: 0}
hitBoxes:
- {fileID: 4367795706020118261}

File diff suppressed because it is too large Load Diff

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);
}

View File

@@ -9,7 +9,14 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Poison_foot
m_Shader: {fileID: 4800000, guid: 4775e5a8f344d6348adf934e722da85d, type: 3}
m_ValidKeywords: []
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- BlendAlpha
- Clip_OFF
- FrameBlend_OFF
- FresnelFade_OFF
- VertLight_OFF
m_InvalidKeywords:
- SoftParticles_OFF
m_LightmapFlags: 1
@@ -18,6 +25,7 @@ Material:
m_CustomRenderQueue: 2450
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@@ -86,3 +94,4 @@ Material:
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 0.135141, g: 1.7207954, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -9,6 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Poison_splash
m_Shader: {fileID: 4800000, guid: 4775e5a8f344d6348adf934e722da85d, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- BlendAlpha
- Clip_OFF
@@ -25,6 +27,7 @@ Material:
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@@ -127,3 +130,4 @@ Material:
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _TintColor: {r: 0.16041078, g: 1.319508, b: 0, a: 0.5}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -1,75 +1,69 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Events; // Nadal potrzebne dla UnityEvent ogólnego użytku
namespace Invector
{
// Prawdopodobnie te typy są zdefiniowane gdzieś globalnie w namespace Invector
// lub w plikach interfejsów. Jeśli nie, trzeba by je tu zdefiniować,
// ale zakładam, że kompilator je znajdzie, skoro vDamageReceiver ich używa.
// [System.Serializable] public class OnReceiveDamage : UnityEvent<vDamage> { } // Jeśli potrzebna definicja
// [System.Serializable] public class OnDead : UnityEvent<GameObject> { } // Jeśli potrzebna definicja
[vClassHeader("HealthController", iconName = "HealthControllerIcon")]
public class vHealthController : vMonoBehaviour, vIHealthController
public class vHealthController : vMonoBehaviour, vIHealthController // Upewnij się, że to jest poprawny interfejs
{
#region Variables
[vEditorToolbar("Health", order = 0)]
[SerializeField] [vReadOnly] protected bool _isDead;
[vBarDisplay("maxHealth")] [SerializeField] protected float _currentHealth;
[SerializeField][vReadOnly] protected bool _isDead;
[vBarDisplay("maxHealth")][SerializeField] protected float _currentHealth;
public bool isImmortal = false;
[vHelpBox("If you want to start with different value, uncheck this and make sure that the current health has a value greater zero")]
public bool fillHealthOnStart = true;
public int maxHealth = 100;
public int MaxHealth
{
get
{
return maxHealth;
}
protected set
{
maxHealth = value;
}
get { return maxHealth; }
protected set { maxHealth = value; }
}
public float currentHealth
{
get
{
return _currentHealth;
}
get { return _currentHealth; }
protected set
{
if (_currentHealth != value)
{
_currentHealth = value;
onChangeHealth.Invoke(_currentHealth);
}
if (!_isDead && _currentHealth <= 0)
{
//_isDead = true;
isDead = true;
onDead.Invoke(gameObject);
}
else if (isDead && _currentHealth > 0)
{
isDead = false;
if (onChangeHealth != null) onChangeHealth.Invoke(_currentHealth);
}
if (!_isDead && _currentHealth <= 0) { isDead = true; }
else if (isDead && _currentHealth > 0) { isDead = false; }
}
}
public virtual bool isDead
{
get
{
if (!_isDead && currentHealth <= 0)
if (!_isDead && _currentHealth <= 0)
{
_isDead = true;
onDead.Invoke(gameObject);
if (_onDead != null) _onDead.Invoke(gameObject);
}
return _isDead;
}
set
{
_isDead = value;
if (_isDead != value)
{
_isDead = value;
if (_isDead)
{
if (_onDead != null) _onDead.Invoke(gameObject);
}
}
}
}
public float healthRecovery = 0f;
@@ -78,38 +72,46 @@ namespace Invector
public float currentHealthRecoveryDelay;
[vEditorToolbar("Events", order = 100)]
public List<CheckHealthEvent> checkHealthEvents = new List<CheckHealthEvent>();
// Używamy typów zdarzeń zdefiniowanych przez Invector (OnReceiveDamage, OnDead)
[SerializeField] protected OnReceiveDamage _onStartReceiveDamage = new OnReceiveDamage();
[SerializeField] protected OnReceiveDamage _onReceiveDamage = new OnReceiveDamage();
[SerializeField] protected OnDead _onDead = new OnDead();
public ValueChangedEvent onChangeHealth;
[SerializeField] protected OnDead _onDead = new OnDead(); // Zakładając, że typ OnDead istnieje
[System.Serializable]
public class ValueChangedEvent : UnityEvent<float> { }
public ValueChangedEvent onChangeHealth = new ValueChangedEvent();
public UnityEvent onResetHealth = new UnityEvent(); // Standardowy UnityEvent
public OnReceiveDamage onStartReceiveDamage { get { return _onStartReceiveDamage; } protected set { _onStartReceiveDamage = value; } }
public OnReceiveDamage onReceiveDamage { get { return _onReceiveDamage; } protected set { _onReceiveDamage = value; } }
public OnDead onDead { get { return _onDead; } protected set { _onDead = value; } }
public UnityEvent onResetHealth;
internal bool inHealthRecovery;
// Właściwości implementujące interfejs, używając typów Invectora
public OnReceiveDamage onStartReceiveDamage { get { return _onStartReceiveDamage; } } // Usunięto 'protected set' aby pasowało do get-only interfejsu
public OnReceiveDamage onReceiveDamage { get { return _onReceiveDamage; } } // Usunięto 'protected set'
public OnDead onDead { get { return _onDead; } } // Usunięto 'protected set'
#endregion
protected virtual void Start()
{
if (fillHealthOnStart)
currentHealth = maxHealth;
if (fillHealthOnStart) currentHealth = maxHealth;
currentHealthRecoveryDelay = healthRecoveryDelay;
}
protected virtual bool canRecoverHealth
{
get
{
return (currentHealth >= 0 && healthRecovery > 0 && currentHealth < maxHealth);
}
get { return (_currentHealth >= 0 && healthRecovery > 0 && _currentHealth < maxHealth && !_isDead); }
}
protected virtual IEnumerator RecoverHealth()
{
inHealthRecovery = true;
while (canRecoverHealth && !isDead)
while (currentHealthRecoveryDelay > 0 && !_isDead)
{
currentHealthRecoveryDelay -= Time.deltaTime;
yield return null;
}
while (canRecoverHealth)
{
HealthRecovery();
yield return null;
@@ -119,149 +121,122 @@ namespace Invector
protected virtual void HealthRecovery()
{
if (!canRecoverHealth||isDead) return;
if (currentHealthRecoveryDelay > 0)
currentHealthRecoveryDelay -= Time.deltaTime;
else
if (!canRecoverHealth) return;
if (_currentHealth < maxHealth)
{
if (currentHealth > maxHealth)
currentHealth = maxHealth;
if (currentHealth < maxHealth)
currentHealth += healthRecovery * Time.deltaTime;
_currentHealth += healthRecovery * Time.deltaTime;
_currentHealth = Mathf.Min(_currentHealth, maxHealth);
if (onChangeHealth != null) onChangeHealth.Invoke(_currentHealth);
}
}
/// <summary>
/// Increase or decrease currentHealth (Positive or Negative Values)
/// </summary>
/// <param name="value">Value to change</param>
public virtual void AddHealth(int value)
{
currentHealth += value;
currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth);
if (!isDead && currentHealth <= 0)
{
isDead = true;
onDead.Invoke(gameObject);
}
HandleCheckHealthEvents();
}
/// <summary>
/// Change the currentHealth of Character
/// </summary>
/// <param name="value"></param>
public virtual void ChangeHealth(int value)
{
currentHealth = value;
currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth);
if (!isDead && currentHealth <= 0)
{
isDead = true;
onDead.Invoke(gameObject);
}
HandleCheckHealthEvents();
}
/// <summary>
/// Reset's current health to specific health value
/// </summary>
/// <param name="health">target health</param>
public virtual void AddHealth(int value) { currentHealth += value; }
public virtual void ChangeHealth(int value) { currentHealth = value; }
public virtual void ResetHealth(float health)
{
currentHealth = health;
onResetHealth.Invoke();
if (isDead) isDead = false;
currentHealth = Mathf.Clamp(health, 0, maxHealth);
if (onResetHealth != null) onResetHealth.Invoke();
if (_isDead && _currentHealth > 0) isDead = false;
}
/// <summary>
/// Reset's current health to max health
/// </summary>
public virtual void ResetHealth()
{
currentHealth = maxHealth;
onResetHealth.Invoke();
if (isDead) isDead = false;
if (onResetHealth != null) onResetHealth.Invoke();
if (_isDead) isDead = false;
}
/// <summary>
/// Change the MaxHealth of Character
/// </summary>
/// <param name="value"></param>
public virtual void ChangeMaxHealth(int value)
{
maxHealth += value;
if (maxHealth < 0)
maxHealth = 0;
if (maxHealth < 0) maxHealth = 0;
if (_currentHealth > maxHealth) currentHealth = maxHealth;
}
/// <summary>
/// Set a value to HealthRecovery to start recovering health
/// </summary>
/// <param name="value"></param>
public virtual void SetHealthRecovery(float value)
{
healthRecovery = value;
StartCoroutine(RecoverHealth());
if (!inHealthRecovery && canRecoverHealth && gameObject.activeInHierarchy)
{
StartCoroutine(RecoverHealth());
}
}
/// <summary>
/// Apply Damage to Current Health
/// </summary>
/// <param name="damage">damage</param>
public virtual void TakeDamage(vDamage damage)
{
if (damage != null)
{
onStartReceiveDamage.Invoke(damage);
currentHealthRecoveryDelay = currentHealth <= 0 ? 0 : healthRecoveryDelay;
if (damage != null && !_isDead)
{
if (inHealthRecovery)
{
StopCoroutine(RecoverHealth());
inHealthRecovery = false;
}
currentHealthRecoveryDelay = healthRecoveryDelay;
if (currentHealth > 0 && !isImmortal)
{
currentHealth -= damage.damageValue;
// Użyj flagi ignoreAllHitEffects zdefiniowanej w Twoim zmodyfikowanym vDamage.cs
if (_onStartReceiveDamage != null && !damage.ignoreAllHitEffects)
{
_onStartReceiveDamage.Invoke(damage);
}
if (_currentHealth > 0 && !isImmortal)
{
_currentHealth -= damage.damageValue;
if (onChangeHealth != null) onChangeHealth.Invoke(_currentHealth);
}
// Użyj flagi ignoreAllHitEffects zdefiniowanej w Twoim zmodyfikowanym vDamage.cs
if (damage.damageValue > 0 && _onReceiveDamage != null && !damage.ignoreAllHitEffects)
{
_onReceiveDamage.Invoke(damage);
}
if (_currentHealth <= 0 && !_isDead)
{
isDead = true;
}
if (damage.damageValue > 0)
onReceiveDamage.Invoke(damage);
HandleCheckHealthEvents();
if (!_isDead && healthRecovery > 0 && !inHealthRecovery && gameObject.activeInHierarchy)
{
StartCoroutine(RecoverHealth());
}
}
}
protected virtual void HandleCheckHealthEvents()
{
var events = checkHealthEvents.FindAll(e => (e.healthCompare == CheckHealthEvent.HealthCompare.Equals && currentHealth.Equals(e.healthToCheck)) ||
(e.healthCompare == CheckHealthEvent.HealthCompare.HigherThan && currentHealth > (e.healthToCheck)) ||
(e.healthCompare == CheckHealthEvent.HealthCompare.LessThan && currentHealth < (e.healthToCheck)));
for (int i = 0; i < events.Count; i++)
if (checkHealthEvents == null) return;
for (int i = 0; i < checkHealthEvents.Count; i++)
{
events[i].OnCheckHealth.Invoke();
var e = checkHealthEvents[i];
if (e == null || e.OnCheckHealth == null) continue;
bool conditionMet = false;
switch (e.healthCompare)
{
case CheckHealthEvent.HealthCompare.Equals:
conditionMet = Mathf.Approximately(_currentHealth, e.healthToCheck);
break;
case CheckHealthEvent.HealthCompare.HigherThan:
conditionMet = _currentHealth > e.healthToCheck;
break;
case CheckHealthEvent.HealthCompare.LessThan:
conditionMet = _currentHealth < e.healthToCheck;
break;
}
if (conditionMet)
{
e.OnCheckHealth.Invoke();
}
}
if (currentHealth < maxHealth && this.gameObject.activeInHierarchy && !inHealthRecovery)
StartCoroutine(RecoverHealth());
}
[System.Serializable]
public class CheckHealthEvent
{
public int healthToCheck;
public float healthToCheck;
public bool disableEventOnCheck;
public enum HealthCompare
{
Equals,
HigherThan,
LessThan
}
public enum HealthCompare { Equals, HigherThan, LessThan }
public HealthCompare healthCompare = HealthCompare.Equals;
public UnityEngine.Events.UnityEvent OnCheckHealth;
}
[System.Serializable]
public class ValueChangedEvent : UnityEvent<float>
{
public UnityEvent OnCheckHealth = new UnityEvent();
}
}
}
}

View File

@@ -1,4 +1,5 @@
using UnityEngine;
namespace Invector
{
[System.Serializable]
@@ -14,7 +15,7 @@ namespace Invector
public bool ignoreDefense;
[Tooltip("Activated Ragdoll when hit the Character")]
public bool activeRagdoll;
[vHideInInspector("activeRagdoll"),Tooltip("Time to keep Ragdoll active")]
[vHideInInspector("activeRagdoll"), Tooltip("Time to keep Ragdoll active")]
public float senselessTime;
[HideInInspector]
public Transform sender;
@@ -22,7 +23,7 @@ namespace Invector
public Transform receiver;
[HideInInspector]
public Vector3 hitPosition;
public bool hitReaction = true;
public bool hitReaction = true; // To pole Invectora pozostaje
[HideInInspector]
public int recoil_id = 0;
[HideInInspector]
@@ -30,32 +31,65 @@ namespace Invector
public string damageType;
[HideInInspector] public Vector3 force;
// >>> NASZE NOWE POLE <<<
[Tooltip("If true, will attempt to bypass standard hit reaction animations, sounds, and events like OnReceiveDamage.")]
public bool ignoreAllHitEffects = false;
public vDamage()
{
this.damageValue = 15;
this.staminaBlockCost = 5;
this.staminaRecoveryDelay = 1;
this.hitReaction = true;
this.ignoreAllHitEffects = false; // Domyślnie efekty są włączone
}
public vDamage(int value)
{
this.damageValue = value;
this.hitReaction = true;
this.ignoreAllHitEffects = false; // Domyślnie efekty są włączone
}
public vDamage(int value, bool ignoreReaction)
// Ten konstruktor już istniał, zmodyfikujemy go lekko
// lub dodamy nowy, jeśli chcemy zachować stary w niezmienionej formie.
// Dla uproszczenia, zmodyfikujmy ten, aby przyjmował naszą nową flagę.
// Jeśli `ignoreReactionOrEffects` jest true, ustawiamy obie flagi.
public vDamage(int value, bool ignoreReactionAndAllEffects)
{
this.damageValue = value;
this.hitReaction = !ignoreReaction;
if (ignoreReaction)
this.ignoreAllHitEffects = ignoreReactionAndAllEffects; // Ustawiamy naszą nową flagę
if (ignoreReactionAndAllEffects)
{
this.hitReaction = false; // Jeśli ignorujemy wszystkie efekty, to reakcję też
this.recoil_id = -1;
this.reaction_id = -1;
}
else
{
this.hitReaction = true; // W przeciwnym razie standardowa reakcja
}
}
// Możesz też dodać bardziej specyficzny konstruktor tylko dla naszej flagi,
// jeśli chcesz mieć większą kontrolę:
/*
public vDamage(int value, bool setHitReaction, bool setIgnoreAllHitEffects)
{
this.damageValue = value;
this.hitReaction = setHitReaction;
this.ignoreAllHitEffects = setIgnoreAllHitEffects;
if (!setHitReaction) // Jeśli hitReaction jest false
{
this.recoil_id = -1;
this.reaction_id = -1;
}
}
}
*/
public vDamage(vDamage damage)
public vDamage(vDamage damage) // Konstruktor kopiujący
{
this.damageValue = damage.damageValue;
this.staminaBlockCost = damage.staminaBlockCost;
@@ -70,6 +104,9 @@ namespace Invector
this.hitPosition = damage.hitPosition;
this.senselessTime = damage.senselessTime;
this.force = damage.force;
this.hitReaction = damage.hitReaction; // Skopiuj oryginalne pole hitReaction
// >>> SKOPIUJ NASZE NOWE POLE <<<
this.ignoreAllHitEffects = damage.ignoreAllHitEffects;
}
/// <summary>

View File

@@ -845,7 +845,7 @@ PlayerSettings:
webWasm2023: 0
scriptingDefineSymbols:
: UNITY_POST_PROCESSING_STACK_V2
Android: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;USE_TIMELINE;USE_NEW_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;TMP_PRESENT;ENEMIES_DISABLED
Android: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;USE_TIMELINE;USE_NEW_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;TMP_PRESENT
CloudRendering: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
GameCoreScarlett: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
@@ -857,12 +857,12 @@ PlayerSettings:
QNX: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
ReservedCFE: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
Stadia: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
Standalone: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;TOUCH_REACT;GAIA_2_PRESENT;INVECTOR_AI_TEMPLATE;UPPipeline;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED
Standalone: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;TOUCH_REACT;GAIA_2_PRESENT;INVECTOR_AI_TEMPLATE;UPPipeline;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3
VisionOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
WebGL: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
XboxOne: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
iPhone: CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;GAIA_2_PRESENT;GAIA_PRO_PRESENT;UPPipeline;UNITY_POST_PROCESSING_STACK_V2;TOUCH_REACT;INVECTOR_AI_TEMPLATE;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_INVECTOR_INVENTORY;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED
iPhone: CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;GAIA_2_PRESENT;GAIA_PRO_PRESENT;UPPipeline;UNITY_POST_PROCESSING_STACK_V2;TOUCH_REACT;INVECTOR_AI_TEMPLATE;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_INVECTOR_INVENTORY;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3
tvOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
additionalCompilerArguments: {}
platformArchitecture: {}