Beispiel #1
0
        public Level AddLevel()
        {
            var level = new Level(this);
            Levels.Add(level);

            return level;
        }
Beispiel #2
0
 public RenderingEffect(ContentManager Content,Game game)
 {
     level = Content.ServiceProvider.GetService(typeof(Level)) as Level;
     dev = game.GraphicsDevice;
     pixel = new Texture2D(dev, 1, 1);
     pixel.SetData<Color>(new Color[] { Color.White });
     screenRect = new Rectangle(0, 0, dev.Viewport.Width, dev.Viewport.Height);
 }
Beispiel #3
0
 public RenderingBlocks(ContentManager Content,Game game)
     : base(Content, game)
 {
     level = Content.ServiceProvider.GetService(typeof(Level)) as Level;
     block1 = Content.Load<Texture2D>("Tiles/block0-1");
     block2a = Content.Load<Texture2D>("Tiles/block0-2a");
     block2b = Content.Load<Texture2D>("Tiles/block0-2b");
     block2c = Content.Load<Texture2D>("Tiles/block0-2c");
 }
Beispiel #4
0
        public LayerEnemy(ContentManager content)
            : base(content)
        {
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;
            enemyRunRed = new Animation(content.Load<Texture2D>("Sprites/MonsterA/RunEnemy"), 0.1f, true);
            enemyIdleRed = new Animation(content.Load<Texture2D>("Sprites/MonsterA/Idle"), 0.15f, true);
            electr = new Animation(content.Load<Texture2D>("Sprites/fulmine"), 0.15f, true,32);

            bladeRun = new Animation(content.Load<Texture2D>("Sprites/Guill"), 0.1f, true);
            thorns = new Animation(content.Load<Texture2D>("Sprites/Thorns"), 0.1f, true);

            Initialize();
        }
Beispiel #5
0
        public LayerPlayer(ContentManager content)
            : base(content)
        {
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;
            playerIdle = new Animation(content.Load<Texture2D>("Sprites/Player/Idle"), 0.1f, true);
            playerRun = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.03f, true);
            playerWalk = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.07f, true);
            playerJump = new Animation(content.Load<Texture2D>("Sprites/Player/jumpPlayer"), 0.1f, false);
            playerWin = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.1f, false);
            playerDie = new Animation(content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false);

            //set default animation sprite
            level.playerLevel.sprite.PlayAnimation(playerIdle);
        }
Beispiel #6
0
        public LayerGameObject(ContentManager content)
        {
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;
            portal = new Animation(content.Load<Texture2D>("Sprites/portal"), 0.32f, true);

            doorClose = new Animation(content.Load<Texture2D>("Sprites/doorClose"), 0.1f, false);
            pass1 = new Animation(content.Load<Texture2D>("Sprites/pass1"), 0.1f, false);
            passClose1 = new Animation(content.Load<Texture2D>("Sprites/passClose1"), 0.1f, false);
            pass2 = new Animation(content.Load<Texture2D>("Sprites/pass2"), 0.1f, false);
            passClose2 = new Animation(content.Load<Texture2D>("Sprites/passClose2"), 0.1f, false);
            pass3 = new Animation(content.Load<Texture2D>("Sprites/pass3"), 0.1f, false);
            passClose3 = new Animation(content.Load<Texture2D>("Sprites/passClose3"), 0.1f, false);
            openDoor = new Animation(content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false);

            handle1 = new Animation(content.Load<Texture2D>("Sprites/handle1"), 0.1f, false);
            handle2 = new Animation(content.Load<Texture2D>("Sprites/handle2"), 0.1f, false);
            handle3 = new Animation(content.Load<Texture2D>("Sprites/handle3"), 0.1f, false);

            Initialize();
        }
Beispiel #7
0
        public SoundManager(ContentManager content)
        {
            rand = new Random();
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;

            jump = content.Load<SoundEffect>("Sounds/PlayerJump").CreateInstance();
            diePlayer = content.Load<SoundEffect>("Sounds/PlayerKilled").CreateInstance();
            goodSwitch = content.Load<SoundEffect>("Sounds/goodSwitch").CreateInstance();
            badSwitch = content.Load<SoundEffect>("Sounds/badSwitch").CreateInstance();

            if (level.numLevel > 3)
            {
                music[0] = content.Load<SoundEffect>("Sounds/s2").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h2").CreateInstance();
            }
            else
            {
                music[0] = content.Load<SoundEffect>("Sounds/s1").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h1").CreateInstance();
            }

            openDoor = content.Load<SoundEffect>("Sounds/openDoor").CreateInstance();
            door = (content.Load<SoundEffect>("Sounds/door")).CreateInstance();
            nextLevel = content.Load<SoundEffect>("Sounds/ExitReached").CreateInstance();
            keyCollected = content.Load<SoundEffect>("Sounds/GemCollected").CreateInstance();

            openDoor.Volume = 0.5f;
            door.Volume = 0.5f;
            diePlayer.Volume = 0.5f;

            cameraListener = new AudioListener();
            cameraListener.Position =
                new Vector3(
                    GraphicsDeviceManager.DefaultBackBufferWidth / 2,
                    GraphicsDeviceManager.DefaultBackBufferHeight / 2,
                    0);
            isSoundActive = true;
        }
