예제 #1
0
        public PlayingState(Game game)
            : base(game)
        {
            game.Services.AddService(typeof(IPlayingState), this);

            //pacMan = new PacManAnimated(OurGame);
            //pacMan.ShowMarkers = true;
            //OurGame.Components.Add(pacMan);
            //pacMan.Visible = false;

            pacMan = new PacManAnimated(this.Game);
            gm     = new GhostManager(this.Game);

            food1 = new Food(this.Game);
            food2 = new Food(this.Game);
            food3 = new Food(this.Game);
            food4 = new Food(this.Game);

            foods = new List <Food>();
            foods.Add(food1);
            foods.Add(food2);
            foods.Add(food3);
            foods.Add(food4);

            foreach (Food f in foods)
            {
                game.Components.Add(f);
            }

            game.Components.Add(pacMan);
            game.Components.Add(gm);
            setAllInvisible();
            setAllDisable();
        }
예제 #2
0
 public Ghost(Game game)
     : base(game)
 {
     // TODO: Construct any child components here
     r           = new Random();
     this.pacMan = ((Game1)game).GetPacMan();
     pacMan.Attach(this);
     gameConsole     = (GameConsole)game.Services.GetService(typeof(IGameConsole));
     strGhostTexture = "RedGhost";
     StartLoc        = new Vector2(50, 50);
     this.ghostState = GhostState.Roving;
     Ghost.Ghosts.Add(this);
 }
예제 #3
0
        public Game1()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //Game Services
            input               = new InputHandler(this);
            console             = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(input);
            this.Components.Add(console);
            this.Components.Add(celAnimationManager);

            pacMan = new PacManAnimated(this);
            gm     = new GhostManager(this);

            food1 = new Food(this);
            food2 = new Food(this);
            food3 = new Food(this);
            food4 = new Food(this);

            foods = new List <Food>();
            foods.Add(food1);
            foods.Add(food2);
            foods.Add(food3);
            foods.Add(food4);

            foreach (Food f in foods)
            {
                this.Components.Add(f);
            }

            this.Components.Add(pacMan);
            this.Components.Add(gm);
        }