Exemplo n.º 1
0
        public BriefingScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            //Mouse.SetPosition(512, 384);
            world = w;
            camera = cam;
            menuFont1 = content.Load<SpriteFont>("Fonts/MenuFont1");
            resumeRectangle = new Rectangle(234, 100, 246, 45);
            loadRectangle = new Rectangle(294, 200, 224, 45);
            exitRectangle = new Rectangle(891, 78, 63, 55);
            spriteBatch = new SpriteBatch(device);
            cursor = content.Load<Texture2D>("cursor");
            userInterface = content.Load<Texture2D>("briefing_interface");
            frame = content.Load<Texture2D>("briefing_frame");
            newIcon = content.Load<Texture2D>("Icons/new");
            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
            forestRectangle = new Rectangle(145, 173, 200, 144);
            arcticRectangle = new Rectangle(145, 329, 200, 144);
            caveRectangle = new Rectangle(145, 485, 200, 144);
            bossRectangle = new Rectangle(379, 543, 542, 111);
            frameRectangle = new Rectangle(144, 171, 203, 149);
            startRectangle = new Rectangle(563, 464, 232, 47);
            new0Rectangle = new Rectangle(155, 170, 80, 45);
            new1Rectangle = new Rectangle(155, 326, 80, 45);
            new2Rectangle = new Rectangle(155, 483, 80, 45);
            new3Rectangle = new Rectangle(390, 543, 80, 45);
            newRectangles = new Rectangle[] {new0Rectangle, new1Rectangle, new2Rectangle, new3Rectangle};
            helpRectangle = new Rectangle(837, 81, 56, 47);

            data.missions.generate((byte)data.player.level);
            data.missions.update();
        }
Exemplo n.º 2
0
        public PauseScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            //Mouse.SetPosition(512, 384);
            world = w;
            camera = cam;
            menuFont1 = content.Load<SpriteFont>("Fonts/MenuFont1");
            resumeRectangle = new Rectangle(725, 76, 63, 58);
            saveRectangle = new Rectangle(402, 225, 228, 43);
            exitRectangle = new Rectangle(402, 505, 228, 43);
            baseRectangle = new Rectangle(402, 393, 228, 43);
            charRectangle = new Rectangle(402, 281, 228, 43);
            missionRectangle = new Rectangle(402, 337, 228, 43);
            titleRectangle = new Rectangle(402, 449, 228, 43);
            helpRectangle = new Rectangle(671, 81, 56, 47);
            frameRectangle = saveRectangle;

            spriteBatch = new SpriteBatch(device);
            cursor = content.Load<Texture2D>("cursor");
            fadeRectangle = new Rectangle(0, 0, 1024, 768);

            userInterface = content.Load<Texture2D>("PauseMenu");
            frame = content.Load<Texture2D>("briefing_frame");
            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
        }
Exemplo n.º 3
0
        public void Update(GameTime gameTime, Camera camera, Vector3 position)
        {
            billboardEngine.Begin(camera.ViewMatrix);
            billboardEngine.AddBillboard(new Vector3(0.0f, 1.0f, 0.0f), Color.Honeydew, 0.01f);

            particleEffect.Update((float)gameTime.ElapsedGameTime.TotalSeconds, camera.ViewMatrix, position);
        }
Exemplo n.º 4
0
        public MissionCompleteScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            //Mouse.SetPosition(512, 384);
            world = w;
            camera = cam;
            menuFont1 = content.Load<SpriteFont>("Fonts/MenuFont1");
            spriteBatch = new SpriteBatch(device);
            cursor = content.Load<Texture2D>("cursor");
            userInterface = content.Load<Texture2D>("missionCompleteInterface");
            frame = content.Load<Texture2D>("briefing_frame");
            forestImg = content.Load<Texture2D>("Icons/forrest");
            wasteImg = content.Load<Texture2D>("Icons/wasteland");
            arcticImg = content.Load<Texture2D>("Icons/artic");

            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
            exitRectangle = new Rectangle(891, 78, 63, 55);
            baseRectangle = new Rectangle(412,579,228,43);
            exploreRectangle = new Rectangle(664, 579, 228, 43);
            imageRectangle =new Rectangle(135,474,191,137);
            helpRectangle = new Rectangle(837, 81, 56, 47);
            frameRectangle = baseRectangle;

            setupRank();
        }
