示例#1
0
        private void LoadContent(ContentManager content)
        {
            this.content = content;

            //Insert the graphics into the static variables.
            Laser.playerLaser = content.Load <Texture2D>("Graphics/PlayerLaser");
            Laser.enemyLaser  = content.Load <Texture2D>("Graphics/Laser");
            destroyedTexture  = content.Load <Texture2D>("Graphics/Destroyed");

            Player.SetDeath = content.Load <Texture2D>("Graphics/PlayerDestroyed");

            UFO = new UFO("UFO", new Vector2(-50, 10), width);
            UFO.Reset();
        }
示例#2
0
        //Reset everything for a new round of Space Invaders.
        public void Reset()
        {
            Main.currentScore = 0;
            overallDifficulty = 0;
            levelDifficulty   = 0;

            invaders         = new List <Enemy>();
            invaderPosition  = new List <EnemyPosition>();
            lasers           = new List <Laser>();
            invaderDestroyed = new List <GraphicalObject>();
            blockFormations  = new List <BlockFormation>();
            lifeMarkers      = new List <GraphicalObject>();

            player = new Player("Player", new Vector2(width / 2, height - 40));
            player.GetLifeTexture();

            EnemyPosition.overallPosition = new Vector2(0, 0);

            pointText = new TextLine("Font", Main.currentScore.ToString(), Color.White, new Vector2(10, 10));

            shootNext = rand.Next(800, 2000);
            lifeMarkers.Add(new GraphicalObject("Player", new Vector2(width, 0)));
            lifeMarkers.Add(new GraphicalObject("Player", new Vector2(width, 0)));

            int blockPoint = width / 5;

            for (int i = 0; i < 4; i++)
            {
                blockFormations.Add(new BlockFormation());
                blockFormations[i].LoadContent(content, blockPoint + blockPoint * i, height);
            }

            UFO.Reset();

            NewWave(content);
        }
示例#3
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());
            }
        }
示例#4
0
        private void LoadContent(ContentManager content)
        {
            this.content = content;

            //Insert the graphics into the static variables.
            Laser.playerLaser = content.Load<Texture2D>("Graphics/PlayerLaser");
            Laser.enemyLaser = content.Load<Texture2D>("Graphics/Laser");
            destroyedTexture = content.Load<Texture2D>("Graphics/Destroyed");

            Player.SetDeath = content.Load<Texture2D>("Graphics/PlayerDestroyed");

            UFO = new UFO("UFO", new Vector2(-50, 10), width);
            UFO.Reset();
        }