当前位置: 首页>>代码示例>>C#>>正文


C# BoundingSphere.Include方法代码示例

本文整理汇总了C#中BoundingSphere.Include方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingSphere.Include方法的具体用法?C# BoundingSphere.Include怎么用?C# BoundingSphere.Include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingSphere的用法示例。


在下文中一共展示了BoundingSphere.Include方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        protected override void Init(MyObjectBuilder_DefinitionBase baseBuilder)
        {
            base.Init(baseBuilder);

            var builder = baseBuilder as MyObjectBuilder_SpawnGroupDefinition;

            Frequency = builder.Frequency;
            if (Frequency == 0.0f)
            {
                MySandboxGame.Log.WriteLine("Spawn group initialization: spawn group has zero frequency");
                return;
            }

            SpawnRadius = 0.0f;
            BoundingSphere sphere = new BoundingSphere(Vector3.Zero, float.MinValue);

            Prefabs.Clear();
            foreach (var prefab in builder.Prefabs)
            {
                SpawnGroupPrefab spawnPrefab = new SpawnGroupPrefab();
                spawnPrefab.Position = prefab.Position;
                spawnPrefab.SubtypeId = prefab.SubtypeId;
                spawnPrefab.BeaconText = prefab.BeaconText;
                spawnPrefab.Speed = prefab.Speed;

                var prefabDef = MyDefinitionManager.Static.GetPrefabDefinition(spawnPrefab.SubtypeId);
                if (prefabDef == null)
                {
                    System.Diagnostics.Debug.Assert(false, "Spawn group initialization: Could not get prefab " + spawnPrefab.SubtypeId);
                    MySandboxGame.Log.WriteLine("Spawn group initialization: Could not get prefab " + spawnPrefab.SubtypeId);
                    return;
                }

                BoundingSphere prefabSphere = prefabDef.BoundingSphere;
                prefabSphere.Center += spawnPrefab.Position;

                sphere.Include(prefabSphere);

                Prefabs.Add(spawnPrefab);
            }

            Voxels.Clear();
            if (builder.Voxels != null)
            {
                foreach (var prefab in builder.Voxels)
                {
                    SpawnGroupVoxel spawnPrefab = new SpawnGroupVoxel();
                    spawnPrefab.Offset = prefab.Offset;
                    spawnPrefab.StorageName = prefab.StorageName;

                    Voxels.Add(spawnPrefab);
                }
            }
            SpawnRadius = sphere.Radius + 5.0f; // Add 5m just to be sure
            IsEncounter = builder.IsEncounter;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:56,代码来源:MySpawnGroupDefinition.cs

示例2: GetBoundingSphereForGrids

 private static BoundingSphere GetBoundingSphereForGrids(MyObjectBuilder_CubeGrid[] currentPrefab)
 {
     BoundingSphere boundingSphere = new BoundingSphere(Vector3.Zero, float.MinValue);
     foreach (var gridBuilder in currentPrefab)
     {
         BoundingSphere localSphere = gridBuilder.CalculateBoundingSphere();
         MatrixD gridTransform = gridBuilder.PositionAndOrientation.HasValue ? gridBuilder.PositionAndOrientation.Value.GetMatrix() : MatrixD.Identity;
         boundingSphere.Include(localSphere.Transform(gridTransform));
     }
     return boundingSphere;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:11,代码来源:MyCubeGrid.Static.cs

示例3: ReloadPrefabs

        public void ReloadPrefabs()
        {
            BoundingSphere sphere = new BoundingSphere(Vector3.Zero, float.MinValue);
            foreach (var prefab in Prefabs)
            {
                var prefabDef = MyDefinitionManager.Static.GetPrefabDefinition(prefab.SubtypeId);
                if (prefabDef == null)
                {
                    System.Diagnostics.Debug.Assert(false, "Spawn group initialization: Could not get prefab " + prefab.SubtypeId);
                    MySandboxGame.Log.WriteLine("Spawn group initialization: Could not get prefab " + prefab.SubtypeId);
                    return;
                }

                if (prefabDef.CubeGrids == null)
                {
                    MyDefinitionManager.Static.ReloadPrefabsFromFile(prefabDef.PrefabPath);
                    prefabDef = MyDefinitionManager.Static.GetPrefabDefinition(prefab.SubtypeId);
                }

                BoundingSphere prefabSphere = prefabDef.BoundingSphere;
                prefabSphere.Center += prefab.Position;

                sphere.Include(prefabSphere);
            }
            SpawnRadius = sphere.Radius + 5.0f; // Add 5m just to be sure
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:26,代码来源:MySpawnGroupDefinition.cs

示例4: ReloadPrefabs

        public void ReloadPrefabs()
        {
            BoundingSphere sphere = new BoundingSphere(Vector3.Zero, float.MinValue);
            float radiusAddition = 0;
            foreach (var prefab in Prefabs)
            {
                var prefabDef = MyDefinitionManager.Static.GetPrefabDefinition(prefab.SubtypeId);
                if (prefabDef == null)
                {
                    System.Diagnostics.Debug.Assert(false, "Spawn group initialization: Could not get prefab " + prefab.SubtypeId);
                    MySandboxGame.Log.WriteLine("Spawn group initialization: Could not get prefab " + prefab.SubtypeId);
                    return;
                }

                BoundingSphere prefabSphere = prefabDef.BoundingSphere;
                prefabSphere.Center += prefab.Position;

                sphere.Include(prefabSphere);

                if (prefabDef.CubeGrids != null)
                {
                    foreach (var grid in prefabDef.CubeGrids)
                    {
                        float gridSize = MyDefinitionManager.Static.GetCubeSize(grid.GridSizeEnum);
                        radiusAddition = Math.Max(radiusAddition, 2 * gridSize);
                    }
                }
            }
            SpawnRadius = sphere.Radius + radiusAddition;
            m_initialized = true;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:31,代码来源:MySpawnGroupDefinition.cs


注:本文中的BoundingSphere.Include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。