Example #1
0
        private void UpdateActiveState(GameTime time, HackGameBoard board, HackNodeGameBoardMedia drawing)
        {
            if (activeFlasher != null)
            {
                activeFlasher.Update(time);
            }

            if (collapseTimer != null)
            {
                collapseTimer.Update(time);
                if (collapseTimer.IsAlive() == false)
                {
                    board.GetElementAtPoint(getCurrentBoardLocation()).Kill(0);
                    List<HackGameBoardElement> nearby = new List<HackGameBoardElement>();
                    HackGameBoardElement west = board.getElementInDirection(getCurrentBoardLocation(), MovementDirection.MovementDirection_West);
                    if (west != null)
                    {
                        nearby.Add(west);
                    }

                    HackGameBoardElement east = board.getElementInDirection(getCurrentBoardLocation(), MovementDirection.MovementDirection_East);
                    if (east != null)
                    {
                        nearby.Add(east);
                    }

                    HackGameBoardElement north = board.getElementInDirection(getCurrentBoardLocation(), MovementDirection.MovementDirection_North);
                    if (north != null)
                    {
                        nearby.Add(north);
                    }

                    HackGameBoardElement south = board.getElementInDirection(getCurrentBoardLocation(), MovementDirection.MovementDirection_South);
                    if (south != null)
                    {
                        nearby.Add(south);
                    }

                    foreach (HackGameBoardElement el in nearby)
                    {
                        if (el.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Bridge_NS || el.type == HackGameBoardElementBaseType.HackGameBoardElementBaseType_Bridge_EW)
                        {
                            el.Kill(2.0f); //slight delay
                        }
                    }

                    //and - kill self.
                    Kill(0);
                }
                UpdateTimerString();
            }
        }