Exemple #1
0
    public void Default()
    {
        var sut = new GlobalDotCounter(0);

        sut.CanGhostLeave(GhostNickname.Blinky).Should().BeFalse();
        sut.CanGhostLeave(GhostNickname.Pinky).Should().BeFalse();
        sut.CanGhostLeave(GhostNickname.Clyde).Should().BeFalse();
        sut.CanGhostLeave(GhostNickname.Inky).Should().BeFalse();
    }
    public bool CanGhostLeave(Ghost ghost)
    {
        if (ghost.NickName == GhostNickname.Blinky)
        {
            return(true);
        }

        if (_globalCounter.IsActive)
        {
            return(_globalCounter.CanGhostLeave(ghost.NickName));
        }

        if (_activeCounter == _nullCounter)
        {
            return(true);
        }

        return(_ghostCounters[ghost.NickName].LimitReached);
    }