コード例 #1
0
    override public IEnumerator Transmit()
    {
        yield return(StartCoroutine(star.Release()));

        GameObject cell        = targetCell.gameObject.transform.Find("canvas/text").gameObject;
        GameObject payload     = Instantiate(cell);
        Text       payloadText = payload.GetComponent <Text>();

        payload.transform.SetParent(targetCell.gameObject.transform.Find("canvas"));
        payload.transform.position = cell.transform.position;

        Vector2 startPosition    = payload.transform.position;
        Vector2 endPosition      = star.LootPosition;
        Color   startFillColor   = GameController.SINGLETON.letterInCellColor;
        Color   endFillColor     = GameController.SINGLETON.transmittingFillColor;
        Color   startStrokeColor = GameController.SINGLETON.letterInCellColor;
        Color   endStrokeColor   = GameController.SINGLETON.transmittingStrokeColor;
        Vector3 startScale       = payload.GetComponent <RectTransform>().localScale;
        Vector3 endScale         = GameController.SINGLETON.star.Loot.gameObject.GetComponent <RectTransform>().localScale;

        float startTime   = Time.time;
        float targetTime  = 1.0f;
        float elapsedTime = 0.0f;

        Outline outline = payload.GetComponent <Outline>();

        outline.enabled = true;

        GameController.SINGLETON.Log("value = *p; // value = '" + targetCell.Label + "'");

        while (elapsedTime <= targetTime)
        {
            float proportion = elapsedTime / targetTime;
            payload.transform.position = Vector2.Lerp(startPosition, endPosition, proportion);
            payloadText.color          = Color.Lerp(startFillColor, endFillColor, proportion);
            outline.effectColor        = Color.Lerp(startStrokeColor, endStrokeColor, proportion);
            payload.GetComponent <RectTransform>().localScale = Vector3.Lerp(startScale, endScale, proportion);
            yield return(null);

            elapsedTime = Time.time - startTime;
        }

        payload.transform.position = endPosition;
        payloadText.color          = endFillColor;
        outline.effectColor        = endStrokeColor;

        star.Acquire(targetCell.Label);
        Destroy(payload);
    }