コード例 #1
0
    /// <summary>
    /// 合并成功处理
    /// </summary>
    public void mergeDeal(float mergeAnimDuration)
    {
        transform.DOScale(new Vector3(1, 1, 1), mergeAnimDuration).OnComplete
            (delegate()
        {
            if (gameObject.GetComponent <CompositeCollider2D>() == null)
            {
                CompositeCollider2D collider2D = gameObject.AddComponent <CompositeCollider2D>();
                collider2D.geometryType        = CompositeCollider2D.GeometryType.Polygons;
                collider2D.generationType      = CompositeCollider2D.GenerationType.Synchronous;
            }

            //合并特效
            if (gameParticleControl != null)
            {
                //gameParticleControl.playMergeParticle(transform);
            }
            //摇晃镜头
            shakeCamer();
            SoundUtil.playSoundClipForMerge();
            //让缸体恢复移动
            Rigidbody2D thisRB = transform.GetComponent <Rigidbody2D>();
            if (thisRB != null)
            {
                thisRB.constraints = RigidbodyConstraints2D.None;
            }
            CommonData.IsDargMove = true;
            //检测是否完成游戏
            checkFinshGame();
        }
            );
    }