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);
            }
        }
        private void SpawnLumberjack(Coordinates position)
        {
            var lumberjackCount = GetLumberjackCount();

            if (lumberjackCount >= 20)
            {
                return;
            }
            var template = EntityTemplateFactory.CreateNPCLumberjackTemplate(position, teamAssignment.Data.teamId);

            SpatialOS.Commands.CreateEntity(npcSpawner, template);
        }
Exemplo n.º 3
0
        private void SpawnLumberjack(Coordinates position)
        {
            var template = EntityTemplateFactory.CreateNPCLumberjackTemplate(position, teamAssignment.Data.teamId);

            SpatialOS.Commands.CreateEntity(npcSpawner, SimulationSettings.NPCPrefabName, template, result => { });
        }