本文整理汇总了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;
}
示例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;
}
示例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
}
示例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;
}