當前位置: 首頁>>代碼示例>>C#>>正文


C# Entity.Delete方法代碼示例

本文整理匯總了C#中System.Entity.Delete方法的典型用法代碼示例。如果您正苦於以下問題:C# Entity.Delete方法的具體用法?C# Entity.Delete怎麽用?C# Entity.Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Entity的用法示例。


在下文中一共展示了Entity.Delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Process

        public override void Process(Entity e)
        {
            Health h = healthMapper.Get(e);

            if (h == null)
                return;

            if (e.HasComponent<Origin>())
            {
                Origin o = e.GetComponent<Origin>();
                Entity parent = o.Parent;

                if (!parent.HasComponent<Body>() || !parent.GetComponent<Health>().IsAlive)
                {
                    if (e.HasComponent<Health>())
                        e.GetComponent<Health>().SetHealth(e, 0);
                    else
                        e.Delete();
                }
            }

            if (!h.IsAlive)
            {
                h.SetHealth(e, 0);
                e.Delete();
            }
        }
開發者ID:LostCodeStudios,項目名稱:SpaceHordes,代碼行數:27,代碼來源:HealthSystem.cs

示例2: Process

        /// <summary>
        /// Renders all entities with a sprite and a transform to the screen.
        /// </summary>
        /// <param name="e"></param>
        public override void Process(Entity e)
        {
            try
            {
                //Get sprite data and transform
                ITransform transform = e.GetComponent<ITransform>();
                Sprite sprite = e.GetComponent<Sprite>();

                if (sprite.Source != null)
                    //Draw to sprite batch
                    spriteBatch.Draw(
                        sprite.SpriteSheet.Texture,
                        ConvertUnits.ToDisplayUnits(transform.Position),
                        sprite.CurrentRectangle,
                        sprite.Color,
                        transform.Rotation,
                        sprite.Origin,
                        sprite.Scale,
                        SpriteEffects.None, sprite.Layer);
            }
            catch
            {
                e.Delete();
                Console.WriteLine("Exception try-caught in RenderSystem");
            }
        }
開發者ID:LostCodeStudios,項目名稱:GameLib,代碼行數:30,代碼來源:RenderSystem.cs

示例3: Process

        public override void Process(Entity e)
        {
            Body b = e.GetComponent<Body>();

            if (b.Position.Y > ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Height) / 2 || Math.Abs(b.Position.X) > ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Width) / 2)
            {
                e.Delete();
            }
        }
開發者ID:LostCodeStudios,項目名稱:SpaceHordes,代碼行數:9,代碼來源:FireRemovalSystem.cs

示例4: Process

        public override void Process(Entity e)
        {
            ITransform t = TransformMapper.Get(e);
            if (t == null)
                return;
            if (Vector2.Distance(t.Position, Vector2.Zero) > bound)
            {
                e.Delete();
                return;
            }

            if (e.HasComponent<Components.Timer>() && e.GetComponent<Components.Timer>().Update(world.Delta))
            {
                if (e.Tag == "Boss1")
                    Console.WriteLine("Whooops");

                e.Delete();
            }
        }
開發者ID:LostCodeStudios,項目名稱:SpaceHordes,代碼行數:19,代碼來源:EntityRemovalSystem.cs

示例5: MoveToMemory

 public static void MoveToMemory(Entity i)
 {
     var obj = new MapObject()
     {
         Dynamic = !StaticProps.Contains(i.Handle),
         Hash = i.Model.Hash,
         Position = i.Position,
         Quaternion = Quaternion.GetEntityQuaternion(i),
         Rotation = i.Rotation,
         Type = ObjectTypes.Prop,
     };
     MemoryObjects.Add(obj);
     StreamedInHandles.Remove(i.Handle);
     StaticProps.Remove(i.Handle);
     i.Delete();
 }
開發者ID:Guad,項目名稱:MapEditor,代碼行數:16,代碼來源:PropStreamer.cs


注:本文中的System.Entity.Delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。