本文整理汇总了C#中MyObjectBuilder_DefinitionBase类的典型用法代码示例。如果您正苦于以下问题:C# MyObjectBuilder_DefinitionBase类的具体用法?C# MyObjectBuilder_DefinitionBase怎么用?C# MyObjectBuilder_DefinitionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyObjectBuilder_DefinitionBase类属于命名空间,在下文中一共展示了MyObjectBuilder_DefinitionBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var materialBuilder = builder as MyObjectBuilder_TransparentMaterialDefinition;
MyDebug.AssertDebug(materialBuilder != null, "Initializing transparent material definition using wrong object builder.");
Texture = materialBuilder.Texture;
TextureType = materialBuilder.TextureType;
CanBeAffectedByLights = materialBuilder.CanBeAffectedByOtherLights;
AlphaMistingEnable = materialBuilder.AlphaMistingEnable;
IgnoreDepth = materialBuilder.IgnoreDepth;
NeedSort = materialBuilder.NeedSort;
UseAtlas = materialBuilder.UseAtlas;
AlphaMistingStart = materialBuilder.AlphaMistingStart;
AlphaMistingEnd = materialBuilder.AlphaMistingEnd;
SoftParticleDistanceScale = materialBuilder.SoftParticleDistanceScale;
Emissivity = materialBuilder.Emissivity;
AlphaSaturation = materialBuilder.AlphaSaturation;
Reflection = materialBuilder.Reflection;
Reflectivity = materialBuilder.Reflectivity;
Color = materialBuilder.Color;
AlphaCutout = materialBuilder.AlphaCutout;
TargetSize = materialBuilder.TargetSize;
}
示例2: Init
protected override void Init(MyObjectBuilder_DefinitionBase ob)
{
base.Init(ob);
var builder = ob as MyObjectBuilder_VoxelMaterialDefinition;
MyDebug.AssertDebug(builder != null);
MaterialTypeName = builder.MaterialTypeName;
MinedOre = builder.MinedOre;
MinedOreRatio = builder.MinedOreRatio;
CanBeHarvested = builder.CanBeHarvested;
IsRare = builder.IsRare;
SpawnsInAsteroids = builder.SpawnsInAsteroids;
SpawnsFromMeteorites = builder.SpawnsFromMeteorites;
DamageRatio = builder.DamageRatio;
DiffuseXZ = builder.DiffuseXZ;
DiffuseY = builder.DiffuseY;
NormalXZ = builder.NormalXZ;
NormalY = builder.NormalY;
SpecularPower = builder.SpecularPower;
SpecularShininess = builder.SpecularShininess;
MinVersion = builder.MinVersion;
if (!string.IsNullOrEmpty(builder.ParticleEffect))
{
ParticleEffect = (MyParticleEffectsIDEnum)Enum.Parse(typeof(MyParticleEffectsIDEnum), builder.ParticleEffect);
}
else
{
ParticleEffect = MyParticleEffectsIDEnum.None;
}
DamageThreshold = (int) (builder.DamageThreashold*255);
DamagedMaterial = MyStringHash.GetOrCompute(builder.DamagedMaterial);
}
示例3: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
m_postprocessBuilder = builder as MyObjectBuilder_ComponentGroupDefinition;
MyDebug.AssertDebug(m_postprocessBuilder != null);
}
示例4: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_CraftingComponentBasicDefinition;
ActionSound = ob.ActionSound;
CraftingSpeedMultiplier = ob.CraftingSpeedMultiplier;
if (ob.AvailableBlueprintClasses != null && ob.AvailableBlueprintClasses != String.Empty)
{
AvailableBlueprintClasses = ob.AvailableBlueprintClasses.Split(' ').ToList();
// TODO: REMOVE WHEN DURABILITY CAN BE ENABLED BYT DEFAULT..
if (!MyFakes.ENABLE_DURABILITY_COMPONENT)
{
if (AvailableBlueprintClasses.Contains("ToolsRepair"))
AvailableBlueprintClasses.Remove("ToolsRepair");
}
}
else
{
System.Diagnostics.Debug.Fail(String.Format("Problem initializing crafting block component definition {0}, it is missing available blueprint classes!", Id.ToString()));
}
}
示例5: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var objectBuilder = builder as MyObjectBuilder_EntityStatDefinition;
MinValue = objectBuilder.MinValue;
MaxValue = objectBuilder.MaxValue;
DefaultValue = objectBuilder.DefaultValue;
EnabledInCreative = objectBuilder.EnabledInCreative;
Name = objectBuilder.Name;
if (float.IsNaN(DefaultValue)) DefaultValue = MaxValue;
GuiDef = new GuiDefinition();
if (objectBuilder.GuiDef != null)
{
GuiDef.HeightMultiplier = objectBuilder.GuiDef.HeightMultiplier;
GuiDef.Priority = objectBuilder.GuiDef.Priority;
GuiDef.Color = objectBuilder.GuiDef.Color;
GuiDef.CriticalRatio = objectBuilder.GuiDef.CriticalRatio;
GuiDef.DisplayCriticalDivider = objectBuilder.GuiDef.DisplayCriticalDivider;
GuiDef.CriticalColorFrom = objectBuilder.GuiDef.CriticalColorFrom;
GuiDef.CriticalColorTo = objectBuilder.GuiDef.CriticalColorTo;
}
}
示例6: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_OreDetectorDefinition;
ResourceSinkGroup = MyStringHash.GetOrCompute(ob.ResourceSinkGroup);
MaximumRange = ob.MaximumRange;
}
示例7: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_EnvironmentItemDefinition;
MyDebug.AssertDebug(ob != null);
}
示例8: InitLazy
public void InitLazy(MyObjectBuilder_DefinitionBase baseBuilder)
{
var builder = baseBuilder as MyObjectBuilder_PrefabDefinition;
Debug.Assert(builder.CubeGrid != null || builder.CubeGrids != null, "No cube grids defined in prefab " + PrefabPath);
if (builder.CubeGrid == null && builder.CubeGrids == null) return;
// Backwards compatiblity
if (builder.CubeGrid != null)
m_cubeGrids = new MyObjectBuilder_CubeGrid[1] { builder.CubeGrid };
else
m_cubeGrids = builder.CubeGrids;
m_boundingSphere = new BoundingSphere(Vector3.Zero, float.MinValue);
m_boundingBox = BoundingBox.CreateInvalid();
foreach (var grid in m_cubeGrids)
{
BoundingBox localBB = grid.CalculateBoundingBox();
Matrix gridTransform = grid.PositionAndOrientation.HasValue ? (Matrix)grid.PositionAndOrientation.Value.GetMatrix() : Matrix.Identity;
m_boundingBox.Include(localBB.Transform(gridTransform));
}
m_boundingSphere = BoundingSphere.CreateFromBoundingBox(m_boundingBox);
foreach (var gridBuilder in m_cubeGrids)
{
gridBuilder.CreatePhysics = true;
gridBuilder.XMirroxPlane = null;
gridBuilder.YMirroxPlane = null;
gridBuilder.ZMirroxPlane = null;
}
Initialized = true;
}
示例9: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_VoxelHandDefinition;
MyDebug.AssertDebug(ob != null);
}
示例10: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
MyObjectBuilder_ContainerTypeDefinition definition = builder as MyObjectBuilder_ContainerTypeDefinition;
CountMin = definition.CountMin;
CountMax = definition.CountMax;
ItemsCumulativeFrequency = 0.0f;
int i = 0;
Items = new ContainerTypeItem[definition.Items.Length];
m_itemSelection = new bool[definition.Items.Length];
foreach (var itemBuilder in definition.Items)
{
ContainerTypeItem item = new ContainerTypeItem();
item.AmountMax = MyFixedPoint.DeserializeStringSafe(itemBuilder.AmountMax);
item.AmountMin = MyFixedPoint.DeserializeStringSafe(itemBuilder.AmountMin);
item.Frequency = Math.Max(itemBuilder.Frequency, 0.0f);
item.DefinitionId = itemBuilder.Id;
ItemsCumulativeFrequency += item.Frequency;
Items[i] = item;
m_itemSelection[i] = false;
++i;
}
m_tempCumulativeFreq = ItemsCumulativeFrequency;
}
示例11: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
// Backward compatibility with definitions of events that have MyObjectBuilder_GlobalEventDefinition as the TypeId
if (builder.Id.TypeId == typeof(MyObjectBuilder_GlobalEventDefinition))
{
builder.Id = new VRage.ObjectBuilders.SerializableDefinitionId(typeof(MyObjectBuilder_GlobalEventBase), builder.Id.SubtypeName);
}
base.Init(builder);
var eventBuilder = builder as MyObjectBuilder_GlobalEventDefinition;
// This ensures that either both min and max activation time are specified or neither of them is
if (eventBuilder.MinActivationTimeMs.HasValue && !eventBuilder.MaxActivationTimeMs.HasValue)
{
eventBuilder.MaxActivationTimeMs = eventBuilder.MinActivationTimeMs;
}
if (eventBuilder.MaxActivationTimeMs.HasValue && !eventBuilder.MinActivationTimeMs.HasValue)
{
eventBuilder.MinActivationTimeMs = eventBuilder.MaxActivationTimeMs;
}
Debug.Assert(eventBuilder.FirstActivationTimeMs.HasValue || eventBuilder.MinActivationTimeMs.HasValue, "Global event definition has to have either the FirstActivationTime or [Min/Max]ActivationTime specified");
if (eventBuilder.MinActivationTimeMs.HasValue)
MinActivationTime = TimeSpan.FromTicks(eventBuilder.MinActivationTimeMs.Value * TimeSpan.TicksPerMillisecond);
if (eventBuilder.MaxActivationTimeMs.HasValue)
MaxActivationTime = TimeSpan.FromTicks(eventBuilder.MaxActivationTimeMs.Value * TimeSpan.TicksPerMillisecond);
if (eventBuilder.FirstActivationTimeMs.HasValue)
FirstActivationTime = TimeSpan.FromTicks(eventBuilder.FirstActivationTimeMs.Value * TimeSpan.TicksPerMillisecond);
}
示例12: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = (MyObjectBuilder_MissileLauncherDefinition)builder;
ProjectileMissile = ob.ProjectileMissile;
}
示例13: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = (MyObjectBuilder_ReflectorBlockDefinition)builder;
ReflectorTexture = ob.ReflectorTexture;
}
示例14: Init
protected override void Init(MyObjectBuilder_DefinitionBase baseBuilder)
{
base.Init(baseBuilder);
var builder = baseBuilder as MyObjectBuilder_PrefabDefinition;
PrefabPath = builder.PrefabPath;
Initialized = false;
}
示例15: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_PhysicalItemDefinition;
MyDebug.AssertDebug(ob != null);
this.Size = ob.Size;
this.Mass = ob.Mass;
this.Model = ob.Model;
this.Models = ob.Models;
this.Volume = ob.Volume.HasValue? ob.Volume.Value / 1000f : ob.Size.Volume;
if (string.IsNullOrEmpty(ob.IconSymbol))
this.IconSymbol = null;
else
this.IconSymbol = MyStringId.GetOrCompute(ob.IconSymbol);
PhysicalMaterial = MyStringHash.GetOrCompute(ob.PhysicalMaterial);
VoxelMaterial = MyStringHash.GetOrCompute(ob.VoxelMaterial);
CanSpawnFromScreen = ob.CanSpawnFromScreen;
RotateOnSpawnX = ob.RotateOnSpawnX;
RotateOnSpawnY = ob.RotateOnSpawnY;
RotateOnSpawnZ = ob.RotateOnSpawnZ;
Health = ob.Health;
if (ob.DestroyedPieceId.HasValue)
{
DestroyedPieceId = ob.DestroyedPieceId.Value;
}
DestroyedPieces = ob.DestroyedPieces;
if (ob.ExtraInventoryTooltipLine != null)
ExtraInventoryTooltipLine = new StringBuilder().Append(Environment.NewLine).Append(ob.ExtraInventoryTooltipLine);
else
ExtraInventoryTooltipLine = new StringBuilder();
}