// Start is called before the first frame update void Start() { item_manager = GameObject.Find("ItemManager").GetComponent <ItemManager>(); cow = null; tiger = null; chicken = null; HPMax = 1000; hp = HPMax; hp_bar = GameObject.FindWithTag("EChickenHp"); hpbar_sx = hp_bar.transform.localScale.x; hpbar_tx = hp_bar.transform.localPosition.x; hpbar_tmp = hpbar_sx / HPMax; //최대 체력에 따른 hp바 이동량 설정 chicken_hp = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>(); cow_hp = GameObject.FindWithTag("cow").GetComponent <Cow_Attack>(); tiger_hp = GameObject.FindWithTag("tiger").GetComponent <Tiger_Attack>(); e_attack_data = GameObject.Find("E_AttackData").GetComponent <E_AttackData>(); attack = e_attack_data.Echicken_attack; //농장씬에서 죽었는지 파악 if (!item_manager.cow_die) { cow = GameObject.Find("Cow").gameObject; } if (!item_manager.chicken_die) { chicken = GameObject.Find("Chicken").gameObject; } if (!item_manager.tiger_die) { tiger = GameObject.Find("tiger").gameObject; } Debug.Log("적닭 공격력: " + attack); }
private void OnTriggerEnter(Collider other) { //공격 함 //적이랑 닿으면 camera 움직임 if ((other.gameObject.tag == "cow") && E_t.is_basic_attack && !cow.is_special_attack_time && E_t.is_target_cow)//소가 고유공격 안할때 데미지 줌 { //cow = GameObject.FindWithTag("cow").GetComponent<Cow_Attack>(); cow.hpMove(E_t.attack); E_t.is_Attack = true; } if ((other.gameObject.tag == "tiger") && E_t.is_basic_attack && E_t.is_target_tiger) { tiger = GameObject.FindWithTag("tiger").GetComponent <Tiger_Attack>(); tiger.hpMove(E_t.attack); E_t.is_Attack = true; } if ((other.gameObject.tag == "chicken") && E_t.is_basic_attack && E_t.is_target_chicken) { chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>(); chicken.hpMove(E_t.attack); E_t.is_Attack = true; } //공격 받음 if (other.gameObject.tag == "chicken_wind") { if (other.gameObject.transform.position.x >= E_t.transform.position.x)//적이 오른쪽에 있다면 { E_t.transform.position = new Vector3(E_t.transform.position.x + 1.5f, E_t.transform.position.y, E_t.transform.position.z); } else//적이 왼쪽 { E_t.transform.position = new Vector3(E_t.transform.position.x - 1.5f, E_t.transform.position.y, E_t.transform.position.z); } E_t.is_basic_attack = false; } }
// Start is called before the first frame update void Start() { Debug.Log("Start Tree"); a_Tiger = gameObject.GetComponent <Tiger_Attack>(); //root에 더함 root.AddChild(selector); //selector에 더함 selector.AddChild(seqBehavior);//행동 find_Target.Tiger_attack = a_Tiger; basic_Attack.Tiger_attack = a_Tiger; skill.Tiger_attack = a_Tiger; //행동들 seqBehavior.AddChild(find_Target); seqBehavior.AddChild(basic_Attack); seqBehavior.AddChild(skill); behaviorProcess = BehaviorProcess(); StartCoroutine(behaviorProcess); }
// Start is called before the first frame update void Start() { tiger = GameObject.FindWithTag("tiger").GetComponent <Tiger_Attack>(); Camera = GameObject.FindWithTag("MainCamera").GetComponent <camera_shake>(); }