本文整理汇总了C#中MyEntity类的典型用法代码示例。如果您正苦于以下问题:C# MyEntity类的具体用法?C# MyEntity怎么用?C# MyEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyEntity类属于命名空间,在下文中一共展示了MyEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
// This method realy initiates/starts the missile
// IMPORTANT: Direction vector must be normalized!
public void Start(
Vector3 position,
Vector3 initialVelocity,
Vector3 direction,
float impulseMultiplier,
MyEntity owner)
{
if (Physics.Static)
{
Physics.Static = false;
}
base.Start(position, initialVelocity, direction, impulseMultiplier, owner, MyTextsWrapper.Get(MyTextsWrapperEnum.RemoteCameraHud));
Physics.AngularDamping = 1;
Health = MaxHealth;
m_directionAfterContact = null;
var ownerShip = owner as MySmallShip;
if (ownerShip != null)
{
ownerShip.Config.BackCamera.SetOn();
ownerShip.AddRemoteCamera(this);
ownerShip.SelectLastRemoteCamera();
}
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:28,代码来源:MyRemoteCamera.cs
示例2: Update
public override bool Update(MyPlayer player, MyEntity me)
{
if (me!=null)
if (Vector3D.DistanceSquared(me.PositionComp.GetPosition(), TargetPos) > m_maxDistance2)
m_IsTrue = true;
return IsTrue;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyTriggerPositionLeft.cs
示例3: Init
public static void Init()
{
if ( !PluginSettings.Instance.PlayerBlockEnforcementEnabled )
return;
if (_init)
return;
_init = true;
MyEntities.OnEntityAdd += MyEntities_OnEntityAdd;
HashSet<MyEntity> allEntities = new HashSet<MyEntity>();
Wrapper.GameAction( () => allEntities = MyEntities.GetEntities() );
MyEntity[] entitiesCopy = new MyEntity[allEntities.Count];
allEntities.CopyTo( entitiesCopy );
Parallel.ForEach( entitiesCopy, ( entity ) =>
{
var grid = entity as MyCubeGrid;
if ( grid == null )
return;
InitGrid( grid );
} );
Essentials.Log.Info( "Initialized player block enforcement." );
ProcessEnforcement();
}
开发者ID:rexxar-tc,项目名称:EssentialsPlugin,代码行数:29,代码来源:PlayerBlockEnforcement.cs
示例4: on_entity_deleted
private void on_entity_deleted(MyEntity entity)
{
//log_event("on_entity_deleted", entity);
var cube_grid = entity as MyCubeGrid;
if (cube_grid != null)
grid_manager.remove_grid(cube_grid);
}
开发者ID:Knsgf,项目名称:SE-diff-throttling,代码行数:7,代码来源:main.cs
示例5: Update
public override bool Update(MyPlayer player, MyEntity me)
{
if (MySession.Static.IsScenario)
if (m_limit <= DateTime.UtcNow - MyScenarioSystem.Static.ServerStartGameTime)
m_IsTrue = true;
return IsTrue;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyTriggerTimeLimit.cs
示例6: MyCharacterPhysicsStateGroup
public MyCharacterPhysicsStateGroup(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
// This is 9 bits per component which is more than enough (512 discrete values per-axis)
m_lowPrecisionOrientation = true;
FindSupportDelegate = () => MySupportHelper.FindSupportForCharacter(Entity);
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCharacterPhysicsStateGroup.cs
示例7: IsMoving
override protected bool IsMoving(MyEntity entity)
{
// Never know if somebody is moving entity when physics is null
return Entity.Physics == null
|| Vector3.IsZero(entity.Physics.LinearVelocity, PRECISION) == false
|| Entity.RotationSpeed > 0.0f;
}
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCharacterPhysicsStateGroup.cs
示例8: Update
public override ChangeInfo Update(MyEntity owner, long playerID = 0)
{
if (MyCubeBuilder.Static==null)
return ChangeInfo.None;
var blockDefinition = MyCubeBuilder.Static.IsActivated ? MyCubeBuilder.Static.ToolbarBlockDefinition : null;
if ((MyCubeBuilder.Static.BlockCreationIsActivated || MyCubeBuilder.Static.MultiBlockCreationIsActivated) && blockDefinition != null && (!MyFakes.ENABLE_BATTLE_SYSTEM || !MySession.Static.Battle))
{
var blockDef = (this.Definition as Sandbox.Definitions.MyCubeBlockDefinition);
if (blockDefinition.BlockPairName == blockDef.BlockPairName)
{
WantsToBeSelected = true;
}
else if (blockDef.BlockStages != null && blockDef.BlockStages.Contains(blockDefinition.Id))
{
WantsToBeSelected = true;
}
else
{
WantsToBeSelected = false;
}
}
else
{
WantsToBeSelected = false;
}
return ChangeInfo.None;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:27,代码来源:MyToolbarItemCubeBlock.cs
示例9: Update
public bool Update(MyPlayer player, MyEntity entity) //returns if lost
{
//MySessionComponentMission.Static.TryCreateFromDefault(Id);
//if (IsLocal(player.Id))
// UpdateLocal(player.Id);
if (!Sync.IsServer)
return false;
MyMissionTriggers mtrig;
if (!MissionTriggers.TryGetValue(player.Id, out mtrig))
{
//Debug.Assert(false,"Bad ID for update in missionTriggers");
mtrig = TryCreateFromDefault(player.Id, false);
}
mtrig.UpdateWin(player, entity);
if (!mtrig.Won)
mtrig.UpdateLose(player, entity);
else
{
m_someoneWon = true;
MyAnalyticsHelper.ReportTutorialEnd();
MyTutorialHelper.MissionSuccess();
}
return mtrig.Lost;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MySessionComponentMissionTriggers.cs
示例10: MyBasicObstacle
public MyBasicObstacle(MyEntity entity)
{
m_entity = entity;
m_entity.OnClosing += OnEntityClosing;
Update();
m_valid = true;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyDynamicObstacles.cs
示例11: SectorOnContactPoint
private void SectorOnContactPoint(int itemId, MyEntity other, ref MyPhysics.MyContactPointEvent e)
{
// if item is already disabled: puff
// We get multiple contact points so this is for that
if (m_sector.DataView.Items[itemId].ModelIndex < 0) return;
var vel = Math.Abs(e.ContactPointEvent.SeparatingVelocity);
if (other == null || other.Physics == null || other is MyFloatingObject) return;
if (other is IMyHandheldGunObject<MyDeviceBase>) return;
// Prevent debris from breaking trees.
// Debris flies in unpredictable ways and this could cause out of sync tree destruction which would is bad.
if (other.Physics.RigidBody != null && other.Physics.RigidBody.Layer == MyPhysics.CollisionLayers.DebrisCollisionLayer) return;
// On objects held in manipulation tool, Havok returns high velocities, after this contact is fired by contraint solver.
// Therefore we disable damage from objects connected by constraint to character
if (MyManipulationTool.IsEntityManipulated(other))
return;
float otherMass = MyDestructionHelper.MassFromHavok(other.Physics.Mass);
double impactEnergy = vel * vel * otherMass;
// TODO: per item max impact energy
if (impactEnergy > ItemResilience(itemId))
{
BreakAt(itemId, e.Position, e.ContactPointEvent.ContactPoint.Normal, impactEnergy);
}
// Meteor destroy always
if (other is MyMeteor)
m_sector.EnableItem(itemId, false);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:35,代码来源:MyBreakableEnvironmentProxy.cs
示例12: Init
public virtual void Init(Vector3 offset, MyEntity parentObject, MyModelsEnum model)
{
base.Init(null, model, null, parentObject, null, null);
LocalMatrix = Matrix.CreateTranslation(offset);
RotationSpeed = 0;
Save = false;
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:7,代码来源:MyDrillHead.cs
示例13: FindSupportForCharacterAABB
public static MyEntity FindSupportForCharacterAABB(MyEntity entity)
{
BoundingBoxD characterBox = entity.PositionComp.WorldAABB;
characterBox.Inflate(1.0);
m_entities.Clear();
MyEntities.GetTopMostEntitiesInBox(ref characterBox, m_entities);
float maxRadius = 0;
MyCubeGrid biggestGrid = null;
MyEntity voxel = null;
foreach(var parent in m_entities)
{
MyCubeGrid grid = parent as MyCubeGrid;
if(parent is MyVoxelBase)
{
voxel = (parent as MyVoxelBase).RootVoxel;
}
if(grid != null)
{
var rad = grid.PositionComp.LocalVolume.Radius;
if (rad > maxRadius || (rad == maxRadius && (biggestGrid == null || grid.EntityId > biggestGrid.EntityId)))
{
maxRadius = rad;
biggestGrid = grid;
}
}
}
if (biggestGrid == null)
{
return voxel;
}
return biggestGrid;
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:35,代码来源:MySupportHelper.cs
示例14: AddShotgun
// Not used apparently
public static void AddShotgun(MyProjectileAmmoDefinition ammoDefinition, MyEntity ignorePhysObject, Vector3 origin, Vector3 initialVelocity, Vector3 directionNormalized, bool groupStart, float thicknessMultiplier, MyEntity weapon, float frontBillboardSize, MyEntity ownerEntity = null, float projectileCountMultiplier = 1)
{
MyProjectile newProjectile = m_projectiles.Allocate();
if (newProjectile != null)
{
//newProjectile.Start(
// ammoDefinition,
// ignorePhysObject,
// origin,
// initialVelocity,
// directionNormalized,
// groupStart,
// thicknessMultiplier,
// 1,
// weapon,
// projectileCountMultiplier
// );
// newProjectile.BlendByCameraDirection = true;
// newProjectile.FrontBillboardMaterial = "ShotgunParticle";
// newProjectile.LengthMultiplier = 2;
// newProjectile.FrontBillboardSize = frontBillboardSize;
// newProjectile.OwnerEntity = ownerEntity != null ? ownerEntity : ignorePhysObject;
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:26,代码来源:MyProjectiles.cs
示例15: FirstIntoRowShouldReturnFirstRowIfMoreThanOneEntityUsed
public void FirstIntoRowShouldReturnFirstRowIfMoreThanOneEntityUsed()
{
var first = new MyEntity() { Table = "x" };
var second = new MyEntity() { Table = "y" };
var query = new SqlQuery().From(first).From(second.Table, Alias.T1).Into(second);
Assert.Equal(first, ((ISqlQueryExtensible)query).FirstIntoRow);
}
开发者ID:nxtayi,项目名称:Serenity,代码行数:7,代码来源:SqlQueryTests.cs
示例16: Add
public static void Add(MyEntity entity)
{
Debug.Assert(entity.Parent == null || (entity.Flags & EntityFlags.IsGamePrunningStructureObject) != 0, "Only topmost entities");
if (entity.TopMostPruningProxyId != MyVRageConstants.PRUNING_PROXY_ID_UNITIALIZED) return; // already inserted
BoundingBoxD bbox = GetEntityAABB(entity);
if (bbox.Size == Vector3D.Zero) return; // don't add entities with zero bounding boxes
if (IsEntityStatic(entity))
{
entity.TopMostPruningProxyId = m_staticObjectsTree.AddProxy(ref bbox, entity, 0);
entity.StaticForPruningStructure = true;
}
else
{
entity.TopMostPruningProxyId = m_dynamicObjectsTree.AddProxy(ref bbox, entity, 0);
entity.StaticForPruningStructure = false;
}
var voxelMap = entity as MyVoxelBase;
if (voxelMap != null)
{
voxelMap.VoxelMapPruningProxyId = m_voxelMapsTree.AddProxy(ref bbox, entity, 0);
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MyGamePruningStructure.cs
示例17: SetTarget
public void SetTarget(MyEntity entity, Vector3? relativeTarget = null)
{
m_mode = AimingMode.TARGET;
m_aimTarget = entity;
m_relativeTarget = relativeTarget;
Update();
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyBotAiming.cs
示例18: Init
public override void Init(StringBuilder displayName, Models.MyModelsEnum? modelLod0Enum, Models.MyModelsEnum? modelLod1Enum, MyEntity parentObject, float? scale, CommonLIB.AppCode.ObjectBuilders.MyMwcObjectBuilder_Base objectBuilder, Models.MyModelsEnum? modelCollision = null, Models.MyModelsEnum? modelLod2 = null)
{
base.Init(displayName, modelLod0Enum, modelLod1Enum, parentObject, scale, objectBuilder, modelCollision, modelLod2);
switch (modelLod0Enum)
{
case Models.MyModelsEnum.Cockpit_SS_04:
Crosshair = HUD.MyHudTexturesEnum.crosshair_nazzi;
break;
case Models.MyModelsEnum.Cockpit_Razorclaw:
Crosshair = HUD.MyHudTexturesEnum.crosshair_templary;
break;
case Models.MyModelsEnum.Cockpit_CN_03:
Crosshair = HUD.MyHudTexturesEnum.crosshair_russian;
break;
case Models.MyModelsEnum.OmniCorp_EAC01_Cockpit:
case Models.MyModelsEnum.OmniCorp01_Cockpit:
case Models.MyModelsEnum.OmniCorp04_Cockpit:
case Models.MyModelsEnum.OmniCorp03_Cockpit:
Crosshair = HUD.MyHudTexturesEnum.crosshair_omnicorp;
break;
case Models.MyModelsEnum.EAC02_Cockpit:
case Models.MyModelsEnum.EAC03_Cockpit:
case Models.MyModelsEnum.EAC04_Cockpit:
case Models.MyModelsEnum.EAC05_Cockpit:
default:
Crosshair = HUD.MyHudTexturesEnum.Crosshair01;
break;
}
m_modelLod0.PreloadTextures(LoadingMode.Immediate, MaterialIndex);
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:31,代码来源:MyCockpit.cs
示例19: MyRadioBroadcaster
public MyRadioBroadcaster(MyEntity parent, float broadcastRadius = 100)
{
SyncObject = new MySyncRadioBroadcaster(this);
Parent = parent;
m_broadcastRadius = broadcastRadius;
parent.OnClose += parent_OnClose;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyRadioBroadcaster.cs
示例20: m_entity_OnClose
void m_entity_OnClose(MyEntity obj)
{
if (m_shotSmoke != null)
{
MyParticlesManager.RemoveParticleEffect(m_shotSmoke);
m_shotSmoke = null;
}
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:8,代码来源:MyLargeBarrelBase.cs
注:本文中的MyEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论