Пример #1
0
 private void Trace()
 {
     if (BossAnimator.GetCurrentAnimatorStateInfo(0).IsTag("Walk") && transform.localScale.x > 0 && Player.transform.position.x < transform.position.x) // 오른쪽일 때 방향전환
     {
         ChangeDirection();
     }
     if (BossAnimator.GetCurrentAnimatorStateInfo(0).IsTag("Walk") && transform.localScale.x < 0 && Player.transform.position.x > transform.position.x) // 왼쪽일 때 방향전환
     {
         ChangeDirection();
     }
 }
Пример #2
0
    private void Move()
    {
        if (HP > MaxHp * 0.5f)
        {
            transform.position = Vector2.Lerp(transform.position, Player.position + YVector, CurrentSpeed * Time.deltaTime);

            if (BossAnimator.GetCurrentAnimatorStateInfo(0).IsTag("Walk")) // 이동
            {
                CurrentSpeed = Speed;
            }
            else if (BossAnimator.GetCurrentAnimatorStateInfo(0).IsTag("NoMove"))
            {
                CurrentSpeed = 0;
            }
        }
    }
Пример #3
0
 private void Patrol()
 {
     if (HP <= MaxHp * 0.5f)
     {
         if (!BossAnimator.GetCurrentAnimatorStateInfo(0).IsTag("NoMove"))
         {
             transform.position = Vector2.MoveTowards(transform.position, moveSpots[randomSpot].position, speed * Time.deltaTime);
             if (Vector2.Distance(transform.position, moveSpots[randomSpot].position) < 0.2f)
             {
                 if (waitTime <= 0)
                 {
                     randomSpot = Random.Range(0, moveSpots.Length);
                     waitTime   = startWaitTime;
                 }
                 else
                 {
                     waitTime -= Time.deltaTime;
                 }
             }
         }
     }
 }