Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "RunningNPC" || other.tag == "EscapeNPC")
     {
         if (!anim.GetBool("isStandBy"))
         {
             anim.SetBool("isStandBy", true);
         }
         lerpValueRateOfIncrease = 0;
     }
     else if (other.tag == "Enemy" && transform.tag == "Enemy")
     {
         StopAllCoroutines();
         EnemyCharacter enemy = other.GetComponent <EnemyCharacter>();
         enemy.StopAllCoroutines();
         transform.tag = "AttackEnemy";
         enemy.tag     = "AttackEnemy";
         transform.LookAt(enemy.transform);
         enemy.transform.LookAt(transform);
         if (priority >= enemy.GetPriority())
         {
             enemy.GetAnimator().SetBool("isStandBy", true);
             anim.SetBool("isShoot", true);
             StartCoroutine(SeeAnotherEnemy(enemy));
         }
         else
         {
             anim.SetBool("isStandBy", true);
             enemy.GetAnimator().SetBool("isShoot", true);
             enemy.StartCoroutine(enemy.SeeAnotherEnemy(this));
         }
     }
 }
Example #2
0
    public IEnumerator SeeAnotherEnemy(EnemyCharacter enemy)
    {
        yield return(new WaitForSeconds(anim.GetCurrentAnimatorClipInfo(0).Length));

        Destroy(Instantiate(bullet[1], enemy.transform.position + Vector3.up * 0.8f, shootTransform.rotation), 1);
        enemy.GetAnimator().SetBool("isDie", true);
        anim.SetBool("isShoot", false);
        anim.SetBool("isStandBy", true);
        yield return(new WaitForSeconds(enemy.GetAnimator().GetCurrentAnimatorClipInfo(0).Length));

        Destroy(enemy.gameObject);
        anim.SetBool("isStandBy", false);
        transform.tag = "Enemy";
        RestartFollowPoint();
    }