• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IGameObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DistanceFor

        ///// <summary>
        ///// Расчитать расход топлива для прыжка
        ///// </summary>
        ///// <returns></returns>
        //public long CalculateFuelForJump(IGameObject obj, IGameObject targetLoc)
        //{
        //    var d = DistanceFor(obj, targetLoc);

        //}

        public double DistanceFor(IGameObject a, IGameObject b)
        {
            LocalPosition alp = LocalPosition.Empty, blp= LocalPosition.Empty;
            var ls = a.Ask(LocalSystem.Query.ResolvePosition)
                .Cast<QueryResponse<LocalPosition>>()
                .FirstOrDefault();
            if (ls != null)
                alp = ls.Value;
            ls = b.Ask(LocalSystem.Query.ResolvePosition)
                .Cast<QueryResponse<LocalPosition>>()
                .FirstOrDefault();
            if (ls != null)
                blp = ls.Value;
            while (!alp.Unknown && !blp.Unknown)
            {
                if (alp.LocalSystem.Level > blp.LocalSystem.Level)
                    alp = alp.LocalSystem.TranslateUp(alp.Coords);
                else if (alp.LocalSystem.Level < blp.LocalSystem.Level)
                    blp = blp.LocalSystem.TranslateUp(blp.Coords);
                if (alp.LocalSystem.Level == blp.LocalSystem.Level)
                    if (alp.LocalSystem != blp.LocalSystem)
                    {
                        alp = alp.LocalSystem.TranslateUp(alp.Coords);
                        blp = blp.LocalSystem.TranslateUp(blp.Coords);
                    }
                    else
                    {
                        
                        return alp.Coords.Distance(blp.Coords) * alp.LocalSystem.Resolution;
                    }
            }
            return double.PositiveInfinity;
        }
开发者ID:Basilid,项目名称:Spheres,代码行数:43,代码来源:!Mechanic.cs


示例17: ResolveOverlap

        public void ResolveOverlap(IGameObject overlappingObject, ICollisionSide side) {
            int xCoordinate = (int)overlappingObject.VectorCoordinates.X;
            int yCoordinate = (int)overlappingObject.VectorCoordinates.Y;

            Rectangle hitBoxA = new Rectangle((int)gameObjectA.VectorCoordinates.X, (int)gameObjectA.VectorCoordinates.Y, (int)gameObjectA.Sprite.SpriteDimensions.X, (int)gameObjectA.Sprite.SpriteDimensions.Y);
            Rectangle hitBoxB = new Rectangle((int)gameObjectB.VectorCoordinates.X, (int)gameObjectB.VectorCoordinates.Y, (int)gameObjectB.Sprite.SpriteDimensions.X, (int)gameObjectB.Sprite.SpriteDimensions.Y);

            collisionRectangle = Rectangle.Intersect(hitBoxA, hitBoxB);   
            
            if (side is LeftSideCollision) {
                xCoordinate -= collisionRectangle.Width;
                Vector2 newLocation = new Vector2(xCoordinate, yCoordinate );
                overlappingObject.VectorCoordinates = newLocation;
            }
            else if (side is RightSideCollision) {
                xCoordinate += collisionRectangle.Width;
                Vector2 newLocation = new Vector2(xCoordinate, yCoordinate);
                overlappingObject.VectorCoordinates = newLocation;
            }
            else if (side is TopSideCollision)
            {
                yCoordinate -= collisionRectangle.Height;
                Vector2 newLocation = new Vector2(xCoordinate, yCoordinate);
                overlappingObject.VectorCoordinates = newLocation;
            }
            else if (side is BottomSideCollision)
            {
                yCoordinate += collisionRectangle.Height;
                Vector2 newLocation = new Vector2(xCoordinate, yCoordinate);
                overlappingObject.VectorCoordinates = newLocation;
            }
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:32,代码来源:CollisionData.cs


示例18: Collision

 public Collision(IGameObject self, IGameObject contact, Vector2f resulVelocity, Vector2f eject)
 {
     Subject = contact;
     Eject = eject;
     Velocity = resulVelocity;
     ContactPoint = self.Body.Incircle.Center + Normal * self.Body.Incircle.Radius;
 }
开发者ID:niemandkun,项目名称:MiraiEngine,代码行数:7,代码来源:Collision.cs


示例19: CircleMotionBehavior

 public CircleMotionBehavior(IGameObject gameObject, GameWorld gw, DecimalPoint center)
     : base(gameObject, gw)
 {
     Center = center;
     Range = 200;
     angle = 0;
 }
开发者ID:ChrisWohlert,项目名称:CHWGameEngine,代码行数:7,代码来源:CircleMotionBehavior.cs


示例20: registerObject

 public void registerObject(IGameObject iCollided)
 {
     if (iCollided.left <= _middle.X)
     {
         if (iCollided.top < _middle.Y)
         {
             topLeft.Add(iCollided);
         }
         else
         {
             bottomLeft.Add(iCollided);
         }
     }
     else
     {
         if (iCollided.top < _middle.Y)
         {
             topRight.Add(iCollided);
         }
         else
         {
             bottomRight.Add(iCollided);
         }
     }
 }
开发者ID:anhlehoang410,项目名称:Game-2,代码行数:25,代码来源:QuadGrid.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IGameState类代码示例发布时间:2022-05-24
下一篇:
C# IGameMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap