コード例 #1
0
ファイル: Level.cs プロジェクト: Militchick/NoColors
        public bool CollidesCharacterWithItemsB(MainCharacterB characterB)
        {
            int  pos      = 0;
            bool collided = false;

            while (pos < items.Count && !collided)
            {
                if (characterB.CollidesWith(items[pos]))
                {
                    collided = true;
                    items.RemoveAt(pos);
                }
                pos++;
            }
            return(collided);
        }
コード例 #2
0
ファイル: Level.cs プロジェクト: Militchick/NoColors
        public ushort CollidesCharacterBWith1_UPItem(MainCharacterB characterB)
        {
            int    pos    = 0;
            ushort result = 0;

            while (pos < items.Count && result == 0)
            {
                if (characterB.CollidesWith(items[pos]))
                {
                    result += items[pos].Lives;
                    items.RemoveAt(pos);
                }
                pos++;
            }
            return(result);
        }