void RushAI() { RushEnemy re_ = GetComponent <RushEnemy>(); if (re_ != null && !player_in_range) { target_square = re_.SetTarget(); } LowHPSnipeEnemy lhs_ = GetComponent <LowHPSnipeEnemy>(); if (lhs_ != null && !player_in_range) { target_square = lhs_.SetTarget(); } WaitEnemy we_ = GetComponent <WaitEnemy>(); if (we_ != null && !player_in_range) { target_square = we_.SetTarget(); } }
void PlayerSearch() { foreach (GameObject r in a_range) { if (r.GetComponent <Square_Info>().GetChara() != null) { if (r.GetComponent <Square_Info>().GetChara().tag == "Player") { player_in_range = true; target_square = r; in_range_player = r.GetComponent <Square_Info>().GetChara(); WaitEnemy we_ = GetComponent <WaitEnemy>(); if (we_ != null) { we_.RushStart(); } break; } } } if (player_in_range) { GameObject[] g_near = target_square.GetComponent <Square_Info>().GetNear(); target_square = null; foreach (GameObject g in g_near) { if (target_square == null) { target_square = g; } else if (target_square.GetComponent <Square_Info>().GetMaxCost() < g.GetComponent <Square_Info>().GetMaxCost()) { target_square = g; } } } a_range.Clear(); }