Exemplo n.º 5
0
        public DexScreen(ContentManager content, GraphicsDevice device, GameData data, AudioManager audio, World w, Camera cam)
            : base(content, device, audio, data)
        {
            world = w;
            camera = cam;

            menuFont1 = content.Load<SpriteFont>("Fonts/MenuFont1");
            cursor = content.Load<Texture2D>("cursor");
            userInterface = content.Load<Texture2D>("dex_interface");
            frame = content.Load<Texture2D>("briefing_frame");
            heatEnemy = content.Load<Texture2D>("Icons\\heat_enemy");
            iceEnemy = content.Load<Texture2D>("Icons\\ice_enemy");
            plasmaEnemy = content.Load<Texture2D>("Icons\\plasma_enemy");
            bossEnemy = content.Load<Texture2D>("Icons\\boss_enemy");
            neutralEnemy = content.Load<Texture2D>("Icons\\neutral_enemy");

            spriteBatch = new SpriteBatch(device);

            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
            bossRectangle = new Rectangle(106, 495, 154, 156);
            heatRectangle = new Rectangle(270, 495, 154, 156);
            iceRectangle = new Rectangle(434, 495, 154, 156);
            plasmaRectangle = new Rectangle(598, 495, 154, 156);
            neutralRectangle = new Rectangle(762, 495, 154, 156);
            activeEnemyRectangle = new Rectangle(153, 196, 223, 223);
            exitRectangle = new Rectangle(891, 78, 63, 55);
            helpRectangle = new Rectangle(837, 81, 56, 47);

            frameRectangle = bossRectangle;
            activeEnemyTexture = bossEnemy;

            descriptionString = "Cobra Commander\n???\n+++++\n+++++\n+";
            frameworkString = "Name:\nType:\nHealth:\nStrength:\nSpeed:";
        }
Exemplo n.º 6
0
 public void Draw(Camera camera)
 {
     graphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
     graphicsDevice.BlendState = BlendState.Additive;
     billboardEngine.Draw(graphicsDevice, camera);
     graphicsDevice.BlendState = BlendState.Opaque;
     graphicsDevice.DepthStencilState = DepthStencilState.Default;
     particleEffect.Draw(camera);
 }
Exemplo n.º 7
0
 public void Draw(Camera camera)
 {
     graphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
     graphicsDevice.BlendState = BlendState.Additive;
     graphicsDevice.RasterizerState = RasterizerState.CullNone;
     if (numParticles > 0) billboardEngine.Draw(graphicsDevice, camera);
     graphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
     graphicsDevice.BlendState = BlendState.Opaque;
     graphicsDevice.DepthStencilState = DepthStencilState.Default;
 }
Exemplo n.º 8
0
 public void Initialize(Camera camera)
 {
     billboardEngine.Begin(camera.ViewMatrix);
     billboardEngine.AddBillboard(new Vector3(0.0f, 1.0f, 0.0f), Color.Honeydew, 0.01f);
     graphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
     graphicsDevice.BlendState = BlendState.Additive;
     billboardEngine.Draw(graphicsDevice, camera);
     graphicsDevice.BlendState = BlendState.Opaque;
     graphicsDevice.DepthStencilState = DepthStencilState.Default;
 }
Exemplo n.º 9
0
        public ActionScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, Camera cam, World w)
            : base(content, device, audio, data)
        {
            Mouse.SetPosition(512, 384);
            camera = cam;
            world = w;

            font = content.Load<SpriteFont>("Fonts/ModFont");

            hud = content.Load<Texture2D>("hud");
            hudRectangle = new Rectangle(0, 0, 1024, 768);
            HP1 = content.Load<Texture2D>("hp_1");
            HP1Rectangle = new Rectangle(37, 49, 30, 30);
            HP = content.Load<Texture2D>("hp");
            HPRectangle = new Rectangle(67, 56, 200, 17);
            spriteBatch = new SpriteBatch(device);

            //stat mod icons
            red = content.Load<Texture2D>("Icons/redslot");
            blue = content.Load<Texture2D>("Icons/blueslot");
            violet = content.Load<Texture2D>("Icons/violetslot");
            green = content.Load<Texture2D>("Icons/greenslot");

            //type mod icons
            cyan = content.Load<Texture2D>("Icons/cyanslot");
            darkblue = content.Load<Texture2D>("Icons/darkblueslot");
            orange = content.Load<Texture2D>("Icons/orangeslot");

            //element mod icons
            lightgreen = content.Load<Texture2D>("Icons/lightgreenslot");
            foxred = content.Load<Texture2D>("Icons/foxredslot");
            white = content.Load<Texture2D>("Icons/whiteslot");

            Mod1Rectangle = new Rectangle(52, 676, 40, 39);
            Mod2Rectangle = new Rectangle(91, 649, 40, 39);
            Mod3Rectangle = new Rectangle(134, 672, 40, 39);
            Mod4Rectangle = new Rectangle(93, 699, 40, 39);
            ModRectangles = new Rectangle[] {Mod1Rectangle, Mod2Rectangle, Mod3Rectangle, Mod4Rectangle};

            spawnNewEnemies = false;
            timeInMission = new TimeSpan(0);
            data.missions.activeMission.timeSpent = timeInMission;

            blurEffect = new BlurEffect(device, content);

            miniMap = new Map(data, world, device, content, new Point(750, 500));
            canShoot = true;
            lowHP = false;
        }
