private void ParseGameObjectsFromStream(Stream stream, NitroxInt3 batchId, NitroxInt3 cellId, int level, List <EntitySpawnPoint> spawnPoints) { LoopHeader gameObjectCount = serializer.Deserialize <LoopHeader>(stream); for (int goCounter = 0; goCounter < gameObjectCount.Count; goCounter++) { GameObject gameObject = DeserializeGameObject(stream); if (gameObject.TotalComponents > 0) { AbsoluteEntityCell absoluteEntityCell = new AbsoluteEntityCell(batchId, cellId, level); NitroxTransform transform = gameObject.GetComponent <NitroxTransform>(); spawnPoints.AddRange(entitySpawnPointFactory.From(absoluteEntityCell, transform, gameObject)); } } }
public override List <EntitySpawnPoint> From(AbsoluteEntityCell absoluteEntityCell, NitroxTransform transform, GameObject gameObject) { List <EntitySpawnPoint> spawnPoints = new List <EntitySpawnPoint>(); EntitySlotsPlaceholder entitySlotsPlaceholder = gameObject.GetComponent <EntitySlotsPlaceholder>(); if (!ReferenceEquals(entitySlotsPlaceholder, null)) { foreach (EntitySlotData entitySlotData in entitySlotsPlaceholder.slotsData) { List <EntitySlot.Type> slotTypes = SlotsHelper.GetEntitySlotTypes(entitySlotData); List <string> stringSlotTypes = slotTypes.Select(s => s.ToString()).ToList(); EntitySpawnPoint entitySpawnPoint = new EntitySpawnPoint(absoluteEntityCell, entitySlotData.localPosition.ToDto(), entitySlotData.localRotation.ToDto(), stringSlotTypes, entitySlotData.density, entitySlotData.biomeType.ToString()); HandleParenting(spawnPoints, entitySpawnPoint, gameObject); } } else { EntitySpawnPoint entitySpawnPoint = new EntitySpawnPoint(absoluteEntityCell, transform.LocalPosition, transform.LocalRotation, transform.LocalScale, gameObject.ClassId); HandleParenting(spawnPoints, entitySpawnPoint, gameObject); } return(spawnPoints); }
public abstract List <EntitySpawnPoint> From(AbsoluteEntityCell absoluteEntityCell, NitroxTransform transform, GameObject gameObject);