예제 #1
0
 internal PacmanObject(GraphicsHandler handler, IReadOnlyCollection <RectangleF> walls)
     : base(GraphicsConstants.SpriteSize)
 {
     sprite = new PacmanSprite
     {
         Orientation = Direction.Right
     };
     handler.Register(this, sprite);
     State      = new PacmanMovingState(this);
     this.walls = walls;
 }
예제 #2
0
 internal GhostObject(GraphicsHandler handler, GhostType type, PacmanObject target, Maze level)
     : base(GraphicsConstants.SpriteSize)
 {
     normalPalette = type.ToPalette();
     sprite        = new GhostSprite()
     {
         Palette = normalPalette
     };
     handler.Register(this, sprite);
     Behavior = GhostAIBehavior.FromGhostType(type, this, target, level);
     State    = new GhostHomeState(this);
     PerformTurn(Direction.Down);
     Velocity = Vector2.Zero;
 }
예제 #3
0
        internal FruitObject(GraphicsHandler handler, GraphicsID spriteID)
            : base(GraphicsConstants.SpriteSize)
        {
            sprite = new StaticSprite(Resources.Sprites, spriteID, GraphicsConstants.SpriteWidth, Resources.Sprites.Width / GraphicsConstants.SpriteWidth)
            {
                Palette = spriteID.ToFruitPalette()
            };
            handler.Register(this, sprite);
            switch (spriteID)
            {
            default:
                throw new Exception("Unhandled GraphicsID.");

            case GraphicsID.SpriteCherry:
                Score = 100;
                break;

            case GraphicsID.SpriteStrawberry:
                Score = 300;
                break;

            case GraphicsID.SpriteOrange:
                Score = 500;
                break;

            case GraphicsID.SpriteApple:
                Score = 700;
                break;

            case GraphicsID.SpriteMelon:
                Score = 1000;
                break;

            case GraphicsID.SpriteGalaxian:
                Score = 2000;
                break;

            case GraphicsID.SpriteBell:
                Score = 3000;
                break;

            case GraphicsID.SpriteKey:
                Score = 5000;
                break;
            }
        }