Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            if (barricade == null)
            {
                barricade = other.GetComponent <Barricade> ();
            }
            if (GetComponent <Monster_Basic> () != null && GetComponent <Monster_Basic> ().audioSource != null && GetComponent <Monster_Basic> ().sound.Length != 0)
            {
                GetComponent <Monster_Basic> ().PlayAudioSource(GetComponent <Monster_Basic> ().sound [0].audioClip);
            }

            barricade.GetHurt(damage, cameraShakeMultiplier, cameraShakeLength);
            if (destroyParticle != null)
            {
                GameObject particle = Instantiate(destroyParticle, this.transform.position, this.transform.rotation) as GameObject;
                Destroy(particle, 3f);
            }
            anim.SetBool("Dead", true);
            if (GetComponent <Monster_Basic> () != null)
            {
                GameMaster.gameMaster.remainingEnemies.Remove(this.gameObject);
                GameMaster.gameMaster.StartCheckFinished(0.1f);
            }
            Destroy(this.gameObject, destroytime);
        }
    }
Esempio n. 2
0
 public void RangeAttack()
 {
     barricade.GetHurt(rangeDamage, cameraShakeMultiplier, cameraShakeLength);
 }