public static void SpawnNpcsAroundPosition(SnapshotBuilder snapshot, Coordinates position, uint team) { float totalNpcs = SimulationSettings.HQStartingWizardsCount + SimulationSettings.HQStartingLumberjacksCount; float radiusFromHQ = SimulationSettings.NPCSpawnDistanceToHQ; for (int i = 0; i < totalNpcs; i++) { float radians = (i / totalNpcs) * 2 * Mathf.PI; Vector3 offset = new Vector3(Mathf.Cos(radians), 0, Mathf.Sin(radians)); offset *= radiusFromHQ; Coordinates coordinates = (position.ToVector3() + offset).ToCoordinates(); Entity entity = null; if (i < SimulationSettings.HQStartingLumberjacksCount) { entity = EntityTemplateFactory.CreateNPCLumberjackTemplate(coordinates, team); } else { entity = EntityTemplateFactory.CreateNPCWizardTemplate(coordinates, team); } var id = snapshot.GenerateId(); snapshot.Add(id, entity); } }
public static void AddCountry(SnapshotBuilder snapshot, Coordinates coordinates) { var entityId = snapshot.GenerateId(); var entity = EntityTemplateFactory.CreateCountryTemplate(coordinates); snapshot.Add(entityId, entity); }
public static void AddTree(SnapshotBuilder snapshot, Coordinates position) { var treeEntityId = snapshot.GenerateId(); var spawnRotation = (uint)Mathf.CeilToInt((float)rand.NextDouble() * 360.0f); var entity = EntityTemplateFactory.CreateTreeTemplate(position, spawnRotation); snapshot.Add(treeEntityId, entity); }
public static void AddHQs(SnapshotBuilder snapshot, Coordinates[] locations) { for (uint teamId = 0; teamId < locations.Length; teamId++) { var position = locations[teamId]; var entity = EntityTemplateFactory.CreateHQTemplate(position, 0, teamId); snapshot.Add(snapshot.GenerateId(), entity); } }
public static void AddPlayerSpawner(SnapshotBuilder snapshot) { var entity = EntityTemplateFactory.CreatePlayerSpawnerTemplate(); snapshot.Add(snapshot.GenerateId(), entity); }
public static void AddSimulationManagerEntity(SnapshotBuilder snapshot) { var entity = EntityTemplateFactory.CreateSimulationManagerTemplate(); snapshot.Add(snapshot.GenerateId(), entity); }