Beispiel #1
0
 public void SubmitAnchorDescription(BitStormAPI.AnchorDescription ad)
 {
     if (AnchorIds.Count == 0)
     {
         Survey.ExecuteOnMainThread.Enqueue(() => DoSubmitAnchorDescription(ad));
     }
 }
Beispiel #2
0
 private void DoSubmitAnchor(string anchorId)
 {
     BitStormAPI.AnchorDescription ad = new BitStormAPI.AnchorDescription();
     ad.id          = anchorId;
     ad.position    = new Vector3();
     ad.is_surveyed = false;
     DoSubmitAnchorDescription(ad);
 }
Beispiel #3
0
    private void DoSubmitAnchorDescription(BitStormAPI.AnchorDescription ad)
    {
        string anchorId = ad.id;

        GameObject x = Anchors.Find((GameObject obj) => obj.name == anchorId);

        if (x != null)
        {
            // If anchor exists and is surveyed, update... Otherwise kill it and create a new one.
            if (ad.is_surveyed)
            {
                x.transform.position = ad.position;
                return;
            }

            Destroy(x);
        }

        x      = Instantiate <GameObject>(AnchorPrefab);
        x.name = anchorId;
        if (ad.is_surveyed)
        {
            x.transform.position = ad.position;
        }
        else
        {
            x.transform.position = new Vector3(0 + Anchors.Count, 0.5f, 0);
        }
        x.transform.rotation = Quaternion.identity;
        x.transform.parent   = AnchorsGroup.transform;

        AnchorLabelScript labelScript = x.GetComponentInChildren <AnchorLabelScript>();

        if (labelScript != null)
        {
            labelScript.GetComponent <TextMesh>().text = anchorId;
        }

        x.BroadcastMessage("Build", anchorId);

        Anchors.Add(x);

        OriginAnchor = Anchors [0];

        if (ad.is_surveyed == false)
        {
            if (Anchors.Count == NumAnchors && surveyStatus == SurveyStatus.None)
            {
                StartCoroutine(GetRanges());
            }
        }
    }