コード例 #1
0
ファイル: CardUI.cs プロジェクト: benk0913/Dawgio_V2
    private IEnumerator AlignRoutine(Transform target, PlayerModule byPlayer = null, bool animateHands = true, bool autoReleaseHand = true)
    {
        float t         = 0f;
        float rndHeight = UnityEngine.Random.Range(0.1f, 1f);

        Transform holdingHand = null;

        if (animateHands)
        {
            if (byPlayer != null)
            {
                holdingHand = byPlayer.Hand;
            }
            else
            {
                if (ParentPlayer != null)
                {
                    byPlayer = ParentPlayer;
                }
            }
        }

        while (t < 1f)
        {
            t += Mathf.Clamp(Game.Instance.ActionQue.Count, 1f, 6f) * 2f * Time.deltaTime;

            transform.rotation = Quaternion.Lerp(transform.rotation, target.transform.rotation, t);
            transform.position = Game.SplineLerp(transform.position, target.transform.position, rndHeight, t);

            if (animateHands && byPlayer != null)
            {
                byPlayer.PositionHand(transform.position + Vector3.up);
            }

            yield return(0);
        }

        if (autoReleaseHand && byPlayer != null)
        {
            byPlayer.SendHandBack();
        }

        LerpRotInstance = null;

        isLerping = false;
    }