Exemplo n.º 10
0
        public GameOverScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            //Mouse.SetPosition(512, 384);
            world = w;
            camera = cam;
            baseRectangle = new Rectangle(390, 475, 245, 50);

            spriteBatch = new SpriteBatch(device);
            cursor = content.Load<Texture2D>("cursor");
            fadeRectangle = new Rectangle(0, 0, 1024, 768);

            userInterface = content.Load<Texture2D>("gameover");
            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
        }
Exemplo n.º 11
0
        public CharScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            world = w;
            camera = cam;

            menuFont1 = content.Load<SpriteFont>("Fonts/MenuFont1");
            cursor = content.Load<Texture2D>("cursor");
            userInterface = content.Load<Texture2D>("CharInfo");

            //stat mod icons
            red = content.Load<Texture2D>("Icons/redslot");
            blue = content.Load<Texture2D>("Icons/blueslot");
            violet = content.Load<Texture2D>("Icons/violetslot");
            green = content.Load<Texture2D>("Icons/greenslot");

            //type mod icons
            cyan = content.Load<Texture2D>("Icons/cyanslot");
            darkblue = content.Load<Texture2D>("Icons/darkblueslot");
            orange = content.Load<Texture2D>("Icons/orangeslot");

            //element mod icons
            lightgreen = content.Load<Texture2D>("Icons/lightgreenslot");
            foxred = content.Load<Texture2D>("Icons/foxredslot");
            white = content.Load<Texture2D>("Icons/whiteslot");

            spriteBatch = new SpriteBatch(device);

            interfaceRectangle = new Rectangle(0, 0, 1024, 768);

            exitRectangle = new Rectangle(726, 78, 63, 55);

            Mod1Rectangle = new Rectangle(296, 542, 40, 39);
            Mod2Rectangle = new Rectangle(335, 515, 40, 39);
            Mod3Rectangle = new Rectangle(378, 538, 40, 39);
            Mod4Rectangle = new Rectangle(337, 565, 40, 39);
            ModRectangles = new Rectangle[] { Mod1Rectangle, Mod2Rectangle, Mod3Rectangle, Mod4Rectangle };
            helpRectangle = new Rectangle(671, 81, 56, 47);

            weaponLabel = "";
            modStatLabel = "";

            modStats = data.player.myWeapon.modStats;

            generateLabels();
        }
Exemplo n.º 12
0
 /// <summary>
 /// draws the object using a specified camera
 /// </summary>
 /// <param name="usedCamera">camera in that space the object will be drawn</param>
 public void Draw(Camera usedCamera)
 {
     Draw(usedCamera.ViewMatrix, usedCamera.ProjectionMatrix);
 }
Exemplo n.º 13
0
        private bool updateCycle(GameTime gameTime, Camera camera, World world, NPCCollection npcs, Player p, Mission m, int factor, float spd, float dx, float dz)
        {
            position += spd * direction;
            if (type == Constants.TYP_WAV)
            {
                Vector3 cross = Vector3.Cross(direction, Vector3.Up);
                if (mirror)
                    position -= 0.5f * cross * (float)Math.Sin(waveTime.Milliseconds * 200);
                else
                    position += 0.5f * cross * (float)Math.Sin(waveTime.Milliseconds*200);
                //position += 0.5f * Vector3.Up * (float)Math.Cos(waveTime.Milliseconds);
                //position.X += dx / factor;
                //position.Z += dz / factor;
            }

            distance += spd;

            bulletOb.Position = position;

            particleEffect.Update((float)gameTime.ElapsedGameTime.TotalSeconds, camera.ViewMatrix, position, direction);

            xTile = (byte)Math.Round(-1 * (position.X) + (Constants.MAP_SIZE - 1));
            zTile = (byte)Math.Round(-1 * (position.Z) + (Constants.MAP_SIZE - 1));

            if (collision(world) || collision(npcs, m) || collision(p, m) || distance > maxDist)
            {
                active = false;
                particleEffect.Clear();
                return false;
            }
            return true;
        }
