// Start is called before the first frame update void Start() { if (Instance != null) { Debug.LogError("There should never be two world controllers"); } Instance = this; }
IEnumerator CoAttack() { State = CreatureState.Skill; GameObject go; // 피격 판정 if (_creature.CompareTag("Team")) { go = FindNearestObjectByTag("Enemy"); } else { go = FindNearestObjectByTag("Team"); } if (go != null) { transform.LookAt(go.transform); //공격대상 바라보기 if (_rangeAttacktype) //원거리 유닛이면 발사체 생성 { GameObject arrow = Managers.Resource.Instantiate($"Creature/Arrow_{(_creature.name).Substring(0, _creature.name.Length-1)}"); //이름뒤에 숫자 빼기 if (arrow != null) { arrow.transform.position = _creature.transform.position + new Vector3(0, 2, 1); ArrowCtrl ac = arrow.GetComponent <ArrowCtrl>(); if (ac != null) { ac.fire(go); } } } CreatureCtrl cc = go.GetComponent <CreatureCtrl>(); if (cc != null) { cc.OnDamaged(_atk); } Debug.Log("On Hit !"); } // 대기 시간 yield return(new WaitForSeconds(_atkSpeed)); _coSkill = null; State = CreatureState.Idle; // <- 공격하는게 어색하다 싶으면 Moving으로 바꿔보기 }