• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyObjectBuilder_DefinitionBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MyObjectBuilder_DefinitionBase的典型用法代码示例。如果您正苦于以下问题:C# MyObjectBuilder_DefinitionBase类的具体用法?C# MyObjectBuilder_DefinitionBase怎么用?C# MyObjectBuilder_DefinitionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyObjectBuilder_DefinitionBase类属于命名空间,在下文中一共展示了MyObjectBuilder_DefinitionBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }   
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:25,代码来源:MyTransparentMaterialDefinition.cs


示例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);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:33,代码来源:MyVoxelMaterialDefinition.cs


示例3: Init

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

            m_postprocessBuilder = builder as MyObjectBuilder_ComponentGroupDefinition;
            MyDebug.AssertDebug(m_postprocessBuilder != null);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyComponentGroupDefinition.cs


示例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()));
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:25,代码来源:MyCraftingComponentBasicDefinition.cs


示例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;
			}
		}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MyEntityStatDefinition.cs


示例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;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyOreDetectorDefinition.cs


示例7: Init

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

            var ob = builder as MyObjectBuilder_EnvironmentItemDefinition;
            MyDebug.AssertDebug(ob != null);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyEnvironmentItemDefinition.cs


示例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;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:35,代码来源:MyPrefabDefinition.cs


示例9: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);
            var ob = builder as MyObjectBuilder_VoxelHandDefinition;

            MyDebug.AssertDebug(ob != null);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyVoxelHandDefinition.cs


示例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;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyContainerTypeDefinition.cs


示例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);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:31,代码来源:MyGlobalEventDefinition.cs


示例12: Init

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

            var ob = (MyObjectBuilder_MissileLauncherDefinition)builder;
            ProjectileMissile = ob.ProjectileMissile;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyMissileLauncherDefinition.cs


示例13: Init

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

            var ob = (MyObjectBuilder_ReflectorBlockDefinition)builder;
            ReflectorTexture = ob.ReflectorTexture;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyReflectorBlockDefinition.cs


