コード例 #1
0
 private void AddLevelHollow(int num)
 {
     for (int i = 0; i < num; i++)
     {
         GameObject newCylinder = (GameObject)Instantiate(GameObject.FindWithTag("LevelHollows").transform.GetChild(GameObject.FindWithTag("LevelHollows").transform.childCount - 1).gameObject, GameObject.FindWithTag("LevelHollows").transform);
         LevelupHollows.Add(newCylinder);
         LevelHollowGetDistance.SetHollow(newCylinder, 10f);
     }
 }
コード例 #2
0
    private void Start()
    {
        GameObject Bullet       = GameObject.FindWithTag("Bullet");
        GameObject Block        = GameObject.FindWithTag("Blocks");
        GameObject Edge         = GameObject.FindWithTag("Edge");
        GameObject Hollow       = GameObject.FindWithTag("HollowFill");
        GameObject LevelHollows = GameObject.FindWithTag("LevelHollows");

        bullet = new ObjectPoolItem();

        bullet.shouldExpand = true;
        bullet.amountToPool = 3;
        bullet.objectToPool = Bullet;
        bullet.objectTag    = Bullet.tag;

        block = new ObjectPoolItem();

        block.shouldExpand = false;
        block.amountToPool = TutorialManager.instance.blockNumber;
        block.objectToPool = Block;
        block.objectTag    = Block.tag;
        TutorialManager.instance.blocks[0] = Block;
        Block.SetActive(false);

        edge = new ObjectPoolItem();

        edge.shouldExpand = true;
        edge.amountToPool = 17;
        edge.objectToPool = Edge;
        edge.objectTag    = Edge.tag;

        hollow = new ObjectPoolItem();

        //float distHollow = 0f;
        if (Hollow != null)
        {
            hollow.shouldExpand = false;
            hollow.amountToPool = 3;
            hollow.objectToPool = Hollow;
            hollow.objectTag    = Hollow.tag;
            TutorialManager.instance.Hollows.Add(hollow.objectToPool);
            TutorialManager.instance.Hollows[0].GetComponent <TutHollowFillScript>().SetQueNumber(0);
            //distHollow = TutorialManager.instance.hollowUpdateDist;
            Hollow.SetActive(false);
        }

        /* else
         * {
         *   hollow.amountToPool = 14;
         *   hollow.objectToPool = GameObject.FindWithTag("Hollow");
         *   distHollow = 50f;
         * }*/

        fullHollows = new ObjectPoolItem();

        fullHollows.shouldExpand = true;
        fullHollows.amountToPool = 50;
        fullHollows.objectToPool = LevelHollows.transform.GetChild(0).gameObject;
        fullHollows.objectTag    = LevelHollows.transform.GetChild(0).gameObject.tag;


        itemsToPool.Add(bullet);
        itemsToPool.Add(block);
        itemsToPool.Add(edge);
        itemsToPool.Add(hollow);
        itemsToPool.Add(fullHollows);

        pooledObjects = new List <GameObject>();
        //Debug.Log("Object Pooler created pooled objects");
        float distEdge = 20f;
        float fullDist = 10f;

        foreach (ObjectPoolItem item in itemsToPool)
        {
            for (int i = 0; i < item.amountToPool; i++)
            {
                if (item == fullHollows)
                {
                    GameObject obj = (GameObject)Instantiate(item.objectToPool, LevelHollows.transform);
                    //obj.SetActive(false);
                    pooledObjects.Add(obj);
                    TutorialManager.instance.LevelupHollows.Add(obj);
                    fullDist = LevelHollowGetDistance.SetHollow(TutorialManager.instance.LevelupHollows[i], fullDist);
                }
                else
                {
                    GameObject obj = (GameObject)Instantiate(item.objectToPool, GameObject.FindWithTag("ALLPLATFORM").transform);

                    pooledObjects.Add(obj);
                    if (item == block)
                    {
                        TutorialManager.instance.blocks[i + 1] = obj;
                    }
                    if (item == edge)
                    {
                        TutorialManager.instance.Edges.Add(obj);
                        distEdge = PlatformScript.SetPlatform(TutorialManager.instance.Edges[i], distEdge);
                    }
                    if (item == hollow)
                    {
                        obj.SetActive(false);
                        TutorialManager.instance.Hollows.Add(obj);
                        TutorialManager.instance.Hollows[i + 1].GetComponent <TutHollowFillScript>().SetQueNumber(i + 1);
                    }
                }
            }
        }
    }
