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


C# IGameObject类代码示例

本文整理汇总了C#中IGameObject的典型用法代码示例。如果您正苦于以下问题:C# IGameObject类的具体用法?C# IGameObject怎么用?C# IGameObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IGameObject类属于命名空间,在下文中一共展示了IGameObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Check

 //[MethodImpl(MethodImplOptions.Synchronized)] // single threaded
 public void Check(IGameObject me, FrameUpdateEventArgs e)
 {
     Rect rme = me.Shape;
     bool hitsGround = false;
     foreach (var other in Obstacles)
     {
         if (other != me)
         {
             Rect rother = other.Shape;
             if (rme.IntersectsWith(rother))
             {
                 Rect overlap = Rect.Intersect(rme,rother);
                 if (other is GroundObject)
                     hitsGround = true;
                 if (other.IsObstacle)
                 {
                     ProcessCollision(me, other, overlap, rme, rother, e.ElapsedMilliseconds / 1000);
                 }
                 me.RaiseOnCollision(me, other, true); // bool: me = caller of CheckCollision
                 other.RaiseOnCollision(other, me, false);
             }
         }
     }
     me.IsGrounded = hitsGround;
 }
开发者ID:apmKrauser,项目名称:ProjectGame,代码行数:26,代码来源:SimpleCollider.cs

示例2: Contains

 public static bool Contains(this ILayer layer, IGameObject gameObject)
 {
     foreach (IReference<IGameObject> reference in layer.GameObjectReferences)
         if (reference.Target == gameObject)
             return true;
     return false;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:7,代码来源:ILayer.cs

示例3: Equals

 public bool Equals(IGameObject other)
 {
     return
         TypeIsSame(other) &&
         FieldNumIsSame(((IChessBoard)other).GetAllFields()) &&
         FieldsAreEqual(((IChessBoard) other).GetAllFields());
 }
开发者ID:BadassGamingCrew,项目名称:Chess-Might-and-Magic,代码行数:7,代码来源:ChessBoard.cs

示例4: ObjectsChanged

    private void ObjectsChanged(Sector sector, IGameObject Object)
    {
        if((Object is IObject) || (Object is Tilemap))
            return;

        UpdateList();
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:7,代码来源:GameObjectListWidget.cs

示例5: MailedSuccesfully

        public override void MailedSuccesfully(Mailbox box, IGameObject obj)
        {
            try
            {
                Metal metal = obj as Metal;
                Collecting collecting = Actor.SkillManager.AddElement(SkillNames.Collecting) as Collecting;
                if (metal != null)
                {
                    // Custom
                    if (!collecting.mMetalData.ContainsKey(metal.Guid))
                    {
                        collecting.mMetalData.Add(metal.Guid, new Collecting.MetalStats(0));
                    }
                }

                base.MailedSuccesfully(box, obj);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:26,代码来源:GetSmeltEx.cs

示例6: Fireball

 public Fireball(Image image, GameWorld gameWorld, IGameObject source)
 {
     this.source = source;
     gw = gameWorld;
     Image = image;
     Init();
 }
开发者ID:ChrisWohlert,项目名称:CHWGameEngine,代码行数:7,代码来源:Fireball.cs

示例7: AddHuntableToInventory

        public static bool AddHuntableToInventory(DogHuntingSkill ths, IGameObject huntable)
        {
            if (huntable == null)
            {
                return false;
            }

            bool flag = false;

            if (SimTypes.IsSelectable(ths.SkillOwner))
            {
                flag = Inventories.TryToMove(huntable, ths.SkillOwner.CreatedSim);
            }
            else
            {
                // Add the item to head of family
                SimDescription head = SimTypes.HeadOfFamily(ths.SkillOwner.Household);
                if (head != null)
                {
                    flag = Inventories.TryToMove(huntable, head.CreatedSim);
                }
            }

            if (!flag)
            {
                huntable.RemoveFromWorld();
                huntable.Destroy();
            }
            else
            {
                StoryProgression.Main.Skills.Notify("SniffOut", ths.SkillOwner.CreatedSim, Common.Localize("SniffOut:Success", ths.SkillOwner.IsFemale, new object[] { ths.SkillOwner, huntable.GetLocalizedName() }));
            }

            return flag;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:35,代码来源:SniffOutEx.cs

示例8: EventEntry

 public EventEntry(IGameObject owner, string name)
 {
     Owner = new WeakReference(owner);
     Name = name;
     _comparison = owner.Id;
     _hashCode = Name.GetHashCode() ^ Owner.GetHashCode();
 }
开发者ID:mobytoby,项目名称:beastmud,代码行数:7,代码来源:EventManager.cs

示例9: Raise

        public static void Raise(string eventName, IGameObject sender, EventArgs args)
        {
            var key = new EventEntry(sender, eventName);
            if(!Entries.ContainsKey(key))
            {
                Log.Warning("A handler for the event '{0}' was not found while attempting to raise the event.", eventName);
                return;
            }

            var list = Entries[key];
            var removes = new List<WeakReference>();
            foreach (var weakRef in list)
            {
                if (!weakRef.IsAlive || weakRef.Target != null)
                {
                    removes.Add(weakRef);
                    continue;
                }
                var action = (Action<IGameObject, EventArgs>) weakRef.Target;
                if (action == null)
                    continue;
                action(sender, args);
            }

            foreach (var weakReference in removes)
            {
                Entries[key].Remove(weakReference);
            }
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:29,代码来源:EventManager.cs

示例10: DrawObject

        public static void DrawObject(this Graphics g, IGameObject obj, Bitmap bitmap, Camera camera)
        {
            var location = obj.Body.Position - camera.Body.Position;
            g.DrawImage(bitmap, location.X, location.Y);

            g.DrawAABB(obj, camera);
        }
开发者ID:niemandkun,项目名称:MiraiEngine,代码行数:7,代码来源:GraphicsExtensions.cs

示例11: GrowingImageDrawBehavior

 public GrowingImageDrawBehavior(IGameObject gameObject)
 {
     GameObject = gameObject;
     size = new Size(50, 50);
     SpeedX = 1;
     SpeedY = 1;
 }
开发者ID:ChrisWohlert,项目名称:CHWGameEngine,代码行数:7,代码来源:GrowingImageDrawBehavior.cs

示例12: Window

 public Window(Game game, Vector2 position, int width, int height)
     : base(game)
 {
     _GameRef = (IGameObject)game;
     ScreenPosition = position;
     WindowSize = new Rectangle(0, 0, width, height);
 }
开发者ID:Wydra,项目名称:WickedEngine,代码行数:7,代码来源:Window.cs

示例13: IGameObjectCollisionCheck

 public static bool IGameObjectCollisionCheck(IGameObject object1, IGameObject object2)
 {
     if (object1.Rect.Intersects(object2.Rect))
         return true;
     else
         return false;
 }
开发者ID:tjw0051,项目名称:MGSE-Project,代码行数:7,代码来源:CollisionCheck.cs

示例14: Collision

 public Collision(IGameObject gameObject)
 {
     ColliderComponent = gameObject.ColliderComponent;
     GameObject = gameObject;
     RigidBody = GameObject.RigidBody;
     Transform = GameObject.Transform;
 }
开发者ID:rumothy,项目名称:pong,代码行数:7,代码来源:Collision.cs

示例15: UpdateGameObject

 public override void UpdateGameObject(IGameObject gameObject)
 {
     if (!this.Equals(gameObject))
     {
         this.chessBoard = gameObject as IChessBoard;
     }
 }
开发者ID:BadassGamingCrew,项目名称:Chess-Might-and-Magic,代码行数:7,代码来源:DrawableChessBoard.cs


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