Exemple #1
0
        public void ChangeEntityPosition(DynamicEntity entity, Map map)
        {
            bool allTeleporterCellTaken = true;

            foreach (Teleporter t in map.TeleporterList)
            {
                Point position = t.CellPosition;
                if (position != CellPosition && map.Board[position.X, position.Y] is Teleporter)
                {
                    allTeleporterCellTaken = false;
                }
            }

            if (!allTeleporterCellTaken)
            {
                Point position = CellPosition;
                while (position == CellPosition)
                {
                    position = FinalBomber.Instance.GamePlayScreen.TeleporterList[
                        GamePlayScreen.Random.Next(FinalBomber.Instance.GamePlayScreen.TeleporterList.Count)].
                               CellPosition;
                }

                var bomb = entity as Bomb;
                if (bomb != null)
                {
                    bomb.ChangeSpeed(bomb.Speed + Config.BombSpeedIncrementeur);
                    bomb.ResetTimer();
                    bomb.ChangePosition(position);
                }
                else
                {
                    entity.ChangePosition(position);
                }
            }
        }