Exemple #1
0
        static void solveArrayList()
        {
            Random    rand    = new Random();
            ArrayList arrList = new ArrayList();

            for (int i = 0; i < 100; i++)
            {
                int          left    = rand.Next(80);
                int          top     = rand.Next(24);
                StarPosition starPos = new StarPosition();
                starPos.left = left;
                starPos.top  = top;
                arrList.Add(starPos);

                Console.CursorLeft = left;
                Console.CursorTop  = top;
                Console.Write("*");
                System.Threading.Thread.Sleep(100);
            }

            for (int i = arrList.Count - 1; i >= 0; i--)
            {
                StarPosition starPos = (StarPosition)arrList[i];
                Console.CursorLeft = starPos.left;
                Console.CursorTop  = starPos.top;
                Console.Write(" ");
                System.Threading.Thread.Sleep(100);
            }
        }
Exemple #2
0
        public ConstellationInfo(GenericReader reader)
        {
            reader.ReadInt();

            Identifier     = reader.ReadInt();
            TimeCoordinate = (TimeCoordinate)reader.ReadInt();

            Name         = reader.ReadString();
            DiscoveredBy = reader.ReadMobile();
            DiscoveredOn = reader.ReadDateTime();
            CoordRA      = reader.ReadInt();
            CoordDEC     = reader.ReadDouble();

            int count = reader.ReadInt();

            StarPositions = new StarPosition[count];

            for (int i = 0; i < count; i++)
            {
                StarPosition pos = new StarPosition
                {
                    ImageID = reader.ReadInt(),
                    X       = reader.ReadInt(),
                    Y       = reader.ReadInt()
                };

                StarPositions[i] = pos;
            }

            if (HasBeenDiscovered)
            {
                AstronomySystem.AddDiscovery(this);
            }
        }
Exemple #3
0
        private (int size_X, int size_Y, int offset_X, int offset_Y, StarPosition[] positions) CalculateStarPosition(int second)
        {
            var starPositions = new StarPosition[_stars.Length];
            var max_X         = int.MinValue;
            var max_Y         = int.MinValue;
            var min_X         = int.MaxValue;
            var min_Y         = int.MaxValue;

            for (var i = 0; i < _stars.Length; i++)
            {
                starPositions[i].X = _stars[i].Position.X + _stars[i].VelocityX * second;
                starPositions[i].Y = _stars[i].Position.Y + _stars[i].VelocityY * second;

                max_X = Math.Max(max_X, starPositions[i].X);
                max_Y = Math.Max(max_Y, starPositions[i].Y);
                min_X = Math.Min(min_X, starPositions[i].X);
                min_Y = Math.Min(min_Y, starPositions[i].Y);
            }

            var offset_X = min_X * -1 + 1;
            var offset_Y = min_Y * -1 + 1;
            var size_X   = max_X - min_X + 3;
            var size_Y   = max_Y - min_Y + 3;

            return(size_X, size_Y, offset_X, offset_Y, starPositions);
        }
Exemple #4
0
        static void solveStack()
        {
            Random rand     = new Random();
            Stack  arrStack = new Stack();

            for (int i = 0; i < 100; i++)
            {
                int          left    = rand.Next(80);
                int          top     = rand.Next(24);
                StarPosition starPos = new StarPosition();
                starPos.left = left;
                starPos.top  = top;
                arrStack.Push(starPos);

                Console.CursorLeft = left;
                Console.CursorTop  = top;
                Console.Write("*");
                System.Threading.Thread.Sleep(100);
            }

            for (int i = 0; i < 100; i++)
            {
                StarPosition starPos = (StarPosition)arrStack.Pop();
                Console.CursorLeft = starPos.left;
                Console.CursorTop  = starPos.top;
                Console.Write(" ");
                System.Threading.Thread.Sleep(100);
            }
        }
