예제 #1
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());
            }
        }
    }
예제 #2
0
    public void StartSimulate()
    {
        isSimulation = true;

        // If we don't have an anchors group, die.
        if (AnchorsGroup == null)
        {
            Debug.LogError("No AnchorsGroup available for simulation.  Create one and attach Anchors to it.");
            Application.Quit();
        }

        foreach (Transform t in AnchorsGroup.transform)
        {
            GameObject        g           = t.gameObject;
            AnchorLabelScript labelScript = g.GetComponentInChildren <AnchorLabelScript>();
            if (labelScript != null)
            {
                labelScript.GetComponent <TextMesh>().text = g.name;
            }
            Anchors.Add(g);
        }
    }