/// <summary> /// 创建Location /// </summary> public void CreateLocation() { GameObject locationObj = new GameObject(); locationObj.transform.SetParent(transform); Location location = locationObj.AddComponent <Location>(); if (location != null) { m_LocationCache = gameObject.GetComponentsInChildren <Location>(); CalcuateMaxLocationId(); int nextLocationId = m_MaxLocationId + 1; string strLocationUid = string.Format("{0}{1}{2}", m_GamingMapArea.GetGamingMapId(), m_GamingMapArea.m_AreaId, MapEditorUtility.CalcuateNumber(nextLocationId, 2)); ulong locationUid = ulong.Parse(strLocationUid); location.Init(locationUid, nextLocationId, this); } Selection.activeGameObject = locationObj; }
/// <summary> /// 创建NPC /// </summary> public void CreateCreature() { GameObject creatureObj = new GameObject(); creatureObj.transform.SetParent(transform); Creature creature = creatureObj.AddComponent <Creature>(); if (creature != null) { m_CreatureCache = gameObject.GetComponentsInChildren <Creature>(); CalcuateMaxCreatureId(); int nextCreatureId = (int)(m_MaxCreatureId + 1); string creatureUidStr = string.Format("{0}{1}{2}", m_GamingMapArea.GetGamingMapId(), m_GamingMapArea.m_AreaId, MapEditorUtility.CalcuateNumber(nextCreatureId, 3)); ulong creatureUid = ulong.Parse(creatureUidStr); creature.Init(creatureUid, nextCreatureId, this); } Selection.activeGameObject = creatureObj; }