コード例 #1
0
    private void DestroyItem()
    {
        if (gameController.targetTrans == transform)
        {
            gameController.HideSignal();
        }
        gameController.PlayAudioEffect("NormalMordel/Item");
        // 生成金币奖励
        GameObject coin = gameController.GetItem("CoinCanvas");

        coin.transform.Find("Img_Coin").GetComponent <CoinMove>().prize = price;
        coin.transform.Find("Img_Coin").GetComponent <CoinMove>().ShowCoin();
        coin.transform.SetParent(gameController.transform);
        coin.transform.position = transform.position;
        // 增加玩家金币
        gameController.ChangeCoinNum(price);
        gameController.clearItemNum++;
        // 生成销毁特效
        GameObject effect = gameController.GetItem("DestroyEffect");

        effect.transform.SetParent(gameController.transform);
        effect.transform.position = transform.position;
        // 将销毁的道具放回对象池
        gameController.PushItem(gameController.currentStage.bigLevelID + "/Item/" + itemID, gameObject);
        InitItem();
        gridPoint.InitGridState();
    }