本文整理汇总了C#中Entity类的典型用法代码示例。如果您正苦于以下问题:C# Entity类的具体用法?C# Entity怎么用?C# Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entity类属于命名空间,在下文中一共展示了Entity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CollidedWith
public override void CollidedWith(Entity e)
{
base.CollidedWith (e);
if (e is TerrainEntity && e.Collidable && !(e is PitEntity)) {
alive = false;
}
}
示例2: SwivelHingeAngularJoint
/// <summary>
/// Constructs a new constraint which allows relative angular motion around a hinge axis and a twist axis.
/// </summary>
/// <param name="connectionA">First connection of the pair.</param>
/// <param name="connectionB">Second connection of the pair.</param>
/// <param name="worldHingeAxis">Hinge axis attached to connectionA.
/// The connected entities will be able to rotate around this axis relative to each other.</param>
/// <param name="worldTwistAxis">Twist axis attached to connectionB.
/// The connected entities will be able to rotate around this axis relative to each other.</param>
public SwivelHingeAngularJoint(Entity connectionA, Entity connectionB, Vector3 worldHingeAxis, Vector3 worldTwistAxis)
{
ConnectionA = connectionA;
ConnectionB = connectionB;
WorldHingeAxis = worldHingeAxis;
WorldTwistAxis = worldTwistAxis;
}
示例3: OnCollisionSolid
public override bool OnCollisionSolid(Entity other)
{
Debug.Log("In Collision");
ChatController.Show ("Hello welcome to college, I will be you're advisor");
return true;
}
示例4: SplitCompound
/// <summary>
/// Splits a single compound collidable into two separate compound collidables and computes information needed by the simulation.
/// </summary>
/// <param name="childContributions">List of distribution information associated with each child shape of the whole compound shape used by the compound being split.</param>
/// <param name="splitPredicate">Delegate which determines if a child in the original compound should be moved to the new compound.</param>
/// <param name="a">Original compound to be split. Children in this compound will be removed and added to the other compound.</param>
/// <param name="b">Compound to receive children removed from the original compound.</param>
/// <param name="distributionInfoA">Volume, volume distribution, and center information about the new form of the original compound collidable.</param>
/// <param name="distributionInfoB">Volume, volume distribution, and center information about the new compound collidable.</param>
/// <returns>Whether or not the predicate returned true for any element in the original compound and split the compound.</returns>
public static bool SplitCompound(IList<ShapeDistributionInformation> childContributions, Func<CompoundChild, bool> splitPredicate,
Entity<CompoundCollidable> a, out Entity<CompoundCollidable> b,
out ShapeDistributionInformation distributionInfoA, out ShapeDistributionInformation distributionInfoB)
{
var bCollidable = new CompoundCollidable { Shape = a.CollisionInformation.Shape };
b = null;
float weightA, weightB;
if (SplitCompound(childContributions, splitPredicate, a.CollisionInformation, bCollidable, out distributionInfoA, out distributionInfoB, out weightA, out weightB))
{
//Reconfigure the entities using the data computed in the split.
float originalMass = a.mass;
if (a.CollisionInformation.children.Count > 0)
{
float newMassA = (weightA / (weightA + weightB)) * originalMass;
Matrix3x3.Multiply(ref distributionInfoA.VolumeDistribution, newMassA * InertiaHelper.InertiaTensorScale, out distributionInfoA.VolumeDistribution);
a.Initialize(a.CollisionInformation, newMassA, distributionInfoA.VolumeDistribution, distributionInfoA.Volume);
}
if (bCollidable.children.Count > 0)
{
float newMassB = (weightB / (weightA + weightB)) * originalMass;
Matrix3x3.Multiply(ref distributionInfoB.VolumeDistribution, newMassB * InertiaHelper.InertiaTensorScale, out distributionInfoB.VolumeDistribution);
b = new Entity<CompoundCollidable>();
b.Initialize(bCollidable, newMassB, distributionInfoB.VolumeDistribution, distributionInfoB.Volume);
}
SplitReposition(a, b, ref distributionInfoA, ref distributionInfoB, weightA, weightB);
return true;
}
else
return false;
}
示例5: QueryManager
/// <summary>
/// Constructs the query manager for a character.
/// </summary>
public QueryManager(Entity characterBody, CharacterContactCategorizer contactCategorizer)
{
this.characterBody = characterBody;
this.contactCategorizer = contactCategorizer;
SupportRayFilter = SupportRayFilterFunction;
}
示例6: WorkitemPropertyDescriptor
private WorkitemPropertyDescriptor(Entity entity, string name, string attribute, Attribute[] attrs, PropertyUpdateSource updateSource)
: base(name, attrs) {
this.entity = entity;
this.attribute = attribute;
this.updateSource = updateSource;
readOnly = entity.IsPropertyDefinitionReadOnly(Attribute) || entity.IsPropertyReadOnly(Attribute);
}
示例7: Initialize
public void Initialize()
{
_tokenizer = new Tokenizer();
_tokenizedBufferEntity = new Entity<LinkedList<Token>>();
_textBuffer = MockRepository.GenerateStub<ITextBufferAdapter>();
_finder = new MatchingBraceFinder(_textBuffer, _tokenizedBufferEntity);
}
示例8: Process
public override void Process(Entity e)
{
Health health = healthMapper.Get(e);
Transform transform = transformMapper.Get(e);
Vector2 textPosition = new Vector2((float)transform.X + 20, (float)transform.Y - 30);
spriteBatch.DrawString(font,health.HealthPercentage + "%",textPosition,Color.White);
}
示例9: MapAllColumns
private static void MapAllColumns(MappingSet set, ITable table, Entity entity)
{
for(int i = 0; i < table.Columns.Count; i++)
{
set.ChangeMappedColumnFor(entity.ConcreteProperties[i]).To(table.Columns[i]);
}
}
示例10: Before
public void Before() {
var pool = Helper.CreatePool();
_e = pool.CreateEntity();
_e.AddComponent(CP.ComponentA, new ComponentA());
_e.AddComponent(CP.ComponentB, new ComponentB());
_e.AddComponent(CP.ComponentC, new ComponentC());
}
示例11: OnBulletHitCallback
public override bool OnBulletHitCallback(UpdateContext updateContext, CBullet bullet, Entity entityHit)
{
EntityWorld entityWorld = bullet.Entity.EntityWorld;
IZombieSpatialMap zombieSpatialMap = entityWorld.Services.Get<IZombieSpatialMap>();
// if the message has not listeners, then there's no point in doing in broadcasting it.
RocketExplodedMessage explodedMessage = entityWorld.HasListeners<RocketExplodedMessage>() ? entityWorld.FetchMessage<RocketExplodedMessage>() : null; // AAWFFUUULL!!
foreach (Entity zombie in zombieSpatialMap.GetAllIntersecting(bullet.Entity.Transform, RocketLauncher.ExplosionRange))
{
if (zombie.Get<CHealth>().IsAlive && ZombieHelper.TakeDamage(zombie, 25, Vector2.Zero))
{
// if the message has not listeners, then there's no point in doing in broadcasting it.
if (explodedMessage != null)
{
explodedMessage.Add(zombie);
}
}
}
// if the message has not listeners, then there's no point in doing in broadcasting it.
if (explodedMessage != null)
{
entityWorld.BroadcastMessage(explodedMessage);
}
IParticleEngine particleEngine = entityWorld.Services.Get<IParticleEngine>();
particleEngine[ParticleEffectID.RocketExplosion].Trigger(bullet.Entity.Transform);
bullet.Entity.Delete();
return true;
}
示例12: RecordsSource_EnumEntityFilters
public RecordsSource_EnumEntityFilters()
{
DB.EntityChanges.Insert(new
{
EntityName = "Entity",
EntityKey = "1",
ChangedOn = DateTime.Now,
ChangeType = EntityChangeType.Insert
});
DB.EntityChanges.Insert(new
{
EntityName = "Entity",
EntityKey = "1",
ChangedOn = DateTime.Now,
ChangeType = EntityChangeType.Update
});
DB.EntityChanges.Insert(new
{
EntityName = "Entity",
EntityKey = "1",
ChangedOn = DateTime.Now,
ChangeType = EntityChangeType.Delete
});
_source = new RecordsSource(new Notificator());
Admin.AddEntity<EntityChange>();
Admin.SetForeignKeysReferences();
Admin.ConnectionStringName = ConnectionStringName;
_entity = Admin.ChangeEntity;
_property = _entity["ChangeType"];
}
示例13: Add
public void Add(Entity e, int distance) {
var v = new Vertebra();
v.SetEntity(e);
v.Distance = distance;
v.Snake = this;
Add(v);
}
示例14: intersect
public override bool intersect(Entity e)
{
if (base.intersect(e))
{
if (e is Player)
((Player)e).die();
else if (e is Explosion)
die();
return true;
}
bool intersect = false;
for(int a = 0; a < 10; a++)
{
if (neck[a] != null)
{
if (neck[a].intersect(e))
{
neck[a] = null;
intersect = true;
}
}
}
return intersect;
}
示例15: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cooldown;
if (state == null) cooldown = 1000;
else cooldown = (int)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
var player = (Player)host.GetNearestEntity(distance, null);
if (player != null)
{
Vector2 vect;
vect = new Vector2(player.X - host.X, player.Y - host.Y);
vect.Normalize();
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + (-vect.X) * dist, host.Y + (-vect.Y) * dist);
host.UpdateCount++;
if (cooldown <= 0)
{
Status = CycleStatus.Completed;
cooldown = 1000;
}
else
{
Status = CycleStatus.InProgress;
cooldown -= time.thisTickTimes;
}
}
state = cooldown;
}