示例#1
0
文件: AEnnemy.cs 项目: poksme/Pacman
        public AEnnemy(SpriteManager s, EOrientation e)
            : base(s, e)
        {
            state_ = EState.ALIVE;

            deadTimer_ = TimeSpan.Zero;

            random_ = new Random();

            freePath_ = new Dictionary<EOrientation, bool>();

            freePath_.Add(EOrientation.DOWN, false);
            freePath_.Add(EOrientation.UP, false);
            freePath_.Add(EOrientation.RIGHT, false);
            freePath_.Add(EOrientation.LEFT, false);
            freePath_.Add(EOrientation.NEUTRAL, false);

            stateOrientationToSprite_ = new Dictionary<Tuple<EState, EOrientation>, SpriteManager.ESprite>();

            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD, ACharacter.EOrientation.UP), SpriteManager.ESprite.EYESUP);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD, ACharacter.EOrientation.DOWN), SpriteManager.ESprite.EYESDOWN);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD, ACharacter.EOrientation.LEFT), SpriteManager.ESprite.EYESLEFT);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD, ACharacter.EOrientation.RIGHT), SpriteManager.ESprite.EYESRIGHT);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD, ACharacter.EOrientation.NEUTRAL), SpriteManager.ESprite.EYESDOWN);

            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD_ENDING, ACharacter.EOrientation.UP), SpriteManager.ESprite.DEADENDINGUP);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD_ENDING, ACharacter.EOrientation.DOWN), SpriteManager.ESprite.DEADENDINGDOWN);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD_ENDING, ACharacter.EOrientation.LEFT), SpriteManager.ESprite.DEADENDINGLEFT);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD_ENDING, ACharacter.EOrientation.RIGHT), SpriteManager.ESprite.DEADENDINGRIGHT);
            stateOrientationToSprite_.Add(Tuple.Create(EState.DEAD_ENDING, ACharacter.EOrientation.NEUTRAL), SpriteManager.ESprite.DEADENDINGDOWN);
        }
示例#2
0
文件: Sprite.cs 项目: poksme/Pacman
 public Sprite(Vector2 pos_, SpriteManager.ESprite id_)
 {
     id = id_;
     pos = pos_;
     drawn = false;
     step = 0;
 }
示例#3
0
文件: Blinky.cs 项目: poksme/Pacman
 //Random random_;
 public Blinky(SpriteManager s)
     : base(s, EOrientation.LEFT)
 {
     orientationToSprite_.Add(EOrientation.LEFT, SpriteManager.ESprite.BLINKYLEFT);
     orientationToSprite_.Add(EOrientation.RIGHT, SpriteManager.ESprite.BLINKYRIGHT);
     orientationToSprite_.Add(EOrientation.UP, SpriteManager.ESprite.BLINKYUP);
     orientationToSprite_.Add(EOrientation.DOWN, SpriteManager.ESprite.BLINKYDOWN);
     orientationToSprite_.Add(EOrientation.NEUTRAL, SpriteManager.ESprite.BLINKYLEFT);
     position_ = new Vector2(121, 140);
     sprite_ = new Sprite(position_, orientationToSprite_[orientation_]);
     orientation_ = EOrientation.RIGHT;
 }
示例#4
0
文件: Hero.cs 项目: poksme/Pacman
 public Hero(SpriteManager s)
     : base(s, EOrientation.NEUTRAL)
 {
     orientationToSprite_.Add(EOrientation.LEFT, SpriteManager.ESprite.PACLEFT);
     orientationToSprite_.Add(EOrientation.RIGHT, SpriteManager.ESprite.PACRIGHT);
     orientationToSprite_.Add(EOrientation.UP, SpriteManager.ESprite.PACUP);
     orientationToSprite_.Add(EOrientation.DOWN, SpriteManager.ESprite.PACDOWN);
     orientationToSprite_.Add(EOrientation.NEUTRAL, SpriteManager.ESprite.PACNEUTRAL);
     position_ = new Vector2(113, 92);
     sprite_ = new Sprite(position_, orientationToSprite_[orientation_]);
     power = new TimeSpan(0);
 }
示例#5
0
文件: Clyde.cs 项目: poksme/Pacman
 public Clyde(SpriteManager s)
     : base(s, EOrientation.DOWN)
 {
     orientationToSprite_.Add(EOrientation.LEFT, SpriteManager.ESprite.CLYDELEFT);
     orientationToSprite_.Add(EOrientation.RIGHT, SpriteManager.ESprite.CLYDERIGHT);
     orientationToSprite_.Add(EOrientation.UP, SpriteManager.ESprite.CLYDEUP);
     orientationToSprite_.Add(EOrientation.DOWN, SpriteManager.ESprite.CLYDEDOWN);
     orientationToSprite_.Add(EOrientation.NEUTRAL, SpriteManager.ESprite.CLYDEDOWN);
     position_ = new Vector2(137, 140);
     sprite_ = new Sprite(position_, orientationToSprite_[orientation_]);
     orientation_ = EOrientation.RIGHT;
     intersected = false;
 }
