Exemplo n.º 1
0
 private void ApplySwordDamage()                                                                    //Invoked as Animation Event
 {
     if (MathHelper.CalculateDistance(transform.position, _player.transform.position) <= 2.5 * 2.5) //TODO try to refactor this
     {
         _playerHealth.TakeDamage(damage, null);
     }
 }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("AttackMouse0"))
        {
            enemyHealthBarScript.Damaged();
        }

        if (other.CompareTag("Player"))
        {
            playerHealth.TakeDamage();
        }
    }
Exemplo n.º 3
0
    void Attack()
    {
        // Reset the timer.
        timer = 0f;

        // If the player has health to lose...
        if (playerHealth.currentHealth > 0)
        {
            // ... damage the player.
            playerHealth.TakeDamage(attackdmg);
        }
    }
Exemplo n.º 4
0
    void OnTriggerEnter(Collider other)
    {
        //			// If the entering collider is the player...
        if (other.gameObject == GameObject.FindGameObjectWithTag("Player"))
        {
            if (playerHealth.currentHealth > 0)
            {
                // ... damage the player.
                playerHealth.TakeDamage(attackdmg);
            }

            // ... the player is in range.
//				playerInRange = true;
        }
    }
Exemplo n.º 5
0
    public void DamageToThePlayer(Templar templarScript)
    {
        playerCaracteristics.playerHealth -= templarScript.templarDamage;

        if (playerCaracteristics.playerHealth > 0)
        {
            animator.SetTrigger("playerIsHit");

            Debug.Log("Damage to the playeeer FUsckjklj !!!!");
            Debug.Log(playerCaracteristics.playerHealth);
            healthPlayerScript.TakeDamage();
        }

        else if (playerCaracteristics.playerHealth <= 0)
        {
            animator.SetTrigger("playerIsDead");
        }
    }