示例#1
0
        private IEnumerator displayStrokeHint(int strokeNum)
        {
            List <Vector3> targetCorners = charData.strokes[strokeNum];

            yield return(new WaitForSeconds(strokeMarkDelay));

            // display the completed next stroke
            GameObject     strokeHint         = new GameObject("Stroke Hint");
            SpriteRenderer strokeHintRenderer = strokeHint.AddComponent <SpriteRenderer>();

            strokeHintRenderer.transform.position = new Vector3(0f, 0f, -5f);

            string spriteName = charData.spriteNames[strokeNum];

            strokeHintRenderer.sprite = spriteRepo.getSprite(spriteName);
            strokeHintRenderer.color  = Color.black;

            // wait a moment
            yield return(new WaitForSeconds(strokeMarkDelay));

            GameObject     mark     = new GameObject();
            SpriteRenderer renderer = mark.AddComponent <SpriteRenderer>();

            renderer.sprite = markSprite;

            // display the corner points in order, pausing along the way
            // to indicate stroke direction
            for (int i = 0; i < targetCorners.Count; i++)
            {
                mark.transform.position =
                    new Vector3(targetCorners[i].x, targetCorners[i].y, SceneDepth.LINE_DEPTH);

                yield return(new WaitForSeconds(strokeMarkDelay));
            }

            // destory the mark, wait a moment, then destroy the stroke hint
            Destroy(mark);
            yield return(new WaitForSeconds(strokeMarkDelay));

            Destroy(strokeHint);
        }
示例#2
0
        private Sprite getSprite(int stroke)
        {
            string name = string.Format("three_{0:00}", stroke);

            return(spriteRepo.getSprite(name));
        }
示例#3
0
        private void setSprite(string name)
        {
            Sprite sprite = spriteRepo.getSprite(name);

            GetComponent <SpriteRenderer>().sprite = sprite;
        }