示例#1
0
    void OnTriggerExit(Collider hit)
    {
        if (hit.transform.tag == "WeaponPlayer") {
            player = GameObject.FindGameObjectWithTag("Player") ; // recupere le parent le plus haut dans la hierrachie
            playerStats = player.GetComponent<PlayerStats>() ;
            health -= playerStats.getAttack() ;
            anim.Play ("gethit");

            if (health <= 0) {
                ia.enabled = false;
                characterController.enabled = false ;
                anim.Play ("die");
                anim ["die"].speed = speedAnimationDie;
                isdead = true;
                hourOfDeath = Time.realtimeSinceStartup;
                giveXp();

                if(quest != null ){
                    quest.SendMessage("oneEnnemyDie",getEnnemyname());
                }
            }
        }
    }