Exemple #5
0
        static void solveArray1()
        {
            Random rand = new Random();

            // StarPosition객체를 저장할 수 있는 100개짜리 참조변수 배열
            StarPosition[] arrStar = new StarPosition[100];
            for (int i = 0; i < arrStar.Length; i++)
            {
                int left = rand.Next(80);
                int top  = rand.Next(24);
                arrStar[i]      = new StarPosition();
                arrStar[i].left = left;
                arrStar[i].top  = top;

                Console.CursorLeft = left;
                Console.CursorTop  = top;
                Console.Write("*");
                System.Threading.Thread.Sleep(100);
            }

            for (int i = arrStar.Length - 1; i >= 0; i--)
            {
                Console.CursorLeft = arrStar[i].left;
                Console.CursorTop  = arrStar[i].top;
                Console.Write(" ");
                System.Threading.Thread.Sleep(100);
            }
        }
Exemple #6
0
        private void ComboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboItem item = (ComboItem)ComboBoxEx1.SelectedItem;

            curStar          = new StarPosition((StarNames)item.Tag);
            curStar.Position = GetPosition();
        }
Exemple #7
0
 //必要なデータを外部から渡す場合
 public void calculateSunPosition(double[] posdata) // double rightascension, double declination, double sundistance, double timeangle)
 {
     asc       = posdata[EclipseData.SUN_ASC];      // rightascension;
     dec       = posdata[EclipseData.SUN_DEC];      // declination;
     phai0     = posdata[EclipseData.PHAI];         // timeangle;
     dist      = posdata[EclipseData.SUN_DIST];     // sundistance;// StarPosition.getSunDistance(timevalue);
     parallax  = StarPosition.getParallax(dist);    //
     k         = StarPosition.getSunriseAltitude(StarPosition.getSunDiameter(dist), 0.0, StarPosition.refraction, parallax);
     twilightk = StarPosition.getTwilightAltitude(0.0, parallax);
 }
Exemple #8
0
    //retrieve the position of the sun
    public void calculateSunPosition(double year, double month, double day, double hour, double minute)
    {
        //Debug.Log( "calculateSunPosiotion");
        //Debug.Log("WORLDCLOCK y= " + year + " m= " + month + " d= " + day + " h= " + hour + " min " + minute);
        time = minute / 60.0 + hour;
        double timevalue = StarPosition.getTime(year, month, day, time);
        double elon      = StarPosition.getSunEclipticLongitude(timevalue); //
        double e         = StarPosition.getInclination(timevalue);          //

        asc       = StarPosition.getRightAscension(elon, e);                //
        dec       = StarPosition.getDeclination(elon, e);                   //
        phai0     = StarPosition.getSidereal(timevalue, time / 24.0, 0);    //
        dist      = StarPosition.getSunDistance(timevalue);
        parallax  = StarPosition.getParallax(dist);                         //
        k         = StarPosition.getSunriseAltitude(StarPosition.getSunDiameter(dist), 0.0, StarPosition.refraction, parallax);
        twilightk = StarPosition.getTwilightAltitude(0.0, parallax);
    }
        public static StarPosition[] RandomStarPositions()
        {
            int amount    = Utility.RandomMinMax(4, 7);
            var positions = new StarPosition[amount];

            for (int i = 0; i < amount; i++)
            {
                StarPosition star = new StarPosition();

                star.ImageID = Utility.RandomMinMax(0x668, 0x67D);
                star.X       = Utility.RandomMinMax(180, 450);
                star.Y       = Utility.RandomMinMax(150, 400);

                positions[i] = star;
            }

            return(positions);
        }
Exemple #10
0
        private bool[,] CalculateStarsMap(int second)
        {
            int size_X   = 0;
            int size_Y   = 0;
            int offset_X = 0;
            int offset_Y = 0;

            StarPosition[] starPositions = new StarPosition[0];
            (size_X, size_Y, offset_X, offset_Y, starPositions) = CalculateStarPosition(second);

            var map = new bool[size_X, size_Y];

            for (var i = 0; i < starPositions.Length; i++)
            {
                map[offset_X + starPositions[i].X, offset_Y + starPositions[i].Y] = true;
            }

            return(map);
        }
Exemple #11
0
        public void Serialize(GenericWriter writer)
        {
            writer.Write(0);

            writer.Write(Identifier);
            writer.Write((int)TimeCoordinate);
            writer.Write(Name);
            writer.Write(DiscoveredBy);
            writer.Write(DiscoveredOn);
            writer.Write(CoordRA);
            writer.Write(CoordDEC);

            writer.Write(StarPositions.Length);

            for (var index = 0; index < StarPositions.Length; index++)
            {
                StarPosition pos = StarPositions[index];
                writer.Write(pos.ImageID);
                writer.Write(pos.X);
                writer.Write(pos.Y);
            }
        }
