Beispiel #1
0
    static public void createAWayPoint()
    {
        Debug.Log("this is waypoint" + wayPointSerial);
        string        wayPointName = "WPT" + wayPointSerial;
        AnvilWayPoint newWayPoint  = new AnvilWayPoint(wayPointSerial, wayPointSerial, wayPointSerial, wayPointName);

        allGameWayPoints.Add(newWayPoint);
        Debug.Log(newWayPoint.ToString());
        wayPointSerial++;
    }
Beispiel #2
0
    private void DrawWayPointCursor()
    {
        int reticleSize = 30;

        activeWayPoint = GetComponent <UIControlScript>().activeWayPoint;
        Vector3 screenPosition  = ScreenPointFromTansform(activeAgent.transform.position);
        Rect    screenCoordRect = new Rect(screenPosition.x + -(reticleSize / 2), Screen.height - screenPosition.y + -(reticleSize / 2), reticleSize, reticleSize);

        GUI.DrawTexture(screenCoordRect, boxReticle);
    }
Beispiel #3
0
    public static Vector3 WayPointToUnityVector3D(AnvilWayPoint waypoint)
    {
        double   latitude  = waypoint.latitude;
        double   longitude = waypoint.longitude;
        float    height    = 6378137 + (float)waypoint.elevation;
        Vector2d outputV2  = new Vector2d(latitude, longitude);
        Vector3  outputV3  = Conversions.GeoToWorldGlobePosition(outputV2, height);

        return(outputV3);
    }
Beispiel #4
0
 public void UpdateWayPointUIInfo()
 {
     if (selectedRoute != null)
     {
         activeWayPoint = selectedRoute.routeWayPoints[waypointIndex];
         //activeWayPointWorldPoint = ConversionTool1.WayPointToUnityVector3D2(activeWayPoint);
         waypointDataLabel.text = "Wpt: " + activeWayPoint.mWayPointName;
         //activeWayPointPositionLabel.text = activeWayPoint.LatLonString();
     }
 }
Beispiel #5
0
 public void UpdateWayPointUIInfo()
 {
     if (selectedRoute != null)
     {
         activeWayPoint           = selectedRoute.routeWayPoints[wayPointIndex];
         activeWayPointWorldPoint = ConversionTool1.WayPointToUnityVector3D2(activeWayPoint);
         //Old waypointUIinfo
         //activeWayPointLabel.text = "[" + (wayPointIndex + 1) + "/" + selectedRoute.routeWayPoints.Count + "]" + activeWayPoint.mWayPointName;
         activeWayPointLabel.text         = "Wpt: " + activeWayPoint.mWayPointName;
         activeWayPointPositionLabel.text = activeWayPoint.LatLonString();
     }
 }
Beispiel #6
0
    void Start()
    {
        factionRouteList = new List <AnvilRoute>();
        AnvilWayPoint waypointA0 = new AnvilWayPoint(36.58386, -121.83619, 200, "KM01");
        AnvilWayPoint waypointA1 = new AnvilWayPoint(36.58951, -121.85216, 157, "KM02");
        AnvilWayPoint waypointA2 = new AnvilWayPoint(36.58951, -121.85216, 157, "KM03");
        AnvilWayPoint waypointB0 = new AnvilWayPoint(36.58951, -121.85216, 157, "KM04");
        AnvilWayPoint waypointB1 = new AnvilWayPoint(36.58951, -121.85216, 157, "KM05");
        AnvilWayPoint waypointB2 = new AnvilWayPoint(36.58951, -121.85216, 157, "KM06");


        List <AnvilWayPoint> routeAList = new List <AnvilWayPoint> {
            waypointA0, waypointA1, waypointA2
        };
        List <AnvilWayPoint> routeBList = new List <AnvilWayPoint> {
            waypointB0, waypointB1, waypointB2
        };
        List <AnvilWayPoint> routeCList = new List <AnvilWayPoint> {
            waypointB2, waypointB1, waypointA1
        };
        List <AnvilWayPoint> wayPointList = new List <AnvilWayPoint>();

        wayPointList.Add(waypointA0);
        wayPointList.Add(waypointA1);
        wayPointList.Add(waypointA2);
        wayPointList.Add(waypointB0);
        wayPointList.Add(waypointB1);
        wayPointList.Add(waypointB2);

        AnvilRoute routeA    = new AnvilRoute("routeA", routeAList);
        AnvilRoute routeB    = new AnvilRoute("routeB", routeBList);
        AnvilRoute routeC    = new AnvilRoute("routeC", routeCList);
        AnvilRoute allRoutes = new AnvilRoute("allPoints", wayPointList);//this is a workaround to show all waypoints from all routes.

        allWayPointsList = wayPointList;

        factionRouteList = new List <AnvilRoute>();
        factionRouteList.Add(allRoutes);
        factionRouteList.Add(routeA);
        factionRouteList.Add(routeB);
        factionRouteList.Add(routeC);

        RefreshFaction();
    }
Beispiel #7
0
    public void executeMoveNow(AnvilWayPoint waypoint)
    {
        speed = 0.05f;

        Vector2d goTo = new Vector2d(waypoint.latitude, waypoint.longitude);

        goToPoint.transform.localPosition  = Conversions.GeoToWorldPosition(goTo, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz();
        goToPoint.transform.localPosition += new Vector3(0, 10, 0);

        Vector3 lookAtGoal = new Vector3(goToPoint.transform.localPosition.x, goToPoint.transform.localPosition.y, goToPoint.transform.localPosition.z);
        Vector3 direction  = lookAtGoal - this.transform.position;


        this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(direction), Time.deltaTime * rotSpeed);
        this.transform.position = Vector3.MoveTowards(this.transform.position, goToPoint.transform.position, speed);


        if (this.transform.position == goToPoint.transform.localPosition)
        {
            moveNow = false;
        }
    }
Beispiel #8
0
 public void addWaypoint(AnvilWayPoint wayPoint)
 {
     routeWayPoints.Add(wayPoint);
 }
Beispiel #9
0
 public void setSPITarget(AnvilWayPoint SPIWayPoint)
 {
     sensorTarget = SPIWayPoint;
     activeSPI    = SPIWayPoint.mWayPointName;
 }
Beispiel #10
0
 public void setNavTarget(AnvilWayPoint NavWayPoint)
 {
     navTarget       = NavWayPoint;
     activeNavTarget = NavWayPoint.mWayPointName;
 }
Beispiel #11
0
 public void setNavTgt(AnvilWayPoint target)
 {
     this.navTgt = target;
 }