Beispiel #1
0
    IEnumerator CreateLine()
    {
        StopCoroutine(CreateLine());
        GameObject nodeOne;
        GameObject nodeTwo;

        ObjectSelector.SelectionUsed();
        ObjectSelector.ResetSelectedObject();

        Msg(LocalizationManager.Localize("chooseFirstNode"));
        do
        {
            yield return(new WaitUntil(ObjectSelector.IsJustSelected));

            nodeOne = ObjectSelector.SelectNode();
        }while (nodeOne == null);

        Msg(LocalizationManager.Localize("chooseSecondNode"));
        do
        {
            yield return(new WaitUntil(ObjectSelector.IsJustSelected));

            nodeTwo = ObjectSelector.SelectNode();
        }while (nodeTwo == null);

        newLine = Instantiate(LinePrefab);
        line    = newLine.GetComponent <LineRenderer>();

        line.SetPosition(0, nodeOne.transform.position);
        line.SetPosition(1, nodeTwo.transform.position);

        newLine.GetComponent <LineSelector>().firstNode = nodeOne;
        newLine.GetComponent <LineSelector>().lastNode  = nodeTwo;
    }