Exemplo n.º 14
0
 public void draw(Camera camera)
 {
     if (!active) return;
     particleEffect.Draw(camera);
     //bulletOb.Draw(camera);
 }
Exemplo n.º 15
0
        public void draw(Camera camera, GraphicsDevice device)
        {
            skybox.Draw(device, camera);
            //device.DepthStencilState = DepthStencilState.None;
            device.BlendState = BlendState.AlphaBlend;

            for (int i = 0; i < SIZE; ++i)
            {
                for (int j = 0; j < SIZE; ++j)
                {
                    if (mapData[i][j] == '-') continue;
                    ModelObject g = ground[i][j];
                    if (g != null) g.Draw(camera);
                    ModelObject m = mapObjects[i][j];

                    if (m != null) m.Draw(camera);
                }
            }

            //device.DepthStencilState = DepthStencilState.Default;
            device.BlendState = BlendState.Opaque;
        }
Exemplo n.º 16
0
Arquivo: NPC.cs Projeto: kayorga/3DSP
 public override void draw(Camera camera)
 {
     if (!active)
         return;
     if (isDead && active)
         explosion.Draw(camera);
     else base.draw(camera);
 }
Exemplo n.º 17
0
        public ModificationScreen(ContentManager content, GraphicsDevice device, AudioManager audio, GameData data, World w, Camera cam)
            : base(content, device, audio, data)
        {
            //Mouse.SetPosition(512, 384);
            world = w;
            camera = cam;
            lastMouseState = ButtonState.Released;
            modFont = content.Load<SpriteFont>("Fonts/ModFont");
            loadRectangle = new Rectangle(294, 200, 224, 45);
            exitRectangle = new Rectangle(891, 78, 63, 55);

            spriteBatch = new SpriteBatch(device);
            cursor = content.Load<Texture2D>("cursor");
            userInterface = content.Load<Texture2D>("mod_interface");
            frame = content.Load<Texture2D>("briefing_frame");

            //stat mod icons
            i_mod_nil = content.Load<Texture2D>("Icons/mod_nil");
            i_mod_str = content.Load<Texture2D>("Icons/mod_str");
            i_mod_spd = content.Load<Texture2D>("Icons/mod_spd");
            i_mod_rcg = content.Load<Texture2D>("Icons/mod_rcg");
            i_mod_acp = content.Load<Texture2D>("Icons/mod_acp");

            //type mod icons
            i_mod_bla = content.Load<Texture2D>("Icons/mod_bla");
            i_mod_wav = content.Load<Texture2D>("Icons/mod_wav");
            i_mod_tri = content.Load<Texture2D>("Icons/mod_tri");

            //element mod icons
            i_mod_pla = content.Load<Texture2D>("Icons/mod_pla");
            i_mod_hea = content.Load<Texture2D>("Icons/mod_hea");
            i_mod_ice = content.Load<Texture2D>("Icons/mod_ice");

            interfaceRectangle = new Rectangle(0, 0, 1024, 768);
            frameRectangle = new Rectangle(174, 334, 105, 105);
            startRectangle = new Rectangle(196, 583, 190, 67);
            slot1Rectangle = new Rectangle(174, 334, 105, 105);
            slot2Rectangle = new Rectangle(307, 334, 105, 105);
            slot3Rectangle = new Rectangle(174, 466, 105, 105);
            slot4Rectangle = new Rectangle(307, 466, 105, 105);
            activeModRectangle=new Rectangle(264,186,60,60);
            activeModTextRectangle = new Rectangle(234, 258, 117, 49);
            dragDropRectangle = new Rectangle(174, 334, 40, 40);
            helpRectangle = new Rectangle(837, 81, 56, 47);
            #region Inventory Rectangles
            inventoryRectangle[0] = new Rectangle[5];
            inventoryRectangle[1] = new Rectangle[5];
            inventoryRectangle[2] = new Rectangle[5];
            inventoryRectangle[3] = new Rectangle[5];
            for(int i = 0; i<4; i++)
                for (int j = 0; j < 5; j++)
                {
                    inventoryRectangle[i][j]=new Rectangle(559+i*87, 217+j*86, 68, 68);
                }
            #endregion

            #region build modlist
            inventoryItems[0] = new ModItem[5];
            inventoryItems[1] = new ModItem[5];
            inventoryItems[2] = new ModItem[5];
            inventoryItems[3] = new ModItem[5];
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 5; j++)
                {
                    inventoryItems[i][j] = new ModItem(data.mods[i+j*4]);
                    switch (data.mods[i + j * 4].type)
                    {
                        case Constants.MOD_NIL: inventoryItems[i][j].icon = i_mod_nil; break;
                        case Constants.MOD_ELM:
                            switch (data.mods[i + j * 4].value)
                            {
                                case Constants.ELM_PLA: inventoryItems[i][j].icon = i_mod_pla; break;
                                case Constants.ELM_HEA: inventoryItems[i][j].icon = i_mod_hea; break;
                                case Constants.ELM_ICE: inventoryItems[i][j].icon = i_mod_ice; break;
                                default: inventoryItems[i][j].icon = i_mod_nil; break;
                            } break;
                        case Constants.MOD_TYP:
                            switch (data.mods[i + j * 4].value)
                            {
                                case Constants.TYP_BLA: inventoryItems[i][j].icon = i_mod_bla; break;
                                case Constants.TYP_WAV: inventoryItems[i][j].icon = i_mod_wav; break;
                                case Constants.TYP_TRI: inventoryItems[i][j].icon = i_mod_tri; break;
                                default: inventoryItems[i][j].icon = i_mod_nil; break;
                            } break;
                        case Constants.MOD_STR: inventoryItems[i][j].icon = i_mod_str; break;
                        case Constants.MOD_SPD: inventoryItems[i][j].icon = i_mod_spd; break;
                        case Constants.MOD_RCG: inventoryItems[i][j].icon = i_mod_rcg; break;
                        case Constants.MOD_ACP: inventoryItems[i][j].icon = i_mod_acp; break;
                        default: inventoryItems[i][j].icon = i_mod_nil; break;
                    }
                }

            slotItems = new ModItem[4];
            if (data.player.myWeapon.mods != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    slotItems[i] = new ModItem(data.player.myWeapon.mods[i]);
                    switch (slotItems[i].modification.type)
                    {
                        case Constants.MOD_NIL: slotItems[i].icon = i_mod_nil; break;
                        case Constants.MOD_ELM:
                            switch (slotItems[i].modification.value)
                            {
                                case Constants.ELM_PLA: slotItems[i].icon = i_mod_pla; break;
                                case Constants.ELM_HEA: slotItems[i].icon = i_mod_hea; break;
                                case Constants.ELM_ICE: slotItems[i].icon = i_mod_ice; break;
                                default: slotItems[i].icon = i_mod_nil; break;
                            } break;
                        case Constants.MOD_TYP:
                            switch (slotItems[i].modification.value)
                            {
                                case Constants.TYP_BLA: slotItems[i].icon = i_mod_bla; break;
                                case Constants.TYP_WAV: slotItems[i].icon = i_mod_wav; break;
                                case Constants.TYP_TRI: slotItems[i].icon = i_mod_tri; break;
                                default: slotItems[i].icon = i_mod_nil; break;
                            } break;
                        case Constants.MOD_STR: slotItems[i].icon = i_mod_str; break;
                        case Constants.MOD_SPD: slotItems[i].icon = i_mod_spd; break;
                        case Constants.MOD_RCG: slotItems[i].icon = i_mod_rcg; break;
                        case Constants.MOD_ACP: slotItems[i].icon = i_mod_acp; break;
                        default: slotItems[i].icon = i_mod_nil; break;
                    }
                }

                #region
                //slot1Item = new ModItem(data.player.myWeapon.mods[0]);
                //switch (slot1Item.modification.type)
                //{
                //    case Constants.MOD_NIL: slot1Item.icon = i_mod_nil; break;
                //    case Constants.MOD_ELM:
                //        switch(slot1Item.modification.value) {
                //            case Constants.ELM_PLA: slot1Item.icon = i_mod_pla; break;
                //            case Constants.ELM_HEA: slot1Item.icon = i_mod_hea; break;
                //            case Constants.ELM_ICE: slot1Item.icon = i_mod_ice; break;
                //            default: slot1Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_TYP:
                //        switch(slot1Item.modification.value) {
                //            case Constants.TYP_BLA: slot1Item.icon = i_mod_bla; break;
                //            case Constants.TYP_WAV: slot1Item.icon = i_mod_wav; break;
                //            case Constants.TYP_TRI: slot1Item.icon = i_mod_tri; break;
                //            default: slot1Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_STR: slot1Item.icon = i_mod_str; break;
                //    case Constants.MOD_SPD: slot1Item.icon = i_mod_spd; break;
                //    case Constants.MOD_RCG: slot1Item.icon = i_mod_rcg; break;
                //    case Constants.MOD_ACP: slot1Item.icon = i_mod_acp; break;
                //    default: slot1Item.icon = i_mod_nil; break;
                //}
                //slot2Item = new ModItem(data.player.myWeapon.mods[1]);
                //switch (slot2Item.modification.type)
                //{
                //    case Constants.MOD_NIL: slot2Item.icon = i_mod_nil; break;
                //    case Constants.MOD_ELM:
                //        switch (slot2Item.modification.value)
                //        {
                //            case Constants.ELM_PLA: slot2Item.icon = i_mod_pla; break;
                //            case Constants.ELM_HEA: slot2Item.icon = i_mod_hea; break;
                //            case Constants.ELM_ICE: slot2Item.icon = i_mod_ice; break;
                //            default: slot2Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_TYP:
                //        switch (slot2Item.modification.value)
                //        {
                //            case Constants.TYP_BLA: slot2Item.icon = i_mod_bla; break;
                //            case Constants.TYP_WAV: slot2Item.icon = i_mod_wav; break;
                //            case Constants.TYP_TRI: slot2Item.icon = i_mod_tri; break;
                //            default: slot2Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_STR: slot2Item.icon = i_mod_str; break;
                //    case Constants.MOD_SPD: slot2Item.icon = i_mod_spd; break;
                //    case Constants.MOD_RCG: slot2Item.icon = i_mod_rcg; break;
                //    case Constants.MOD_ACP: slot2Item.icon = i_mod_acp; break;
                //    default: slot2Item.icon = i_mod_nil; break;
                //}
                //slot3Item = new ModItem(data.player.myWeapon.mods[2]);
                //switch (slot3Item.modification.type)
                //{
                //    case Constants.MOD_NIL: slot3Item.icon = i_mod_nil; break;
                //    case Constants.MOD_ELM:
                //        switch (slot3Item.modification.value)
                //        {
                //            case Constants.ELM_PLA: slot3Item.icon = i_mod_pla; break;
                //            case Constants.ELM_HEA: slot3Item.icon = i_mod_hea; break;
                //            case Constants.ELM_ICE: slot3Item.icon = i_mod_ice; break;
                //            default: slot3Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_TYP:
                //        switch (slot3Item.modification.value)
                //        {
                //            case Constants.TYP_BLA: slot3Item.icon = i_mod_bla; break;
                //            case Constants.TYP_WAV: slot3Item.icon = i_mod_wav; break;
                //            case Constants.TYP_TRI: slot3Item.icon = i_mod_tri; break;
                //            default: slot3Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_STR: slot3Item.icon = i_mod_str; break;
                //    case Constants.MOD_SPD: slot3Item.icon = i_mod_spd; break;
                //    case Constants.MOD_RCG: slot3Item.icon = i_mod_rcg; break;
                //    case Constants.MOD_ACP: slot3Item.icon = i_mod_acp; break;
                //    default: slot3Item.icon = i_mod_nil; break;
                //}
                //slot4Item = new ModItem(data.player.myWeapon.mods[3]);
                //switch (slot4Item.modification.type)
                //{
                //    case Constants.MOD_NIL: slot4Item.icon = i_mod_nil; break;
                //    case Constants.MOD_ELM:
                //        switch (slot4Item.modification.value)
                //        {
                //            case Constants.ELM_PLA: slot4Item.icon = i_mod_pla; break;
                //            case Constants.ELM_HEA: slot4Item.icon = i_mod_hea; break;
                //            case Constants.ELM_ICE: slot4Item.icon = i_mod_ice; break;
                //            default: slot4Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_TYP:
                //        switch (slot4Item.modification.value)
                //        {
                //            case Constants.TYP_BLA: slot4Item.icon = i_mod_bla; break;
                //            case Constants.TYP_WAV: slot4Item.icon = i_mod_wav; break;
                //            case Constants.TYP_TRI: slot4Item.icon = i_mod_tri; break;
                //            default: slot4Item.icon = i_mod_nil; break;
                //        } break;
                //    case Constants.MOD_STR: slot4Item.icon = i_mod_str; break;
                //    case Constants.MOD_SPD: slot4Item.icon = i_mod_spd; break;
                //    case Constants.MOD_RCG: slot4Item.icon = i_mod_rcg; break;
                //    case Constants.MOD_ACP: slot4Item.icon = i_mod_acp; break;
                //    default: slot4Item.icon = i_mod_nil; break;
                //}
                #endregion
            }

            slot1Item = slotItems[0];
            slot2Item = slotItems[1];
            slot3Item = slotItems[2];
            slot4Item = slotItems[3];

            #endregion

            dragDropActive = false;
        }