示例#6
0
 public ACharacter(SpriteManager s, EOrientation e)
 {
     orientation_ = EOrientation.NEUTRAL;
     totalElapsedTime_ = new TimeSpan();
     timePerFrame_ = new TimeSpan(1000000);
     blocked_ = true;
     orientationToSprite_ = new Dictionary<EOrientation, SpriteManager.ESprite>();
     spriteManager_ = s;
     atIntersection_ = false;
     hitBox_ = new Rectangle((int)position_.X + 4, (int)position_.Y + 4, 8, 8);
     destination_ = e;
     speedPerSec_ = 60;
 }
示例#7
0
文件: Pinky.cs 项目: poksme/Pacman
 public Pinky(SpriteManager s)
     : base(s, EOrientation.RIGHT)
 {
     orientationToSprite_.Add(EOrientation.LEFT, SpriteManager.ESprite.PINKYLEFT);
     orientationToSprite_.Add(EOrientation.RIGHT, SpriteManager.ESprite.PINKYRIGHT);
     orientationToSprite_.Add(EOrientation.UP, SpriteManager.ESprite.PINKYUP);
     orientationToSprite_.Add(EOrientation.DOWN, SpriteManager.ESprite.PINKYDOWN);
     orientationToSprite_.Add(EOrientation.NEUTRAL, SpriteManager.ESprite.PINKYRIGHT);
     position_ = new Vector2(105, 140);
     sprite_ = new Sprite(position_, orientationToSprite_[orientation_]);
     orientation_ = EOrientation.LEFT;
     intersected = false;
 }
示例#8
0
 public SceneManager(SpriteManager spm, SoundManager som)
 {
     scenes = new Dictionary<EScene,AScene>();
     scenes.Add(EScene.LEVEL, new Play(this, spm, som));
     scenes.Add(EScene.PAUSE, new Pause(this, spm, som));
     scenes.Add(EScene.LEGEND, new Legend(this, spm, som));
     scenes.Add(EScene.TITLE, new TitleScreen(this, spm, som));
     scenes.Add(EScene.WIN, new WinScreen(this, spm, som));
     spm_ = spm;
     som_ = som;
     activateScene(EScene.TITLE);
     exit_ = false;
     lastState = GamePad.GetState(PlayerIndex.One);
     currentState = GamePad.GetState(PlayerIndex.One);
 }
示例#9
0
 public WinScreen(SceneManager sm, SpriteManager spm, SoundManager som)
     : base(sm, spm, som)
 {
     lastState = GamePad.GetState(PlayerIndex.One);
     sm_ = sm;
 }
示例#10
0
文件: Legend.cs 项目: poksme/Pacman
 public Legend(SceneManager scm, SpriteManager spm, SoundManager som)
     : base(scm, spm, som)
 {
     lastState = GamePad.GetState(PlayerIndex.One);
     textPos = Vector2.Zero;
 }
示例#11
0
 public TitleScreen(SceneManager sm, SpriteManager spm_, SoundManager som)
     : base(sm, spm_, som)
 {
     lastState = GamePad.GetState(PlayerIndex.One);
     som_.play(SoundManager.ESound.BEGIN);
 }
示例#12
0
文件: Play.cs 项目: poksme/Pacman
 public Play(SceneManager sm, SpriteManager spm, SoundManager som)
     : base(sm, spm, som)
 {
     load();
 }
示例#13
0
 public void drawMapScaled(uint x, uint y, SpriteManager.ESprite b)
 {
     if (!heroCentered_)
     {
         tmpPos_.X = (x * 8 - 4) * zoomScale_ + ((graphicsDevice_.Viewport.Width + blackRec_.Width) / 2) - (backgroundRec_.Width / 2) * zoomScale_;
         tmpPos_.Y = (y * 8 + 20) * zoomScale_ + (graphicsDevice_.Viewport.Height / 2) - (backgroundRec_.Height / 2) * zoomScale_;
     }
     else
     {
         tmpPos_.X = (x * 8 - 4) * zoomScale_ + ((graphicsDevice_.Viewport.Width + blackRec_.Width) / 2) - heroPos_.X * zoomScale_;
         tmpPos_.Y = (y * 8 + 20) * zoomScale_ + (graphicsDevice_.Viewport.Height / 2) - heroPos_.Y * zoomScale_;
     }
     spriteBatch_.Draw(spriteTex_, tmpPos_, spriteRec_[b][0], Color.White, 0f, Vector2.Zero, zoomScale_, SpriteEffects.None, 0f);
 }
示例#14
0
文件: Pause.cs 项目: poksme/Pacman
 public Pause(SceneManager sm, SpriteManager spm, SoundManager som)
     : base(sm, spm, som)
 {
     recent = false;
 }
示例#15
0
文件: AScene.cs 项目: poksme/Pacman
 public AScene(SceneManager scm, SpriteManager spm, SoundManager som)
 {
     scm_ = scm;
     spm_ = spm;
     som_ = som;
 }
示例#16
0
 public Legend(SceneManager scm, SpriteManager spm, SoundManager som)
     : base(scm, spm, som)
 {
     lastState = GamePad.GetState(PlayerIndex.One);
     textPos   = Vector2.Zero;
 }