public GamePlay() { IsEndFlag = false; var gameDevice = GameDevice.Instance(); sound = gameDevice.GetSound(); }
protected override void Attack() { tentacles.ForEach(tentacle => tentacle.Speed = 1f); var index = GameDevice.Instance().GetRandom().Next(3); tentacles[index].Speed = 2f; }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } GameDevice.Instance().Update(gameTime); float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;//1フレーム進むのにかかった時間(秒) if (HitStop.mIsHitStop) { deltaTime = 0;//ヒットストップ時はdeltaTimeを0にしてtimerや移動などを止める HitStop.mHitStopTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (HitStop.mHitStopTime <= 0) { HitStop.mIsHitStop = false; } } mSceneManager.Update(deltaTime); if (!HitStop.mIsHitStop) { HitStop.mHitStopScale -= (float)gameTime.ElapsedGameTime.TotalSeconds * 2f; if (HitStop.mHitStopScale <= 1) { HitStop.mHitStopScale = 1; } } base.Update(gameTime); }
private void DashUpdate(float deltaTime) { mDashTimer.Update(deltaTime); if (mDashTimer.Rate() <= 0.3f) { mVelocity.X = GameDevice.Instance().GetRandom().Next(-1, 2) * mSpeed; } else { mVelocity.Y = 0; mVelocity.X = ((int)mCurrentDir - 2) * (mDashSpeed - (mDashTimer.Rate() * 500)); if (mHitPoint <= mMaxHitPoint / 2) { mVelocity.X = ((int)mCurrentDir - 2) * (mDashSpeed * 1.2f - (mDashTimer.Rate() * 500)); } } if (mDashTimer.IsTime()) { mDashTimer.Initialize(); mAttackState = AttackState.Stay; if (mHitPoint <= mMaxHitPoint / 3) { mAttackState = AttackState.Attack; } } }
public LoadShop(IScene town, GameManager gameManager, GameDevice gameDevice) { this.gameDevice = gameDevice; this.gameManager = gameManager; townScene = town; renderer = gameDevice.Renderer; }
public GuildMenu(GameManager gameManager, GameDevice gameDevice) { this.gameManager = gameManager; this.gameDevice = gameDevice; input = gameDevice.InputState; renderer = gameDevice.Renderer; }
/// <summary> /// コンストラクタ /// </summary> /// <param name="score"></param> /// <param name="timer"></param> public GameOver(Score score, Timer timer) { isEndFlag = false; this.score = score; this.timer = timer; sound = GameDevice.Instance().GetSound(); }
public C_DrawDebugMessage(GameDevice gameDevice, C_BezierPoint bezier, float alpha = 1, float depth = 100) { this.alpha = alpha; this.depth = depth; this.bezier = bezier; inputState = gameDevice.GetInputState; }
public void Draw() { if (ObjectManager.Instance().GetPlayer() != null) { for (int i = 0; i < ObjectManager.Instance().GetPlayer().GetMaxHP(); i++) { GameDevice.Instance().GetRenderer().DrawTexture("HP_frame", new Vector2(100 + i * 64, 50)); } for (int i = 0; i < ObjectManager.Instance().GetPlayer().GetHP(); i++) { GameDevice.Instance().GetRenderer().DrawTexture("HP_player", new Vector2(100 + i * 64, 50)); } } if (ObjectManager.Instance().GetBoss() != null) { for (int i = 0; i < ObjectManager.Instance().GetBoss().GetMaxHP(); i++) { GameDevice.Instance().GetRenderer().DrawTexture("HP_frame", new Vector2(Screen.WIDTH - 164 - i * 64, 50)); } for (int i = 0; i < ObjectManager.Instance().GetBoss().GetHP(); i++) { GameDevice.Instance().GetRenderer().DrawTexture("HP_boss", new Vector2(Screen.WIDTH - 164 - i * 64, 50)); } } }
public void Draw() { if (mBlast == null) { return; } if (mBlast.Amount <= 0.0f) { mBlast = null; return; } for (int i = 0; i < ShakeStrenge; i++) { Vector2 origin = mBlast.Center / 2; Vector2 position = mBlast.Center - origin; float alpha = 0.35f * (mBlast.Amount / mBlast.Magnitude); Color color = new Color(1.0f, 1.0f, 1.0f, alpha); float scale = (1.0f + (mBlast.Magnitude - mBlast.Amount) * 0.1f + ((float)(i + 1) / 40.0f)); GameDevice.Instance().GetRenderer().DrawRenderTargetTexture( position, null, 0.0f, origin, scale, color, SpriteEffects.None, 1.0f); } }
public ParticleMiddle(IParticleMediator mediator) : base(mediator) { var random = GameDevice.Instance().GetRandom(); timer = new CountDownTimer(random.Next(1, 3)); name = "particleMiddle"; }
public ParticleMiddle(string name, Vector2 position, Vector2 velocity, IParticleMediator mediator) : base(name, position, velocity, mediator) { var random = GameDevice.Instance().GetRandom(); timer = new CountDownTimer((float)random.NextDouble() - 0.2f - 0.2f); }
public void Draw() { var r = GameDevice.Instance().GetRenderer(); switch (mCount) { case 0: r.DrawTexture("rule1", Vector2.Zero); mAnim.Draw(mAPos); mAnim.Draw(mBPos); mAnim.Draw(mCPos); r.DrawTexture("box", mAPos + new Vector2(GridSize.GRID_SIZE, 0)); r.DrawTexture("box", mBPos + new Vector2(GridSize.GRID_SIZE, 0)); r.DrawTexture("box", mBPos + new Vector2(GridSize.GRID_SIZE * 2, 0)); r.DrawTexture("box", new Vector2(GridSize.GRID_SIZE * 13, GridSize.GRID_SIZE * 4)); break; case 1: r.DrawTexture("rule2", Vector2.Zero); mAnim.Draw(mDPos); r.DrawTexture("box", mBoxPos); break; } FadeDraw(); }
public override void Attack() { bulletCnt++; if (bulletCnt > bulletInterval) { bulletCnt = 0; float targetPosX = mediator.GetPlayer().Position.X; float distance = Math.Abs(this.position.X - targetPosX); if (distance < 1500f) { sound.PlaySE("e_atk"); if (targetPosX > this.position.X) { mediator.AddCharacter( new ShotEnemyBullet( new Vector2(position.X + 16, position.Y), new Vector2(8, -8), GameDevice.Instance())); } else { mediator.AddCharacter( new ShotEnemyBullet( new Vector2(position.X + 16, position.Y), new Vector2(-8, -8), GameDevice.Instance())); } } } }
public void Break() { GameDevice.Instance().GetSound().PlaySE("lifewall_break"); IsDead = true; new DestroyParticle(Name, Position, Size, DestroyParticle.DestroyOption.Center); GameDevice.Instance().DisplayQuake = new Vector2(0, 1.5f); }
/// <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 IsMouseVisible = false; gameDevice = new GameDevice(Content, GraphicsDevice); gameManager = new GameManager(gameDevice); sceneManager = new SceneManager(gameDevice); IScene dungeon = new DungeonScene(gameManager, gameDevice); IScene boss = new BossScene(gameManager, gameDevice); IScene town = new TownScene(gameManager, gameDevice); sceneManager.AddScene(SceneType.Load, new Load(gameDevice)); sceneManager.AddScene(SceneType.Logo, new LogoScene(gameDevice)); sceneManager.AddScene(SceneType.Title, new SceneFader(new Title(gameDevice), gameDevice)); sceneManager.AddScene(SceneType.LoadTown, new LoadTown(gameManager, gameDevice)); sceneManager.AddScene(SceneType.Town, new SceneFader(town, gameDevice)); sceneManager.AddScene(SceneType.UpgradeStore, new UpgradeStore(town, gameManager, gameDevice)); sceneManager.AddScene(SceneType.LoadShop, new LoadShop(town, gameManager, gameDevice)); sceneManager.AddScene(SceneType.ItemShop, new ItemShop(town, gameManager, gameDevice)); sceneManager.AddScene(SceneType.Quest, new GuildScene(town, gameManager, gameDevice)); sceneManager.AddScene(SceneType.Depot, new Depot(town, gameManager, gameDevice)); sceneManager.AddScene(SceneType.DungeonSelect, new SceneFader(new DungeonSelect(town, gameManager, gameDevice), gameDevice)); sceneManager.AddScene(SceneType.LoadMap, new LoadMap(gameManager, gameDevice)); sceneManager.AddScene(SceneType.Dungeon, new SceneFader(dungeon, gameDevice)); sceneManager.AddScene(SceneType.LoadBoss, new LoadBossScene(gameManager, gameDevice)); sceneManager.AddScene(SceneType.Boss, new SceneFader(boss, gameDevice)); sceneManager.AddScene(SceneType.Pause, new PauseScene(dungeon, boss, town, gameManager, gameDevice)); sceneManager.Change(SceneType.Load); base.Initialize(); }
public LifeWall(Vector2 position) : base("life_wall_1", position, size) { displayPos = position; Position = -GameDevice.Instance().DisplayModify + displayPos; healParticles = new List <HealParticle>(); }
public override void Update(GameTime gameTime) { mAnim.Update(gameTime); if (Input.GetKeyState(Keys.Left)) { mMove.MoveLeft(ref mPosition); } if (Input.GetKeyState(Keys.Right)) { mMove.MoveRight(ref mPosition); } if (Input.GetKeyState(Keys.Up)) { mMove.MoveUp(ref mPosition); } if (Input.GetKeyState(Keys.Down)) { mMove.MoveDown(ref mPosition); } mMove.Move(ref mPosition); if (Input.GetKeyUp(Keys.Z)) { mMove.PreviousPosition(ref mPosition); GameDevice.Instance().GetSound().PlaySE("undo"); } }
public override void Update(GameTime gameTime) { nowCount = wallNames.Length - lifeWalls.Count(w => !w.IsDead); if (wallNames.Length - 1 < nowCount) { nowCount = wallNames.Length - 1; } Name = wallNames[nowCount]; Position = -GameDevice.Instance().DisplayModify + displayPos; foreach (var hp in healParticles) { if (hp.IsDead) { //lifeWalls.Add(new LifeWall(new Vector2(Block.BlockSize, (Screen.Height - size.Y) - space * lifeWalls.Count) // )); foreach (var wall in lifeWalls) { if (wall.IsDead && !AllIsDead()) { wall.IsDead = false; break; } } } } healParticles.RemoveAll(hp => hp.IsDead); base.Update(gameTime); }
public ParticleSmall(IParticleMediator mediator) : base(mediator) { Random random = GameDevice.Instance().GetRandom(); timer = new CountDownTimer(random.Next(3, 6)); name = "particleBlue"; }
public AttackState_Com_Player(GameDevice gameDevice) { this.gameDevice = gameDevice; inputState = gameDevice.GetInputState; attackTime = 2; attackTimer = new Timer(attackTime); }
public Boss(Vector2 position, GameDevice gameDevice, IGameMediator mediator) : base("BossLeft", position, 128 * 2, 128 * 2, gameDevice) { this.mediator = mediator; //bulletList = new List<Bullet>(); rnd = new Random(); hp = 2500; Charge = 0; Rectangle bound = new Rectangle(100, 100, 0, 50); gauge = new Gauge("gauge", "pixel", 150, 50, bound, hp, hp, 1100, Color.LightGreen); alpha = 1.0f; color = new Color[2] { Color.White, Color.DarkGray, }; color2 = new Color[2] { Color.Red, Color.DarkRed }; colorNumber = 0; gameDevice = GameDevice.Instance(); sound = gameDevice.GetSound(); }
public Bermuda(Vector2 position, Vector2 origin, GameDevice gameDevice, IGameObjectMediator mediator) : base("blue", position, 0, origin, 32, 1280, gameDevice) { this.mediator = mediator; this.position = new Vector2(1900, 0); }
protected override void Draw(GameTime gameTime) { GameDevice.Instance().GetRenderer().BeginRenderTarget(); GraphicsDevice.Clear(Color.CornflowerBlue); mSceneManager.Draw(); GameDevice.Instance().GetRenderer().EndRenderTarget(); //GameDevice.Instance().GetRenderer().Begin(SpriteSortMode.Deferred, BlendState.Additive); GameDevice.Instance().GetRenderer().Begin(); if (ObjectManager.Instance().GetPlayer() != null) { Vector2 origin = ObjectManager.Instance().GetPlayer().GetOrigin(); GameDevice.Instance().GetRenderer().DrawRenderTargetTexture(origin, null, 0.0f, origin, HitStop.mHitStopScale, Color.White); } else { GameDevice.Instance().GetRenderer().DrawRenderTargetTexture(new Vector2(Screen.WIDTH / 2, Screen.HEIGHT / 2), null, 0.0f, new Vector2(Screen.WIDTH / 2, Screen.HEIGHT / 2), HitStop.mHitStopScale, Color.White); } mHPUI.Draw(); GameDevice.Instance().GetRenderer().End(); base.Draw(gameTime); }
public Box(IGameMediator mediator) : base("box") { mMediator = mediator; mMove = new ActorMove(mMediator); mFootprint = new List <Vector2>(); GameDevice.Instance().GetRenderer().LoadContent(mFilename); }
public Title() { isEndFlag = false; var gameDevice = GameDevice.Instance(); sound = gameDevice.GetSound(); }
public ParticleBlue(string name, Vector2 position, Vector2 velocity, IParticleMediator mediator) : base(name, position, velocity, mediator) { var random = GameDevice.Instance().GetRandom(); timer = new CountDownTimer(random.Next(1, 3)); }
/// <summary> /// 初期化処理(起動時、コンストラクタの後に1度だけ呼ばれる) /// </summary> protected override void Initialize() { // この下にロジックを記述 //ゲームデバイスの実体を取得 gameDevice = GameDevice.Instance(Content, GraphicsDevice); //シーン管理生成 sceneManager = new SceneManager(); sceneManager.Add(Scene.SceneName.LoadScene, new LoadScene()); sceneManager.Add(Scene.SceneName.GameTitle, new GameTitle()); sceneManager.Add(Scene.SceneName.GamePlay, new GamePlay()); //最初のシーンに変更 sceneManager.Change(Scene.SceneName.LoadScene); //CSVReader csvReader = new CSVReader(); //csvReader.Read("map.csv"); #region ゴリラ //map = new Map(gameDevice); //map.Load("map.csv"); //gameObjectManager.Add(map); #endregion // この上にロジックを記述 base.Initialize();// 親クラスの初期化処理呼び出し。絶対に消すな!! }
public Robot(IGameMediator mediator, Map1 map1, float speed) : base("rbh", mediator) { this.speed = speed; Device.Camera.GetScreenPos(position); this.map = map1; position = Vector2.Zero; var gameDevice = GameDevice.Instance(); sound = gameDevice.GetSound(); //リストの生成 rightPos = new List <Vector2>() { new Vector2(73, 0), new Vector2(73, 88) }; leftPos = new List <Vector2>() { new Vector2(-1f, 0), new Vector2(-1f, 88) }; upPos = new List <Vector2>() { new Vector2(0, -1), new Vector2(73, -1) }; downPos = new List <Vector2>() { new Vector2(73, 89), new Vector2(73, 89) }; }
public Player(IGameMediator mediator, Map1 map1) : base("Player", mediator) { Device.Camera.GetScreenPos(position); this.map = map1; position = Vector2.Zero; var gameDevice = GameDevice.Instance(); sound = gameDevice.GetSound(); //リストの生成 rightPos = new List <Vector2>() { new Vector2(27.5f, 0), new Vector2(27, 30) }; leftPos = new List <Vector2>() { new Vector2(-1f, 0), new Vector2(-1f, 30) }; upPos = new List <Vector2>() { new Vector2(0, -1), new Vector2(23, -1) }; downPos = new List <Vector2>() { new Vector2(7, 32), new Vector2(25, 32) }; }
public void SetGameDevice(GameDevice gameDevice) { _gameDevice = gameDevice; }
/// <summary> /// Toggles the current game device to the respective other possibility. /// </summary> public void ToggleGameDevice() { if (_gameDevice == GameDevice.PC) { _gameDevice = GameDevice.Tablet; } else { _gameDevice = GameDevice.PC; } }
/// <summary>Sets the default values for all setting parameters.</summary> public void SetDefaults() { _numHousesPerPlayer = 6; _numSeedsPerHouse = 4; _gameDevice = GameDevice.PC; _numberFieldsShallBeShown = true; // The number of gameboards to evaluate at a maximum is numEvals = m^n where m is the number of houses // and n is the recursion depth. // Ideally, the chosen recursion depth should be independent from the number of houses. Practically, we // need to be careful with a too deep recursion for a high number of houses. Therefore, on the harder levels // the computer plays better with a decreasing number of houses: _recursionDepth = new int[3, 8] { { -1, -1, -1, 3, 3, 3, 3, 3 }, // Easy computer opponent { -1, -1, -1, 6, 6, 6, 6, 5 }, // Medium computer opponent { -1, -1, -1, 15, 11, 10, 9, 8 } // Hard computer opponent }; }