예제 #1
0
        public void AddGold(Vector3 position, int count)
        {
            Global.gApp.gAudioSource.PlayOneShot(m_AudioClip);
            if (count <= 0)
            {
                return;
            }
            float expect = count / 15;

            for (int i = 1; i <= count; i++)
            {
                if (m_CacheGoldProps.Count > 0)
                {
                    Vector3  offsetPos = new Vector3(Random.Range(-expect, expect), Random.Range(-expect, expect), Random.Range(0, 2));
                    GoldProp gold      = gold = m_CacheGoldProps[0];
                    gold.Init();
                    gold.transform.position = position + offsetPos;
                    m_CacheGoldProps.RemoveAt(0);
                }
                else
                {
                    m_Player.GetPlayerData().AddGold(1.0f);
                }
            }
        }
예제 #2
0
        private void CacheProp()
        {
            SceneType sceneType = Global.gApp.CurScene.GetSceneType();
            int       cacheNum  = 150;
            Transform bulletTsf = Global.gApp.gBulletNode.transform;

            for (int i = 0; i < cacheNum; i++)
            {
                GameObject propGo = Global.gApp.gResMgr.InstantiateObj(m_PropPath[4]);
                propGo.transform.position = new Vector3(1000, 0, 0);
                propGo.transform.SetParent(bulletTsf);
                GoldProp gold = propGo.GetComponent <GoldProp>();
                gold.Stop();
                m_CacheGoldProps.Add(gold);
            }
        }
예제 #3
0
 public void RemoveGoldProp(GoldProp prop)
 {
     prop.transform.position = new Vector3(1000, 0, 0);
     prop.enabled            = false;
     m_CacheGoldProps.Add(prop);
 }