Beispiel #1
0
    public void init(Transform root, int life)
    {
        _life = life;
        _root = root;
        TimerManager.instance.addEventListeners(this);
        _lastDir    = 0;
        _nextDir    = -1;
        _isDead     = false;
        _curPos     = new Coord(10, 0);
        _isLastTile = true;
        _curTween   = null;
        setPos(_curPos.x, _curPos.y);

        if (_tailList.Count != 0)
        {
            for (int i = 0; i < _tailList.Count; i++)
            {
                _pool.Despawn(_tailList[i]);
            }
            _tailList.Clear();
            tailIdx.Clear();
        }

//		tf.GetComponent<SpriteRenderer>().DOColor(new Color(1, 1, 1, 0), 0.2f).SetLoops(12, LoopType.Yoyo);
        headSprRdr.maskInteraction = SpriteMaskInteraction.None;
    }
Beispiel #2
0
    public void DeSpawn(ELoadType loadType, GameObject Instance, bool bImediate = false)
    {
        SpawnPool pool = null;

        if (m_Pools == null)
        {
            Debug.Log("Despaw() Instance.name:" + Instance.name + " m_Pools had destroyed");
            return;
        }
        if (m_Pools.TryGetValue(loadType, out pool))
        {
            if (pool != null && pool.isActiveAndEnabled && Instance != null)
            {
                Instance.transform.parent = pool.transform;
                if (!bImediate && pool.delayDelTime > 0.0f)
                {
                    pool.Despawn(Instance, pool.delayDelTime);
                }
                else
                {
                    pool.Despawn(Instance);
                }
            }
        }
    }
Beispiel #3
0
        bool isResult = false;                         // リザルトフラグ

        /// <summary>
        /// 再生.
        /// </summary>
        public void PlayBgm(string id)
        {
            // 重複再生を防止
            if (spawnedBgm && spawnedBgm.isPlaying)
            {
                spawnedBgm.Stop();
                bgmPool.Despawn(spawnedBgm.transform);
            }

            // 指定した音をスポーン
            Transform spawnedSeTrans = bgmPool.Spawn(id);

            // AudioSourceを取得
            spawnedBgm = spawnedSeTrans.GetComponent <AudioSource>();

            // ミュート時はボリュームを0に、そうでなければ設定データのBGMボリュームを設定
            if (GameDataManager.Inst.SettingData.IsBgmMute)
            {
                spawnedBgm.volume = 0;
            }
            else
            {
                spawnedBgm.volume = GameDataManager.Inst.SettingData.BgmVolume;
            }

            // 再生
            spawnedBgm.Play();
        }
Beispiel #4
0
    /// <summary>
    /// エフェクト停止
    /// </summary>
    public void StopEffect()
    {
        // スワイプエフェクトを停止
        swipeEffect.Stop();

        // スワイプエフェクトをデスポーン
        effectPool.Despawn(swipeEffect.transform);
    }
 public void Despawn(Transform prefab)
 {
     if (spawnPool == null)
     {
         spawnPool = PoolManager.Pools[poolName];
     }
     spawnPool.Despawn(prefab, spawnPool.transform);
 }
Beispiel #6
0
    IEnumerator Recycle(ParticleSystem particle)
    {
        float time = particle.duration;

        yield return(new WaitForSeconds(time + 0.1f));

        pool.Despawn(particle.transform);
    }
Beispiel #7
0
 public void Despawn(Transform obj)
 {
     if (obj)
     {
         prefabPool.Despawn(obj, pool);
     }
     else
     {
         Trace.LogWarning("特效丢失");
     }
 }
