Compare commits
No commits in common. "e6ba08e34a601f141c6fc587384c57a4e579c688" and "4566ef6684dcf66c0d96132b8297f93ba95cc61f" have entirely different histories.
e6ba08e34a
...
4566ef6684
|
@ -1,7 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class EnemyAnimationHandler : MonoBehaviour
|
||||
{
|
||||
|
@ -16,9 +15,6 @@ public class EnemyAnimationHandler : MonoBehaviour
|
|||
}
|
||||
void EnemyDie()
|
||||
{
|
||||
GetComponent<Collider2D>().enabled = false;
|
||||
GetComponent<NavMeshAgent>().enabled = false;
|
||||
|
||||
StartCoroutine(AnimationDie());
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ public class EnemyPathFinding : MonoBehaviour
|
|||
Vector2 dir = closestTarget.position - transform.position;
|
||||
if (Physics2D.Raycast(transform.position, dir.normalized, ropeDistCheck, ropeCheckMask)) return;
|
||||
|
||||
|
||||
agent.SetDestination(closestTarget.position);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ using UnityUtils;
|
|||
|
||||
public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
|
||||
{
|
||||
[SerializeField] private bool onlyCallZeroHealthOnce = true;
|
||||
[SerializeField] float maxHealth = 100;
|
||||
|
||||
[SerializeField] float damageTickDelay = 0.25f;
|
||||
|
@ -27,8 +26,6 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
|
|||
[SerializeField]
|
||||
float squezeDamageScalor = 1f;
|
||||
|
||||
bool alreadyReachedZero = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
currentHealth = maxHealth;
|
||||
|
@ -65,19 +62,12 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver
|
|||
accumulatedDamageInTick += damage;
|
||||
|
||||
if (currentHealth <= 0) {
|
||||
if (alreadyReachedZero && onlyCallZeroHealthOnce) return;
|
||||
|
||||
alreadyReachedZero = true;
|
||||
// Make sure to flush accumulated when dying
|
||||
if (accumulatedDamageInTick > 1f)
|
||||
OnHealthChangeAtPos?.Invoke(transform.position.Add(y: 2f), accumulatedDamageInTick);
|
||||
|
||||
OnHealthZero?.Invoke();
|
||||
|
||||
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);
|
||||
BloodComputeShader.Instance.createBlood(transform.position, (int)(maxHealth *maxHealth * BloodComputeShader.Instance.scoreMult), maxHealth / 8.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue