demo下载:(待审核)
https://download.csdn.net/download/K86338236/89527924
const {
ccclass, property } = cc._decorator;
const enum box_color {
NORMAL = 0,
DASHED_LINE = 1,//虚线
TRANSLUCENT = 2,//半透明
}
@ccclass
export default class main extends cc.Component {
@property(cc.Node)
boxNode: cc.Node = null;
@property(cc.Node)
layerNode: cc.Node = null;
/**层的父节点 */
@property(cc.Node)
layerRootNode: cc.Node = null;
/**点击检测射线 */
@property(cc.Node)
touchNode: cc.Node = null;
/**普通的颜色 */
@property([cc.Material])
changeMat: cc.Material[] = [];
/**普通颜色第二层,半透明用 */
@property([cc.Material])
changeMat2: cc.Material[] = [];
/**选择状态的颜色 */
@property([cc.Material])
changeMatChoose: cc.Material[] = [];
@property([cc.Material])
changeMatChoose2: cc.Material[] = [];
/**向左旋转45 */
@property(cc.Button)
leftBtn: cc.Button = null;
/**向右旋转45 */
@property(cc.Button)
rightBtn: cc.Button = null;
/**分离、合起 */
@property(cc.Button)
divideBtn: cc.Button = null;
/**已经修改颜色uid物体 */
changeUids: string[] = [];
/**当前分离状态,是否分离 */
curDivideState: boolean = false;
/**当前角度 */
curAngle: number = 0;
/**是否动作中 */
isPlay: boolean = false;
/**当前角度 */
choose_type: number = 0;
// onLoad () {}
start() {
this.setAngle(-15)
cc.director.getPhysics3DManager().enabled = true;
this.touchNode.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
let boxArr = ["1,1|1,2|1,3|2,1|2,2|3,1",