Exemplo n.º 18
0
        public void update(GameTime gameTime, Camera camera, World world, NPCCollection npcs, Player p, Mission m)
        {
            if (!active) return;

            waveTime += gameTime.ElapsedGameTime;
            float dx = (float)Math.Sin(waveTime.Milliseconds);
            float dz = (float)Math.Cos(waveTime.Milliseconds);

            int factor = (int) Math.Ceiling(speed);

            float remainingSpeed = speed;
            float spd = speed / (float)factor;

            for (int i = 0; i < factor; i++)
            {
                spd = Math.Min(spd, remainingSpeed);
                bool u = updateCycle(gameTime, camera, world, npcs, p, m, factor, spd, dx, dz);
                remainingSpeed -= spd;
                if (!u || remainingSpeed == 0) break;
            }

            return;
        }
Exemplo n.º 19
0
 public virtual void draw(Camera camera, Queue<DmgNumber> queue)
 {
     model.Draw(camera);
 }
Exemplo n.º 20
0
 public virtual void draw(Camera camera)
 {
     model.Draw(camera);
 }
Exemplo n.º 21
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            audio = new AudioManager(Content);
            camera = new Camera(GraphicsDevice.Viewport.AspectRatio);
            world = new World(Content, GraphicsDevice);
            data = new GameData(Content, GraphicsDevice, audio, world);
            screen = new TitleScreen(Content, GraphicsDevice, audio, data);
            myAction = new ActionScreen(Content, GraphicsDevice, audio, data, camera, world);
            audio.playBackground(0);

            fading = false;
            fadeOut = true;
            fadeFrames = 0;
            maxFadeFrames = 30;
            fadeRectangle = new Rectangle(0, 0, 1024, 768);

            base.Initialize();
        }
