예제 #1
0
    //光头强只会和障碍物碰撞,不会吃东西
    protected override void OnTriggerEnter(Collider other)
    {
        BrokenObjectController broken = other.gameObject.GetComponent <BrokenObjectController>();

        if (broken == null)
        {
            return;
        }

        if (broken.IsLocker)
        {
            //Debug.Log(other.gameObject + "#跳出");
            return;
        }
        if (broken.brokenHandleType != BrokenObjectController.BrokenHandleType.HandleType_Barrier)
        {
            return;
        }
        //Debug.Log(other.gameObject + "#########");
        broken.IsLocker = true;
        //处理被撞物品
        broken.StartBroken(hControllerScriptCS as IParkourControllerScriptCS);
        //触发碰撞消息
        playerAIControler.OnEventHitBrokenObject();
        //播放碰撞语言
        SoundEffectPlayer.Play("touchbroken.wav");
        //playerSoundControler.PlayAudioSource(IParkourPlayerSound.PlayerSoundType.Type_Barrier);
    }
예제 #2
0
    protected override void OnTriggerEnter(Collider other)
    {
        BrokenObjectController broken = other.gameObject.GetComponent <BrokenObjectController>();

        if (broken == null)
        {
            return;
        }

        if (broken.IsLocker)
        {
            return;
        }

        broken.IsLocker = true;
        //m_particleList = broken.particleList;
        //if (m_particleList != null && m_particleList.Length != 0)
        //{
        //    PlayParticleList(m_particleList);
        //}
        if (broken.m_PropParticleStruct != null)
        {
            PlayParticleList(broken.m_PropParticleStruct);
        }

        //处理被撞物品
        broken.StartBroken(hControllerScriptCS as IParkourControllerScriptCS);
        if (broken.brokenHandleType == BrokenObjectController.BrokenHandleType.HandleType_Barrier)
        {
            //触发碰撞消息
            playerAIControler.OnEventHitBrokenObject();
            //播放碰撞语言
            SoundEffectPlayer.Play("touchbroken.wav");
            //playerSoundControler.PlayAudioSource(IParkourPlayerSound.PlayerSoundType.Type_Barrier);
        }
        else if (broken.brokenHandleType == BrokenObjectController.BrokenHandleType.HandleType_AddScore)
        {
            ////如果没有开始游戏 则不加分 跳过
            //if (!IsEnterStart)
            //{
            ////播放加分语言
            //playerSoundControler.PlayAudioSource(IParkourPlayerSound.PlayerSoundType.Type_AddScore);
            //return;
            //}
            //给玩家加分
            PlayerAddScore((int)broken.brokenValue);
            //播放加分语言
            SoundEffectPlayer.Play("touchgold.wav");
            //playerSoundControler.PlayAudioSource(IParkourPlayerSound.PlayerSoundType.Type_AddScore);
        }
    }
예제 #3
0
    //工厂 包装道具
    public void AddPropMod(BrokenObjectController Prop)
    {
        PropModStruct boc = new PropModStruct();

        for (int i = 0; i < m_propModStructItem.Length; i++)
        {
            if (Prop.brokenType == m_propModStructItem[i].m_BrokenObjectController.brokenType)
            {
                boc = m_propModStructItem[i];
                break;
            }
        }

        if (boc.m_BrokenObjectController == null)
        {
            throw new Exception("没有匹配到路面Prop");
        }

        //复制碰撞层
        Prop.gameObject.layer = boc.m_PropLayer;

        //复制物品的类型
        Prop.brokenHandleType = boc.m_BrokenObjectController.brokenHandleType;
        //复制物品的分数
        Prop.brokenValue = boc.m_BrokenObjectController.brokenValue;
        Prop.remainTime  = boc.m_BrokenObjectController.remainTime;

        //音频复制
        //Prop.AudioClipNameList = boc.m_BrokenObjectController.AudioClipNameList;

        //存放粒子特效
        Prop.m_PropParticleStruct = boc.m_PropParticleStruct;

        //Prop.particleList = new ParticleSystem[boc.m_PropParticleStruct.Length];
        //ParticleSystem ps = null;
        //for (int i = 0; i < Prop.particleList.Length; i++)
        //{
        //    GameObject psobject = GameRoot.gameResource.LoadResource_Prefabs(boc.m_PropParticleStruct[i].m_PropParticlePrefabName);
        //    Transform pstransform = psobject.transform;
        //    ps = psobject.GetComponent<ParticleSystem>();
        //    Prop.particleList[i] = ps;
        //    pstransform.parent = Prop.gameObject.transform;
        //    pstransform.localPosition = new Vector3(Vector3.zero.x, m_setParticleLocalHight, Vector3.zero.z);

        //}
    }