void Start() { hideAgent = GetComponent <HideAgent>(); followAgent = GetComponent <FollowAgent>(); GetState(); coreDamage = transform.Find("NewMechWithSlots").Find("CoreHitbox").GetComponent <MechTakeDamage>(); maxHP = coreDamage.health; defenseHP = maxHP / 2; }
public void dmgRight(int dmg, MechTakeDamage hitbox) { rightHealth -= dmg; if (rightHealth < 0) { rightHealth = 0; hitbox.Exploding(); } if (isPlayer) { healthbars[3].setHealthBar((float)rightHealth / (float)maxHealth); } }
public void dmgRear(int dmg, MechTakeDamage hitbox) { Debug.Log("Rear takes damage"); rearHealth -= dmg; if (rearHealth < 0) { rearHealth = 0; hitbox.Exploding(); } if (isPlayer) { healthbars[4].setHealthBar((float)rearHealth / (float)maxHealth); } }
public void dmgLeft(int dmg, MechTakeDamage hitbox) { Debug.Log("Left takes damage"); leftHealth -= dmg; if (leftHealth < 0) { leftHealth = 0; hitbox.Exploding(); } if (isPlayer) { healthbars[2].setHealthBar((float)leftHealth / (float)maxHealth); } }
public void dmgFront(int dmg, MechTakeDamage hitbox) { Debug.Log("Front takes damage"); frontHealth -= dmg; if (frontHealth < 0) { frontHealth = 0; //eSync.Explode("FrontHitbox", MechTakeDamage.Hitbox.FrontHitbox); hitbox.ExplodingFront(); } if (isPlayer) { healthbars[1].setHealthBar((float)frontHealth / (float)maxHealth); } }
public bool dmgCore(int dmg, MechTakeDamage hitbox) { Debug.Log("Core takes " + dmg + " damage"); coreHealth -= dmg; if (coreHealth < 0) { coreHealth = 0; //eSync.Explode("CoreHitbox", MechTakeDamage.Hitbox.CoreHitbox); hitbox.ExplodingCore(); status.Destroyed = true; } coreDestroyed = (coreHealth == 0); if (isPlayer) { healthbars[0].setHealthBar((float)coreHealth / (float)maxHealth); } return(coreDestroyed); }
public void RpcHitboxTakeDamage(int dmgAmount, string hbName) { Transform hitbox = GetHitBox(gameObject, hbName); MechTakeDamage m = hitbox.GetComponent <MechTakeDamage>(); if (gameObject == null) { return; } if (invincible) { return; } if (m.Invincible) { return; } if (hbName == "FrontHitbox") { pHealth.dmgFront(dmgAmount, m); } else if (hbName == "LeftHitbox") { pHealth.dmgLeft(dmgAmount, m); } else if (hbName == "RightHitbox") { Debug.Log("Right takes damage"); pHealth.dmgRight(dmgAmount, m); } else if (hbName == "CoreHitbox") { Debug.Log("Core takes " + dmgAmount + " damage"); pHealth.dmgCore(dmgAmount, m); GameObject flames = Instantiate(flameEffect, hitbox.transform.position, Quaternion.identity, hitbox.transform); flames.transform.localScale += new Vector3(1f, 1f, 1f); } else if (hbName == "RearHitbox") { Debug.Log("Rear takes damage"); pHealth.dmgRear(dmgAmount, m); } }