Skip to content
Snippets Groups Projects
Commit 80b95725 authored by Bill Clinton's avatar Bill Clinton
Browse files

Merge branch 'refactor/enemy-pet-take-damage-mech' into 'main'

Refactor Enemy Pet Taking Damage Mechanism

See merge request !26
parents ca90edde 2c5d7c48
1 merge request!26Refactor Enemy Pet Taking Damage Mechanism
......@@ -20,8 +20,6 @@ namespace Nightmare
CapsuleCollider capsuleCollider;
EnemyMovement enemyMovement;
bool isPet;
// Orbs
public GameObject increaseDamageOrbPrefab; // Increase Damage Orb
public GameObject restoreHealthOrbPrefab; // Restore Health Orb
......@@ -29,8 +27,6 @@ namespace Nightmare
void Awake ()
{
isPet = GetComponent<EnemyPetMovement>() != null;
if (isPet) { Debug.Log("Dogs");}
anim = GetComponent <Animator> ();
enemyAudio = GetComponent <AudioSource> ();
hitParticles = GetComponentInChildren <ParticleSystem> ();
......@@ -65,11 +61,6 @@ namespace Nightmare
{
if (IsDead())
{
if (isPet)
{
// TODO: Set rigidbody to kinematic and sink instead of vanish immediately
Destroy(gameObject);
};
transform.Translate (-Vector3.up * sinkSpeed * Time.deltaTime);
if (transform.position.y < -10f)
{
......@@ -85,12 +76,10 @@ namespace Nightmare
public void TakeDamage (int amount, Vector3 hitPoint)
{
if (isPet) Debug.Log("kaing");
if (!IsDead())
{
if (!isPet) enemyAudio.Play();
// if (!isPet) enemyAudio.Play();
currentHealth -= amount;
if (isPet) Debug.Log("Dog health : " + currentHealth );
if (currentHealth <= 0)
{
......
......@@ -40,11 +40,13 @@ namespace Nightmare
{
if (IsDead())
{
transform.Translate (-Vector3.up * sinkSpeed * Time.deltaTime);
if (transform.position.y < -10f)
{
Destroy(gameObject);
}
// TODO: Set rigidbody to kinematic and sink instead of vanish immediately
Destroy(gameObject);
// transform.Translate (-Vector3.up * sinkSpeed * Time.deltaTime);
// if (transform.position.y < -1f)
// {
// Destroy(gameObject);
// }
}
}
......@@ -55,7 +57,7 @@ namespace Nightmare
public void TakeDamage (int amount, Vector3 hitPoint)
{
Debug.Log("Enemy Pet: " + currentHealth);
if (!IsDead())
{
// enemyAudio.Play();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment