Пример #1
0
    public override void PowerPillEaten(GhostFrightSession session)
    {
        base.PowerPillEaten(session);

        if (State == GhostState.Eyes)
        {
            return;
        }

        State = GhostState.Frightened;

        if (MovementMode is GhostMovementMode.Chase or GhostMovementMode.Scatter)
        {
            _whenInCenterOfNextTile = () =>
            {
                DirectionInfo current = Direction;

                Direction direction = switchDirectionForChaseOrScatter(current.Current);

                if (direction is not None)
                {
                    Direction.Update(direction);
                }

                _mover = new GhostFrightenedMover(this, _maze);
            };
        }
    }
Пример #2
0
        void reverseChase()
        {
            _blinkyTimer = new EggTimer(4600.Milliseconds(), () => { });

            _pacTimer = new EggTimer(4350.Milliseconds(), async() =>
            {
                _finished = true;
                await _mediator.Publish(new CutSceneFinishedEvent());
            });

            _pacMan.Visible    = false;
            _bigPacMan.Visible = true;

            var s    = new LevelStats(0);
            var sess = new GhostFrightSession(s.GetLevelProps());

            _blinky.Direction = new DirectionInfo(Directions.Right, Directions.Right);
            _blinky.SetFrightSession(sess);
            _blinky.SetFrightened();
            _blinkyPositions = _blinkyPositions.Reverse();

            var bigPacPos = _pacPositions.Reverse();

            bigPacPos = new StartAndEndPos(bigPacPos.Start - new Vector2(100, 0), bigPacPos.End);

            _pacPositions = bigPacPos;
        }
Пример #3
0
        ValueTask reverseChase()
        {
            _powerPillToEat.Visible = false;
            _ghostTimer             = new EggTimer(12.Seconds(), () => { });
            _pacTimer = new EggTimer(6.Seconds(), () => { });

            var levelStats     = new LevelStats(0);
            var frightSessions = new GhostFrightSession(levelStats.GetLevelProps());

            foreach (var eachGhost in _ghosts)
            {
                eachGhost.Direction.Update(Directions.Right);
                eachGhost.SetFrightSession(frightSessions);
                eachGhost.SetFrightened();

                _ghostPositions[eachGhost.NickName] = _ghostPositions[eachGhost.NickName].Reverse();
            }

            _pacPositions = _pacPositions.Reverse();

            _pacMan.Direction = Directions.Right;

            return(default);