Пример #1
0
    //  현재위치로부터 목적지까지의 방향과 회전각 계산
    void calculateDirection()
    {
        //  목적지를 향한 방향벡터
        direction = destinationPos - myPos;
        direction.Normalize();

        //  목적지를 향한 방향벡터를 회전각으로 변환
        destinationAngle = Vector3.Angle(Vector3.forward, direction);
        destinationAngle = Vector3.Dot(Vector3.right, direction) > 0.0 ? destinationAngle : -destinationAngle;

        //  안내 캐릭터의 회전각
        characterAxis.transform.rotation = Quaternion.Euler(0f, destinationAngle, 0f);

        //  목적지까지의 남은 거리를 m 단위로 계산
        distance = (float)(DistanceManager.Distance(mlatitude, mlongitude, dlatitude, dlongitude, 'K') * 1000);

        //  20000m (20km) 보다 더 멀리 있으면
        if (distance >= 20000)
        {
            distanceText.text = "걸어가기엔 너무 멀어요!";
        }
        else if (distance <= 10)
        {
            //  도착
            distanceText.text = "근처에 도착하였습니다!";
        }
        else
        {
            distanceText.text = "남은 거리 : " + Mathf.Floor(distance) + " m";
        }
    }
Пример #2
0
    public IEnumerator ConTowerPos()
    {
        yield return(new WaitForSeconds(1));

        float  slatitude  = googleMap.centerLocation.latitude;  //자신의 위치를 구글맵으로 불러오는 공식 위도
        float  slongitude = googleMap.centerLocation.longitude; //자신의 위치를 구글맵으로 불러오는 공식 경도
        double distance   = DistanceManager.Distance(slatitude, slongitude, latitude, longitude, 'K') * 1000;

        if (distance < 1)
        {
        }
        if (distance > 1)
        {
        }
    }
Пример #3
0
    void Update()
    {
        float slatitude  = map.centerLocation.latitude;
        float slongitude = map.centerLocation.longitude;

        float distance = (float)DistanceManager.Distance(
            latiTude, longiTude, slatitude, slongitude, 'K') * 1000;



        if (distance < 20)
        {
            diaryManager.diary_Second();
        }
        else
        {
        }
    }