コード例 #1
0
        public int SpawnEntity(string entityType, Vector3 pos, Quaternion rot)
        {
            EntitySimulator entity = new EntitySimulator();

            entity.Id       = SimulationHost.NextEntityId;
            entity.Name     = "Simulated Entity #" + entity.Id.ToString();
            entity.Type     = EntityType.Civilian;
            entity.Position = pos;
            entity.Rotation = rot;
            this.AddEntity(entity);
            return(entity.Id);
        }
コード例 #2
0
        public void GeneratePoIs(int count)
        {
            EntitySimulator entity;

            for (int i = 0; i < count; i++)
            {
                entity      = new EntitySimulator();
                entity.Id   = SimulationHost.NextEntityId;
                entity.Name = "PoI #" + entity.Id.ToString();
                entity.Type = EntityType.BA;
                if (this.Terrain != null)
                {
                    entity.Position = new Vector3(
                        (float)((this.random.NextDouble() * this.Terrain.Width) - (this.Terrain.Width / 2.0)), 0.0f,
                        (float)((this.random.NextDouble() * this.Terrain.Height) - (this.Terrain.Height / 2.0)));
                    entity.position.y = this.GetTerrainHeightAt(entity.Position.x, entity.Position.z);
                }
                this.AddEntity(entity);
            }
        }