public bool add_crash_obj(crash_base_obj obj_entry) { foreach (crash_base_obj enry in _crash_objs) { if(obj_entry._pos._x == enry._pos._x && obj_entry._pos._y == enry._pos._y && obj_entry._pos._z == enry._pos._z) { return false; } } crash_obj_addr obj_addr = _crash_manager.get_crash_obj_addr(obj_entry._pos); if(obj_addr == null) { return false; } if (_crash_manager.get_crash_obj_addr(obj_entry._pos)._crash_obj != null) { return false; } // add_crash_obj(obj_entry); obj_entry._crash_mole = this; _crash_objs.Add(obj_entry); _crash_manager._crash_objs[obj_entry._pos._x, obj_entry._pos._z, obj_entry._pos._y]._crash_obj = obj_entry; _crash_manager._crash_moles[obj_entry._pos._x, obj_entry._pos._z, obj_entry._pos._y]._crash_mole = this; return true; }
public bool remove_crash_obj(crash_base_obj obj_entry) { if(_crash_objs.Remove(obj_entry)) { _crash_manager._crash_objs[obj_entry._pos._x, obj_entry._pos._z, obj_entry._pos._y]._crash_obj = null; _crash_manager._crash_moles[obj_entry._pos._x, obj_entry._pos._z, obj_entry._pos._y]._crash_mole = null; return true; } return false; }