Exemple #12
0
    /* //
     * private void drawDayLightSide(int hinode, int hinoiri, int y)
     * {
     * //    Log.d("WORLDCLOCK", "left = " +hinode  + " right = " +hinoiri);
     * //	  Log.d("WorldClock", "y=" + y);
     *  if (hinode <= hinoiri)
     *   {
     *    for (int i = hinode; i <= hinoiri; i++)
     *     {
     *      screen.SetPixel(i, y, worldmap.getPixel(i, y));
     *     }
     *   }
     *  else
     *   {
     *    for (int i = hinode; i < wholewidth; i++)
     *     {
     *      screen.SetPixel(i, y, worldmap.getPixel(i, y));
     *     }
     *    for (int i = 0; i <= hinoiri; i++)
     *     {
     *      screen.SetPixel(i, y, worldmap.getPixel(i, y));
     *     }
     *   }
     * }
     */
    //
    private void drawTwilight(double latitude, int startx, int endx, int y)
    {
        int    addition  = startx <= endx ? 1 : -1;
        double longitude = 0.0;

        if (startx < 0 || startx >= wholewidth || endx < 0 || endx >= wholewidth)
        {
            return;
        }

        for (int i = startx; i != endx; i += addition)
        {
            longitude = (double)i / (double)wholewidth * 360.0;

            // double phai = StarPosition.getSidereal(timevalue, time / 24.0, longitude);//?P????
            double phai     = phai0 + longitude;                                     //地方恒星時 =グリニッジ恒星時+経度
            double altitude = StarPosition.getSunAltitude(asc, dec, latitude, phai); //???x
            if (altitude > 0.0)
            {
                continue;
            }

            if (!Double.IsNaN(altitude))
            {
                double ratio = 1.0f - (8.0 + Math.Floor(altitude)) / 12.0;
                if (ratio >= 1.0)
                {
                    screen.SetPixel(i, y, nightside);  //screen.SetPixel(i, y, nightmap.getPixel(i, y));
                }
                //else if(ratio > 1.0) screen.setPixel(i, y, worldmap.getPixel(i, y));
                else
                {
                    float alpha = nightside.a; alpha *= (float)ratio; screen.SetPixel(i, y, new Color(nightside.r, nightside.g, nightside.b, alpha));
                }
                //    screen.SetPixel(i, y, composeColors(nightmap.getPixel(i, y), worldmap.getPixel(i, y), ratio));
            }
        }
    }
Exemple #13
0
        public int FindStarsOptimalPosition(int second = 0)
        {
            var previous_min_size_X = int.MaxValue;
            var previous_min_size_Y = int.MaxValue;
            var min_size_X          = int.MaxValue - 1;
            var min_size_Y          = int.MaxValue - 1;

            int size_X   = 0;
            int size_Y   = 0;
            int offset_X = 0;
            int offset_Y = 0;

            StarPosition[] starPositions = new StarPosition[0];

            while (min_size_X < previous_min_size_X && min_size_Y < previous_min_size_Y)
            {
                (size_X, size_Y, offset_X, offset_Y, starPositions) = CalculateStarPosition(second);

                if (size_X <= min_size_X && size_Y <= min_size_Y)
                {
                    previous_min_size_X = min_size_X;
                    previous_min_size_Y = min_size_Y;
                    min_size_X          = size_X;
                    min_size_Y          = size_Y;
                }

                if (size_X > min_size_X && size_Y > min_size_Y)
                {
                    second--;
                    break;
                }

                second++;
            }

            return(second);
        }
