예제 #1
0
 void Update()
 {
     if (zombieInRange)
     {
         hp.TakeDamage(hp.currentHealth);
     }
 }
예제 #2
0
    public void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            playerHealth = collision.gameObject.GetComponent <CompleteProject.PlayerHealth>();
            // If the player has health to lose...

            if (playerHealth.currentHealth > 0)
            {
                // ... damage the player.
                playerHealth.TakeDamage(damage);
            }
        }
    }
예제 #3
0
        void Attack()
        {
            // Reset the timer.
            timer = 0f;

            // If the player has health to lose...
            if (!playerHealth.isDead)
            {
                // ... damage the player.
                playerHealth.TakeDamage(attackDamage);

                // Knock back
                player.transform.position = Vector3.MoveTowards(player.transform.position, transform.position + (transform.forward * 2.0f), 2.0f);
            }
        }
예제 #4
0
        void Attack()
        {
            // Reset the timer.
            timer = 0f;

            // Set the player's animation controller to attack.
            anim.SetBool("Attack", true);

            // If the player has health to lose...
            if (playerHealth.currentHealth > 0)
            {
                // ... damage the player.
                playerHealth.TakeDamage(attackDamage);
            }
        }
        void Attack()
        {
            // Reset the timer.
            timer = 0f;

            // If the player has health to lose...
            if (playerHealth.currentHealth > 0)
            {
                var damageBuff = GameManager.Manager.BuffManager.CreateBuff <Damage>();
                damageBuff.Value = attackDamage;
                damageBuff.Maker = enemyHealth;
                damageBuff.Type  = DamageType;
                playerHealth.TakeDamage(damageBuff);
            }
        }
예제 #6
0
        void Attack()
        {
            // Reset the timer.
            timer = 0f;

            // If the player has health to lose...
            if (playerHealth.currentHealth > 0)
            {
                // ... damage the player.
                playerHealth.TakeDamage(attackDamage);

                arrowLine.enabled = true;
                arrowLine.SetPosition(0, transform.position);
                arrowLine.SetPosition(1, player.transform.position);
            }
        }
예제 #7
0
        void Attack()
        {
            // Reset the timer.
            timer = 0f;

            // If the player has health to lose...
            if (playerHealth.currentHealth > 0)
            {
                playerHealth.TakeDamage(new Damage()
                {
                    Value = attackDamage,
                    Maker = enemyHealth,
                    Type  = DamageType
                });
            }
        }
예제 #8
0
        void Explode()
        {
            Collider[] collidersToDestroy = Physics.OverlapSphere(transform.position, 6, pLayerMask.value);

            foreach (Collider nearbyObject in collidersToDestroy)
            {
                EnemyHealth bodyZomb = nearbyObject.GetComponent <EnemyHealth>();

                if (bodyZomb != null)
                {
                    bodyZomb.TakeDamage(125, transform.position);
                }

                PlayerHealth bodyPlayer = nearbyObject.GetComponent <PlayerHealth>();

                if (bodyPlayer != null && !bodyPlayer.isDead)
                {
                    bodyPlayer.TakeDamage(125);
                }
            }
        }
예제 #9
0
        void OnTriggerEnter(Collider other)
        {
            if (other.tag == "Boundary" || other.tag == "Enemy")
            {
                return;
            }

            if (explosion != null)
            {
                Instantiate(explosion, transform.position, transform.rotation);
            }

            if (other.tag == "Player")
            {
                Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
                playerHealth.TakeDamage(10);
            }

            //gameController.AddScore(scoreValue); //this is here incase everything keeps blowing up.

            Destroy(other.gameObject);
            Destroy(gameObject);
        }
예제 #10
0
 public void TakeDamage(int Damage)
 {
     HP.TakeDamage(Damage);
 }