Exemplo n.º 1
0
    void OnCollisionEnter(Collision collision)
    {
        //弾が当たった時
        if (collision.gameObject.tag == "Bullet")
        {
            Destroy(collision.gameObject);
            Destroy(GetComponent <CapsuleCollider>());
            enemyGenerator.AddAttackEnemyCount();
            animator.SetTrigger("Falling");
            source.PlayOneShot(sounds[3]);
            Destroy(this.gameObject, 1f);
        }

        //プレイヤーと接触時
        if (collision.gameObject.tag == "Player")
        {
            animator.SetTrigger("attack");
            source.PlayOneShot(sounds[2]);
            Invoke("Stan", 1f);
        }
    }