Exemplo n.º 22
0
Arquivo: NPC.cs Projeto: kayorga/3DSP
        public bool update(GameTime gameTime, BulletCollection bullets, Camera camera, Player p, Mission m)
        {
            #region npc death
            //die and grant xp
            if (health <= 0 && !isDead)
            {
                int exp = (int)(XP * (float)level / (float)p.level);
                exp = Math.Min(exp,(int) (XP * 1.5f));
                exp = Math.Max(exp, 1);
                if (p.lv == 50) exp = 0;
                else p.getEXP(exp);
                m.update(kind, exp);
                isDead = true;
                isHit = false;
                hitTimer = 0;
                explosion.Position = Position + new Vector3(0, 0.5f, 0);
                explosion.Initialize(camera);
            }

            //Explosion Update if NPC is down
            if (isDead && active)
            {
                hitTimer++;
                explosion.Update(gameTime, camera);
                if (hitTimer > 25)
                {
                    active = false;
                    isDead = false;
                    this.explosion.Clear();
                    dmgNumbers.Clear();
                    return false;
                }
            }
            #endregion

            #region shoot

            //shoot if player is within shooting distance and not on cooldown
            if (playerDistance <= world.shootDistance && cooldown == 0)
            {
                cooldown = maxCooldn;
                Vector3 dir = (p.position - position);
                dir.Normalize();
                bullets.generate(false, position + dir, dir, 1, world.shootDistance * 2, strength, element);
                audio.playShoot(false);
            }

            if (cooldown > 0) cooldown--;
            #endregion

            #region move
            //if (moving)
                //move();
            //else

            if (!moving || !move())
            {
                {
                    pathFinder.setup(new Point((int)Math.Round((-1 * position.X + world.size - 1)), (int)Math.Round((-1 * position.Z + world.size - 1))), p);
                    target = pathFinder.findPath(kind == Constants.NPC_BOSS);
                    newTarget = true;
                    direction = target - position;
                    if (direction.Length() != 0) direction.Normalize();
                    moving = true;
                    //move();
                }
            }

            #endregion

            #region get hit billboard/dmg number
            //Hit Notification
            if (isHit)
            {
                hitTimer++;
                billboardEngine.AddBillboard(this.position + new Vector3(0, 2, 0), Color.Red, 1.5f);
                if (hitTimer == 70)
                {
                    isHit = false;
                    hitTimer = 0;
                }
            }
            #endregion

            //Rotate Model
            double rotationAngle = Math.Acos((Vector3.Dot(direction, -1 * Vector3.UnitX)) / (direction.Length()));
            rotationAngle = (p.Position.Z < this.Position.Z) ? rotationAngle * -1.0f : rotationAngle;
            rotationAngle += (this.kind == Constants.NPC_BOSS) ? Math.PI / 2 : -Math.PI / 2;
            model.Rotation = new Vector3(0, (float)(rotationAngle), 0);

            //Update PlayerDistance
            playerDistance = (p.Position - this.Position).Length();

            if (playerDistance < 4)
            {
                target = position;
                direction = p.Position - this.Position;
            }

            return true;
        }
