コード例 #1
0
ファイル: PlayerStats.cs プロジェクト: skyhoshi/PacManBlazor
    public void NewLevel()
    {
        _levelStats     = new(++_levelNumber);
        _ghostHouseDoor = new(0, _mediator);

        var props = LevelStats.GetGhostPatternProperties();

        _ghostMovementConductor = new(props);
    }
コード例 #2
0
ファイル: PlayerStats.cs プロジェクト: skyhoshi/PacManBlazor
    public PlayerStats(int playerIndex, IMediator mediator)
    {
        _mediator   = mediator;
        PlayerIndex = playerIndex;

        Score = Score.Zero;

        // cheat
        Lives        = Constants.PacManLives;
        _levelNumber = -1;

        _extraLives     = new() { 10_000 };
        _levelStats     = new(0);
        _ghostHouseDoor = new(0, _mediator);

        var props = LevelStats.GetGhostPatternProperties();

        _ghostMovementConductor = new(props);
    }
コード例 #3
0
        public GhostInsideHouseMover(
            Ghost ghost,
            IMaze maze,
            GhostHouseDoor ghostHouseDoor) :
            base(ghost, GhostMovementMode.InHouse, maze, () => new ValueTask <CellIndex>(CellIndex.Zero))
        {
            _door = ghostHouseDoor;

            Vector2 center = Maze.PixelCenterOfHouse;

            float x = center.X + ghost.OffsetInHouse * 16;

            _topPos    = new Vector2(x, (float)(13.5 * 8 + 4));
            _bottomPos = new Vector2(x, (float)(15.5 * 8 - 4));

            var centerOfUpDown = new Vector2(_topPos.X, Maze.PixelCenterOfHouse.Y);

            ghost.Position = _topPos + new Vector2(0, (_bottomPos.Y - _topPos.Y) / 2);

            _cellToMoveFrom = ghost.Position;

            if (ghost.Direction.Current == Directions.Down)
            {
                _cellToMoveTo = _bottomPos;
            }
            else if (ghost.Direction.Current == Directions.Up)
            {
                _cellToMoveTo = _topPos;
            }
            else
            {
                throw new InvalidOperationException("Ghost must be pointing up or down at start.");
            }

            _routeOut = new[] { centerOfUpDown, Maze.PixelCenterOfHouse, Maze.PixelHouseEntrancePoint };
        }
コード例 #4
0
 public GhostInsideHouseMover(
     Ghost ghost,
     IMaze maze,
     GhostHouseDoor ghostHouseDoor) : base(ghost, GhostMovementMode.InHouse, maze, () => new(CellIndex.Zero))