// Start is called before the first frame update void Start() { dropableItem = GetComponent <ItemDropEvent>(); anim = GetComponentInChildren <Animator>(); collider = GetComponent <Collider>(); enemyRigidbody = GetComponent <Rigidbody>(); targetPlayer = GameObject.FindGameObjectWithTag("Player"); stateMachine = new StateMachine <Enemy>(); stateMachine.Setup(this, new EnemyMovement()); currentState = stateMachine.GetCurrentState.ToString(); isDeath = false; forceAttack = false; canAttack = true; canMove = true; isStun = false; maxHealth = enemyStat.health; if (enemyStat.attackType != AttackType.AreaMelee && enemyStat.attackType != AttackType.AreaRanged) { enemyStat.attackRadiusOfArea = 0; } input = new Debuginput(); input.Enable(); input.debugging.DropItem.performed += _ => dropableItem.DropItem(); }
// Start is called before the first frame update public void Enter(Enemy enemy) { deathTime = Time.time; hpBar = enemy.GetComponent <EnemyHitPoint>(); dropableItem = enemy.GetComponent <ItemDropEvent>(); if (dropableItem) { dropableItem.DropItem(); } }
public void DequeueItem(GameObject dropMonster) // 몬스터 처치 시 아이템 정보 Set { if (itemPouchs.Count == 0) { itemPouchs.Enqueue(dropPouchs[0]); dropPouchs.RemoveAt(0); } DropItem item = itemPouchs.Dequeue(); dropPouchs.Add(item); item.SetItemData(dropMonster); item.gameObject.transform.position = dropMonster.transform.position; item.gameObject.SetActive(true); ItemDropEvent?.Invoke(item); }