示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (healthManager.CheckHealth() <= 0)
     {
         if (GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !GetComponent <Animator>().IsInTransition(0) && dying)
         {
             Destroy(gameObject);
         }
         else if (!dying)
         {
             if (!clips.catDieSource.isPlaying)
             {
                 clips.catDieSource.Play();
             }
             dying = true;
             StaticValues.PlayerDead = true;
             GetComponent <Animator>().SetTrigger("Dead");
         }
     }
     else
     {
         StaticValues.PlayerPosition = transform.position;
         CheckMovement();
         CheckActions();
     }
 }