示例#1
0
        void switchActive(DotCounter counter)
        {
            _activeCounter.Deactivate();

            _activeCounter = counter;

            _activeCounter.Activate();
        }
示例#2
0
        public GhostHouseDoor(int level, IMediator mediator)
        {
            _mediator = mediator;

            _ghostCounters = new Dictionary <GhostNickname, DotCounter>();

            _nullCounter = new DotCounter(int.MaxValue, "NULL");

            _globalCounter = new GlobalDotCounter();

            var pinkyCounter = new DotCounter(0, "PINKY");

            if (level == 0)
            {
                _ghostCounters[GhostNickname.Pinky] = pinkyCounter;
                _ghostCounters[GhostNickname.Inky]  = new DotCounter(30, "INKY");
                _ghostCounters[GhostNickname.Clyde] = new DotCounter(60, "CLYDE");
            }

            if (level == 1)
            {
                _ghostCounters[GhostNickname.Pinky] = pinkyCounter;
                _ghostCounters[GhostNickname.Inky]  = new DotCounter(0, "INKY");
                _ghostCounters[GhostNickname.Clyde] = new DotCounter(50, "CLYDE");
            }

            if (level >= 2)
            {
                _ghostCounters[GhostNickname.Pinky] = pinkyCounter;
                _ghostCounters[GhostNickname.Inky]  = new DotCounter(0, "INKY");
                _ghostCounters[GhostNickname.Clyde] = new DotCounter(0, "CLYDE");
            }

            _pillConsumptionTimeIdle = TimeSpan.Zero;

            _activeCounter = pinkyCounter;

            _activeCounter.Activate();

            switchToUseCounterOfNextGhost();
        }