void ShowAttackIndicator() { Vector3 tempOffset = TPOffsetObj.transform.position; tempOffset.y -= 0.5f; if (AttackIndicator != null) { AttackIndicator.ShowText(tempOffset, "!"); } }
public void TakeDamage(float damage, bool unBlockable = false) { if (isAlive) { if (currentHealth > 0) { if (animator.GetBool("isRolling")) //damage dodged { damage = 0; //xpPopups.ShowDodge(transform.position); //xpPopups uses a static animation instead of the number animation } if (!unBlockable) { if (IsShieldBashing) { damage = 0; xpPopups.ShowText(transform.position, "Blocked"); } } currentHealth -= (damage); healthBar.SetHealth(currentHealth); if (damage > 0) { Vector3 tempPos = transform.position; tempPos += TPOffset; //damage pop up TextPopupsHandler.ShowDamage(damage, tempPos); if (animator.GetBool("isAttacking") == false) { animator.SetTrigger("Hurt"); } FlashMaterial(); //GetKnockback(true); // Invoke("ResetMaterial", .1f); } } //hurt animation if (currentHealth <= 0) { Die(); } } }
void ShowAttackIndicator() //TODO: fix reference { if (AttackIndicator != null) { Vector3 tempPos = transform.position; tempPos.y += 0.2f; AttackIndicator.ShowText(tempPos, "!"); } }
void LevelUp(float overflowXP = 0) { currentPlayerLevel++; slider.value = overflowXP; //reset progress and add overflowXP if xp exceeded level up slider.maxValue = (currentPlayerLevel * 100) * 1.25f; //XP requirement if (displayPlayerLevel != null) //update level { displayPlayerLevel.text = currentPlayerLevel.ToString(); } playerCombat.maxHealth += ((currentPlayerLevel - 1) * 10f); //health +10/level healthBar.SetMaxHealth(playerCombat.maxHealth); playerCombat.HealPlayer(healthBar.maxHealth); playerCombat.wepDamage += ((currentPlayerLevel - 1) * 2); //damage +2/level xpPopups.ShowText(player.position, "\nLEVEL UP"); }