示例14: Init

 protected override void Init(MyObjectBuilder_DefinitionBase baseBuilder)
 {
     base.Init(baseBuilder);
     var builder = baseBuilder as MyObjectBuilder_PrefabDefinition;
     PrefabPath = builder.PrefabPath;
     Initialized = false;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyPrefabDefinition.cs


示例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();
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:32,代码来源:MyPhysicalItemDefinition.cs


示例16: Init

 protected override void Init(MyObjectBuilder_DefinitionBase builder)
 {
     base.Init(builder);
     var ob = builder as MyObjectBuilder_AudioEffectDefinition;
     Effect.EffectId = Id.SubtypeId;
     foreach( var soundsEffects in ob.Sounds)
     {
         var soundsEffects2 = new List<MyAudioEffect.SoundEffect>();
         foreach(var effect in soundsEffects.SoundEffects)
         {
             var seff = new MyAudioEffect.SoundEffect();
             MyCurveDefinition def;
             if(!MyDefinitionManager.Static.TryGetDefinition<MyCurveDefinition>(new MyDefinitionId(typeof (MyObjectBuilder_CurveDefinition), effect.VolumeCurve), out def))
             {
                 seff.VolumeCurve = null;
             }
             else
                 seff.VolumeCurve = def.Curve;
             seff.Duration = effect.Duration;
             seff.Filter = effect.Filter;
             seff.Frequency = (float)(2 * Math.Sin(3.14 * effect.Frequency / 44100));
             
             seff.OneOverQ = 1 / effect.Q;
             seff.StopAfter = effect.StopAfter;
             soundsEffects2.Add(seff);
         }
         Effect.SoundsEffects.Add(soundsEffects2);
     }
     if (ob.OutputSound == 0)
         Effect.ResultEmitterIdx = Effect.SoundsEffects.Count - 1;
     else
         Effect.ResultEmitterIdx = ob.OutputSound - 1;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:33,代码来源:MyEffectDefinition.cs


示例17: Init

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

            MyDebug.AssertDebug(builder is MyObjectBuilder_ProductionBlockDefinition);
            var obDefinition = builder as MyObjectBuilder_ProductionBlockDefinition;

            this.InventoryMaxVolume = obDefinition.InventoryMaxVolume;
            this.InventorySize = obDefinition.InventorySize;
	        ResourceSinkGroup = MyStringHash.GetOrCompute(obDefinition.ResourceSinkGroup);
            this.StandbyPowerConsumption = obDefinition.StandbyPowerConsumption;
            this.OperationalPowerConsumption = obDefinition.OperationalPowerConsumption;

            System.Diagnostics.Debug.Assert(obDefinition.BlueprintClasses != null, "Production block has no blueprint classes specified");
            if (obDefinition.BlueprintClasses == null)
                InitializeLegacyBlueprintClasses(obDefinition);

            BlueprintClasses = new List<MyBlueprintClassDefinition>();
            for (int i = 0; i < obDefinition.BlueprintClasses.Length; ++i)
            {
                var className = obDefinition.BlueprintClasses[i];
                var classDef = MyDefinitionManager.Static.GetBlueprintClass(className);
                System.Diagnostics.Debug.Assert(classDef != null, "Production block references non-existent blueprint class");
                if (classDef == null) continue;

                BlueprintClasses.Add(classDef);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MyProductionBlockDefinition.cs


示例18: Init

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

            MyObjectBuilder_BlueprintDefinition builder = (MyObjectBuilder_BlueprintDefinition)ob;

            Prerequisites = new Item[builder.Prerequisites.Length];
            for (int i = 0; i < Prerequisites.Length; ++i)
            {
                Prerequisites[i] = Item.FromObjectBuilder(builder.Prerequisites[i]);
            }
            if (builder.Result != null)
            {
                Results = new Item[1];
                Results[0] = Item.FromObjectBuilder(builder.Result);
            }
            else
            {
                Results = new Item[builder.Results.Length];
                for (int i = 0; i < Results.Length; ++i)
                {
                    Results[i] = Item.FromObjectBuilder(builder.Results[i]);
                }
            }
            BaseProductionTimeInSeconds = builder.BaseProductionTimeInSeconds;
            PostprocessNeeded = true;
            ProgressBarSoundCue = builder.ProgressBarSoundCue;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MyBlueprintDefinition.cs


示例19: Init

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

            var ob = builder as MyObjectBuilder_ToolItemDefinition;
            MyDebug.AssertDebug(ob != null);

            if (ob.VoxelMinings != null && ob.VoxelMinings.Length > 0)
            {
                VoxelMinings = new MyVoxelMiningDefinition[ob.VoxelMinings.Length];

                for (int i = 0; i < ob.VoxelMinings.Length; ++i)
                {
                    VoxelMinings[i].MinedOre = ob.VoxelMinings[i].MinedOre;
                    VoxelMinings[i].HitCount = ob.VoxelMinings[i].HitCount;
                    VoxelMinings[i].PhysicalItemId = ob.VoxelMinings[i].PhysicalItemId;
                    VoxelMinings[i].RemovedRadius = ob.VoxelMinings[i].RemovedRadius;
                    VoxelMinings[i].OnlyApplyMaterial = ob.VoxelMinings[i].OnlyApplyMaterial;
                }
            }

            CopyActions(ob.PrimaryActions, PrimaryActions);
            CopyActions(ob.SecondaryActions, SecondaryActions);

            HitDistance = ob.HitDistance;

        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MyToolItemDefinition.cs


示例20: Init

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

            var upgradeDef = builder as MyObjectBuilder_UpgradeModuleDefinition;

            Upgrades = upgradeDef.Upgrades;
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:8,代码来源:MyUpgradeModuleDefinition.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyObjectBuilder_EntityBase类代码示例发布时间:2022-05-24
下一篇:
C# MyObjectBuilder_CubeGrid类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap