Exemplo n.º 1
0
        public GhostFrightSession(LevelProps levelProps)
        {
            _amountOfGhostsEaten = 0;
            _timeLeft            = TimeSpan.FromMilliseconds(levelProps.FrightGhostTime * 1000);

            int flashesLeft = levelProps.FrightGhostFlashes;

            _timeLeftToStartFlashing = _timeLeft -
                                       TimeSpan.FromMilliseconds(flashesLeft * _eachFlashDurationMs.TotalMilliseconds);
            _timer = new LoopingTimer(
                _eachFlashDurationMs, () => _tickTock = !_tickTock);
        }
Exemplo n.º 2
0
// we are reading these properties:
// elroy1DotsLeft
// elroy1SpeedPc
// elroy2DotsLeft
// elroy2SpeedPc

        protected override float GetNormalGhostSpeedPercent()
        {
            LevelStats levelStats = CurrentPlayerStats.LevelStats;

            LevelProps levelProps = levelStats.GetLevelProps();

            int pillsRemaining = levelStats.PillsRemaining;

            if (pillsRemaining > levelProps.Elroy1DotsLeft)
            {
                return(levelProps.GhostSpeedPc);
            }

            if (pillsRemaining < levelProps.Elroy2DotsLeft)
            {
                return(levelProps.Elroy2SpeedPc);
            }

            return(levelProps.Elroy1SpeedPc);
        }