当前位置: 首页>>代码示例>>C#>>正文


C# Entity.GetHashCode方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:dgg5503,项目名称:The-Chicago-Project,代码行数:21,代码来源:EntityManager.cs

示例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();
        }
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:19,代码来源:EntityEquality.cs

示例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();
        }
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:19,代码来源:EntityEquality.cs

示例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());
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:6,代码来源:Fixture.cs

示例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);
        }
开发者ID:raycrasher,项目名称:Fell-Sky,代码行数:17,代码来源:StandardShipModelRenderer.cs


注:本文中的Entity.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。