Ejemplo n.º 1
0
 public DKBananaCollectedState(DKBanana item)
 {
     this.item = item;
     ScoreSystem.addBananas(1);
     SoundPool.PlaySound(Sound.CollectibleBanana);
     item.Body.Velocity = new Vector2(X_COLLECTED_SPEED, Y_COLLECTED_SPEED);
 }
Ejemplo n.º 2
0
        public DKKongTileCollectedState(DKKongTile item)
        {
            this.item = item;
            switch (item.KongTileLetter)
            {
            case DKKongTileType.K:
                SoundPool.PlaySound(Sound.CollectibleLetterK);
                break;

            case DKKongTileType.O:
                SoundPool.PlaySound(Sound.CollectibleLetterO);
                break;

            case DKKongTileType.N:
                SoundPool.PlaySound(Sound.CollectibleLetterN);
                break;

            case DKKongTileType.G:
                SoundPool.PlaySound(Sound.CollectibleLetterG);
                break;
            }
            ScoreSystem.addKongTiles(item.KongTileLetter);
            PhysicsWorld.Instance.DestroyBody(this.item.Body);
            WorldManager.Instance.RemoveObject(this.item);
        }
Ejemplo n.º 3
0
 public DKRambiCrateBrokenState(DKRambiCrate item)
 {
     this.item   = item;
     item.Sprite = ItemSpriteFactory.Instance.CreateDKRambiCrateOpeningSprite();
     item.Sprite.AnimationDelegate = this;
     SoundPool.PlaySound(Sound.RambiCrateOpen);
 }
 public void ProcessCollected()
 {
     this.item.Sprite = ItemSpriteFactory.Instance.CreateDKCheckpointBarrelSpriteOpened();
     //not removed from wm list to keep on screen
     PhysicsWorld.Instance.DestroyBody(this.item.Body);
     CheckpointManager.Instance.UpdateCheckpointLocation(this.item.Body.BottomCenter);
     SoundPool.PlaySound(Sound.CollectibleBarrelSave);
 }
Ejemplo n.º 5
0
 public DKBalloonCollectedState(DKBalloon item)
 {
     this.item = item;
     ScoreSystem.addLives(1);
     SoundPool.PlaySound(Sound.CollectibleLifeGained);
     PhysicsWorld.Instance.DestroyBody(this.item.Body);
     WorldManager.Instance.RemoveObject(this.item);
 }
Ejemplo n.º 6
0
 public void Kill()
 {
     state = new EnemyDeadState();
     PhysicsWorld.Instance.DestroyBody(this.Body);
     WorldManager.Instance.RemoveObject(this);
     SoundPool.PlaySound(Sound.EnemyKritterDie);
     //body.UpdateVelocity(body.Velocity.X, body.Velocity.Y + 1);
 }
Ejemplo n.º 7
0
 public void Kill()
 {
     state = new EnemyDeadState();
     PhysicsWorld.Instance.DestroyBody(this.Body);
     WorldManager.Instance.RemoveObject(this);
     SoundPool.PlaySound(Sound.EnemyGnawtyDie);
     //Sprint 3 would've move the enemy off the screen
     //body.UpdateVelocity(body.Velocity.X, body.Velocity.Y + 1);
 }
Ejemplo n.º 8
0
 public void Reset()
 {
     SoundPool.StopBackgroundMusic();
     PhysicsWorld.Instance.DestroyAllBodies();
     ScoreSystem.Reset();
     Initialize();
     LoadAllGameObjects();
     gameIsOver = false;
 }
 public DKBananaGroupCollectedState(DKBananaGroup item)
 {
     this.item          = item;
     item.Body.Velocity = new Vector2(X_COLLECTED_SPEED, Y_COLLECTED_SPEED);
     ScoreSystem.addBananas(10);
     SoundPool.PlaySound(Sound.CollectibleBananaGroup);
     //Should probably have some form of garbage collection for collectibles off the screen to pull them from WM & PW
     //PhysicsWorld.Instance.DestroyBody(this.item.Body);
     //WorldManager.RemoveObject(this.item);
 }
Ejemplo n.º 10
0
 public void GameOver()
 {
     SoundPool.StopBackgroundMusic();
     PhysicsWorld.Instance.DestroyAllBodies();
     Initialize();
     gameIsOver = true;
     gameObjects.Clear();
     ScoreSystem.Reset();
     MoveCamera(Vector2.Zero);
     backgroundMap = ItemSpriteFactory.Instance.CreateGameOverSprite();
 }
Ejemplo n.º 11
0
 /*
  * LoadContent will be called once per game and is the place to load
  * all of your content.
  */
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     SoundPool.LoadContent(Content);
     EnemySpriteFactory.Instance.LoadAllTextures(Content);
     ItemSpriteFactory.Instance.LoadAllTextures(Content);
     PlayerSpriteFactory.Instance.LoadAllTextures(Content);
     FontFactory.Instance.LoadAllFonts(Content);
     WorldManager.Instance.LoadAllGameObjects();
     PlayerCollisionHandler.LoadCollisionResponseTable();
     EnemyCollisionHandler.LoadCollisionResponseTable();
 }
Ejemplo n.º 12
0
        public void LoadAllGameObjects()
        {
            DKLevelParser.ParseLevel("Levels/fullLevel1.tmx", out gameObjects);

            Player p = new Player();

            gameObjects.Add(p);
            inputReceivers.Add(p);
            player = p;
            SoundPool.PlayBackgroundMusic();

            backgroundMap = ItemSpriteFactory.Instance.CreateBackgroundSprite();
        }
        public DKTrophyCollectedState(DKTrophy item)
        {
            this.item = item;
            if (counter++ == 1)
            {
                SoundPool.PlaySound(Sound.CollectibleTrophy1);
            }
            else if (counter++ == 2)
            {
                SoundPool.PlaySound(Sound.CollectibleTrophy2);
            }
            else if (counter++ == 3)
            {
                SoundPool.PlaySound(Sound.CollectibleTrophy3);
            }
            else if (counter++ > 3)
            {
                SoundPool.PlaySound(Sound.CollectibleTrophyAll);
            }

            PhysicsWorld.Instance.DestroyBody(this.item.Body);
            WorldManager.Instance.RemoveObject(this.item);
        }
Ejemplo n.º 14
0
 public DKThrownBarrelRollState(DKThrownBarrel item)
 {
     this.item   = item;
     item.Sprite = ItemSpriteFactory.Instance.CreateDKBarrelRollSprite();
     SoundPool.PlaySound(Sound.CollectibleBarrelRoll);
 }
Ejemplo n.º 15
0
 protected override void Setup(Player player, IPlayerStateTransitionSet transitionSet, ISprite sprite)
 {
     base.Setup(player, transitionSet, sprite);
     player.Body.ApplyScaledImpulse(new Vector2(0, JUMP_IMPULSE_MAG));
     SoundPool.PlaySound(Sound.RambiJump);
 }
 public DKStandardBarrelBrokenState(DKStandardBarrel item)
 {
     this.item   = item;
     item.Sprite = ItemSpriteFactory.Instance.CreateDKStandardBarrelBrokenSprite();
     SoundPool.PlaySound(Sound.CollectibleBarrelBreak);
 }
Ejemplo n.º 17
0
 public void Win()
 {
     SoundPool.PlaySound(Sound.PlayerDKVictory);
     ScoreSystem.Reset();
     player.Win();
 }