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


C# Definitions.MyObjectBuilder_DefinitionBase类代码示例

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


MyObjectBuilder_DefinitionBase类属于Sandbox.Common.ObjectBuilders.Definitions命名空间,在下文中一共展示了MyObjectBuilder_DefinitionBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

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

            var ob = builder as MyObjectBuilder_AgentDefinition;
            this.BotModel = ob.BotModel;
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:7,代码来源:MyAgentDefinition.cs

示例2: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            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(FirstActivationTime.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:austusross,项目名称:SpaceEngineers,代码行数:25,代码来源:MyGlobalEventDefinition.cs

示例3: 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:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyOreDetectorDefinition.cs

示例4: 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:fluxit,项目名称:SpaceEngineers,代码行数:31,代码来源:MyGlobalEventDefinition.cs

示例5: Init

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

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

示例6: 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;
            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:Krulac,项目名称:SpaceEngineers,代码行数:27,代码来源:MyProductionBlockDefinition.cs

示例7: 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:fluxit,项目名称:SpaceEngineers,代码行数:35,代码来源:MyPrefabDefinition.cs

示例8: Init

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

            var warheadBuilder = (MyObjectBuilder_WarheadDefinition)builder;
            ExplosionRadius = warheadBuilder.ExplosionRadius;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MyWarheadDefinition.cs

示例9: Init

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

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

示例10: Init

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

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

示例11: Init

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

            Diameter = ob.Diameter;
            Deviation = ob.Deviation;
            StructureRatio = ob.StructureRatio;
            NormalNoiseValue = ob.NormalNoiseValue;
            HasAtmosphere = ob.HasAtmosphere;

            HillParams = ob.HillParams;
            CanyonParams = ob.CanyonParams;
            NumLayers = ob.NumLayers;
            HostilityProbability = ob.HostilityProbability;

            SouthPole = ob.SouthPole;
            NorthPole = ob.NorthPole;

            FloraMaterialSpawnProbability = ob.FloraMaterialSpawnProbability;


            OrganicHeightEnd = ob.OrganicHeightEnd;

            MetalsOreProbability =  ob.MetalsOreProbability;

            GravityFalloffPower = ob.GravityFalloffPower;

            HostileAtmosphereColorShift = ob.HostileAtmosphereColorShift;

            MaterialsMaxDeph = ob.MaterialsMaxDeph;
            MaterialsMinDeph = ob.MaterialsMinDeph;
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:33,代码来源:MyPlanetGeneratorDefinition.cs

示例12: 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.Count()];
            m_itemSelection = new bool[definition.Items.Count()];
            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:fluxit,项目名称:SpaceEngineers,代码行数:30,代码来源:MyContainerTypeDefinition.cs

示例13: Init

 protected override void Init(MyObjectBuilder_DefinitionBase builder)
 {
     base.Init(builder);
     var batteryBlockBuilder = builder as MyObjectBuilder_BatteryBlockDefinition;
     MaxStoredPower = batteryBlockBuilder.MaxStoredPower;
     RequiredPowerInput = batteryBlockBuilder.RequiredPowerInput;
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:7,代码来源:MyBatteryBlockDefinition.cs

示例14: Init

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

            var thrustBuilder = builder as MyObjectBuilder_ThrustDefinition;
            MyDebug.AssertDebug(thrustBuilder != null, "Initializing thrust definition using wrong object builder.");

	        ResourceSinkGroup = MyStringHash.GetOrCompute(thrustBuilder.ResourceSinkGroup);
            FuelConverter = thrustBuilder.FuelConverter;
			SlowdownFactor = thrustBuilder.SlowdownFactor;
            ForceMagnitude = thrustBuilder.ForceMagnitude;
            MaxPowerConsumption = thrustBuilder.MaxPowerConsumption;
            MinPowerConsumption = thrustBuilder.MinPowerConsumption;
            FlameDamageLengthScale = thrustBuilder.FlameDamageLengthScale;
            FlameDamage = thrustBuilder.FlameDamage;
            FlameLengthScale = thrustBuilder.FlameLengthScale;
            FlameFullColor = thrustBuilder.FlameFullColor;
            FlameIdleColor = thrustBuilder.FlameIdleColor;
            FlamePointMaterial = thrustBuilder.FlamePointMaterial;
            FlameLengthMaterial = thrustBuilder.FlameLengthMaterial;
            FlameGlareMaterial = thrustBuilder.FlameGlareMaterial;
            FlameVisibilityDistance = thrustBuilder.FlameVisibilityDistance;
            FlameGlareSize = thrustBuilder.FlameGlareSize;
            FlameGlareQuerySize = thrustBuilder.FlameGlareQuerySize;

            EffectivenessAtMinInfluence = thrustBuilder.EffectivenessAtMinInfluence;
            EffectivenessAtMaxInfluence = thrustBuilder.EffectivenessAtMaxInfluence;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:28,代码来源:MyThrustDefinition.cs

示例15: Init

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

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

			this.MaterialTypeName		= builder.MaterialTypeName;
            this.MinedOre               = builder.MinedOre;
            this.MinedOreRatio          = builder.MinedOreRatio;
            this.CanBeHarvested         = builder.CanBeHarvested;
            this.IsRare                 = builder.IsRare;
            this.SpawnsInAsteroids      = builder.SpawnsInAsteroids;
            this.SpawnsFromMeteorites   = builder.SpawnsFromMeteorites;
            this.DamageRatio            = builder.DamageRatio;
            this.DiffuseXZ              = builder.DiffuseXZ;
            this.DiffuseY               = builder.DiffuseY;
            this.NormalXZ               = builder.NormalXZ;
            this.NormalY                = builder.NormalY;
            this.SpecularPower          = builder.SpecularPower;
            this.SpecularShininess      = builder.SpecularShininess;
            this.MinVersion             = builder.MinVersion;
            this.SpawnsFlora            = builder.SpawnsFlora;
            this.BiomeValue = 0;
            SpawnChannels = builder.SpawnChannels;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:26,代码来源:MyVoxelMaterialDefinition.cs


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