本文整理汇总了C#中Entity.GetId方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetId方法的具体用法?C# Entity.GetId怎么用?C# Entity.GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.GetId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGroupOf
/**
* @param e entity
* @return the name of the group that this entity belongs to, null if none.
*/
public String GetGroupOf(Entity e) {
int entityId = e.GetId();
if(entityId < groupByEntity.GetCapacity()) {
return groupByEntity.Get(entityId);
}
return null;
}
示例2: Change
public void Change(Entity e) {
bool contains = (systemBit & e.GetSystemBits()) == systemBit;
bool interest = (typeFlags & e.GetTypeBits()) == typeFlags;
if (interest && !contains && typeFlags > 0) {
actives.Add(e.GetId(),e);
e.AddSystemBit(systemBit);
Added(e);
} else if (!interest && contains && typeFlags > 0) {
Remove(e);
}
}
示例3: Set
/**
* Set the group of the entity.
*
* @param group group to set the entity into.
* @param e entity to set into the group.
*/
public void Set(String group, Entity e) {
Remove(e); // Entity can only belong to one group.
Bag<Entity> entities;
if(!entitiesByGroup.TryGetValue(group,out entities)) {
entities = new Bag<Entity>();
entitiesByGroup.Add(group, entities);
}
entities.Add(e);
groupByEntity.Set(e.GetId(), group);
}
示例4: Remove
/**
* Removes the provided entity from the group it is assigned to, if any.
* @param e the entity.
*/
public void Remove(Entity e) {
int entityId = e.GetId();
if(entityId < groupByEntity.GetCapacity()) {
String group = groupByEntity.Get(entityId);
if(group != null) {
groupByEntity.Set(entityId, null);
Bag<Entity> entities;
if(entitiesByGroup.TryGetValue(group,out entities)) {
entities.Remove(e);
}
}
}
}
示例5: Remove
private void Remove(Entity e)
{
actives.Remove(e.GetId());
e.RemoveSystemBit(systemBit);
Removed(e);
}