예제 #1
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;
        }