コード例 #1
0
        public void Kill()
        {
            TimeSpan  FrameInterval = new TimeSpan(0);
            Animation An            = AnimationManager.getInstance().Find(AnimName.UfoDeath);

            TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, An, delegate { Actions.Animate(An, this); });
        }
コード例 #2
0
        public void Reset()
        {
            this.FlipSprite(SpriteName.Ufo);
            isDying = false;

            this.direction.X = 0;
            this.Position.X  = -70;

            Random X = new Random();
            int    s = X.Next(3);

            switch (s)
            {
            case 0:
                score = 50;
                break;

            case 1:
                score = 100;
                break;

            case 2:
                score = 150;
                break;
            }

            Sound Effect = SoundManager.getInstance().Find(SoundName.UFOMove);

            Effect.PauseSoundLooped();

            TimeSpan FrameInterval = new TimeSpan(0, 0, 20);
            UFO      ufo           = (UFO)GameObjMananger.getInstance().Find(GameObjName.UFO);

            TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, ufo, delegate { Actions.Act(ufo); });
        }
コード例 #3
0
        public static void Animate(Animation Anim, Ship player)
        {
            if (player.Status == playerStatus.Live)
            {
                player.FlipSprite(Anim.getNextFrame());
                TimeSpan FrameInterval = new TimeSpan(25000000);
                TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Anim, delegate { Actions.Animate(Anim, player); });

                Sound Effect = SoundManager.getInstance().Find(SoundName.ShipDeath);
                Effect.PlaySound();

                player.Status = playerStatus.Hit;
            }
            else if (player.Status == playerStatus.Hit)
            {
                GameManager.getInstance().Hit();
                player.FlipSprite(Anim.getNextFrame());

                if (GameManager.getInstance().isDead())
                {
                    TimeSpan FrameInterval = new TimeSpan(0);
                    TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Anim, delegate { Actions.Animate(Anim, player); });
                    player.Status = playerStatus.Dead;
                }
                else
                {
                    player.Status = playerStatus.Live;
                }
            }
            else if (player.Status == playerStatus.Dead)
            {
                player.score = GameManager.getInstance().getCurrentScore();
                player.lives = GameManager.getInstance().getCurrentLives();
            }
        }
コード例 #4
0
 public Animation(Sprite insprite, int numFrames, TimeSpan inFrame)
 {
     FrameNum      = numFrames;
     _frames       = new Frame[numFrames];
     _sprite       = insprite;
     Speed         = AnimSpeed.Dynamic;
     FrameInterval = inFrame;
     LastInterval  = TimeEventManager.getInstance().GetCurrentTime();
 }
コード例 #5
0
 public Animation(Sprite insprite, int numFrames, AnimSpeed speed, AnimName inName)
 {
     Name          = inName;
     FrameNum      = numFrames;
     _frames       = new Frame[numFrames];
     _sprite       = insprite;
     Speed         = speed;
     FrameInterval = new TimeSpan(2750000);
     LastInterval  = TimeEventManager.getInstance().GetCurrentTime();
 }
コード例 #6
0
        public static void Animate(Animation Anim, Bomb bomb)
        {
            bomb.FlipSprite(Anim.getNextFrame());

            if (bomb.getStatus())
            {
                TimeSpan  FrameInterval = new TimeSpan(2000000);
                Animation An            = AnimationManager.getInstance().Find(AnimName.BombAnim);
                TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, An, delegate { Actions.Animate(An, bomb); });
            }
        }
コード例 #7
0
        public override void VisitBomb(Bomb inBomb)
        {
            ((Super)(GameObjMananger.getInstance().Find(GameObjName.Super))).ReloadBomb(inBomb);

            if (Status == playerStatus.Live)
            {
                TimeSpan  FrameInterval = new TimeSpan(0);
                Animation An            = AnimationManager.getInstance().Find(AnimName.ShipDeath);
                TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, An, delegate { Actions.Animate(An, this); });
            }
        }
コード例 #8
0
        public static void Act(Super Supah)
        {
            Supah.Action();

            TimeSpan FrameInterval = new TimeSpan(0, 0, 0, 0, 1000 - GameManager.getInstance().getDifficulty());//new TimeSpan(5750000);

            TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Supah, delegate { Actions.Act(Supah); });

            Sound Effect = (Sound)SoundManager.getInstance().Find(SoundName.AlienMove);

            Effect.PlaySoundLib();
        }
コード例 #9
0
        public void StartTimedEvents()
        {
            TimeSpan FrameInterval = new TimeSpan(5750000);
            Super    Super         = (Super)GameObjMananger.getInstance().Find(GameObjName.Super);

            TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Super, delegate { Actions.Act(Super); });

            FrameInterval = new TimeSpan(0, 0, 15);
            UFO ufo = (UFO)GameObjMananger.getInstance().Find(GameObjName.UFO);

            TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, ufo, delegate { Actions.Act(ufo); });
        }