Exemple #14
0
    public void updateScreen()
    {
        double hinode_keido, hinoiri_keido, asayake, higure;
        int    hinoiriX = 0, hinodeX = 0;
        int    asayakeX = 0, higureX = 0;

/*
 * Color transparent = new Color(0, 0, 0, 0);
 * for (int i = 0; i < screen.height; i++)
 * {
 * for (int j = 0; j < screen.width; j++)
 * {
 *  screen.SetPixel(j, i, transparent);
 * }
 * }
 */
//screen.eraseColor(0xff000000);

        //screencanvas.drawBitmap(worldmap, 0.0f, 0.0f, p);//世界地図で初期化
        for (int i = 0; i < wholeheight; i++)
        {
            //double latitude = getLatitudeFromY(Yequator - i);//Javaなどの左上が0の処理系の場合
            double latitude = getLatitudeFromY(i - Yequator);//unityなどの左下が0の処理系の場合

            double jikaku     = StarPosition.getTimeAngle(k, dec, latitude);
            double jikaku_twi = StarPosition.getTimeAngle(twilightk, dec, latitude);

            if (!Double.IsNaN(jikaku))//
            {
                hinode_keido  = StarPosition.reviseAngle(-jikaku + asc - phai0);
                hinoiri_keido = StarPosition.reviseAngle(jikaku + asc - phai0);
                hinodeX       = (int)getXfromLongitude(hinode_keido);
                hinoiriX      = (int)getXfromLongitude(hinoiri_keido);//

                //drawDayLightSide(hinodeX, hinoiriX, i);//
                if (!Double.IsNaN(jikaku_twi))//
                {
                    asayake  = StarPosition.reviseAngle(-jikaku_twi + asc - phai0);
                    higure   = StarPosition.reviseAngle(jikaku_twi + asc - phai0);
                    asayakeX = (int)getXfromLongitude(asayake);
                    higureX  = (int)getXfromLongitude(higure);

                    drawNightSide(higureX, asayakeX, i);
                    //
                    if (asayakeX < hinodeX)
                    {
                        drawTwilight(latitude, asayakeX, hinodeX, i);
                    }
                    else
                    {
                        drawTwilight(latitude, asayakeX, wholewidth - 1, i);
                        drawTwilight(latitude, 0, hinodeX, i);
                    }
                    //
                    if (hinoiriX < higureX)
                    {
                        drawTwilight(latitude, hinoiriX, higureX, i);
                    }
                    else
                    {
                        drawTwilight(latitude, hinoiriX, wholewidth - 1, i);
                        drawTwilight(latitude, 0, higureX, i);
                    }
                }
                else//
                {
                    if (hinodeX <= hinoiriX)
                    {
                        drawTwilight(latitude, hinoiriX, wholewidth - 1, i);
                        drawTwilight(latitude, 0, hinodeX, i);
                    }
                    else
                    {
                        drawTwilight(latitude, hinoiriX, hinodeX, i);
                    }
                }
            }
            else //
            {
                if (!Double.IsNaN(jikaku_twi))//
                {
                    asayake  = StarPosition.reviseAngle(-jikaku_twi + asc - phai0);
                    higure   = StarPosition.reviseAngle(jikaku_twi + asc - phai0);
                    asayakeX = (int)getXfromLongitude(asayake);
                    higureX  = (int)getXfromLongitude(higure);

                    if (asayakeX < higureX)
                    {
                        drawTwilight(latitude, asayakeX, higureX, i);
                        drawNightSide(higureX, wholewidth - 1, i);
                        drawNightSide(0, asayakeX, i);
                    }
                    else
                    {
                        drawTwilight(latitude, asayakeX, wholewidth - 1, i);
                        drawTwilight(latitude, 0, higureX, i);
                        drawNightSide(higureX, asayakeX, i);
                    }
                }
                else //
                {
                    //
                    //          double altitude = StarPosition.getSunAltitude(asc, dec, latitude, StarPosition.getSidereal(timevalue, time / 24.0, 0.0));
                    //          drawTwilight(0, wholewidth -1, i, altitude);
                    drawTwilight(latitude, 0, wholewidth - 1, i);
                }
            }
        }
    }
Exemple #15
0
    void Update()
    {
        //画角値の確認
        if (!calibrated)
        {
            if (Calibration.calibrated)
            {
                horizontalFOV           = Calibration.horizontal;
                verticalFOV             = Calibration.vertical;
                calibrated_orientation  = (int)Calibration.deviceOrientation;
                appdata.HorizontalAngle = horizontalFOV;
                appdata.VerticalAngle   = verticalFOV;
                appdata.saveApplicationData();
                calibrated = true;
            }
            else
            {
#if UNITY_ANDROID
                // Javaのオブジェクトを作成
                AndroidJavaClass nativeDialog = new AndroidJavaClass("studio.beautifulworld.dialoglibrary.MenuDialog");

                // Context(Activity)オブジェクトを取得する
                AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject context     = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

                // AndroidのUIスレッドで動かす
                context.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                    // ダイアログ表示のstaticメソッドを呼び出す
                    nativeDialog.CallStatic(
                        "showMessages",
                        context,
                        "お知らせ",
                        "画角の値が記録されていません。\nキャリブレーションを実行します。");
                }));
