コード例 #1
0
ファイル: TaskListUI.cs プロジェクト: JohnTM/HomeGame
    public void SpawnRewardTick(int amount, TaskBroadcaster tb, EmotionalStateUI emotionUI)
    {
        if (m_taskIconMap.ContainsKey(tb))
        {
            TaskIcon icon = m_taskIconMap[tb];

            RectTransform punishTick = Instantiate <RectTransform>(m_rewardTickPrefab, transform.parent);
            punishTick.position = icon.transform.position + Vector3.up * 30;

            Vector3 start  = punishTick.position;
            Vector3 target = emotionUI.transform.position;
            Vector3 dir    = (start - target + Vector3.up * 20).normalized;
            target += dir * 50.0f;

            Vector3[] path = new Vector3[] { start, Vector3.Lerp(start, target, 0.5f) + Vector3.up * 30.0f, target };

            var seq = DOTween.Sequence();

            seq.Append(punishTick.DOPath(path, 1.0f, PathType.CatmullRom).SetEase(Ease.InCubic));
            seq.Insert(0, punishTick.GetComponent <Image>().DOFillAmount(1.0f, 0.25f));
            seq.InsertCallback(0.9f, () => { emotionUI.Reward(amount, tb); });
            Destroy(punishTick.gameObject, 1.0f);
        }

        //m_emotionalStateUI.Punish(amount, source);
    }