本文整理汇总了C#中MyObjectBuilder_EntityBase类的典型用法代码示例。如果您正苦于以下问题:C# MyObjectBuilder_EntityBase类的具体用法?C# MyObjectBuilder_EntityBase怎么用?C# MyObjectBuilder_EntityBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyObjectBuilder_EntityBase类属于命名空间,在下文中一共展示了MyObjectBuilder_EntityBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(MyObjectBuilder_EntityBase builder)
{
var ob = (MyObjectBuilder_VoxelMap)builder;
if (ob == null)
{
return;
}
m_storage = MyStorageBase.Load(ob.StorageName);
//By Gregory: Added for compatibility with old saves
if(m_storage == null)
{
return;
}
Init(builder, m_storage);
if (ob.ContentChanged.HasValue)
{
ContentChanged = ob.ContentChanged.Value;
}
else
{
ContentChanged = true;
}
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:27,代码来源:MyVoxelMap.cs
示例2: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
this.objectBuilder = objectBuilder;
generator = Entity as IMyGravityGeneratorSphere;
generator.NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME;
added = false;
}
开发者ID:THDigi,项目名称:NaturalGravity,代码行数:7,代码来源:NaturalGravityGenerator.cs
示例3: Init
public override void Init(MyObjectBuilder_EntityBase builder)
{
ProfilerShort.Begin("base init");
SyncFlag = true;
base.Init(builder);
base.Init(null, null, null, null, null);
ProfilerShort.BeginNextBlock("Load file");
var ob = (MyObjectBuilder_VoxelMap)builder;
if (ob == null)
{
return;
}
if (ob.MutableStorage)
{
StorageName = ob.StorageName;
}
else
{
StorageName = string.Format("{0}-{1}", ob.StorageName, m_immutableStorageNameSalt++);
}
m_storage = MyStorageBase.Load(ob.StorageName);
m_storage.RangeChanged += storage_RangeChanged;
m_storageMax = m_storage.Size;
InitVoxelMap(ob.PositionAndOrientation.Value.Position, m_storage.Size);
ProfilerShort.End();
}
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:33,代码来源:MyVoxelMap.cs
示例4: ConvertInventoryBagToEntityBase
private MyObjectBuilder_EntityBase ConvertInventoryBagToEntityBase(MyObjectBuilder_EntityBase oldBagBuilder, Vector3 linearVelocity, Vector3 angularVelocity)
{
MyObjectBuilder_EntityBase newBuilder = ConvertBuilderToEntityBase(oldBagBuilder, null);
if (newBuilder == null)
return null;
if (newBuilder.ComponentContainer == null)
newBuilder.ComponentContainer = MyObjectBuilderSerializer.CreateNewObject(typeof(MyObjectBuilder_ComponentContainer), newBuilder.SubtypeName) as MyObjectBuilder_ComponentContainer;
foreach (var componentBuidler in newBuilder.ComponentContainer.Components)
{
if (componentBuidler.Component is MyObjectBuilder_PhysicsComponentBase)
{
// Data already written.
return newBuilder;
}
}
MyObjectBuilder_PhysicsComponentBase physicsComponent = MyObjectBuilderSerializer.CreateNewObject(typeof(MyObjectBuilder_PhysicsBodyComponent),
newBuilder.SubtypeName) as MyObjectBuilder_PhysicsComponentBase;
newBuilder.ComponentContainer.Components.Add(new MyObjectBuilder_ComponentContainer.ComponentData()
{ Component = physicsComponent, TypeId = typeof(MyPhysicsComponentBase).Name });
physicsComponent.LinearVelocity = linearVelocity;
physicsComponent.AngularVelocity = angularVelocity;
return newBuilder;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:28,代码来源:MySessionCompatHelper.cs
示例5: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
ProfilerShort.Begin("MyEntity.Init(objectBuilder)");
if (objectBuilder != null)
{
if (objectBuilder.PositionAndOrientation.HasValue)
{
var posAndOrient = objectBuilder.PositionAndOrientation.Value;
MatrixD matrix = MatrixD.CreateWorld(posAndOrient.Position, posAndOrient.Forward, posAndOrient.Up);
MyUtils.AssertIsValid(matrix);
Container.Entity.PositionComp.SetWorldMatrix(matrix);
}
// Do not copy EntityID if it gets overwritten later. It might
// belong to some existing entity that we're making copy of.
if (objectBuilder.EntityId != 0)
Container.Entity.EntityId = objectBuilder.EntityId;
Container.Entity.Name = objectBuilder.Name;
Container.Entity.Render.PersistentFlags = objectBuilder.PersistentFlags;
}
AllocateEntityID();
Container.Entity.InScene = false;
MyEntities.SetEntityName(m_entity, false);
if (m_entity.SyncFlag)
{
m_entity.CreateSync();
}
GameLogic.Init(objectBuilder);
ProfilerShort.End();
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:34,代码来源:MyEntityGameLogic.cs
示例6: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
MyDefinitionManager.Static.TryGetDefinition(objectBuilder.GetId(), out m_definition);
Debug.Assert(m_definition != null, "Area marker definition cannot be null!");
if (m_definition == null) return;
m_tmpPlaceAreas.Clear();
MyPlaceAreas.Static.GetAllAreas(m_tmpPlaceAreas);
MyPlaceArea firstFound = null;
int markerCount = 0;
foreach (var area in m_tmpPlaceAreas)
{
if (area.AreaType == m_definition.Id.SubtypeId)
{
if (firstFound == null)
firstFound = area;
++markerCount;
}
}
if (m_definition.MaxNumber >= 0 && markerCount >= m_definition.MaxNumber)
{
if (SyncFlag)
firstFound.Entity.SyncObject.SendCloseRequest();
else
firstFound.Entity.Close();
}
m_tmpPlaceAreas.Clear();
InitInternal();
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:34,代码来源:MyAreaMarker.cs
示例7: ConvertBuilderToEntityBase
/// <summary>
/// Converts the given builder to be of type EntityBase only with components. Prefix is added to sub type name for the created EntityBase and also for component builders.
/// Should be used when an entity was transformed to components and do not need specific entity implementation at all.
/// </summary>
protected MyObjectBuilder_EntityBase ConvertBuilderToEntityBase(MyObjectBuilder_EntityBase origEntity, string subTypeNamePrefix)
{
var origSubTypeName = !string.IsNullOrEmpty(origEntity.SubtypeName)
? origEntity.SubtypeName : (origEntity.EntityDefinitionId != null ? origEntity.EntityDefinitionId.Value.SubtypeName : null);
System.Diagnostics.Debug.Assert(origSubTypeName != null);
if (origSubTypeName == null)
return null;
var newSubTypeName = subTypeNamePrefix != null ? subTypeNamePrefix : "" + origSubTypeName;
MyObjectBuilder_EntityBase newBuilder = MyObjectBuilderSerializer.CreateNewObject(typeof(MyObjectBuilder_EntityBase), newSubTypeName) as MyObjectBuilder_EntityBase;
newBuilder.EntityId = origEntity.EntityId;
newBuilder.PersistentFlags = origEntity.PersistentFlags;
newBuilder.Name = origEntity.Name;
newBuilder.PositionAndOrientation = origEntity.PositionAndOrientation;
newBuilder.ComponentContainer = origEntity.ComponentContainer;
if (newBuilder.ComponentContainer != null && newBuilder.ComponentContainer.Components.Count > 0)
{
foreach (var componentBuidler in newBuilder.ComponentContainer.Components)
{
if (!string.IsNullOrEmpty(componentBuidler.Component.SubtypeName) && componentBuidler.Component.SubtypeName == origSubTypeName)
componentBuidler.Component.SubtypeName = newSubTypeName;
}
}
return newBuilder;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:32,代码来源:MySessionCompatHelper.cs
示例8: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
if (objectBuilder.SubtypeName != null && objectBuilder.SubtypeName.Length > 0)
m_physicalItemId = new MyDefinitionId(typeof(MyObjectBuilder_PhysicalGunObject), objectBuilder.SubtypeName + "Item");
PhysicalObject = (MyObjectBuilder_PhysicalGunObject)MyObjectBuilderSerializer.CreateNewObject(m_physicalItemId);
base.Init(objectBuilder, m_physicalItemId);
var definition = MyDefinitionManager.Static.GetPhysicalItemDefinition(m_physicalItemId);
Init(null, definition.Model, null, null, null);
Render.CastShadows = true;
Render.NeedsResolveCastShadow = false;
PhysicalObject.GunEntity = (MyObjectBuilder_EntityBase)objectBuilder.Clone();
PhysicalObject.GunEntity.EntityId = this.EntityId;
foreach (ToolSound toolSound in m_handItemDef.ToolSounds)
{
if (toolSound.type == null || toolSound.subtype == null || toolSound.sound == null)
continue;
if (toolSound.type.Equals("Main"))
{
if(toolSound.subtype.Equals("Idle"))
weldSoundIdle = new MySoundPair(toolSound.sound);
if (toolSound.subtype.Equals("Weld"))
weldSoundWeld = new MySoundPair(toolSound.sound);
}
}
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:28,代码来源:MyWelder.cs
示例9: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
// Fix old EntityDefinitionId with MyObjectBuilder_EntityBase.
if (objectBuilder.EntityDefinitionId != null && objectBuilder.EntityDefinitionId.Value.TypeId != typeof(MyObjectBuilder_InventoryBagEntity))
{
objectBuilder.EntityDefinitionId = new SerializableDefinitionId(typeof(MyObjectBuilder_InventoryBagEntity), objectBuilder.EntityDefinitionId.Value.SubtypeName);
}
base.Init(objectBuilder);
if (objectBuilder is MyObjectBuilder_InventoryBagEntity)
{
var builderIBE = (MyObjectBuilder_InventoryBagEntity)objectBuilder;
var physicsComponentBuilder = GetPhysicsComponentBuilder(builderIBE);
if (physicsComponentBuilder == null)
{
Physics.LinearVelocity = builderIBE.LinearVelocity;
Physics.AngularVelocity = builderIBE.AngularVelocity;
}
}
else if (objectBuilder is MyObjectBuilder_ReplicableEntity)
{
// Backward compatibility
var builderRE = (MyObjectBuilder_ReplicableEntity)objectBuilder;
Physics.LinearVelocity = builderRE.LinearVelocity;
Physics.AngularVelocity = builderRE.AngularVelocity;
}
else
{
Debug.Fail("Unknown object builder for inventory bag");
}
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:32,代码来源:MyInventoryBagEntity.cs
示例10: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
_objectBuilder = objectBuilder;
if (!_initialized)
_Init();
base.Init(objectBuilder);
}
开发者ID:Intueor,项目名称:Space-Engineers-Admin-script-mod,代码行数:9,代码来源:ProtectedCubePlacer.cs
示例11: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
_objectBuilder = objectBuilder;
if ( MyAPIGateway.Multiplayer != null && MyAPIGateway.Multiplayer.MultiplayerActive)
_Init();
base.Init(objectBuilder);
}
开发者ID:DigTron,项目名称:Space-Engineers-Admin-script-mod,代码行数:9,代码来源:ProtectedLandingGear.cs
示例12: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
Init(null, "Models\\Weapons\\AngleGrinder.mwm", null, null, null);
Render.CastShadows = true;
Render.NeedsResolveCastShadow = false;
PhysicalObject.GunEntity = (MyObjectBuilder_EntityBase)objectBuilder.Clone();
PhysicalObject.GunEntity.EntityId = this.EntityId;
}
开发者ID:martejj,项目名称:SpaceEngineers,代码行数:11,代码来源:MyAngleGrinder.cs
示例13: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
m_MergeBlock = Container.Entity as InGame.IMyShipMergeBlock;
//m_Grid = m_MergeBlock.CubeGrid as IMyCubeGrid;
m_Logger = new Logger(m_MergeBlock.EntityId.ToString(), "MergeBlock");
log("Attached to merge block", "Init");
(m_MergeBlock as IMyShipMergeBlock).BeforeMerge += beforeMerge;
}
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:11,代码来源:MergeBlock.cs
示例14: Init
// Gamelogic initialization
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
// Update each frame, note this may not work for all object's types!
Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
block = Entity as BlockModAPIType;
if (block == null || MyAPIGateway.Session == null) return;
BlockInit();
active = true;
}
开发者ID:justburn,项目名称:SE_Anima,代码行数:13,代码来源:Example1.cs
示例15: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
//Get door that script it attatched to.
Door = Entity as IMyDoor;
//Set up detonation callback when 'door' is opened.
Door.DoorStateChanged += Detonate;
m_objectBuilder = objectBuilder;
//DEBUG
//MyLogger.Default.ToScreen = false ;
//MyLogger.Default.WriteLine("Successfully placed a bolt");
}
开发者ID:Pritchy96,项目名称:Explosive-Bolt,代码行数:13,代码来源:ExplosiveBolt.cs
示例16: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
Init(null, null, null, null, null);
Render.CastShadows = true;
Render.NeedsResolveCastShadow = false;
HasSecondaryEffect = false;
HasPrimaryEffect = false;
m_firstShot = true;
//PhysicalObject.GunEntity = (MyObjectBuilder_EntityBase)objectBuilder.Clone();
}
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:14,代码来源:MyBlockPlacerBase.cs
示例17: SavePrefab
public static void SavePrefab(string prefabName, MyObjectBuilder_EntityBase entity)
{
var fsPath = Path.Combine(MyFileSystem.ContentPath, Path.Combine("Data", "Prefabs", prefabName + ".sbc"));
var prefab = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PrefabDefinition>();
prefab.Id = new MyDefinitionId(new MyObjectBuilderType(typeof(MyObjectBuilder_PrefabDefinition)), prefabName);
prefab.CubeGrid = (MyObjectBuilder_CubeGrid)entity;
var definitions = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_Definitions>();
definitions.Prefabs = new MyObjectBuilder_PrefabDefinition[1];
definitions.Prefabs[0] = prefab;
MyObjectBuilderSerializer.SerializeXML(fsPath, false, definitions);
}
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:14,代码来源:MyPrefabManager.cs
示例18: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
m_definition = MyDefinitionManager.Static.GetPhysicalItemDefinition(objectBuilder.GetId());
Init(null, m_definition.Model, null, null, null);
Render.SkipIfTooSmall = false;
Render.NeedsDraw = true;
this.InitSpherePhysics(MyMaterialType.METAL, Model, 1, 1, 1, 0, RigidBodyFlag.RBF_DEFAULT);
Physics.Enabled = true;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:15,代码来源:MyBaseInventoryItemEntity.cs
示例19: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
base.Init(objectBuilder);
var ob = (MyObjectBuilder_Rope)objectBuilder;
var ropeDefinitionId = new MyDefinitionId(typeof(MyObjectBuilder_RopeDefinition), ob.SubtypeName ?? "BasicRope");
var ropeDefinition = MyDefinitionManager.Static.GetRopeDefinition(ropeDefinitionId);
MyRopeComponent.AddRopeData(new MyRopeData
{
HookEntityIdA = ob.EntityIdHookA,
HookEntityIdB = ob.EntityIdHookB,
MaxRopeLength = ob.MaxRopeLength,
CurrentRopeLength = ob.CurrentRopeLength,
Definition = ropeDefinition,
}, ob.EntityId);
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:15,代码来源:MyRope.cs
示例20: Init
public override void Init(MyObjectBuilder_EntityBase objectBuilder)
{
var builder = objectBuilder as MyObjectBuilder_FloatingObject;
if (builder.Item.Amount <= 0)
{
// I can only prevent creation of entity by throwing exception. This might cause crashes when thrown outside of MyEntities.CreateFromObjectBuilder().
throw new ArgumentOutOfRangeException("MyPhysicalInventoryItem.Amount", string.Format("Creating floating object with invalid amount: {0}x '{1}'", builder.Item.Amount, builder.Item.Content.GetId()));
}
base.Init(objectBuilder);
this.Item = new MyPhysicalInventoryItem(builder.Item);
InitInternal();
NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
}
开发者ID:notten,项目名称:SpaceEngineers,代码行数:16,代码来源:MyFloatingObject.cs
注:本文中的MyObjectBuilder_EntityBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论