示例#1
0
 /// <summary>
 /// Entfernt ein BoardObject vom Spielfeld
 /// </summary>
 /// <param name="boardObject">Das Boardobject was gelöscht werden soll.</param>
 public void remove(BoardObject boardObject)
 {
     ArrayUtils.remove(ref boardObjects, boardObject);
     if (boardObject.isAnt())
     {
         ants.Remove((Ant)boardObject);
     }
     else if (boardObject.isBase())
     {
         bases.Remove((Base)boardObject);
     }
     else if (boardObject.isSugar())
     {
         sugars.Remove((Sugar)boardObject);
     }
     removeFromMap(boardObject);
 }
示例#2
0
        /// <summary>
        /// Fügt ein BoardObject hinzu.
        /// </summary>
        /// <returns>true wenn er hinzugefügt wurde andernfalls false</returns>
        public bool add(BoardObject boardObject)
        {
            if (!addToMap(boardObject)) {
                return false;
            }

            ArrayUtils.add(ref boardObjects, boardObject);
            if (boardObject.isAnt()) {
                Ant ant = (Ant) boardObject;
                ants.Add(ant);
                ant.Owner.incrementAnts(ant);
            } else if (boardObject.isBase()) {
                bases.Add((Base) boardObject);
            } else if (boardObject.isSugar()) {
                sugars.Add((Sugar) boardObject);
            }
            return true;
        }
示例#3
0
        /// <summary>
        /// Fügt ein BoardObject hinzu.
        /// </summary>
        /// <returns>true wenn er hinzugefügt wurde andernfalls false</returns>
        public bool add(BoardObject boardObject)
        {
            if (!addToMap(boardObject))
            {
                return(false);
            }

            ArrayUtils.add(ref boardObjects, boardObject);
            if (boardObject.isAnt())
            {
                Ant ant = (Ant)boardObject;
                ants.Add(ant);
                ant.Owner.incrementAnts(ant);
            }
            else if (boardObject.isBase())
            {
                bases.Add((Base)boardObject);
            }
            else if (boardObject.isSugar())
            {
                sugars.Add((Sugar)boardObject);
            }
            return(true);
        }
示例#4
0
 private void setColor(BoardObject obj, Bitmap bitmap)
 {
     if (obj.isCarry()) {
         setColor(bitmap, obj.Coords, COLOR_PLAYER1_CARRY, COLOR_PLAYER2_CARRY, (obj as Ant).Owner);
     } else if (obj.isScout()) {
         setColor(bitmap, obj.Coords, COLOR_PLAYER1_SCOUT, COLOR_PLAYER2_SCOUT, (obj as Ant).Owner);
     } else if (obj.isWarrior()) {
         setColor(bitmap, obj.Coords, COLOR_PLAYER1_WARRIOR, COLOR_PLAYER2_WARRIOR, (obj as Ant).Owner);
     } else if (obj.isBase()) {
         Base playerbase = obj as Base;
         if (playerbase.RangeLevel > 0) {
             for (int i = 0;i < playerbase.RangeCoords.Count;i++) {
                 setColor(bitmap, playerbase.RangeCoords[i], COLOR_PLAYER1_BASE, COLOR_PLAYER2_BASE, playerbase.Player);
             }
         }
         setColor(bitmap, obj.Coords, COLOR_PLAYER1_BASE, COLOR_PLAYER2_BASE, (obj as Base).Player);
     } else if (obj.isSugar()) {
         setColor(bitmap, obj.Coords, COLOR_GAME_SUGAR, Color.Transparent, null);
     }
 }
示例#5
0
 /// <summary>
 /// Entfernt ein BoardObject vom Spielfeld
 /// </summary>
 /// <param name="boardObject">Das Boardobject was gelöscht werden soll.</param>
 public void remove(BoardObject boardObject)
 {
     ArrayUtils.remove(ref boardObjects, boardObject);
     if (boardObject.isAnt()) {
         ants.Remove((Ant) boardObject);
     } else if (boardObject.isBase()) {
         bases.Remove((Base) boardObject);
     } else if (boardObject.isSugar()) {
         sugars.Remove((Sugar) boardObject);
     }
     removeFromMap(boardObject);
 }