コード例 #10
0
        public void Update(Column inColumn)
        {
            if (usedBomb < MaxBomb)
            {
                bool drop = DropBomb(inColumn);

                if (drop)
                {
                    TimeSpan  FrameInterval = new TimeSpan(1750000);
                    Animation An            = AnimationManager.getInstance().Find(AnimName.BombAnim);
                    TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, An, delegate { Actions.Animate(An, inColumn.getAssignedBomb()); });
                }
            }
        }
コード例 #11
0
        public void Initialize(GraphicsDeviceManager graphics, SpriteBatch spritebatch)
        {
            TextureManager.getInstance().Initialize();
            TextureManager.getInstance().CreateGameTextures();

            SoundManager.getInstance().Initialize();
            SoundManager.getInstance().CreateSounds();

            ImageManager.getInstance().Initialize();
            ImageManager.getInstance().CreateGameImages();

            SpriteManager.getInstance().Initialize();
            SpriteManager.getInstance().CreateAllSprites();

            AnimationManager.getInstance().Initialize();
            AnimationManager.getInstance().CreateAnimations();

            SpriteBatchManager.getInstance().Initialize();
            SpriteBatchManager.getInstance().CreateAllSpriteBatches(graphics.GraphicsDevice);
            SpriteBatchManager.getInstance().CreateMenu(graphics.GraphicsDevice);

            ColObjManager.getInstance().Initialize();
            GameObjMananger.getInstance().Initialize();

            ColGroupManager.getInstance().Initialize();
            ColGroupManager.getInstance().Create();

            ColPairManager.getInstance().Initialize();
            ColPairManager.getInstance().CreateCollisionPairs();

            GameObjMananger.getInstance().CreateSuper();
            GameObjMananger.getInstance().CreateLevel(graphics.GraphicsDevice);
            GameObjMananger.getInstance().CreateShield();
            GameObjMananger.getInstance().CreateShip();
            GameObjMananger.getInstance().CreateUI();
            GameObjMananger.getInstance().CreateUfo();

            InputManager.Instance().Initialize();
            TimeEventManager.getInstance().Initialize();
            TimeEventManager.getInstance().StartTimedEvents();

            ScreenManager.Instance().CurrentScreen = Screen.MainMenu;
            ScreenManager.Instance().switchScreen();

            getCurrentPlayerData();

            CurrLevel  = 0;
            Difficulty = CurrLevel * 2;
        }
コード例 #12
0
        public void Update(GameTime gameTime)
        {
            currentPlayerStatus = ((Ship)(GameObjMananger.getInstance().Find(GameObjName.Ship))).Status;

            InputManager.Instance().Update(ScreenManager.Instance().CurrentScreen);

            if (currentPlayerStatus != playerStatus.Dead && ScreenManager.Instance().CurrentScreen == Screen.Game)
            {
                ColPairManager.getInstance().Collide();
                GameObjMananger.getInstance().Update(gameTime);
                TimeEventManager.getInstance().Update(gameTime);
                AnimationManager.getInstance().Update(gameTime);
                UpdateHIScore();
            }

            if (currentPlayerStatus == playerStatus.Dead && ScreenManager.Instance().CurrentScreen == Screen.Game)
            {
                GAMEOVER();
            }
        }
コード例 #13
0
        public static void Animate(Animation Anim, UFO Ufo)
        {
            if (!Ufo.isDying)
            {
                Ufo.FlipSprite(Anim.getNextFrame());
                TimeSpan FrameInterval = new TimeSpan(1750000);
                TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Anim, delegate { Actions.Animate(Anim, Ufo); });
                Ufo.isDying = true;

                Sound Effect = SoundManager.getInstance().Find(SoundName.UFOKill);
                Effect.PlaySound();
            }
            else
            {
                Ufo.Reset();
                GameManager.getInstance().ScoreUp(Ufo.getScore());
                UI Score = (UI)GameObjMananger.getInstance().Find(GameObjName.Score);
                Score.ChangeText(GameManager.getInstance().getCurrentScore());
            }
        }
コード例 #14
0
        public static void Animate(Animation Anim, Alien alien)
        {
            if (!alien.isDying)
            {
                alien.FlipSprite(Anim.getNextFrame());
                TimeSpan FrameInterval = new TimeSpan(1750000);
                TimeEventManager.getInstance().Add(TimeEventManager.getInstance().GetCurrentTime() + FrameInterval, Anim, delegate { Actions.Animate(Anim, alien); });
                alien.isDying = true;

                Sound Effect = SoundManager.getInstance().Find(SoundName.AlienKill);
                Effect.PlaySound();
            }
            else
            {
                GameObjMananger.getInstance().KillObject(alien, SpriteBatchName.Scene);
                GameManager.getInstance().ScoreUp(alien.getScore());
                UI Score = (UI)GameObjMananger.getInstance().Find(GameObjName.Score);
                Score.ChangeText(GameManager.getInstance().getCurrentScore());
                GameManager.getInstance().AlienDead();
            }
        }