本文整理汇总了C#中Entity.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetHashCode方法的具体用法?C# Entity.GetHashCode怎么用?C# Entity.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.GetHashCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEntity
/// <summary>
/// Adds the given entity into the list of entities, and adjusts the player location if a player object is added
/// </summary>
public void AddEntity(Entity.Entity e)
{
e.currentWorld = world;
Console.WriteLine("Added Entity: " + e.GetType().FullName + " (#" + e.GetHashCode() + ")");
if (e is Player) {
if (playerLoc == -1) {
playerLoc = 0;
entities.Insert(0, e);
} else {
entities[playerLoc] = e;
}
} else {
if (e is NPC)
civilianCount++;
// entities.Add(e);
entitiesToAdd.Add(e);
}
}
示例2: Two_entities_with_the_same_Id_should_equal_each_other
public void Two_entities_with_the_same_Id_should_equal_each_other()
{
var first = new Entity{Id = 99};
var second = new Entity { Id = 99 };
first.Equals(second).ShouldBeTrue();
second.Equals(first).ShouldBeTrue();
Equals(first, second).ShouldBeTrue();
Equals(second, first).ShouldBeTrue();
first.GetHashCode().ShouldEqual(second.GetHashCode());
(first == second).ShouldBeTrue();
(second == first).ShouldBeTrue();
(first != second).ShouldBeFalse();
(second != first).ShouldBeFalse();
}
示例3: Two_entities_with_different_Ids_should_not_equal_each_other
public void Two_entities_with_different_Ids_should_not_equal_each_other()
{
var first = new Entity { Id = 66 };
var second = new Entity { Id = 77 };
first.Equals(second).ShouldBeFalse();
second.Equals(first).ShouldBeFalse();
Equals(first, second).ShouldBeFalse();
Equals(second, first).ShouldBeFalse();
first.GetHashCode().ShouldNotEqual(second.GetHashCode());
(first == second).ShouldBeFalse();
(second == first).ShouldBeFalse();
(first != second).ShouldBeTrue();
(second != first).ShouldBeTrue();
}
示例4: SimpleExpressionWithNewInstance
public void SimpleExpressionWithNewInstance()
{
var a = new Entity() { Id = 2, Name = "2" };
var restriction = Restrictions.Eq("A", a);
Assert.AreEqual(@"A = [email protected]" + a.GetHashCode() + "(hash)", restriction.ToString());
}
示例5: RenderPartGlow
private void RenderPartGlow(Entity root, Entity partEntity, ref Matrix parentMatrix)
{
var partComponent = partEntity.GetComponent<IShipPartComponent>();
var glow = partEntity.GetComponent<PartGlowComponent>();
Vector3 offset = new Vector3(
(_randomFloats[0] * 6) % partComponent.GetHashCode() - 3,
(_randomFloats[1] * 6) % partEntity.GetHashCode() - 3,
0
);
var xform = partEntity.GetComponent<Transform>();
var sprite = partEntity.GetComponent<SpriteComponent>();
var color = glow.Color;
color.A = 0;
Matrix matrix = xform.Matrix * Matrix.CreateTranslation(offset) * parentMatrix;
_batch.Draw(sprite, ref matrix, color);
}