/// <summary> /// 弾生成機構を変更 /// </summary> /// <param name="bulletFactory">BulletFactory</param> public void SetBulletFactory(BulletFactory bulletFactory) { if (bulletFactory == null) { return; } this.bulletFactory = bulletFactory; this.bulletFactory.SetOwner(this); }
public Player(string name, int hp, float moveSpeed, IController controller, BulletFactory bulletFactory) : base(name, hp, controller, bulletFactory) { safeColider = damegeColider; damegeColider = new Circle(Vector2.Zero, 1f); this.moveSpeed = moveSpeed; nowState = State.START; startTimer = new Timer(1.0f); flashTimer = new Timer(0.1f); invincibleTimer = new Timer(1.5f); alpha = 1.0f; sound = ShootingGame.GetGameDevice().GetSound(); }
public Character(string name, int hp, IController controller, BulletFactory bulletFactory = null) : base(name) { this.hp = hp; nowHp = hp; SetDamegeColider(new Circle(Vector2.Zero, ShootingGame.GetGameDevice().GetRenderer().Textures[name].Width / 2)); SetEquip(controller, bulletFactory); //アニメションを設置 deadAnime = new Animation(ShootingGame.GetGameDevice().GetRenderer(), "deadAnime", 0.1f, false); animationPlayer.SetAnimation(deadAnime); }
public Enemy(string name, int hp, IController controller, BulletFactory bulletFactroy) : base(name, hp, controller, bulletFactroy) { nowState = State.NORMAL; sound = ShootingGame.GetGameDevice().GetSound(); isAnim = false; }
public void GetDeathControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { Vector2 velo2 = Vector2.Subtract(destination, position); fireTimer.Update(gameTime, Parameters.GameSpeed); if (position != destination) { position += velo2 * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; } if (position.X < 0 || position.X > Screen.GameWidth) { velocity.X = -velocity.X; } position.X = MathHelper.Clamp(position.X, 0, Screen.GameWidth); if (fireTimer.IsTime()) { fireTimer.Initialize(); direction = new Vector2(((float)Math.Cos(angle * (Math.PI / 180))) - (float)Math.Sin(angle * (Math.PI / 180)), ((float)Math.Sin(angle * (Math.PI / 180))) + (float)Math.Cos(angle * (Math.PI / 180))); bf.Fire(direction * 70); angle += 12; } }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { timer.Update(gameTime, Parameters.GameSpeed); position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; if (position.X < 0 || position.X > Screen.GameWidth) { velocity.X = -velocity.X; } position.X = MathHelper.Clamp(position.X, 0, Screen.GameWidth); if (timer.IsTime()) { timer.Initialize(); bf.Fire(new Vector2(0, 1) * 200); } }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { Vector2 velo2 = Vector2.Subtract(destination, position); fireTimer.Update(gameTime, Parameters.GameSpeed); if (isFire) { waitFire.Update(gameTime); } if (isGetDestination && waitFire.IsTime()) { position += new Vector2(0, -5) * Parameters.GameSpeed; } if (position != destination && isGetDestination == false) { position += velo2 * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; } if (Vector2.Distance(position, destination) <= 50) { isGetDestination = true; } if (position.X < 0 || position.X > Screen.GameWidth) { velocity.X = -velocity.X; } position.X = MathHelper.Clamp(position.X, 0, Screen.GameWidth); if (isGetDestination && fireTimer.IsTime() && isFire == false) { bf.Fire(new Vector2(0, 1) * 180); fireTimer.Initialize(); isFire = true; } }
public void GetDeathControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { if (!deathFire) { for (int i = 0; i < 12; i++) { bf.Fire(fireDirection * 200); fireDirection = Vector2.Transform(fireDirection, rotation); } deathFire = true; } }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { Vector2 velo2 = Vector2.Subtract(destination, position); fireTimer.Update(gameTime); Vector2 distance = position - destination; if (deathAttack == false) { position += velo2 * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; if (distance.Length() < 50) { deathAttack = true; playerPotion = GamePlay.GetObjManager().GetPlayerPosition(); velocity = playerPotion - position; } } else { position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; } position.X = MathHelper.Clamp(position.X, 0, Screen.GameWidth); }
/// <summary> /// コントローラーと弾生成機構両方変更 /// </summary> /// <param name="controller">コントローラー</param> /// <param name="bulletFactory">弾生成機構</param> public void SetEquip(IController controller, BulletFactory bulletFactory) { SetBulletFactory(bulletFactory); SetController(controller); }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { fireTimer.Update(gameTime, Parameters.GameSpeed); velocity = input.Velocity() * player.MoveSpeed; position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; position = Vector2.Clamp(position, Vector2.Zero, new Vector2(Screen.GameWidth, Screen.GameHeight)); if (input.CheckDownKey(Keys.Space, Buttons.RightTrigger) && fireTimer.IsTime()) { bf.Fire(fireDirection * 1000); fireTimer.Initialize(); ShootingGame.GetGameDevice().GetSound().PlaySE("shot"); } }
public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf) { timer.Update(gameTime, Parameters.GameSpeed); position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; if (target.NowHp() > target.GetHp() / 2) { if (position.X < 0 || position.X > Screen.GameWidth) { velocity.X = -velocity.X; } } else if (target.NowHp() <= target.GetHp() / 2) { //Vector2 velo2 = Vector2.Subtract(destination, position); //fireTimer.Update(gameTime); if (position != destination) { position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed; } if (position.X < 0 || position.X > Screen.GameWidth) { velocity.X = -velocity.X; } } position.X = MathHelper.Clamp(position.X, 0, Screen.GameWidth); position.Y = MathHelper.Clamp(position.Y, 0, Screen.GameHeight); if (timer.IsTime()) { if (target.NowHp() > target.GetHp() / 2) { timer.Initialize(); direction = new Vector2(((float)Math.Cos(angle * (Math.PI / 180))) - (float)Math.Sin(angle * (Math.PI / 180)), ((float)Math.Sin(angle * (Math.PI / 180))) + (float)Math.Cos(angle * (Math.PI / 180))); bf.Fire(direction * 70); angle += 12; } else if (target.NowHp() <= target.GetHp() / 2) { timer.Initialize(); bf.Fire(new Vector2(0, 1) * 150); } } }