Beispiel #1
0
    public void TakeDamage(int damage)
    {
        Health -= damage;
        Debug.Log("Health for " + this.transform.name + " is " + Health);

        HitCircle.color = Color.red;
        DelayHelper.DelayAction(this, swapToWhite, .7f);
        bool deathnoise = false;

        if (Health <= 0)
        {
            if (deathnoise == false)
            {
                EnemyAudio.clip = AudioExploding;
                EnemyAudio.Play();
                deathnoise = true;
                Exploder.Play();
                PLC.UpdateHealth(1);
            }

            DisableObject();
            Debug.Log(this.transform.name + " is " + "dead");
            LV.IncreaseScore(5);
            if (IsFreezeOn == true)
            {
                LV.IncreaseScore(5);
            }
        }
    }
Beispiel #2
0
    public void TakeDamage(float amount)
    {
        health -= amount;
        //if shot by player and has not noticed, make enemy angry and always chase player
        if (!hasNoticed)
        {
            attackRadius = Vector3.Distance(target.position, transform.position) * 1.15f;
            Debug.Log("Shot me in the back? Now I'm angry! Attack radius == " + attackRadius);
            //moveCloserRadius = attackRadius + 20f;
            //hasNoticed = true;
        }

        if (health <= 0f && !isDead)//if health is below zero and is not already dead
        {
            Debug.Log("I, " + gameObject.name + " am dead! Distributing bounty...");
            isDead = true;
            //target.IncreaseScore(10);
            //call level controller to increase score
            Level01Controller _lc1 = FindObjectOfType <Level01Controller>();
            _lc1.IncreaseScore(bounty);
            if (gameObject.name == "Enemy_BOOS")
            {
                _lc1.KillBoss();
            }
            //start death procedure
            StartCoroutine(Die());
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Enemy")
     {
         _levelController.IncreaseScore(_pointValue);
         Destroy(other.gameObject);
     }
 }
    public void TakeDamage(float amount)
    {
        health -= amount;
        if (health <= 0f)
        {
            //Die();
            StartCoroutine(Die());

            Level01Controller _lc1 = FindObjectOfType <Level01Controller>();
            _lc1.IncreaseScore(destructionReward);
        }
        //explosionGO = Instantiate(explosionEffect, transform.position, transform.rotation);
        //Destroy(explosionGO, 15f);
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Ball")
        {
            float randomX = Random.Range(-45f, 45f);
            float randomZ = Random.Range(-45f, 45f);

            levelController.IncreaseScore(-1);
            GameObject temp = Instantiate(ball.gameObject, spawnPoint);
            temp.transform.position = new Vector3(randomX, 2, randomZ);
            temp.GetComponent <Ball>().Spawn();
            Destroy(other.gameObject);
        }
    }
Beispiel #6
0
    private void OnTriggerEnter(Collider other)
    {
        //if collides with enemy and is small enough
        if (other.gameObject.CompareTag("Player"))
        {
            //give score
            levelController.IncreaseScore(1);

            //feedback
            audioSource.Play();
            particleSystem.Play();

            //delay destroy
            art.SetActive(false);
            boxCollider.enabled = false;
            Destroy(gameObject, 2f);
        }
    }
Beispiel #7
0
 public void TakeDamage(int damage)
 {
     if (_currentHealth > 0)
     {
         AudioHelper.PlayClip2D(_enemyDamaged, 0.25f);
         _currentHealth -= damage;
     }
     if (_currentHealth <= 0)
     {
         AudioHelper.PlayClip2D(_enemyDeath, 0.25f);
         _levelController.IncreaseScore(_scoreToAdd);
         _levelController.IncreaseMultiplier();
         if (this.CompareTag("Boss"))
         {
             _levelController.Victory();
         }
         DestroyObject();
     }
 }
Beispiel #8
0
 private void OnTriggerEnter(Collider other)
 {
     scoreController.IncreaseScore(scoreValue);
     AudioHelper.PlayClip2D(pickup, 1);
     Destroy(this.gameObject);
 }
 public void OnDestruction(GameObject destroyer)
 {
     controller.IncreaseScore(pointValue);
 }
Beispiel #10
0
 public void HitEnemy(Collider enemy)
 {
     levelController.IncreaseScore(2);
     enemy.GetComponent <EnemyController>().EnemyDeath();
     //Destroy(enemy.gameObject);
 }