Compare commits

..

No commits in common. "e6ba08e34a601f141c6fc587384c57a4e579c688" and "4566ef6684dcf66c0d96132b8297f93ba95cc61f" have entirely different histories.

3 changed files with 1 additions and 16 deletions

View File

@ -1,7 +1,6 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.AI;
public class EnemyAnimationHandler : MonoBehaviour public class EnemyAnimationHandler : MonoBehaviour
{ {
@ -16,9 +15,6 @@ public class EnemyAnimationHandler : MonoBehaviour
} }
void EnemyDie() void EnemyDie()
{ {
GetComponent<Collider2D>().enabled = false;
GetComponent<NavMeshAgent>().enabled = false;
StartCoroutine(AnimationDie()); StartCoroutine(AnimationDie());
} }

View File

@ -29,7 +29,6 @@ public class EnemyPathFinding : MonoBehaviour
Vector2 dir = closestTarget.position - transform.position; Vector2 dir = closestTarget.position - transform.position;
if (Physics2D.Raycast(transform.position, dir.normalized, ropeDistCheck, ropeCheckMask)) return; if (Physics2D.Raycast(transform.position, dir.normalized, ropeDistCheck, ropeCheckMask)) return;
agent.SetDestination(closestTarget.position); agent.SetDestination(closestTarget.position);
} }

View File

@ -6,7 +6,6 @@ using UnityUtils;
public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
{ {
[SerializeField] private bool onlyCallZeroHealthOnce = true;
[SerializeField] float maxHealth = 100; [SerializeField] float maxHealth = 100;
[SerializeField] float damageTickDelay = 0.25f; [SerializeField] float damageTickDelay = 0.25f;
@ -27,8 +26,6 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
[SerializeField] [SerializeField]
float squezeDamageScalor = 1f; float squezeDamageScalor = 1f;
bool alreadyReachedZero = false;
void Awake() void Awake()
{ {
currentHealth = maxHealth; currentHealth = maxHealth;
@ -65,19 +62,12 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
accumulatedDamageInTick += damage; accumulatedDamageInTick += damage;
if (currentHealth <= 0) { if (currentHealth <= 0) {
if (alreadyReachedZero && onlyCallZeroHealthOnce) return;
alreadyReachedZero = true;
// Make sure to flush accumulated when dying // Make sure to flush accumulated when dying
if (accumulatedDamageInTick > 1f) if (accumulatedDamageInTick > 1f)
OnHealthChangeAtPos?.Invoke(transform.position.Add(y: 2f), accumulatedDamageInTick); OnHealthChangeAtPos?.Invoke(transform.position.Add(y: 2f), accumulatedDamageInTick);
OnHealthZero?.Invoke(); OnHealthZero?.Invoke();
BloodComputeShader.Instance.createBlood(transform.position, (int)(maxHealth *maxHealth * BloodComputeShader.Instance.scoreMult), maxHealth / 8.0f);
int blood = (int)(maxHealth * 100.0f * BloodComputeShader.Instance.scoreMult);
BloodComputeShader.Instance.createBlood(transform.position, blood/2, maxHealth / 8.0f);
BloodComputeShader.Instance.createBlood(transform.position, blood / 2, maxHealth / 8.0f);
} }
} }