private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "chicken_enemy" && (cow.is_basic_attack || cow.is_special_attack_time) && cow.is_target_chicken) //충돌+(기본공격 or 고유공격 중) { E_chicken = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>(); E_chicken.hpMove(cow.attack); //Debug.Log("소 공격력: "+cow.attack); cow.is_Attack = true; camera_shake = true; } if (other.gameObject.tag == "tiger_enemy" && (cow.is_basic_attack || cow.is_special_attack_time) && cow.is_target_tiger) { cow.is_Attack = true; camera_shake = true; } if (other.gameObject.tag == "cow_enemy" && (cow.is_basic_attack || cow.is_special_attack_time) && cow.is_target_cow) { E_cow = GameObject.FindWithTag("cow_enemy").GetComponent <E_cow_Attack>(); E_cow.hpMove(cow.attack); cow.is_Attack = true; camera_shake = true; } }
private void OnTriggerEnter(Collider other) { //적이랑 닿으면 camera 움직임 if (other.gameObject.tag == "chicken_enemy" && tiger.is_basic_attack && tiger.is_target_chicken) { E_chicken = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>(); E_chicken.hpMove(tiger.attack); tiger.is_Attack = true; } if (other.gameObject.tag == "tiger_enemy" && tiger.is_basic_attack && tiger.is_target_tiger) { E_tiger = GameObject.FindWithTag("tiger_enemy").GetComponent <E_t_Attack>(); E_tiger.hpMove(tiger.attack); tiger.is_Attack = true; } if (other.gameObject.tag == "cow_enemy" && tiger.is_basic_attack && tiger.is_target_cow) { E_cow = GameObject.FindWithTag("cow_enemy").GetComponent <E_cow_Attack>(); E_cow.hpMove(tiger.attack); tiger.is_Attack = true; } }
// Start is called before the first frame update void Start() { // isDie = GameObject.Find("Tiger_p").transform.GetChild(0).GetComponent<Tiger_Move>().isDie; HPMax = 1000; hp = HPMax; hp_bar = GameObject.FindWithTag("TigerHp"); hpbar_sx = hp_bar.transform.localScale.x; hpbar_tx = hp_bar.transform.localPosition.x; hpbar_tmp = hpbar_sx / HPMax; //최대 체력에 따른 hp바 이동량 설정 //hp 가져오기 E_chicken_hp = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>(); E_cow_hp = GameObject.FindWithTag("cow_enemy").GetComponent <E_cow_Attack>(); E_tiger_hp = GameObject.FindWithTag("tiger_enemy").GetComponent <E_t_Attack>(); // fPazik = transform.GetChild(1).gameObject; fPazik.SetActive(false); cow = GameObject.FindWithTag("cow").GetComponent <Cow_Attack>(); chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>(); //공격 레벨 가져오기 item_manager = GameObject.Find("ItemManager").GetComponent <ItemManager>(); level = item_manager.tiger_level; //공격력 가져오기 attack_data = GameObject.Find("AttackData").GetComponent <Attack_Data>(); attack = attack_data.getAttackValue(level); Debug.Log("호랑이 레벨: " + level + ", 공격력: " + attack); animator = GetComponent <Animator>(); }
// Start is called before the first frame update void Start() { Debug.Log("Start Tree"); a_E_chicken = gameObject.GetComponent <E_ch_Attack>(); //root에 더함 root.AddChild(selector); //selector에 더함 selector.AddChild(seqBehavior);//행동 find_Target.E_chicken_attack = a_E_chicken; basic_Attack.E_chicken_attack = a_E_chicken; //행동들 seqBehavior.AddChild(find_Target); seqBehavior.AddChild(basic_Attack); behaviorProcess = BehaviorProcess(); StartCoroutine(behaviorProcess); }
// Start is called before the first frame update void Start() { E_chicken = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>(); Camera = GameObject.FindWithTag("MainCamera").GetComponent <camera_shake>(); cow = GameObject.FindWithTag("cow").GetComponent <Cow_Attack>(); }
private void OnTriggerEnter(Collider other) { Vector3 pos; //적이랑 닿으면 camera 움직임 if (other.gameObject.tag == "chicken_enemy") { E_chicken = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>(); chicken.is_Attack = true; camera_shake = true; if (!attacked) //중복 방지 { if (chicken.is_go_right) //적이 왼쪽 이면 { pos = new Vector3(other.transform.position.x - 1, other.transform.position.y, other.transform.position.z); } else//적이 오른쪽이면 { pos = new Vector3(other.transform.position.x + 1, other.transform.position.y, other.transform.position.z); } transform.position = Vector3.MoveTowards(other.transform.position, pos, 0.1f); E_chicken.hpMove(chicken.attack); if (E_chicken.hp <= 0) { camera_shake = false; } attacked = true; } } if (other.gameObject.tag == "tiger_enemy") { E_tiger = GameObject.FindWithTag("tiger_enemy").GetComponent <E_t_Attack>(); chicken.is_Attack = true; camera_shake = true; if (!attacked) //중복 방지 { if (chicken.is_go_right) //적이 왼쪽 이면 { pos = new Vector3(other.transform.position.x - 1, other.transform.position.y, other.transform.position.z); } else//적이 오른쪽이면 { pos = new Vector3(other.transform.position.x + 1, other.transform.position.y, other.transform.position.z); } transform.position = Vector3.MoveTowards(other.transform.position, pos, 0.1f); E_tiger.hpMove(chicken.attack); if (E_tiger.hp <= 0) { camera_shake = false; } attacked = true; } } if (other.gameObject.tag == "cow_enemy") { E_cow = GameObject.FindWithTag("cow_enemy").GetComponent <E_cow_Attack>(); chicken.is_Attack = true; camera_shake = true; if (!attacked) //중복 방지 { if (chicken.is_go_right) //적이 왼쪽 이면 { pos = new Vector3(other.transform.position.x - 1, other.transform.position.y, other.transform.position.z); } else//적이 오른쪽이면 { pos = new Vector3(other.transform.position.x + 1, other.transform.position.y, other.transform.position.z); } transform.position = Vector3.MoveTowards(other.transform.position, pos, 0.1f); E_cow.hpMove(chicken.attack); if (E_cow.hp <= 0) { camera_shake = false; } attacked = true; } } }