Beispiel #1
0
    public void Init()
    {
        bulls = new C_ObjectPool(C_GAMEMANAGER.GetInstance().GetPlayer().GetBulletCount(), C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject(C_GAMEMANAGER.GetInstance().strSelectedCharName + "_Bullet"));
        chars = new C_ObjectPool(C_GAMEMANAGER.GetInstance().GetPlayer().GetChargeBulletCount(), C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject(C_GAMEMANAGER.GetInstance().strSelectedCharName + "_Bullet_Charge"));

        GetComponent <BoxCollider2D>().size = new Vector2(C_GAMEMANAGER.GetInstance().GetPlayer().GetPlayerStats().m_fColliderScale,
                                                          C_GAMEMANAGER.GetInstance().GetPlayer().GetPlayerStats().m_fColliderScale);

        saveRed.x = C_GAMEMANAGER.GetInstance().GetPlayer().SpeedReducer();
        saveRed.y = C_GAMEMANAGER.GetInstance().GetPlayer().GetGravitySpeed();
    }
Beispiel #2
0
    IEnumerator Start()
    {
        m_cPool = new C_ObjectPool(nSize, C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject(strObstacleName));

        while (true)
        {
            if (C_GAMEMANAGER.GetInstance().GetPlayer().GetState() == E_PLAYERSTATE.E_PLAYERRELEASE)
            {
                break;
            }
            yield return(new WaitForSeconds(0.02f));
        }


        int nCount = 0;

        while (true)
        {
            yield return(new WaitForSeconds(fCoolTime));

            if (nCount >= nSize)
            {
                nCount = 0;
                m_cPool.DestroyAll();
                m_cPool = new C_ObjectPool(nSize, C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject(strObstacleName));
            }
            GameObject goObject = m_cPool.Alloc();
            goObject.GetComponent <Transform>().position = transform.position + new Vector3(0, Random.Range(-7, 7));
            nCount++;
            if (C_GAMEMANAGER.GetInstance().GetPlayer().GetState() == E_PLAYERSTATE.E_PLAYERDIE)
            {
                m_cPool.DestroyAll();
                break;
            }
        }
    }
Beispiel #3
0
    IEnumerator Start()
    {
        GameObject oo = C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject("EmptyItem_IM");

        if (oo == null)
        {
            Debug.Log("Failed!~!");
            yield return(new WaitForSeconds(0.0f));
        }

        m_cPool = new C_ObjectPool(nSize, oo);

        while (true)
        {
            if (C_GAMEMANAGER.GetInstance().GetPlayer().GetState() == E_PLAYERSTATE.E_PLAYERRELEASE)
            {
                break;
            }
            yield return(new WaitForSeconds(0.02f));
        }


        int nCount = 0;

        while (true)
        {
            yield return(new WaitForSeconds(fCoolTime));

            if (nCount >= nSize)
            {
                nCount = 0;
                m_cPool.DestroyAll();

                GameObject jj = C_GAMEMANAGER.GetInstance().GetObjectMgr().GetObject("EmptyItem_IM");

                if (jj == null)
                {
                    break;
                }

                m_cPool = new C_ObjectPool(nSize, jj);
            }
            GameObject goObject = m_cPool.Alloc();

            ItemScript iss = goObject.GetComponent <ItemScript>();

            if (iss != null)
            {
                iss.SetItemSpr();
            }

            goObject.GetComponent <Transform>().position = transform.position + new Vector3(0, Random.Range(-7, 7));
            nCount++;

            if (C_GAMEMANAGER.GetInstance().GetPlayer().GetState() == E_PLAYERSTATE.E_PLAYERDIE)
            {
                m_cPool.DestroyAll();
                break;
            }
        }
    }