Esempio n. 1
0
    private void GenerateChapterMap(Chapter chapter, bool showAnimation = true)
    {
        OnRefreshChapterTitle(chapter);
        ChapterMap oldChapterMap = ChapterMap;

        ChapterMap = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ChapterMap].AllocateGameObject <ChapterMap>(ChapterMapContainer);
        ChapterMap.transform.SetAsFirstSibling();
        ChapterMap.Initialize(chapter);
        if (showAnimation)
        {
            ChapterMap.transform.localScale = Vector3.zero;
            StartCoroutine(Co_ChapterMapAnimation(oldChapterMap, ChapterMap));
        }
        else
        {
            oldChapterMap?.PoolRecycle();
        }
    }
Esempio n. 2
0
    IEnumerator Co_ChapterMapAnimation(ChapterMap oldMap, ChapterMap newMap)
    {
        if (oldMap)
        {
            oldMap.transform.DOScale(Vector3.one * 0.05f, 1f);
            oldMap.transform.DORotate(new Vector3(0, 0, 270f), 1f, RotateMode.FastBeyond360);

            yield return(new WaitForSeconds(0.4f));
        }

        newMap.transform.localScale = Vector3.one * 3f;
        newMap.transform.rotation   = Quaternion.Euler(0, 0, 180f);

        newMap.transform.DOScale(Vector3.one, 0.8f);
        newMap.transform.DORotate(new Vector3(0, 0, 360f), 0.8f, RotateMode.FastBeyond360).OnComplete(
            delegate { newMap.transform.rotation = Quaternion.Euler(0, 0, 0); });

        yield return(new WaitForSeconds(0.7f));

        oldMap?.PoolRecycle();
    }