コード例 #3
0
    //This is used for level based level endings
    private IEnumerator LevelEndedState(float PlayerSpeedLimit)
    {
        yield return(new WaitForSeconds(.3f));

        ///////////////////////////////////////////////////renklerrrr////////////////////////////////////////////////////////////////

        /*float randFlt = Random.Range (0.01f, 1f);
         *
         * DataScript.levelModeBlockColor = HueChanger.hueChanger (DataScript.levelModeBlockColor, randFlt);//Random.Range (0f,1f));
         * DataScript.levelModeHexogenColor = HueChanger.hueChanger (DataScript.levelModeHexogenColor, randFlt);//Random.Range (0f,1f));*/
        ///////////////////////////////////////////////////renklerrrr//////////////////////////////////////////////////////////////
        ///
        /// Safe swicth for when player dies after stepping last block dont increment level and break corountine
        if (isGameOn != true)
        {
            yield break;
        }

        playerLock                         = true;
        onIdle                             = true;
        DataScript.pointHolder             = points;
        DataScript.isSessionEnded          = false;
        DataScript.isPassedAtLeastOneLevel = true;
        DataScript.ThemeIndex              = (Level - 1) % DataScript.Themes.Count;
        PlayerPrefs.SetInt("PlayerLevel", Level);
        FB.LogAppEvent(AppEventName.AchievedLevel, (float)Level - 1);
        if (PlayerPrefs.GetInt("MaxLevel") < Level)
        {
            PlayerPrefs.SetInt("MaxLevel", Level);
        }
        GameObject coins         = GameObject.FindWithTag("Coins");
        GameObject levelHexogans = GameObject.FindWithTag("LevelHollows");

        float speedRate = 10f;
        float waitTime  = .01f;

        while (!PlayerAccelerator.PlayerFastEnough(Player.instance.speed.z, PlayerSpeedLimit))
        {
            Player.instance.speed.z += speedRate;
            yield return(new WaitForSeconds(waitTime));
        }

        bool  changed = false;
        float tilt    = 0;
        Color ex      = levelHexogans.transform.GetChild(0).transform.GetChild(0).GetComponent <Renderer>().material.color;

        while (onIdle)
        {
            if (Player.instance.transform.position.z >= coins.transform.GetChild(coins.transform.childCount - 1).transform.position.z + 50f && !changed)
            {
                changed = true;
                uIScript.NextLevel();
            }
            if (tilt < 1)
            {
                tilt = Mathf.MoveTowards(tilt, 1f, 0.01f);
                foreach (Renderer r in levelHexogans.GetComponentsInChildren <Renderer>())
                {
                    r.material.color = Color.Lerp(ex, DataScript.Themes[DataScript.ThemeIndex].HexagonColor, tilt);
                }
                Edges.ForEach(delegate(GameObject g)
                {
                    foreach (Renderer r in g.GetComponentsInChildren <Renderer>())
                    {
                        r.material.color = Color.Lerp(ex, DataScript.Themes[DataScript.ThemeIndex].HexagonColor, tilt);
                    }
                });
            }

            LevelHollowGetDistance.SetHollow(levelHexogans.transform.GetChild(0).gameObject, LevelHollowGetDistance.GetDistance(levelHexogans.transform) + 10f);
            levelHexogans.transform.GetChild(0).SetAsLastSibling();
            yield return(new WaitUntil(() => Player.instance.transform.position.z >= GameObject.FindWithTag("LevelHollows").transform.GetChild(GameObject.FindWithTag("LevelHollows").transform.childCount - 25).transform.position.z));
        }
    }