Exemple #1
0
 /// <summary>
 /// 生成方块
 /// </summary>
 /// <returns></returns>
 private BlockEntity SpawnBlock(BlockData data)
 {
     currentBlock = EntityModule.Instance.SpawnEntity <BlockEntity>(IdContract.PREFAB_BLOCK); //获取预设体
     currentBlock.SetData(data);                                                              //设置数据
     currentBlock.transform.position = genaratePosition;
     //方块监听控制器事件
     callBlockChangeShape       += currentBlock.OnChangeShape;
     callBlockDownMove          += currentBlock.OnDownMove;
     callBlockDrop              += currentBlock.OnDrop;
     callBlockLeftMove          += currentBlock.OnLeftMove;
     callBlockRightMove         += currentBlock.OnRightMove;
     currentBlock.onChangeShape += OnBlockChangeShape;
     currentBlock.onDownMove    += OnBlockDown;
     currentBlock.onDrop        += OnBlockDrop;
     currentBlock.onLeftMove    += OnBlockLeft;
     currentBlock.onRightMove   += OnBlockRight;
     return(currentBlock);
 }