コード例 #1
0
    //--------------------------------------------------------
    IEnumerator Rebirth()
    {
        // Wait for popup-rebirth to finish its animation
        yield return(new WaitForSeconds(2f));  // 'show-x' animation: frames count / frame rate

        // Play VFX to tell player where the egg is re-spawned
        StickyContainer sc = lastBasket.GetComponentInChildren <StickyContainer>();

        PlayVFX("Prefabs/vfx_rebirth", sc.transform.position, sc.transform);

        // Wait for previous animation to finish
        yield return(new WaitForSeconds(0.4f));

        SoundController.PlaySFX("pre-rebirth");
        yield return(new WaitForSeconds(1.1f));

        // Move the egg the respawn point
        egg.InitStickTo(sc);
        egg.OnStickTo(lastBasket);
        PlayVFX("Prefabs/vfx_goal", egg.transform.position);

        // Update UI
        InvalidateLives();

        // Enable the Input module
        eggThrower.enabled = true;
    }
コード例 #2
0
    //--------------------------------------------------------
    void Start()
    {
        #if UNITY_EDITOR
        Clear();
        #endif

        spawnFrom    = 0;
        lastSpawnPos = transform.position;
        Basket firstBasket = null;
        loop       = 1;
        levelIndex = (shuffle && shuffle1stLoop) ? Random.Range(0, levels.Length) : 0;
        levelData  = levels[levelIndex];

        for (int i = 0; i < preSpawn; ++i)
        {
            Basket b = SpawnNext();
            if (firstBasket == null)
            {
                firstBasket = b;
            }
        }

        Egg egg = GameObject.FindObjectOfType <Egg>();
        egg.InitStickTo(
            firstBasket.GetComponentInChildren <StickyContainer>()
            );
        egg.OnStickTo(firstBasket);
    }