private bool isEmpty(crash_mole obj_temp) { int count_temp = obj_temp._crash_objs.Count; for (int i = 0; i < count_temp; i++) { if (isEmpty(((crash_obj)obj_temp._crash_objs[i])) == false) { return false; } } return true; }
void add_can_not_move_list(crash_mole mole) { foreach(crash_mole entry in _can_not_move_list) { if(entry == mole) { return; } } _can_not_move_list.Add(mole); }
public bool add_crash_mole(crash_mole obj_temp) { foreach (crash_mole entry in _crash_moles_list) { if(obj_temp == entry) { return false; } } _crash_moles_list.Add(obj_temp); return true; }
protected bool move(crash_mole mole, dir_move dir) { if(mole == null) { return false; } _use_count++; int min_move_y = (int)crash_define.max_y; foreach (crash_base_obj entry in mole._crash_objs) { crash_pos pos_temp = new crash_pos(); pos_temp = entry._pos; if (min_move_y > pos_temp._y) { min_move_y = pos_temp._y; } pos_temp.move(dir); Vector3 vec = _creature.get_position(); int pos_x = transform_to_map(vec.x); int pos_y = transform_to_map(vec.y); int pos_z = transform_to_map(vec.z); if(_freezen_creature == false) { if (pos_temp._x == pos_x && pos_temp._y == pos_y && pos_temp._z == pos_z) { return false; } } if (check_pos_valid(pos_temp)) { crash_mole mole_entry = get_crash_mole_addr(pos_temp)._crash_mole; if (is_in_can_not_move_list(mole_entry) == true) { return false; } if(mole_entry == null) { continue; } else { if(mole_entry == mole) { continue; } int length = _move_mole_list.Count; bool have_mole = false; for (int i = 0; i < length; i++) { if (mole_entry == (crash_mole)_move_mole_list[i]) { have_mole = true; } } if (have_mole == true) { continue; } else { _move_mole_list.Add(mole_entry); } if (move(mole_entry, dir) == false) { foreach(crash_mole entry_temp in _move_mole_list) { add_can_not_move_list(entry_temp); } _move_mole_list.Clear(); return false; } } } else { _move_mole_list.Clear(); return false; } } return true; }
bool is_in_can_not_move_list(crash_mole entry) { foreach(crash_mole temp in _can_not_move_list) { if(temp == entry) { return true; } } return false; }
public crash_mole create_crash_mole() { crash_mole mole_entry = new crash_mole(); mole_entry._crash_manager = this; return mole_entry; }
public void create_mole(int x, int y, crash_mole mole) { seek_create_mole(x - 1, y, mole); seek_create_mole(x + 1, y, mole); seek_create_mole(x, y - 1, mole); seek_create_mole(x, y + 1, mole, true); }
void seek_create_mole(int temp_x, int temp_y, crash_mole mole, bool dir_up = false) { MapData map_data = global_instance.Instance.GetMapData(); if(map_data == null) { return; } if (temp_x >= 0 && temp_x < map_data.width_ && temp_y >= 0 && temp_y < map_data.height_) { crash_mole mole_entry = null; int group = 11; group = map_data.groups_[temp_x, temp_y]; if (group != 11) { int x_offset = (_max_x - map_data.width_) / 2; mole_entry = global_instance.Instance._crash_manager.get_crash_mole_addr(temp_x + x_offset, 9, temp_y + 20)._crash_mole; if (mole_entry == null) { if (group == 10) { if (dir_up == true) { crash_base_obj obj = global_instance.Instance._crash_manager.create_flag_obj(temp_x + x_offset, temp_y + 20); mole.add_crash_obj(obj); create_mole(temp_x, temp_y, mole); } } else if (group == mole._color_group || dir_up == true && group == 10) { crash_obj obj = global_instance.Instance._crash_manager.create_crash_obj(temp_x + x_offset, temp_y + 20); mole.add_crash_obj(obj); create_mole(temp_x, temp_y, mole); } } } } }