Beispiel #8
0
 public void DespawnChildList()
 {
     if (usePool)
     {
         foreach (var child in _childList)
         {
             if (_spawnPool != null)
             {
                 _spawnPool.Despawn(child.transform, _spawnPool.transform);
             }
         }
     }
 }
 void Update()
 {
     if (gameObject.activeInHierarchy)
     {
         if (gameObject.tag == "Thunder")
         {
             effectSpawnPool.Despawn(transform, 0.7f);
         }
         else
         {
             effectSpawnPool.Despawn(transform, 1.2f);
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// 再生終了したものをすべて削除する.
        /// </summary>
        void LateUpdate()
        {
            // 再生が終了しているすべての音を取得
            List <AudioSource> removeSeList = endWatchSeList.FindAll(se => !se.isPlaying);

            // 取得したすべての音をデスポーン
            foreach (var item in removeSeList)
            {
                sePool.Despawn(item.transform);

                // 再生終了チェックリストから削除
                endWatchSeList.Remove(item);
            }
        }
    /// <summary>
    /// 終了
    /// </summary>
    void OnDisable()
    {
        foreach (Transform panel in setedPanels)
        {
            // セットされたパネルを全てもとの親オブジェクトに戻す
            panel.SetParent(sourceRabbitPanelParent);
            // 戻したパネルをオフにする
            panel.gameObject.SetActive(false);
        }

        foreach (Transform layout in spawnedLayouts)
        {
            // HorizontalLayoutの親をプールに戻す
            layout.SetParent(horizontalLayoutPool.transform);

            // 残っているオブジェクトをデスポーンする
            if (horizontalLayoutPool.IsSpawned(layout))
            {
                horizontalLayoutPool.Despawn(layout);
            }
        }

        // リストを削除する
        setedPanels.Clear();
        // 新しく救出したウサギのリストをクリアする
        RabbitPictureBookFlagSwitcher.Inst.ClearNewRescuedRabbitData();
    }
Beispiel #12
0
    /// <summary>
    /// Check for pickup type and set powerup effect
    /// </summary>
    /// <param name="other">What are we colliding with? Should only check for player</param>
    private void OnTriggerEnter(Collider other)
    {
        if (!other.gameObject.CompareTag("Player"))
        {
            return;
        }

        switch (pickupType)
        {
        case PickupType.FireRate:
            IncreaseFireRate();
            break;

        case PickupType.BulletVel:
            IncreaseBulletVelocity();
            break;

        case PickupType.SpeedBoost:
            IncreasePlayerSpeed();
            break;

        case PickupType.BulletDmg:
            IncreaseBulletDmg();
            break;

        default:
            DebugUtils.Assert(false);
            break;
        }
        _particleManager.CreatePowerupParticleEffects(_xForm.position);
        _pool.Despawn(transform);
    }
Beispiel #13
0
    void Update()
    {
        //显示提示
        if (Time.time > m_PrevTipTime + 0.5f)
        {
            m_PrevTipTime = Time.time;

            if (m_TipQueue.Count > 0)
            {
                //从队列中取数据
                TipEntity entity = m_TipQueue.Dequeue();

                Transform trans = m_TipPool.Spawn(m_TipItem);
                trans.GetComponent <UITipItemView>().SetUI(entity.Type, entity.Text);
                trans.SetParent(transform);
                trans.localPosition = Vector3.zero;
                trans.localScale    = Vector3.one;

                trans.DOLocalMoveY(150, 0.5f).OnComplete(() =>
                {
                    m_TipPool.Despawn(trans);
                });
            }
        }
    }
 public void DespawnBuffTipsView(Transform prefab)
 {
     if (_spawnPool)
     {
         _spawnPool.Despawn(prefab);
     }
 }
Beispiel #15
0
    public void SpawnJumpScore()
    {
        Transform jumpscore     = jumpScorePool.Spawn("JumpScore");
        Text      jumpscoreText = jumpscore.GetComponent <Text> ();

        if (currentScore == currentLevel)
        {
            jumpscoreText.text = "+" + currentLevel;
        }
        else
        {
            jumpscoreText.text = comboWords [comboWordsIndex] + "\n+" + currentScore;
            comboWordsIndex++;
        }
        if (comboWordsIndex == comboWords.Length - 1)
        {
            comboWordsIndex = 0;
        }
        jumpscore.SetParent(jumpScoretrans);
        Vector2 targetPostion = Camera.main.WorldToScreenPoint(StepGenerate.Instance.tempStep.position) + Vector3.left * 40 - Vector3.up * 200;

        jumpscore.GetComponent <RectTransform> ().position = targetPostion;
        jumpscore.DOMoveY(targetPostion.y + 100, 0.5f, false).onComplete = delegate() {
            jumpScorePool.Despawn(jumpscore);
            jumpscoreText.DOFade(1, 0.1f);
        };
        jumpscoreText.DOFade(0.5f, 0.5f);
    }
 internal void DespawnSource(AudioSource source)
 {
     source.Stop();
     source.clip   = null;
     source.volume = sourceTemplate.volume;
     spawnPool.Despawn(source.transform);
 }
Beispiel #17
0
    private void EndFire()
    {
        if (this.Parent)
        {
            this.Parent.ExtinguishPoint(this);
        }
        if (BoltNetwork.isRunning && base.entity && base.entity.isAttached && base.entity.isOwner)
        {
            BoltNetwork.Detach(base.gameObject);
        }
        SpawnPool spawnPool = PoolManager.Pools["Particles"];

        if (spawnPool.IsSpawned(base.transform))
        {
            spawnPool.Despawn(base.transform);
        }
        else if (base.transform.parent)
        {
            base.gameObject.SetActive(false);
        }
        else
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }
    }
    public void AddEffect()
    {
        if (_view._btnCrak.transform.childCount > 0)
        {
            return;
        }
        if (PoolManager.Pools.ContainsKey("InGameEffectRes"))
        {
            SpawnPool pool = PoolManager.Pools["InGameEffectRes"];
            if (pool.prefabs.ContainsKey("FX_Dingque"))
            {
                Transform effect = pool.Spawn("FX_Dingque");
                Transform ewan   = effect.Find("Panel/FX_Btn_crak");
                Transform etiao  = effect.Find("Panel/FX_Btn_bam");
                Transform etong  = effect.Find("Panel/FX_Btn_dot");
                if (ewan && etiao && etong)
                {
                    ewan.parent         = _view._btnCrak.transform;
                    etiao.parent        = _view._btnBam.transform;
                    etong.parent        = _view._btnDot.transform;
                    ewan.localPosition  = Vector3.zero;
                    etiao.localPosition = Vector3.zero;
                    etong.localPosition = Vector3.zero;

                    pool.Despawn(effect);
                }
            }
        }
        else
        {
            Debug.LogError("No InGameEffectRes Prefab Loaded!!!");
        }
    }
 public void AddEffect()
 {
     if (_view._btnWin.transform.childCount > 0)
     {
         return;
     }
     if (PoolManager.Pools.ContainsKey("InGameEffectRes"))
     {
         SpawnPool pool = PoolManager.Pools["InGameEffectRes"];
         if (pool.prefabs.ContainsKey("FX_PengGang"))
         {
             Transform effect = pool.Spawn("FX_PengGang");
             Transform kong   = effect.Find("Panel/FX_Btn_kong");
             Transform win    = effect.Find("Panel/FX_Btn_win");
             Transform pong   = effect.Find("Panel/FX_Btn_pong");
             if (kong && win && pong)
             {
                 win.parent         = _view._btnWin.transform;
                 pong.parent        = _view._btnPong.transform;
                 kong.parent        = _view._btnKong.transform;
                 win.localPosition  = Vector3.zero;
                 pong.localPosition = Vector3.zero;
                 kong.localPosition = Vector3.zero;
                 win.gameObject.SetActive(true);
                 pong.gameObject.SetActive(true);
                 kong.gameObject.SetActive(true);
                 pool.Despawn(effect);
             }
         }
     }
     else
     {
         Debug.LogError("No InGameEffectRes Prefab Loaded!!!");
     }
 }
Beispiel #20
0
 void Update()
 {
     initeAIcars();
     if (Input.GetKeyDown(KeyCode.K))
     {
         print("+1");
         GameObject newAICar = instance.AIpool.Spawn(AIframe, AIroot.transform.position, Quaternion.identity).gameObject;
         newAICar.transform.SetParent(AIroot.transform, true);
         Transform shape = newAICar.transform.Find("shape");
         if (shape == null)
         {
             GameObject newCarShape = Instantiate <GameObject>(aiShape[Random.Range(0, aiShape.Length)], newAICar.transform);
             newCarShape.name = "shape";
         }
     }
     if (Input.GetKeyDown(KeyCode.L))
     {
         foreach (Transform temp in AIroot.GetComponentsInChildren <Transform>())
         {
             if (temp.name != "AIroot")
             {
                 AIpool.Despawn(temp);
             }
         }
     }
 }
Beispiel #21
0
    /// <summary>
    /// Spawn a particle instance at start, and respawn it to show particle reactivation
    /// </summary>
    private IEnumerator ParticleSpawner()
    {
        SpawnPool particlesPool = PoolManager.Pools[this.particlesPoolName];

        ParticleSystem prefab      = this.particleSystemPrefab;
        Vector3        prefabXform = this.particleSystemPrefab.transform.position;
        Quaternion     prefabRot   = this.particleSystemPrefab.transform.rotation;

        // Spawn an emitter that will auto-despawn when all particles die
        //  testEmitterPrefab is already a ParticleEmitter, so just pass it.
        // Note the return type is also a ParticleEmitter
        ParticleSystem emitter = particlesPool.Spawn(prefab, prefabXform, prefabRot);

        while (emitter.IsAlive(true))
        {
            // Wait for a little while to be sure we can see it despawn
            yield return(new WaitForSeconds(3));
        }

        ParticleSystem inst = particlesPool.Spawn(prefab, prefabXform, prefabRot);

        // Early despawn (in 2 seconds) and re-spawn
        particlesPool.Despawn(inst.transform, 2);

        yield return(new WaitForSeconds(2));

        particlesPool.Spawn(prefab, prefabXform, prefabRot);
    }
Beispiel #22
0
 public static void Despawn(SpawnPool pool, GameObject unit)
 {
     if (unit.activeSelf)
     {
         pool.Despawn(unit.transform);
     }
 }
Beispiel #23
0
    //爆道具的移除
    public override void Despawn()
    {
        if (gameObject.activeInHierarchy)
        {
            if (SceneManager.GetActiveScene().name != Game.Instance.StaticData.Level3)
            {
                effectSpawnPool.Spawn(DeadEffect, new Vector2(transform.position.x, transform.position.y - 10.4f), Quaternion.identity);
            }

            //爆道具
            int ran = Random.Range(0, items.Count * 5);
            //int ran = Random.Range(0, items.Count);
            if (ran >= 0 && ran < items.Count)
            {
                GameObject item = Instantiate(items[ran].Prefab, transform.position, Quaternion.identity);
                //GameObject item = Instantiate(items[5].Prefab, transform.position, Quaternion.identity);
                if (SceneManager.GetActiveScene().name == Game.Instance.StaticData.Level3)
                {
                    //itemLight位置处理
                    foreach (GameObject go in itemLight)
                    {
                        if (go.activeInHierarchy == false)
                        {
                            if (!choseItemLight)
                            {
                                go.SetActive(true);
                                go.transform.position = transform.position;
                                go.transform.parent.SetParent(item.transform.GetChild(0));

                                choseItemLight = true;
                            }
                        }
                    }
                }
            }
            //int ran = Random.Range(0, items.Count);
            //int ran = Random.Range(items.Count - 2, items.Count);
            //GameObject item = Instantiate(items[0].Prefab, transform.position, Quaternion.identity);
            GameObject.Find("Player").GetComponent <Player>().money += 10;
            //入对象池之前恢复之前的血量
            Hp             = MaxHp;
            choseItemLight = false;
            enemySpawnPool.Despawn(transform);
            //Instantiate(items[4].Prefab, transform.position, Quaternion.identity);
            //items[ran].Prefab.GetComponent<Animator>().SetBool("Move", true);
        }
    }
    //清除色子
    public IEnumerator DisapperDice(float delayTime = 0)
    {
        yield return(new WaitForSeconds(delayTime));

        if (diceA)
        {
            spawnPool.Despawn(diceA);
            diceA = null;
        }
        if (diceB)
        {
            spawnPool.Despawn(diceB);
            diceB = null;
        }

        yield return(0);
    }
Beispiel #25
0
    public override void Despawn()
    {
        if (gameObject.activeInHierarchy)
        {
            effectSpawnPool.Spawn(DeadEffect, new Vector2(transform.position.x, transform.position.y - 10.4f), Quaternion.identity);

            int ran = Random.Range(0, items.Count * 5);
            if (ran >= 0 && ran < items.Count)
            {
                Instantiate(items[ran].Prefab, transform.position, Quaternion.identity);
            }
            GameObject.Find("Player").GetComponent <Player>().money += 20;
            //入对象池之前恢复之前的血量
            Hp = MaxHp;
            enemySpawnPool.Despawn(transform);
        }
    }
Beispiel #26
0
 public void Despawn(Transform instance)
 {
     if (pool == null)
     {
         return;
     }
     pool.Despawn(instance, pool.transform);
 }
Beispiel #27
0
        /// <summary>
        /// 延迟释放资源
        /// </summary>
        /// <param name="type"></param>
        /// <param name="prefab"></param>
        /// <param name="seconds"></param>
        public void Despawn(PoolType type, Transform prefab, float seconds)
        {
            SpawnPool tempPool = GetPool(type);

            if (tempPool != null)
            {
                tempPool.Despawn(prefab, seconds, pool.transform);
            }
        }
Beispiel #28
0
        public override void Show(string msg)
        {
            base.Show(msg);
            FloatText.text = msg;
            SpawnPool  pool     = PoolManager.Pools["MessageBox"];
            GameObject poolRoot = GameObject.Find("MessageBoxPool");

            pool.Despawn(Root, 1, poolRoot.transform);
        }
 private void ClearPageItems()
 {
     while (scrollRect.content.childCount > 0)
     {
         var item = scrollRect.content.GetChild(0);
         item.GetComponent <PageItem>().Clear();
         item.SetParent(pool.transform);
         pool.Despawn(item);
     }
 }
Beispiel #30
0
 public void clear()
 {
     _pool = GlobalController.instance.getCurPool();
     for (int i = 0; i < mstList.Count; i++)
     {
         mstList[i].GetComponent <EnemyBase>().clear();
         _pool.Despawn(mstList[i]);
     }
     mstList.Clear();
 }