Exemple #1
0
    IEnumerator CheckMonsterState()
    {
        while (!isDie)
        {
            yield return(new WaitForSeconds(0.2f));

            float dist = Vector3.Distance(playerTr.position, transform.position);

            if (!PlayerMovement.IsCombat)
            {
                if (dist > TraceFastDist)
                {
                    jerryState = JerryStateEnum.traceFast;
                }
                else if (dist >= traceDist)
                {
                    jerryState = JerryStateEnum.trace;
                }
                else
                {
                    jerryState = JerryStateEnum.idle;
                }

                sawFight     = false;
                backAwayDone = false;
            }
            else
            {
                if (!sawFight && dist > TraceFastDist)
                {
                    jerryState = JerryStateEnum.traceFast;
                }
                else if (!sawFight && dist >= traceDist)
                {
                    jerryState = JerryStateEnum.trace;
                }
                else if (!backAwayDone)
                {
                    jerryState = JerryStateEnum.backAway;
                    StartCoroutine(BackAwaySeq());
                    sawFight = true;
                }
                else
                {
                    jerryState = JerryStateEnum.scared;
                }
            }
        }
    }
Exemple #2
0
    void MonsterDie()
    {
        gameObject.tag = "Untagged";

        StopAllCoroutines();

        isDie      = true;
        jerryState = JerryStateEnum.die;
        //nvAgent.Stop();   // Obsolete. So changed to code below.nvAgent.Stop();
        nvAgent.isStopped = true;
        animator.SetInteger("DyingMotion", (int)dieMotion);
        animator.SetTrigger("IsDie");

        gameObject.GetComponent <CapsuleCollider>().enabled = false;
    }