Beispiel #1
0
 public override void Hit(Character character)
 {
     if (isDead == true)
     {
         return;
     }
     if (character.GetCharacterID() == CharacterID.PlayerBullet)
     {
         return;                                                                                        //弾とは当たらない
     }
     if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.PlayerSide) //プレイヤーグループと当たる
     {
         isDead = true;
     }
 }
 public void Add(Character character)
 {
     //キャラクターを分類して追加
     if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.PlayerSide)
     {
         playerSide.Add(character);
     }
     else if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.EnemySide)
     {
         enemySide.Add(character);
     }
     else//当てはまらないキャラは中立に
     {
         neutralSide.Add(character);
     }
 }
Beispiel #3
0
 public override void Hit(Character character)
 {
     if (isDead == true)
     {
         return;
     }
     if (character.GetCharacterID() == CharacterID.EnemyStorm)//追加:Storm に当たると敵側に吸い寄せられる処理
     {
         position.X += 2;
         return;
     }
     if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.EnemySide)   //敵グループと当たる
     {
         //isDead = true;
         mediator.AddCharacter(new Explosion(position, gameManager, mediator));
     }
 }
Beispiel #4
0
 public override void Hit(Character character)
 {
     if (isDead == true)
     {
         return;
     }
     if (character.GetCharacterID() == CharacterID.EnemyBullet)
     {
         return;                                               //敵の弾とは当たらない
     }
     if (character.GetCharacterID() == CharacterID.EnemyStorm) //追加:竜巻に当たると乱反射
     {
         velocity.X *= -1;
         velocity.Y  = random.Next(-5, 5);
         return;
     }
     if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.EnemySide) //敵とのみ当たる
     {
         isDead = true;
     }
 }
Beispiel #5
0
        public override void Hit(Character character)
        {
            if (character.GetCharacterID() == CharacterID.Enemy2)
            {
                rotateHeight += 32;
            }
            if (character.GetCharacterID() == CharacterID.Enemy3)
            {
                rotateHeight -= 16;
            }
            if (character.GetCharacterID() == CharacterID.Enemy4)
            {
                NotSin = true;
            }

            if (character.GetCharacterID() == CharacterID.Enemy ||
                character.GetCharacterID() == CharacterID.Enemy2 ||
                character.GetCharacterID() == CharacterID.Enemy3)
            {
                //距離を測る
                float distanse = (float)Math.Sqrt((nextPosition.X - origin.X) * (nextPosition.X - origin.X)
                                                  + (nextPosition.Y - origin.Y) * (nextPosition.Y - origin.Y));
                if (radian <= 45)
                {
                    origin.X = nextPosition.X + distanse;

                    radian = 0;
                }
                else if (radian <= 135)
                {
                    origin.Y = nextPosition.Y - distanse;
                    radian   = 90;
                }
                else if (radian <= 225)
                {
                    origin.X = nextPosition.X - distanse;

                    radian = 180;
                }
                else if (radian < 315)
                {
                    origin.Y = nextPosition.Y + distanse;

                    radian = 270;
                }
                else
                {
                    origin.X = nextPosition.X + distanse;

                    radian = 0;
                }

                position = nextPosition;

                hide = false;
                //senterPosition = (position + basePosition) * 2;
                //couse = true;
                //isDead = true;
            }
        }
Beispiel #6
0
 public override void Hit(Character character)
 {
     if (isDead == true)
     {
         return;
     }
     if ((int)character.GetCharacterID() / (int)CharacterID.CheckNumber == (int)CharacterID.PlayerSide)//プレイヤーグループと当たる
     {
         isDead = true;
         gameManager.SetScore(gameManager.GetScore() + 10);
         mediator.AddCharacter(new Explosion(position, gameManager, mediator));
     }
 }
Beispiel #7
0
        public override void Hit(Character character)
        {
            if (!hide)
            {
                return;
            }

            //距離を測る
            float distanse = (float)Math.Sqrt((nextPosition.X - origin.X) * (nextPosition.X - origin.X)
                                              + (nextPosition.Y - origin.Y) * (nextPosition.Y - origin.Y));


            //バンパーに当たった時
            if (character.GetCharacterID() == CharacterID.Enemy2)
            {
                rotateHeight += 48;
            }
            //低反発に当たった時
            if (character.GetCharacterID() == CharacterID.Enemy3)
            {
                rotateHeight -= 48;
            }
            //気流にあたった時
            if (character.GetCharacterID() == CharacterID.Enemy4)
            {
                NotSin = true;
            }

            //全ブロックに当たった時の処理
            if (character.GetCharacterID() == CharacterID.Enemy ||
                character.GetCharacterID() == CharacterID.Enemy2 ||
                character.GetCharacterID() == CharacterID.Enemy3)
            {
                //第2象限
                if (bCos > cos && bSin < sin)
                {
                    origin.Y = origin.Y + rotateHeight * 2;
                    radian   = 5.3;//////////////////////
                }
                //第4象限
                else if (bCos > cos && bSin > sin)
                {
                    origin.X = origin.X + rotateHeight * 2;
                    radian   = 0.6;
                }
                //第3象限
                else if (bCos < cos && bSin < sin)
                {
                    origin.X = origin.X - rotateHeight * 2;
                    radian   = 3.8;
                }
                //第1象限
                else if (bCos < cos && bSin > sin)
                {
                    origin.Y = origin.Y - rotateHeight * 2;
                    radian   = 2.1;
                }

                position = nextPosition;

                //回転軸が移動したときのちらつき防止
                hide = false;
            }


            //if (radian <= 45)
            //{
            //    origin.X = nextPosition.X + distanse;

            //    radian = 0;
            //}
            //else if (radian <= 135)
            //{
            //    origin.Y = nextPosition.Y - distanse;
            //    radian = 90;
            //}
            //else if (radian <= 225)
            //{
            //    origin.X = nextPosition.X - distanse;

            //    radian = 180;
            //}
            //else if (radian < 315)
            //{
            //    origin.Y = nextPosition.Y + distanse;

            //    radian = 270;
            //}
            //else
            //{
            //    origin.X = nextPosition.X + distanse;

            //    radian = 0;
            //}

            //isDead = true;
        }