예제 #1
0
파일: Boss.cs 프로젝트: Jorgegomezb/TFGONCE
 void Awake()
 {
     Player    = GameObject.Find("Player");
     boss_Anim = GetComponent <BossAnimator>();
     audio     = GetComponent <AudioSource>();
     init_pos  = new Vector3(transform.position.x, transform.position.y, transform.position.z);
 }
예제 #2
0
 public ChaseState(Boss boss) : base(boss.gameObject)
 {
     _boss = boss;
     movementController = _boss.GetComponent <MovementController>();
     collider           = _boss.GetComponent <BoxCollider2D>();
     animController     = _boss.GetComponent <BossAnimator>();
     player             = GameObject.Find("Player");
 }
예제 #3
0
 // Start is called before the first frame update
 void Awake()
 {
     enemy_script  = GetComponent <EnemyBehaviour>();
     player_script = GetComponent <PlayerMovement>();
     audio         = GetComponent <AudioSource>();
     audio.clip    = life_audio;
     boss_Anim     = GetComponent <BossAnimator>();
 }
예제 #4
0
 void Start()
 {
     startingPoint = transform.position;
     playerObject  = GameObject.FindGameObjectWithTag("Player");
     agent         = GetComponent <NavMeshAgent>();
     mobStats      = GetComponent <MobStats>();
     bossAnimator  = GetComponent <BossAnimator>();
 }
예제 #5
0
    private void Start()
    {
        if (!player)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }
        _health          = gameObject.AddComponent <Health>();
        _health.HasDied += HasDied;

        _bossAnimator = GetComponent <BossAnimator>();
    }
예제 #6
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();
     }
 }
예제 #7
0
    private void BossPattern2()
    {
        if (idx == 0)
        {
            BossAnimator.SetTrigger("Pattern3");
        }
        else if (idx == 1)
        {
            BossAnimator.SetTrigger("Pattern4");
        }

        idx += 1;
    }
예제 #8
0
    private void BossPattern()
    {
        int idx = Random.Range(0, 2);    // 랜덤 난수

        if (idx == 0)
        {
            BossAnimator.SetTrigger("Pattern1");
        }
        else if (idx == 1)
        {
            BossAnimator.SetTrigger("Pattern2");
        }
    }
예제 #9
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;
            }
        }
    }
예제 #10
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;
                 }
             }
         }
     }
 }
 public AttackState(Boss boss) : base(boss.gameObject)
 {
     _boss          = boss;
     animController = _boss.GetComponent <BossAnimator>();
 }
예제 #12
0
 private void AttackCancle()
 {
     BossAnimator.SetBool("Attack", false);
 }