// <summary> /// 离开区域加载 /// </summary> public void OnExitArea(LevelArea area) { if (OnExitAreaHandler != null) { OnExitAreaHandler(area); } }
// <summary> /// 区域加载完毕 /// </summary> public void OnLoadedArea(LevelArea area) { if (OnLoadedAreaHandler != null) { OnLoadedAreaHandler(area); } }
public void Initialize(LevelArea area, SecurityElement xml) { this.m_xml = xml; this.m_area = area; m_layer = LayerMask.NameToLayer(LevelFunctionType.Ground.ToString()); gameObject.layer = m_layer; // 动画开始格子id m_animationStartGridId = m_xml.Attribute("animation_start_id"); m_map = m_map = new Dictionary <string, LevelGrid>(); foreach (SecurityElement xmlChild in m_xml.Children) { GameObject go = new GameObject(); go.name = "gird"; go.transform.parent = transform; go.layer = m_layer; var grid = go.AddComponent <LevelGrid>(); grid.assetName = xmlChild.Attribute("asset_name"); grid.bundleName = xmlChild.Attribute("bundle_name"); grid.position = new Vector3(int.Parse(xmlChild.Attribute("pos_x")), int.Parse(xmlChild.Attribute("pos_y")), int.Parse(xmlChild.Attribute("pos_z"))); grid.rotationAngle = new Vector3(int.Parse(xmlChild.Attribute("angle_x")), int.Parse(xmlChild.Attribute("angle_y")), int.Parse(xmlChild.Attribute("angle_z"))); grid.function = LevelFunctionType.Ground; grid.adjacentPx = xmlChild.Attribute("adjacent_px"); grid.adjacentNx = xmlChild.Attribute("adjacent_nx"); grid.adjacentPz = xmlChild.Attribute("adjacent_pz"); grid.adjacentNz = xmlChild.Attribute("adjacent_nz"); grid.layer = m_layer; grid.Initialize(); AddGrid(grid); } }
public void Initialize(LevelArea _area, SecurityElement _xml) { m_xml = _xml; m_area = _area; GameObject go = new GameObject(); go.name = "gird"; go.transform.parent = transform; m_grid = go.AddComponent <LevelGrid>(); m_grid.assetName = m_xml.Attribute("asset_name"); m_grid.bundleName = m_xml.Attribute("bundle_name"); m_grid.position = new Vector3(int.Parse(m_xml.Attribute("pos_x")), int.Parse(m_xml.Attribute("pos_y")), int.Parse(m_xml.Attribute("pos_z"))); m_grid.rotationAngle = new Vector3(int.Parse(m_xml.Attribute("angle_x")), int.Parse(m_xml.Attribute("angle_y")), int.Parse(m_xml.Attribute("angle_z"))); m_grid.function = LevelFunctionType.Door; }