private void RealRemoveEntity(TileEntity entity) { int entity_id = entity.GetHashCode(); Assert.Should(m_entityHash.ContainsKey(entity_id)); m_entities[(int)entity.GetOwner()].Remove(entity); m_entityHash.Remove(entity_id); FillBuildingMapData(entity, 0); }
private void RealAddEntity(TileEntity entity) { // 先初始化(否则在后面添加墙数据时没有精灵会导致空引用) entity.AddedToWorld(); int entity_id = entity.GetHashCode(); Assert.Should(!m_entityHash.ContainsKey(entity_id)); // 添加到列表和Hash表 m_entities[(int)entity.GetOwner()].Add(entity); m_entityHash.Add(entity_id, entity); FillBuildingMapData(entity, entity_id); }
public void EndMoveEntity(TileEntity entity) { int entity_id = entity.GetHashCode(); FillBuildingMapData(entity, entity_id); }