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:"; }
public Player(World world, ContentManager Content, AudioManager audio, GraphicsDevice graphicsDevice) : base() { this.world = world; this.model = new ModelObject(Content.Load<Model>("Models\\T")); this.speed=0.15f; this.level=1; this.maxHealth=100; this.health=100; maxRest = 15; restore = 0; maxHitDelay = Constants.PLAYER_HIT_DELAY; hitDelay = 0; charging = false; weapon = new Weapon(audio); exp = 0; invincibleTimer = 0; this.charge = new Charge(this.position, graphicsDevice, Content); reset(); }
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(); }
public Map(GameData data, World world, GraphicsDevice graphicsDevice, ContentManager Content, Point position) { spriteBatch = new SpriteBatch(graphicsDevice); this.data = data; this.world = world; enemy = Content.Load<Texture2D>("Map\\enemy"); player = Content.Load<Texture2D>("Map\\player"); ground = Content.Load<Texture2D>("Map\\ground"); obstacle = Content.Load<Texture2D>("Map\\obstacle"); none = Content.Load<Texture2D>("Map\\none"); size = 5; mapRectangle = new Rectangle[Constants.MAP_SIZE*2][]; for (int i = 0; i < Constants.MAP_SIZE*2; i++) { mapRectangle[i] = new Rectangle[Constants.MAP_SIZE*2]; for (int j = 0; j < Constants.MAP_SIZE*2; j++) { mapRectangle[i][j] = new Rectangle(position.X + i*size, position.Y + j*size, size, size); } } }
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(); }
/// <summary> /// creates empty NPC with placeholder attributes /// </summary> /// <param name="Content"></param> /// <param name="graphicsDevice"></param> /// <param name="world"></param> /// <param name="bilbo"></param> public NPC(ContentManager Content, GraphicsDevice graphicsDevice, World world, BillboardEngine bilbo, AudioManager audio) { model = null; position = Vector3.Zero; direction = Vector3.Zero; this.world = world; speed = 0; level = 0; maxHealth = 0; health = 0; active = false; newTarget = false; XP = 0; cooldown = 0; maxCooldn = 0; element = 0; kind = 0; strength = 0; pathFinder = null; target = Vector3.Zero; isHit = false; hitTimer = 0; isDead = false; billboardEngine = bilbo; this.graphicsDevice = graphicsDevice; this.audio = audio; explosion = new Explosion(Position, graphicsDevice, Content); dmgNumbers = new List<DmgNumber>(); }
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); }
public GameData(ContentManager Content, GraphicsDevice device, AudioManager audio, World world) { player = new Player(world, Content, audio, device); mods = new ModCollection(); npcs = new NPCCollection(world, Content, player, device, audio); bullets = new BulletCollection(Content, device); missions = new MissionCollection(world, npcs); this.world = world; this.audio = audio; }
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; }
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); }
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(); }
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; }
/// <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(); }
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; }
//bullet - world collision private bool collision(World world) { if (world.MoveData[xTile / 2][zTile / 2] == 1) return true; return false; }
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; }