コード例 #1
0
 public override void ContactObject(MoveObject mobject, out bool needRemove)
 {
     if (mobject is Tank)
      {
          (mobject as Tank).Weapon.interval = 3;
          needRemove = true;
      }
      else
          needRemove = false;
 }
コード例 #2
0
ファイル: Bullet.cs プロジェクト: asokolovskiy15/BattleCity
 public override void ContactObject(MoveObject mobject, out bool needRemove)
 {
     if (mobject is BonusBase)
     {
         needRemove = false;
     }
     else
     {
         needRemove = true;
     }
 }
コード例 #3
0
 public override bool IsNeedRemove(MoveObject mobject)
 {
     if (mobject is Bullet)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: asokolovskiy15/BattleCity
 public bool Contact(MoveObject mobject1, MoveObject mobject2)
 {
     if (mobject1.X >= (mobject2.X + mobject2.Width) || (mobject1.X + mobject1.Width) <= mobject2.X)
     {
         return(false);
     }
     if (mobject1.Y >= (mobject2.Y + mobject2.Width) || (mobject1.Y + mobject1.Width) <= mobject2.Y)
     {
         return(false);
     }
     return(true);
 }
コード例 #5
0
        public override bool IsNeedRemove(MoveObject mobject)
        {
            var bul = mobject as Bullet;

            if (bul != null && bul.Power > 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
 public override void ContactObject(MoveObject mobject, out bool needRemove)
 {
     if (mobject is Bullet)
     {
         HealthPoint--;
     }
     if (HealthPoint <= 0)
     {
         needRemove = true;
     }
     else
     {
         needRemove = false;
     }
 }
コード例 #7
0
        public TileBase IntersectionTile(MoveObject mobject)
        {
            TileBase tile = null;

            int RowUp    = mobject.Y / Constants.tileWidth;
            int ColLeft  = mobject.X / Constants.tileWidth;
            int RowDown  = (mobject.Y + mobject.Width - 1) / Constants.tileWidth;
            int ColRight = (mobject.X + mobject.Width - 1) / Constants.tileWidth;

            for (int r = RowUp; r <= RowDown; ++r)
            {
                for (int c = ColLeft; c <= ColRight; ++c)
                {
                    TileBase t = GetTile(r, c);
                    if (t == null)
                    {
                        if (tile == null)
                        {
                            tile = new TileBorder();
                        }
                        continue;
                    }

                    if ((t is TileWater && mobject is Bullet) || t is TileEmpty)
                    {
                        continue;
                    }

                    if (t.IsNeedRemove(mobject))
                    {
                        RemoveTile(t);
                    }

                    if (tile == null)
                    {
                        tile = t;
                    }
                }
            }
            return(tile);
        }
コード例 #8
0
 public virtual void ContactObject(MoveObject mobject, out bool needRemove)
 {
     needRemove = false;
 }
コード例 #9
0
ファイル: Game.cs プロジェクト: asokolovskiy15/BattleCity
 public void AddMoveObject(MoveObject mobject)
 {
     GameObject.Add(mobject);
 }
コード例 #10
0
 public virtual bool IsNeedRemove(MoveObject mobject)
 {
     return(false);
 }