Exemplo n.º 23
0
 public override void draw(Camera camera)
 {
     base.draw(camera);
     if (charging) charge.Draw(camera);
 }
Exemplo n.º 24
0
        public bool update(GameTime gameTime, NPCCollection npcs, BulletCollection bullets, Camera camera, bool canShoot)
        {
            if (Mouse.GetState().RightButton == ButtonState.Released && rightButton) charge.Clear();
            rightButton = (Mouse.GetState().RightButton == ButtonState.Pressed);

            if (lastMapID != world.mapID)
            {
                reset();
                return true;
            }

            if (health <= 0) return false;

            restore = (byte) Math.Max(restore - 1, 0);
            hitDelay = (byte) Math.Max(hitDelay - 1, 0);

            if (health < maxHealth && hitDelay == 0
                && Mouse.GetState().RightButton == ButtonState.Pressed)
            {
                charging = true;
                charge.Update(gameTime, camera, this.Position);
                if (restore <= 0)
                {
                    int h = Math.Max((int)(maxHealth * .01f), 1);
                    health = Math.Min(health + h, maxHealth);
                    restore = maxRest;
                }
            }
            else charging = false;

            /*if (Mouse.GetState().RightButton == ButtonState.Pressed)
            {
                charging = true;
                charge.Update(gameTime, camera, this.Position);
            }*/

            model.Rotation = new Vector3(0, -camera.Phi,0);

            Vector3 front = new Vector3(camera.Direction.X, 0, camera.Direction.Z);
            front.Normalize();
            float forward = (Keyboard.GetState().IsKeyDown(Keys.W) ? 1.0f : 0.0f) - (Keyboard.GetState().IsKeyDown(Keys.S) ? 1.0f : 0.0f);

            Vector3 sideVec = Vector3.Cross(front, new Vector3(0,1,0));
            float side = (Keyboard.GetState().IsKeyDown(Keys.D) ? 1.0f : 0.0f) - (Keyboard.GetState().IsKeyDown(Keys.A) ? 1.0f : 0.0f);

            this.direction = front * forward + sideVec * side;
            if (this.direction != Vector3.Zero) this.direction.Normalize();

            moveAndCollide(npcs);

            if (invincibleTimer > 0)
                invincibleTimer--;

            if (world.mapID != 0)
                weapon.update(bullets, position, front, canShoot);
            return true;
        }
