public virtual void Update() { Globals.SoundControl.PlaySong("BackGroundMusic"); mainChar.Update(); GameGlobals.gameTimePassed++; maincharCycle++; powerCycle++; //Mob xuat hien MobTops.Update(); if (GameGlobals.gameTimePassed >= 1000) { MobDowns.Update(); } if (GameGlobals.gameTimePassed >= 1500) { MobLefts.Update(); } if (GameGlobals.gameTimePassed >= 2200) { MobRights.Update(); } TopBar.Update(MobTops.Current, MobTops.Full); DownBar.Update(MobDowns.Current, MobDowns.Full); LeftBar.Update(MobLefts.Current, MobLefts.Full); RightBar.Update(MobRights.Current, MobRights.Full); if (MobDowns.Current < 42 && MobTops.Current < 42 && MobLefts.Current < 42 && MobRights.Current < 42) { for (int i = 0; i < Projectile2Ds.Count; i++) { Projectile2Ds[i].Update(offset, mainChar, MobTops, MobDowns, MobLefts, MobRights); if (Projectile2Ds[i].done) { Projectile2Ds.RemoveAt(i); i--; } } if (isPower) { for (int i = 0; i < projectile2DforMainChars.Count; i++) { projectile2DforMainChars[i].Update(offset, MobTops, MobDowns, MobLefts, MobRights); if (projectile2DforMainChars[i].done) { projectile2DforMainChars.RemoveAt(i); i--; } } } } if (MobDowns.Current >= 42 || MobTops.Current >= 42 || MobLefts.Current >= 42 || MobRights.Current >= 42) { KeyboardState keyboardState = Keyboard.GetState(); dead = true; Globals.SoundControl.StopSong("BackGroundMusic"); Globals.SoundControl.PlaySong("GameOver"); if (keyboardState.IsKeyDown(Keys.Enter)) { GameGlobals.gameTimePassed = 0; GameGlobals.score = 0; ResetWorld(null); } if (ResetBtn.Update(offset)) { GameGlobals.gameTimePassed = 0; GameGlobals.score = 0; ResetWorld(null); } } // animation for mainChar #region if (maincharCycle <= 20) { mainChar.myModel = Globals.content.Load <Texture2D>("mainCharOpenEye"); } if (maincharCycle > 20 && maincharCycle <= 40) { mainChar.myModel = Globals.content.Load <Texture2D>("mainChar04"); } if (maincharCycle > 40 && maincharCycle <= 50) { mainChar.myModel = Globals.content.Load <Texture2D>("mainCharOpenEye"); } if (maincharCycle > 50 && maincharCycle <= 60) { mainChar.myModel = Globals.content.Load <Texture2D>("mainChar"); } if (maincharCycle > 60 && maincharCycle <= 70) { mainChar.myModel = Globals.content.Load <Texture2D>("mainChar02"); //powerfull01.myModel = Globals.content.Load<Texture2D>("powerfull01"); } if (maincharCycle > 70 && maincharCycle <= 80) { mainChar.myModel = Globals.content.Load <Texture2D>("mainChar"); if (maincharCycle == 80) { maincharCycle = 0; } } #endregion CountScore(); }