Exemple #1
0
    // Use this for initialization
    void Start()
    {
        // Create matrix of ranges .. Normally, this would come in from the field
        // but for simulation sake, just calculate magnitude between each anchor.

        if (UseAnchorIds == false)
        {
            AnchorIds.Clear();
        }

        if (Simulate)
        {
            foreach (GameObject g1 in Anchors)
            {
                AnchorScript g1as = g1.GetComponent <AnchorScript> ();
                foreach (GameObject g2 in Anchors)
                {
                    //TODO: Use sqrMagnitude for quicker math later
                    float dist = (g1.transform.position - g2.transform.position).magnitude;

                    AnchorDistance ad = new AnchorDistance();
                    ad.anchor   = g2.GetComponent <AnchorScript> ();
                    ad.distance = dist;
                    g1as.AnchorDistances.Add(ad);

                    ad.anchor.IsSurveyed = false;
                }
            }
        }
        else
        {
            Anchors.Clear();
            OriginAnchor = null;
        }

        // Create the group to hold the markers
        markerGroup      = new GameObject();
        markerGroup.name = "Markers";
        markerGroup.transform.position = Vector3.zero;
        markerGroup.transform.rotation = Quaternion.identity;

        tcpServerScript = GetComponent <TcpServer> ();
        bitstormScript  = GetComponent <BitStormAPI>();

        if (!Simulate && AnchorIds.Count == 0 && bitstormScript != null)
        {
            StartCoroutine(DoRetrieveAnchors());
        }
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        surveyScript = GetComponent <Survey> () as Survey;
        engineScript = GetComponent <LocationEngine2D> () as LocationEngine2D;
        clientScript = GetComponent <TcpClient> () as TcpClient;
        apiScript    = GetComponent <BitStormAPI> () as BitStormAPI;

        if (Simulate)
        {
            Debug.Log("Running simulation .. Starting in 2 seconds.");
            simScript = GetComponent <Simulation> () as Simulation;
            Invoke("LaunchSimulation", 2);
        }
        else
        {
            Debug.Log("Running LIVE .. Starting in 2 seconds.");
            Invoke("LaunchLive", 2);
        }
    }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     tcpServerScript = GetComponent <TcpServer> ();
     bitstormScript  = GetComponent <BitStormAPI>();
 }