示例#1
0
    IEnumerator FlyCoroutine()
    {
        time = 0;
        while (time < (TotalTime * distance))
        {
            time  += (Time.deltaTime / Time.timeScale);
            tmpPos = Vector3.Lerp(
                originalPos,
                targetPos,
                time / (TotalTime * distance));
            tmpPos.z    = _t.position.z;
            _t.position = tmpPos;
            yield return(null);
        }

        if (trgt != null)
        {
            trgt.SendMessage(BOUNCE_MESSAGE);
            trgt.SendMessage(UPDATE_NUMBER_MESSAGE, targetMessageNumber);
        }

        if (audioToPlay.HasValue)
        {
            switch (audioToPlay.Value)
            {
            case AudioToPlay.BlockCollect:
                SoundBoard.PlayBlockCollect();
                break;

            case AudioToPlay.ItemCollect:
                SoundBoard.PlayItemCollect();
                break;
            }
        }

        Despawn(this);
    }