Example #1
0
        private void ShootPatternNormal1(Object targetObject, Bullet bullet, float speed)
        {
            // 180°分回転度数を変更したい
            double rad = Math.Atan2(targetObject.position.Y - position.Y, targetObject.position.X - position.X);

            bullet.rot = -(float)rad + (float)Math.PI;
            bullet.degree = -(float)MathHelper.ToDegrees((float)rad + (float)Math.PI) + 180;// + 180で向きは修正された?

            // 移動量を計算
            bullet.speed = new Vector2((float)Math.Cos(rad) * speed, (float)Math.Sin(rad) * speed);
            bullet.isShot = true;
        }
Example #2
0
        /// <summary>
        /// Playerへ直線的にホーミングさせる速度を与えるパターン。
        /// </summary>
        private void ShootPattern1(Object target_object, Bullet bullet, float speed)
        {
            double rad = Math.Atan2(target_object.position.Y - position.Y, target_object.position.X - position.X);
            bullet.rot = -(float)rad + (float)Math.PI;
            bullet.degree = -(float)MathHelper.ToDegrees((float)rad + (float)Math.PI);

            // 移動量を計算
            bullet.speed =  new Vector2((float)Math.Cos(rad) * speed, (float)Math.Sin(rad) * speed);
            bullet.isShot = true;
        }
Example #3
0
 // new: 8/16 弾種→射撃パターンでまとめる
 private void ShootPatternNormal0(Bullet bullet, Vector2 bulletSpeed)
 {
     bullet.speed = bulletSpeed;
     bullet.isShot = true;
 }
Example #4
0
 /// <summary>
 /// 与えられたBulletに初期化が必要かどうか判定するメソッド
 /// </summary>
 /// <param name="bullet">判定したいBullet</param>
 /// <returns>Bulletに初期化が必要ならtrue、必要ないならfalseを返す</returns>
 private bool NeedIni(Bullet bullet)
 {
     return bullet.isShot && bullet.counter == 0;
 }