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


C# Entity类代码示例

本文整理汇总了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;
     }
 }
开发者ID:jgeumlek,项目名称:Element-Chronicles-Prototype,代码行数:7,代码来源:FrostEntity.cs

示例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;
 }
开发者ID:dsmo7206,项目名称:Lemma,代码行数:16,代码来源:SwivelHingeAngularJoint.cs

示例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;
    }
开发者ID:EpxStudio,项目名称:CollegeLifeSim,代码行数:7,代码来源:AdvisorEntity.cs

示例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;
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:43,代码来源:CompoundHelper.cs

示例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;
        }
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:10,代码来源:QueryManager.cs

示例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);
 }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:7,代码来源:WorkitemPropertyDescriptor.cs

示例7: Initialize

		public void Initialize()
		{
			_tokenizer = new Tokenizer();
			_tokenizedBufferEntity = new Entity<LinkedList<Token>>();
			_textBuffer = MockRepository.GenerateStub<ITextBufferAdapter>();
			_finder = new MatchingBraceFinder(_textBuffer, _tokenizedBufferEntity);
		}
开发者ID:rpete4130,项目名称:vsClojure,代码行数:7,代码来源:MatchingBraceFinderTests.cs

示例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);
 }
开发者ID:dackjaniels2001,项目名称:starwarrior_CSharp,代码行数:7,代码来源:HealthBarRenderSystem.cs

示例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]);
     }
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:7,代码来源:ModelSetup.cs

示例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());
 }
开发者ID:ChicK00o,项目名称:Entitas-CSharp,代码行数:7,代码来源:EntityGetComponent.cs

示例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;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:31,代码来源:RocketLauncher.cs

示例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"];
        }
开发者ID:anupvarghese,项目名称:Ilaro.Admin,代码行数:31,代码来源:RecordsSource_EnumEntityFilters.cs

示例13: Add

 public void Add(Entity e, int distance) {
     var v = new Vertebra();
     v.SetEntity(e);
     v.Distance = distance;
     v.Snake = this;
     Add(v);
 }
开发者ID:KrissLaCross,项目名称:BreakOut,代码行数:7,代码来源:Snake.cs

示例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;
        }
开发者ID:ra4king,项目名称:Shooter,代码行数:28,代码来源:Boss.cs

示例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;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:34,代码来源:StayBack.cs


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