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); }
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"); }
// 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>(); }
void Start() { startingPoint = transform.position; playerObject = GameObject.FindGameObjectWithTag("Player"); agent = GetComponent <NavMeshAgent>(); mobStats = GetComponent <MobStats>(); bossAnimator = GetComponent <BossAnimator>(); }
private void Start() { if (!player) { player = GameObject.FindGameObjectWithTag("Player"); } _health = gameObject.AddComponent <Health>(); _health.HasDied += HasDied; _bossAnimator = GetComponent <BossAnimator>(); }
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(); } }
private void BossPattern2() { if (idx == 0) { BossAnimator.SetTrigger("Pattern3"); } else if (idx == 1) { BossAnimator.SetTrigger("Pattern4"); } idx += 1; }
private void BossPattern() { int idx = Random.Range(0, 2); // 랜덤 난수 if (idx == 0) { BossAnimator.SetTrigger("Pattern1"); } else if (idx == 1) { BossAnimator.SetTrigger("Pattern2"); } }
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; } } }
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>(); }
private void AttackCancle() { BossAnimator.SetBool("Attack", false); }