protected void _catch_click(int i, bool his) { if (_creature._is_in_falldown == false) { if (i == 0) { _cash_click = false; } else { _cash_click = true; } Vector3 vc = _creature.get_position(); dir_move dir = _creature.get_dir(); crash_pos pos = new crash_pos(); pos._x = transform_to_map(vc.x); pos._y = transform_to_map(vc.y); pos._z = transform_to_map(vc.z); if (_cash_click) { if (_freezen_creature == false) { crash_pos pos_target = new crash_pos(); pos_target.clone(pos); pos_target.move(dir); if (check_pos_valid(pos_target) == true) { crash_mole target_mole = get_crash_mole_addr(pos_target)._crash_mole; if (target_mole != null) { _freezen_creature = true; if (his == false) { _creature.frozen_history(_freezen_creature); } _obj_creature = new crash_obj_creature(pos._x, pos._y, pos._z); _obj_creature._creature = _creature; _creature.set_position(pos._x + 0.45f, pos._y + 0.2f, pos._z + 0.5f); target_mole.add_crash_obj(_obj_creature); _lock_mole.Add(target_mole); global_instance.Instance._ngui_edit_manager.CatchButtonUpdate (true); } } } } else { if (_obj_creature != null) { _lock_mole.Clear(); if (_freezen_creature == true) { pos.move(dir_move.up); if (check_pos_valid(pos)) { if (_obj_creature._crash_mole != null) { crash_mole mole_temp = _obj_creature._crash_mole; mole_temp.remove_crash_obj(_obj_creature); _obj_creature = null; } } global_instance.Instance._ngui_edit_manager.CatchButtonUpdate (false); _freezen_creature = false; if (his == false) { _creature.frozen_history(_freezen_creature); } } } } } }
public void clear() { clear_enclosure(); if (_crash_objs != null && _crash_moles != null) { for (int x = 0; x < (int)_max_x; x++) { for (int y = 0; y < (int)_max_y; y++) { for (int z = 0; z < (int)_max_z; z++) { _crash_objs[x, z, y]._crash_obj = null; _crash_moles[x, z, y]._crash_mole = null; } } } } _grid_distance = (float)1; _need_play_animation = false; _move_animation_distance = (float)0.1; int length = _Game_objs.Count; for(int i = 0; i < length; i ++) { GameObject obj = (GameObject)_Game_objs[i]; GameObject.Destroy(obj); } _crash_moles_list.Clear(); _move_mole_list.Clear(); _Game_objs.Clear(); _obj_creature = null; _freezen_creature = false; _lock_mole.Clear (); if(_creature != null) { _creature.gameObject.SetActive(false); } _catch_click_list.Clear(); _game_state = gameState.game_prepare; _History.reset(); _current_frame_count = 0; _move_count = 0; }