コード例 #1
0
    public void Death()
    {
        playerSkill.increaseBar(skillValue);
        isDead = true;
        enemyMovement.speed = 0;
        enemyAttack.enabled = false;         // disable enemy attacking

        anim.SetTrigger("IsDead");
        GetComponent <BoxCollider2D> ().enabled    = false; //So that player can walk over it
        GetComponent <CircleCollider2D> ().enabled = false; //So that player wont detect it as enemy anymore
        GetComponent <AudioSource> ().Play();
        GetComponent <Rigidbody2D> ().isKinematic = true;   //so unity will ignore it
        ScoreManager.score += scoreValue;                   //Add score
        Destroy(gameObject, DeathDelay);
    }