Beispiel #8
0
        private void LoadTemplate(string xml)
        {
            if (LevelTemplate != null && !_hasTemplateErrors)
                return;

            if (LevelTemplate == null)
                Log.Write("Loading template...");
            else
                Log.Write("Reloading template (previous attempt failed)...");

            try
            {
                if (xml.IsNullOrWhiteSpace())
                    throw new CommonException("Level template is empty");

                var docTemplate = new XmlDocument();
                docTemplate.LoadXml(xml);

                TaskConfig = new TaskConfig(docTemplate.DocumentElement);
                SpawnItemConfig = new SpawnItemConfig(docTemplate.DocumentElement);
                LevelTemplate = new Level(this, docTemplate.DocumentElement["Level"], true);

                _hasTemplateErrors = false;
            }
            catch (Exception ex)
            {
                // ��������� ������, ���� �� ������� �������� �� �����
                if (TaskConfig == null)
                    TaskConfig = new TaskConfig(new string[1], new string[1]);

                if (LevelTemplate == null)
                    LevelTemplate = new Level(this, true);

                if (SpawnItemConfig == null)
                    SpawnItemConfig = new SpawnItemConfig();

                _hasTemplateErrors = true;

                Log.Write("Error while loading level template: {0}", ex.Message);
            }
        }
 public RenderingGameObject(ContentManager Content,Game game)
     : base(Content,game)
 {
     level = Content.ServiceProvider.GetService(typeof(Level)) as Level;
 }
 //update service when load a next level
 public void UpdateLevelService(ContentManager content)
 {
     level = content.ServiceProvider.GetService(typeof(Level)) as Level;
     base.UpdateLevelService(content);
 }
Beispiel #11
0
 public static void LoadIntoLevel( LEVEL_NUM num )
 {
     m_levelNo = num;
     Level l = BinaryLoader.LoadLevel(num);
     m_levelData = l;
     m_currentLevelSpeed = m_levelData.speed;
 }
Beispiel #12
0
 //update the service whrn load the next level
 public void UpdateLevelService(ContentManager content)
 {
     level = content.ServiceProvider.GetService(typeof(Level)) as Level;
     Initialize();
 }
Beispiel #13
0
 //update service when load a next level
 public void UpdateLevelService(ContentManager content)
 {
     level = content.ServiceProvider.GetService(typeof(Level)) as Level;
     //block1 = content.Load<Texture2D>("Tiles/block" + level.numLevel.ToString() + "-1");
     //block2a = content.Load<Texture2D>("Tiles/block" + level.numLevel.ToString() + "-2a");
     //block2b = content.Load<Texture2D>("Tiles/block" + level.numLevel.ToString() + "-2b");
     base.UpdateLevelService(content);
 }
Beispiel #14
0
 public RenderingPlayer(ContentManager Content,Game game)
     : base(Content,game)
 {
     level = Content.ServiceProvider.GetService(typeof(Level)) as Level;
     play.PlayAnimation(playerDie);
 }
Beispiel #15
0
        //update service whene load the next level
        public void UpdateLevelService(ContentManager content)
        {
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;
            float temp = rand.Next(4);

            music[0].Stop();
            music[1].Stop();
            System.Threading.Thread.Sleep(10);
            if (level.numLevel > 2)
            {
                music[0] = content.Load<SoundEffect>("Sounds/s2").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h2").CreateInstance();
            }
            else
            {
                music[0] = content.Load<SoundEffect>("Sounds/s1").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h1").CreateInstance();
            }
            music[0].Play();
            music[1].Play();
        }
Beispiel #16
0
        public Level InsertLevel(int index)
        {
            var level = new Level(this);
            Levels.Insert(index, level);

            return level;
        }
Beispiel #17
0
 public GameState(ContentManager content)
     : base(content)
 {
     level = content.ServiceProvider.GetService(typeof(Level)) as Level;
 }