#endif
                moveToCalibration();
            }
        }

        //データ選択・又は地点選択の場合、以後の処理はしない
        if (chooser.enabled | pointchooser.enabled | helpvisible)
        {
            return;
        }

        //処理開始
        interval += Time.deltaTime;
        if (interval > 0.1f & ready)
        {
            currenteclipsedata.getPositions(current, posdata);
            clock.setTime(current);

            if (!Input.location.isEnabledByUser)
            {
                state = LOCATION_UNAVAILABLE;
            }
            else
            {
                LocationInfo locinfo = Input.location.lastData;
                magnetism = false;
                if (locinfo.longitude > 122.5f & locinfo.longitude <150.0f& locinfo.latitude> 23.0f & locinfo.latitude < 45.5f)
                {
                    magnetism = true;
                    //磁気偏角計算
                    float declination_angle = TerrestrialMagnetism.getMagneticDeclination(locinfo.longitude, locinfo.latitude);
                    declination = Quaternion.Euler(0.0f, declination_angle, 0.0f);
                }

                float height = 0;//高度
                if (locationmode == CURRENT_LOCATION)
                {
                    longitude = locinfo.longitude;
                    latitude  = locinfo.latitude;
                    height    = locinfo.altitude;
                }
                float[,] matrix  = caliculation.getMatrix(longitude, latitude, height);
                float[,] inverse = caliculation.getInverseMatrix(matrix);

                //debug

                /*
                 *  //分、秒を含めて時間で表す
                 *  double hour = current.Hour +9+ current.Minute / 60.0 + current.Second / 3600.0;
                 *  double T = StarPosition.getTime(current.Year, current.Month, current.Day, hour);
                 * //太陽の黄経を計算するelon:ecliptic longitude
                 *  double elon = StarPosition.getSunEclipticLongitude(T);
                 *  //黄道傾角を計算する
                 *  double e = StarPosition.getInclination(T);//
                 *  //太陽の赤経に変換
                 *  double asc = StarPosition.getRightAscension(elon, e);//
                 *  //太陽の赤緯に変換
                 *  double dec = StarPosition.getDeclination(elon, e);//   //恒星時を計算する
                 *  double phai0 = StarPosition.getSidereal(T, hour / 24.0, longitude);//経過時間を引く必要があるので時間を別に与える
                 */
                //食分計算
                //VesselElements ve = new VesselElements(posdata[EclipseData.SUN_ASC], posdata[EclipseData.SUN_DEC], posdata[EclipseData.SUN_DIST],
                //posdata[EclipseData.MOON_ASC], posdata[EclipseData.MOON_DEC], posdata[EclipseData.MOON_DIST], current);

                double phai = posdata[EclipseData.PHAI] + longitude;// longitude;//地方恒星時=グリニッジ恒星時+経度。恒星時は反時計回り、経度は時計回り

                //太陽の方位・高度を計算する
                sun_direction = StarPosition.getSunDirection(posdata[EclipseData.SUN_ASC], posdata[EclipseData.SUN_DEC], latitude, phai);
                sun_altitude  = StarPosition.getSunAltitude(posdata[EclipseData.SUN_ASC], posdata[EclipseData.SUN_DEC], latitude, phai);

                //コンパス空間に写像する
                //太陽の方向ベクトルを求める
                double sunz = Math.Sin(sun_altitude / RadToDeg);
                double suny = Math.Cos(sun_altitude / RadToDeg);
                double sunx = suny * Math.Cos((90.0 - sun_direction) / RadToDeg);
                suny = suny * Math.Sin((90.0 - sun_direction) / RadToDeg);

                double[] sun_vector = new double[] { sunx, suny, sunz };//角度から算出したベクトルなので、現在位置は引く必要はない

                //太陽への方向ベクトル単位化
                double norm = Math.Sqrt(sun_vector[0] * sun_vector[0] + sun_vector[1] * sun_vector[1] + sun_vector[2] * sun_vector[2]);
                sun_vector[0] /= norm;
                sun_vector[1] /= norm;
                sun_vector[2] /= norm;

                //太陽の方向が地平線の下
                if (sun_vector[2] < 0.0f)
                {
                    state = UNDER_HORIZON;
                }
                else
                {
                    //デバイスの向きを検出する
                    Quaternion gyro = Input.gyro.attitude;
                    camrotation.Set(-gyro.x, -gyro.y, gyro.z, gyro.w);

                    camrotation = Quaternion.Euler(90.0f, 0.0f, 0.0f) * camrotation;
                    //向き検出・終わり

                    //デバイス座標系に変換
                    Quaternion inverseQ   = Quaternion.Inverse(camrotation);
                    Vector3[]  sunandmoon = new Vector3[2];

                    sunandmoon[0] = inverseQ * new Vector3((float)sun_vector[0], (float)sun_vector[2], (float)sun_vector[1]);
                    //sunandmoon[1] = inverseQ * new Vector3((float)moon_vector[0], (float)moon_vector[2], (float)moon_vector[1]);

                    //最後に有効になったデバイス向きを取得する
                    DeviceOrientation orientation = camview.getLastOrienation();

                    //画角とタンジェント値を得る
                    float[] viewangles = new float[2];
                    getViewAngle(orientation, viewangles);
                    float verticalFOV               = viewangles[1] / RadToDeg;
                    float horizontalFOV             = viewangles[0] / RadToDeg;
                    float screen_tangent_horizontal = Mathf.Tan(horizontalFOV);
                    float screen_tangent_vertical   = Mathf.Tan(verticalFOV);
                    float ratio = 0.5f / (screen_tangent_vertical * 2);

                    for (int i = 0; i < 1; i++)
                    {
                        //磁気補正
                        if (magnetism)
                        {
                            sunandmoon[i] = declination * sunandmoon[i];
                        }

                        //後ろの場合も見えないので、手順をスキップする。
                        float x_angle = Mathf.Atan(sunandmoon[i].x / sunandmoon[i].z);
                        float y_angle = Mathf.Atan(sunandmoon[i].y / sunandmoon[i].z);

                        if (Mathf.Abs(x_angle) < horizontalFOV & Mathf.Abs(y_angle) < verticalFOV & sunandmoon[i].z > 0)
                        {
                            float screenX = Mathf.Tan(x_angle) / screen_tangent_horizontal * Screen.width / 2 + Screen.width / 2 - images[SUNIMAGE].width / 2;
                            float screenY = Screen.height / 2 - Mathf.Tan(y_angle) / screen_tangent_vertical * Screen.height / 2 - images[SUNIMAGE].height / 2;
                            //datas.targetposition.Set(x, y, targetbox.width, targetbox.height);

                            switch (i)
                            {
                            case 0: state = INSIDE_SCREEN; sunrect.Set(screenX, screenY, images[SUNIMAGE].width * ratio, images[SUNIMAGE].height * ratio); break;
                                //case 1: moonSeeable = true; moonrect.Set(screenX, screenY, moonbox.width * ratio, moonbox.height * ratio); break;
                            }

                            blink         = true;
                            blinkinterval = 0.0f;
                        }
                        else
                        {
                            state = OUTSIDE_SCREEN;
                            //太陽の位置を示すアイコンを決める
                            getGuideImage(sunandmoon[0]);
                        }
                    }//for終わり
                }
                //デバイス座標系に変換・終わり
            }


            //時間を一つ進める
            current = current.AddMinutes(1.0);
            //終了時刻よりあとの時刻か
            if (current.CompareTo(finish) > 0)
            {
                current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc);
            }
            //
            interval = 0.0f;
        }

        //アプリケーションの終了
        if (Application.platform == RuntimePlatform.Android)
        {
            // エスケープキー取得
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Input.gyro.enabled = false;
                Input.location.Stop();
                Input.compass.enabled = false;
                // アプリケーション終了処理
                Application.Quit();
                return;
            }
        }
    }