Example #1
0
    IEnumerator teachWriting()
    {
        SelectIt.SetActive(false);

        WriteIt.SetActive(true);
        taps.speed = 0;
        current    = teachingPhase.Null;



        edge = GameManager.word.GetComponentInChildren <EdgeCollider2D>();
        stylus.transform.position = edge.gameObject.transform.TransformPoint(edge.points[0]);
        taps.Play("Touch", -1, 0);
        int tracker = 0;

        do
        {
            while (stylus.transform.position != edge.gameObject.transform.TransformPoint(edge.points[tracker]))
            {
                stylus.transform.position = Vector3.MoveTowards(stylus.transform.position, edge.gameObject.transform.TransformPoint(edge.points[tracker]), 0.04f);

                yield return(null);
            }
            if (tracker == 0)
            {
                taps.Play("Touch", -1, 1);
            }
            tracker++;
            yield return(null);
        }while (tracker < edge.pointCount && !written);


        if (!written)
        {
            yield return(new WaitForSeconds(1.0f));

            StartCoroutine(teachWriting());
        }
        if (written)
        {
            yield return(new WaitForSeconds(.25f));

            WriteIt.SetActive(false);
            stylus.GetComponent <SpriteRenderer>().enabled = false;
        }


        yield return(null);
    }
Example #2
0
    IEnumerator teachSelect()
    {
        SelectIt.SetActive(true);

        stylus.GetComponent <SpriteRenderer>().enabled = true;

        stylus.transform.position = startpos;

        //target = GameObject.Find("LIghtning 2").transform;
        taps.Play("Touch", -1, 0);
        while (stylus.transform.position != target.position)
        {
            stylus.transform.position = Vector3.MoveTowards(stylus.transform.position, target.position, 0.04f);
            yield return(null);
        }

        StartCoroutine(StylusTap());

        yield return(null);
    }