Exemplo n.º 25
0
 /// <summary>
 /// draws all sprites with given effect settings
 /// </summary>
 public void Draw(GraphicsDevice device, Camera camera)
 {
     Effect.VertexColorEnabled = true;
     Effect.World = Matrix.Identity;
     Effect.View = camera.ViewMatrix;
     Effect.Projection = camera.ProjectionMatrix;
     Effect.LightingEnabled = false;
     device.SetVertexBuffer(vb);
     //device.DrawPrimitives(PrimitiveType.TriangleList, 0, currentSpriteNumber * 2);
     foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
     {
         pass.Apply();
         try { device.DrawPrimitives(PrimitiveType.TriangleList, 0, currentSpriteNumber * 2); }
         catch { ArgumentOutOfRangeException e = new ArgumentOutOfRangeException(); }
     }
 }
Exemplo n.º 26
0
 public void Draw(GraphicsDevice graphics, Camera camera)
 {
     Draw(graphics, camera.ViewMatrix, camera.ProjectionMatrix, Matrix.CreateTranslation(new Vector3(size / 2 -10.0f, 3, size / 2-10.0f)));
 }
Exemplo n.º 27
0
Arquivo: NPC.cs Projeto: kayorga/3DSP
        public override void draw(Camera camera, Queue<DmgNumber> queue)
        {
            draw(camera);

            //crit number position calculation
            for (int i = 0; i < dmgNumbers.Count; i++ )
            {
                DmgNumber dmgNum = dmgNumbers[i];
                if (!dmgNum.update())
                {
                    dmgNumbers.Remove(dmgNum);
                    i--;
                    continue;
                }

                Vector3 dmgNumPos3 = graphicsDevice.Viewport.Project(Vector3.Zero,
                                                                        camera.ProjectionMatrix,
                                                                        camera.ViewMatrix,
                                                                        Matrix.CreateTranslation(position + new Vector3(0, 2, 0)));

                dmgNum.setPos(dmgNumPos3.X, dmgNumPos3.Y);

                queue.Enqueue(dmgNum);
            }
        }