コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public static void AddCountry(SnapshotBuilder snapshot, Coordinates coordinates)
        {
            var entityId = snapshot.GenerateId();
            var entity   = EntityTemplateFactory.CreateCountryTemplate(coordinates);

            snapshot.Add(entityId, entity);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        public static void AddPlayerSpawner(SnapshotBuilder snapshot)
        {
            var entity = EntityTemplateFactory.CreatePlayerSpawnerTemplate();

            snapshot.Add(snapshot.GenerateId(), entity);
        }
コード例 #6
0
        public static void AddSimulationManagerEntity(SnapshotBuilder snapshot)
        {
            var entity = EntityTemplateFactory.CreateSimulationManagerTemplate();

            snapshot.Add(snapshot.GenerateId(), entity);
        }