コード例 #1
0
    static Animator SpawnLetterCanvas(LetterPrefabReference letter, float xPosition, Transform parent)
    {
        var letterInWorld = letter.InstantiateOutline();

        letterInWorld.transform.parent = parent;

        var animator = letterInWorld.GetComponent <Animator>();

        letterInWorld.transform.position = new Vector2(xPosition, letterInWorld.transform.position.y);
        return(animator);
    }
コード例 #2
0
    public void StartActivity(DrawLetterAnimationController drawingAnimations, LetterPrefabReference requestedLetter, int maxAttempts, int sensitivity)
    {
        var canvas = InstantiateCanvas(Position.x, _root);
        var sprite = canvas.transform.GetChild(0);

        _requestedLetter      = requestedLetter;
        _maxAttempts          = maxAttempts;
        _attemptCounter       = canvas.GetComponentInChildren <AttemptCounter>();
        _gestureScript        = new Gesture(_root, sensitivity);
        _drawletterAnimations = drawingAnimations;

        _gestureScript.LettersToMatch = new Letter[] { requestedLetter.Letter };
        _ressi.TouchInteractions.OverrideInputChain(_gestureScript);
        _gestureScript.OnGestureComplete += ValidateDrawing;

        _canvasTrigger.StartCoroutine(WaitForCanvasAppearance(sprite));
    }