Пример #1
0
        public SimpleGhost(GhostNickname nickName, Directions direction)
        {
            NickName  = nickName;
            Direction = new DirectionInfo(direction, direction);

            Visible = true;

            var spriteSheet = new GhostSpritesheet();

            SpritesheetInfoNormal      = spriteSheet.GetEntry(nickName);
            _spritesheetInfoFrightened = new GhostSpritesheet().GetFrightened();
            _spriteSheetEyes           = spriteSheet.Eyes;

            SpriteSheetPos = SpritesheetInfoNormal.GetSourcePosition(Direction.Next, true);
        }
Пример #2
0
        public GhostSpritesheet()
        {
            const int left = 457;

            int x = left + 8 * 16;

            _frightened = new FrightenedSpritesheet(
                new FramePair(new Vector2(x, 64), new Vector2(x += 16, 64)),
                new FramePair(new Vector2(x += 16, 64), new Vector2(x + 16, 64)));

            x    = left + 8 * 16;
            Eyes = new EyesSpritesheetInfo(new Vector2(x, 64 + 16));

            _entries = new Dictionary <GhostNickname, GhostSpritesheetInfo>
            {
                [GhostNickname.Blinky] = new GhostSpritesheetInfo(new Vector2(left, 64)),
                [GhostNickname.Pinky]  = new GhostSpritesheetInfo(new Vector2(left, 64 + 16)),
                [GhostNickname.Inky]   = new GhostSpritesheetInfo(new Vector2(left, 64 + 32)),
                [GhostNickname.Clyde]  = new GhostSpritesheetInfo(new Vector2(left, 64 + 48))
            };
        }