Ejemplo n.º 1
0
    public void GetEffectPool(FootInfo footInfo)
    {
        GameObject newEffect;

        if (footInfo.Efeect == null)
        {
            if (effectPool.Count < effectPoolCount)
            {
                if (this.effectType == 5 && weaterType == 1)                          //雨天并且沙地用泥地效果
                {
                    newEffect = GameObject.Instantiate <GameObject>(this.effects[4]); //用泥地效果
                }
                else
                {
                    newEffect = GameObject.Instantiate <GameObject>(this.effects[this.effectType]);
                }
                effectPool.Add(newEffect);
            }
            else
            {
                newEffect = effectPool[reuseIndex];
                newEffect.gameObject.SetActive(false);
                newEffect.gameObject.SetActive(true);
                reuseIndex++;
                if (reuseIndex == effectPoolCount)
                {
                    reuseIndex = 0;
                }
            }
        }
        else
        {
            var effectId = footInfo.Efeect.GetInstanceID();
            if (!m_EffectPool.ContainsKey(effectId))
            {
                m_EffectPool[effectId] = new FootPrintPoolInfo()
                {
                    MateEffect = footInfo.Efeect
                };
            }

            newEffect = m_EffectPool[effectId].GetPoolObject();
        }

        newEffect.transform.SetPositionAndRotation(footInfo.Pos, footInfo.Rotation);
    }
Ejemplo n.º 2
0
    private void PlayFieldFootAudio(FootInfo footInfo)
    {
        if (DisableFootAudio)
        {
            return;
        }

        int index = footInfo.Index;

        if (index != 3)
        {
            return;
        }
        //index += 1;
        count++;
        if (count % 2 == 0)
        {
            switch (effectType)
            {
            case 3:
                //grass

                //SoundTools.PlaySoundEffect("Grassland-1"/* + index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("Grassland-1", footInfo.Pos);
                break;

            case 4:
                //muddy
                //SoundTools.PlaySoundEffect("Muddyland-1" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("Muddyland-1", footInfo.Pos);
                break;

            case 5:
                //land
                //SoundTools.PlaySoundEffect("Sand-1" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("sand-1", footInfo.Pos);
                break;
            }
        }
        else
        {
            switch (effectType)
            {
            case 3:
                //grass

                //SoundTools.PlaySoundEffect("Grassland-2"/* + index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("Grassland-2", footInfo.Pos);
                break;

            case 4:
                //muddy
                //SoundTools.PlaySoundEffect("Muddyland-2" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("Muddyland-2", footInfo.Pos);
                break;

            case 5:
                //land
                //SoundTools.PlaySoundEffect("Sand-2" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]);
                SoundTools.PlaySoundEffect("sand-2", footInfo.Pos);
                break;
            }
        }
    }