Exemplo n.º 1
0
        public Ghost(Game game)
            : base(game)
        {
            // TODO: Construct any child components here
            r           = new Random();
            this.pacMan = ((Game1)game).pacMan;
            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);

            ghostNum = Ghosts.Count;
        }
Exemplo n.º 2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //Game Services
            fps                 = new FPS(this);
            input               = new InputHandler(this);
            console             = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(fps);
            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);
        }