Beispiel #1
0
    //Surprise爆炸
    void SurpriseExplode()
    {
        //在Surpise的周围,产生4枚爆炸效果
        BlockDisappearPool.GetBlockDisappearParticle(transform.position + Vector3.up);
        BlockDisappearPool.GetBlockDisappearParticle(transform.position + Vector3.down);
        BlockDisappearPool.GetBlockDisappearParticle(transform.position + 1.5F * Vector3.left);
        BlockDisappearPool.GetBlockDisappearParticle(transform.position + 1.5F * Vector3.right);

        //播放礼花爆炸音效
        MyClass.AudioPlay(GameObject.Find("SoundPlayer").GetComponent <AudioSource>(),
                          Resources.Load <AudioClip>("Audio/Pop" + Random.Range(0, 4)),
                          MyClass.soundEnable);
    }
Beispiel #2
0
    //方法,棋盘方块消失
    public void ChessBlockDisappear()
    {
        //如果方块类型[0,10]
        if (typeIndex <= 10)
        {
            //在该棋盘的位置处产生一枚爆炸粒子效果
            BlockDisappearPool.GetBlockDisappearParticle(transform.position);

            //播放方块爆炸音效
            MyClass.AudioPlay(GameObject.Find("SoundPlayer").GetComponent <AudioSource>(),
                              Resources.Load <AudioClip>("Audio/BlockBroken"),
                              MyClass.soundEnable);

            //对应的棋盘数组为空
            GameController.Instance.chessBlockArray[rowIndex, columnIndex] = null;

            //该棋盘方块禁用
            gameObject.SetActive(false);
        }

        //如果方块类型11或16
        if (typeIndex == 11 || typeIndex == 16)
        {
            //对应的棋盘数组为空
            GameController.Instance.chessBlockArray[rowIndex, columnIndex] = null;

            //该棋盘方块禁用
            gameObject.SetActive(false);
        }

        //如果方块类型[12,15]
        if (typeIndex >= 12 && typeIndex <= 15)
        {
            //对应的棋盘数组为空
            GameController.Instance.chessBlockArray[rowIndex, columnIndex] = null;

            //播放离场动画
            GetComponent <Animator>().SetTrigger("ChessBlockDisappear");
        }
    }