コード例 #1
0
        public void RemoveIfOutsideBounds(BoundingArea boundingArea)
        {
            int i = 0;

            while (i < _spawnedProjectiles.Count)
            {
                if (!boundingArea.Contains(_spawnedProjectiles[i].GetBoundingArea()))
                {
                    _spawnedProjectiles.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
        }
コード例 #2
0
        public bool RemoveIfHittingBound(BoundingArea boundingArea)
        {
            bool hitBound = false;
            int  i        = 0;

            while (i < _spawnedProjectiles.Count)
            {
                if (_spawnedProjectiles[i].GetBoundingArea().Intersects(boundingArea))
                {
                    _spawnedProjectiles.RemoveAt(i);
                    hitBound = true;
                }
                else
                {
                    i++;
                }
            }
            return(hitBound);
        }
コード例 #3
0
ファイル: Slide.cs プロジェクト: FredrikLundvall/BattleCity
 public void SetBoundingArea(BoundingArea boundingArea)
 {
     _boundingArea = boundingArea;
 }
コード例 #4
0
 public bool Contains(BoundingArea boundingArea)
 {
     return(GetRect().Contains(boundingArea.GetRect()));
 }
コード例 #5
0
 public bool Intersects(BoundingArea boundingArea)
 {
     return(GetRect().Intersects(boundingArea.GetRect()));
 }