GameNode.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. import { _decorator, geometry, Node, Camera, view, EventTouch, Prefab, instantiate, v3, tween, RigidBody, MeshRenderer, Vec3, find, input, Input, Tween, PhysicsSystem, physics, PhysicsSystem2D, EPhysics2DDrawFlags, director } from 'cc';
  2. import { ComponentEx } from '../../core/component/ComponentEx';
  3. import Utils from '../../core/utils/Utils';
  4. import { TileItem } from './TileItem';
  5. import GameConst, { ITEM_TYPE } from '../../core/common/GameConst';
  6. import WindowManager from '../../core/manager/WindowManager';
  7. import { DrawStarLayer } from './gameui/DrawStarLayer';
  8. import GameEvent from '../../core/event/GameEvent';
  9. import MsgHints from '../../core/utils/MsgHints';
  10. import Data from '../../core/manager/Data';
  11. import BusyLoadingManager, { BUSY_TYPE } from '../../core/manager/BusyLoadingManager';
  12. import { Main } from './Main';
  13. import levelsData from 'db://assets/data/levelsData';
  14. import platformSystem from 'db://assets/platform/platformSystem';
  15. import { constants } from 'db://assets/data/constants';
  16. import audioManager from 'db://assets/manager/audioManager';
  17. import { utils } from 'db://assets/data/utils';
  18. const { Ray } = geometry;
  19. const { ccclass, property, executeInEditMode } = _decorator;
  20. @ccclass('GameNode')
  21. export class GameNode extends ComponentEx {
  22. @property({type: Node,tooltip:"底部的盘子"})
  23. public plate: Node = null;
  24. public collectpos: Vec3[] = [];
  25. public collectTiles: Node[] = [];
  26. public allTiles: Node[] = [];
  27. public optionTiles: Node[] = [];
  28. public start() {
  29. setTimeout(() => {
  30. this.initWall();
  31. this.collectpos = [];
  32. this.GetNode("collectbox").children.map(a => {
  33. this.collectpos.push(a.worldPosition);
  34. a.active = false;
  35. })
  36. }, 100);
  37. GameEvent.Instance().register(this, GameConst.CLEAR_ALL_BOX, () => {
  38. console.log("清空盒子")
  39. this.lock=false
  40. setTimeout(() => {
  41. for (let i = 0; i < this.collectTiles.length; ++i) {
  42. this.pushBask(this.collectTiles[i].name);
  43. }
  44. this.collectTiles.map(a => {
  45. a.destroy();
  46. })
  47. this.collectTiles = [];
  48. }, 500);
  49. })
  50. //提示
  51. GameEvent.Instance().register(this, GameConst.USE_ITEM_HINT,this.prompt.bind(this))
  52. }
  53. onEnable() {
  54. input.on(Input.EventType.TOUCH_START, this.onTouchStart, this);
  55. input.on(Input.EventType.TOUCH_END, this.onTouchEnd, this);
  56. input.on(Input.EventType.TOUCH_MOVE, this.onTouchMove, this);
  57. }
  58. onDisable() {
  59. input.off(Input.EventType.TOUCH_START, this.onTouchStart, this);
  60. input.off(Input.EventType.TOUCH_END, this.onTouchEnd, this);
  61. input.off(Input.EventType.TOUCH_MOVE, this.onTouchMove, this);
  62. }
  63. moveToRightPos() {
  64. //移动到正确位置
  65. this.collectTiles.map((a, i) => {
  66. let tileItem = a.getComponent(TileItem)
  67. Tween.stopAllByTarget(a)
  68. tween(a).to(0.3, { worldPosition: this.collectpos[i].clone(), worldScale: v3(1, 1, 1) }).call(() => {
  69. tileItem.auto_rotation = true;
  70. if (tileItem.removed) {
  71. utils.remove(this.optionTiles,a);
  72. tween(a).to(0.25, { worldPosition: tileItem.removedPos }, { easing: 'backIn' }).call(async () => {
  73. //最中央的播放移除特效
  74. if (tileItem.playRmovedEff) {
  75. //增加星星
  76. let pos = this.GetNode("Main Camera").getComponent(Camera).convertToUINode(a.worldPosition, find("Canvas"));
  77. let node_ani = await Utils.playSkAni("effect_hecheng", "effect", find("Canvas"), pos);
  78. audioManager.playOneShot(constants.audios.starCollect);
  79. platformSystem.platform.vibrateShort();
  80. Utils.flyAnim(ITEM_TYPE.Star, node_ani, Main.Instance()._GameUI.starNode, 1, 0, (b) => {
  81. if (b) {
  82. node_ani.destroy();
  83. Main.Instance()._GameUI.star++;
  84. }
  85. });
  86. }
  87. a.destroy()
  88. this.moveToRightPos()
  89. this.checkResult()
  90. }).start()
  91. }
  92. }).start();
  93. })
  94. }
  95. chooseTile(tile: Node) {
  96. let chooseName = tile.name;
  97. this.optionTiles.push(tile);
  98. //删除点击对象从列表
  99. tile.getComponent(TileItem).destoryCollider()
  100. for (var i = 0; i < this.allTiles.length; ++i) {
  101. if (this.allTiles[i] == tile) {
  102. this.allTiles.splice(i, 1);
  103. break;
  104. }
  105. }
  106. //插入
  107. let bInsert = false;
  108. for (var i = this.collectTiles.length - 1; i >= 0; --i) {
  109. if (this.collectTiles[i].name == chooseName) {
  110. this.collectTiles.splice(i + 1, 0, tile);
  111. bInsert = true;
  112. break;
  113. }
  114. }
  115. if (!bInsert) {
  116. this.collectTiles.push(tile);
  117. }
  118. this.moveToRightPos()
  119. //检测要删除的
  120. let tmp = this.collectTiles.filter(a => {
  121. return a.name == chooseName;
  122. })
  123. if (tmp.length == 3) {
  124. for (var i = this.collectTiles.length - 1; i >= 0; --i) {
  125. if (this.collectTiles[i].name == chooseName) {
  126. let delNode = this.collectTiles[i];
  127. delNode.getComponent(TileItem).removed = true
  128. this.collectTiles.splice(i, 1);
  129. delNode.getComponent(TileItem).removedPos = tmp[1].worldPosition
  130. if (delNode == tmp[1])
  131. delNode.getComponent(TileItem).playRmovedEff = true
  132. }
  133. }
  134. }
  135. this.checkResult()
  136. }
  137. lock=false
  138. checkResult() {
  139. if(this.lock)return
  140. //检测胜利和失败
  141. if (this.collectTiles.length >= 7) {
  142. this.lock=true
  143. if (!WindowManager.ins.isShow("OutOfBoxLayer"))
  144. WindowManager.ins.open("OutOfBoxLayer");
  145. } else if (this.collectTiles.length == 0 && this.allTiles.length == 0) {
  146. this.lock=true
  147. WindowManager.ins.open("DrawStarLayer").then((com: DrawStarLayer) => {
  148. com.setStar(Main.Instance()._GameUI.star);
  149. })
  150. }
  151. }
  152. private touchTileItem: TileItem = null;
  153. onTouchStart(event: EventTouch) {
  154. if (Main.Instance()._GameUI.pasue) return;
  155. if (Data.user.useMagnet) return;
  156. if (this.allTiles.length == 0) return;
  157. if (this.collectTiles.length >= 7) {
  158. return;
  159. }
  160. const p = event.getLocation();
  161. let camera = this.GetNode("Main Camera").getComponent(Camera);
  162. const r = new Ray();
  163. camera?.screenPointToRay(p.x, p.y, r);
  164. let b = PhysicsSystem.instance.raycastClosest(r, 1)
  165. if (b) {
  166. let collider = PhysicsSystem.instance.raycastClosestResult.collider;
  167. console.log(collider.node.name, collider.getComponent(RigidBody).group);
  168. let item = collider.node.parent.getComponent(TileItem);
  169. if (item) {
  170. item.enableCollider = false;
  171. let pos = item.node.getWorldPosition();
  172. pos.y += 0.3;
  173. item.node.setWorldPosition(pos);
  174. this.touchTileItem = item;
  175. }
  176. }
  177. }
  178. onTouchEnd(event: EventTouch) {
  179. if (Main.Instance()._GameUI.pasue) return;
  180. if (Data.user.useMagnet) return;
  181. if (!this.touchTileItem) return;
  182. if (this.allTiles.length == 0) return;
  183. if (this.collectTiles.length >= 7) {
  184. return;
  185. }
  186. const p = event.getLocation();
  187. let camera = this.GetNode("Main Camera").getComponent(Camera);
  188. const r = new Ray();
  189. camera?.screenPointToRay(p.x, p.y, r);
  190. let b = PhysicsSystem.instance.raycastClosest(r, 1);
  191. if (b) {
  192. let collider = PhysicsSystem.instance.raycastClosestResult.collider;
  193. let item = collider.node.parent.getComponent(TileItem);
  194. if (item && item == this.touchTileItem) {
  195. platformSystem.platform.vibrateShort();
  196. this.chooseTile(item.node);
  197. this.touchTileItem = null;
  198. audioManager.playOneShot(constants.audios.tap);
  199. }else {
  200. this.touchTileItem.enableCollider = true;
  201. }
  202. }
  203. }
  204. onTouchMove(event: EventTouch) {
  205. if (Main.Instance()._GameUI.pasue) return;
  206. if (Data.user.useMagnet) return;
  207. if (this.allTiles.length == 0) return;
  208. if (this.collectTiles.length >= 7) {
  209. return;
  210. }
  211. const p = event.getLocation();
  212. let camera = this.GetNode("Main Camera").getComponent(Camera);
  213. const r = new Ray();
  214. camera?.screenPointToRay(p.x, p.y, r);
  215. let b = PhysicsSystem.instance.raycastClosest(r, 1)
  216. if (b) {
  217. let collider = PhysicsSystem.instance.raycastClosestResult.collider
  218. let item = collider.node.parent.getComponent(TileItem);
  219. if (item) {
  220. if (this.touchTileItem && item == this.touchTileItem) {
  221. }else {
  222. if (this.touchTileItem) this.touchTileItem.enableCollider = true;
  223. item.enableCollider = false;
  224. let pos = item.node.getWorldPosition();
  225. pos.y += 0.3;
  226. // console.log("切换")
  227. item.node.setWorldPosition(pos);
  228. this.touchTileItem = item;
  229. }
  230. }
  231. else {
  232. if (this.touchTileItem) {
  233. // console.log("无目标")
  234. this.touchTileItem.enableCollider = true;
  235. this.touchTileItem = null;
  236. }
  237. }
  238. }
  239. }
  240. initWall() {
  241. if (!PhysicsSystem.instance) return;
  242. const OFFSET = 25;
  243. let camera = this.GetNode("Main Camera").getComponent(Camera);
  244. const r = new Ray();
  245. let size = view.getCanvasSize();
  246. //左边墙
  247. camera?.screenPointToRay(OFFSET, size.height / 2, r);
  248. if (PhysicsSystem.instance.raycastClosest(r)) {
  249. const result = PhysicsSystem.instance.raycastClosestResult;
  250. this.GetNode("PlaneLeft").setWorldPosition(result.hitPoint);
  251. }
  252. //右边墙
  253. camera?.screenPointToRay(size.width - OFFSET, size.height / 2, r);
  254. if (PhysicsSystem.instance.raycastClosest(r)) {
  255. const result = PhysicsSystem.instance.raycastClosestResult;
  256. this.GetNode("PlaneRight").setWorldPosition(result.hitPoint);
  257. }
  258. //上边墙
  259. camera?.screenPointToRay(size.width / 2, size.height - OFFSET * 4, r);
  260. if (PhysicsSystem.instance.raycastClosest(r)) {
  261. const result = PhysicsSystem.instance.raycastClosestResult;
  262. this.GetNode("PlaneTop").setWorldPosition(result.hitPoint);
  263. }
  264. let minx = this.GetNode("PlaneLeft").worldPosition.x;
  265. let maxx = this.GetNode("PlaneRight").worldPosition.x;
  266. let scale = (maxx - minx) / 8.461091041564941;
  267. this.GetNode("bottom").scale = v3(scale, scale, scale);
  268. //格子位置
  269. camera?.screenPointToRay(size.width / 2, 10, r);
  270. if (PhysicsSystem.instance.raycastClosest(r)) {
  271. const result = PhysicsSystem.instance.raycastClosestResult;
  272. //result.hitPoint
  273. let p: Vec3 = new Vec3(result.hitPoint.x,4,result.hitPoint.z);
  274. this.GetNode("bottom").setWorldPosition(p);
  275. }
  276. //下边墙
  277. this.GetNode("PlaneDown").setWorldPosition(this.GetNode("bottom").worldPosition.add3f(0, 0, -2.5 * scale));
  278. }
  279. async createTiles() {
  280. let Margin = 0
  281. let minx = this.GetNode("PlaneLeft").worldPosition.x + Margin;
  282. let maxx = this.GetNode("PlaneRight").worldPosition.x - Margin;
  283. let maxz = this.GetNode("PlaneDown").worldPosition.z + Margin;
  284. let minz = this.GetNode("PlaneTop").worldPosition.z - Margin;
  285. let obj = levelsData.getCurLevelInfo();
  286. //数量
  287. let tileCount = Math.floor(obj.count / 3);
  288. // if (Data.user.lv == 1) tileCount = 2;
  289. // tiles = Utils.shuffle(tiles);
  290. let tilepools = [];// 30 /2 = 15
  291. let count1 = Math.floor(tileCount / 2);
  292. let count2 = tileCount - count1;
  293. //1从解锁池选一半
  294. let OpenItems:Array<string> = levelsData.getDeblockDatas();
  295. for (let i = Data.user.openIndex - 1; i >= 0; --i) {
  296. tilepools.push(OpenItems[i]);
  297. count1--;
  298. if (count1 == 0) {
  299. break;
  300. }
  301. }
  302. console.log("解锁取", tileCount - (count2 + count1), "标准取", tileCount - (tileCount - (count2 + count1)))
  303. //2从标准池选一半
  304. let ItemNames:Array<string> = levelsData.getNormModelDatas();
  305. for(let k = count2 + count1 - 1; k >= 0; --k) {
  306. tilepools.push(ItemNames[k]);
  307. }
  308. tilepools = Utils.shuffle(tilepools);
  309. Main.Instance()._GameUI.pasue = true;
  310. BusyLoadingManager.ins.addBusy(BUSY_TYPE.RES);
  311. for (let i = 0; i < tileCount; i++) {
  312. let ret = await levelsData.LoadItemPrefabByName(tilepools[i]) as Prefab;
  313. if (!ret) continue;
  314. //获取节点下的 MeshRenderer 组件 设置阴影投射模式
  315. (ret.data.getComponentInChildren(MeshRenderer) as MeshRenderer).shadowCastingMode = MeshRenderer.ShadowCastingMode.ON;
  316. for (let j = 0; j < 3; j++) {
  317. const globalIndex = (i * 3 + j) % 9;
  318. let lnode = this.GetNode(`l${globalIndex}`);
  319. tween(this.node).delay(j * 0.03).call(() => {
  320. let nomal_node: Node = instantiate(ret);
  321. nomal_node.name = ret.name;
  322. let tile = nomal_node.addComponent(TileItem);
  323. let rigid = tile.addCollider();
  324. nomal_node.scale = v3(1.25, 1.25, 1.25)
  325. if (Data.user.lv == 1) {
  326. nomal_node.setWorldPosition(lnode.getWorldPosition());
  327. nomal_node.parent = this.node;
  328. this.allTiles.push(nomal_node);
  329. }else{
  330. let p = v3(Utils.getRandomInt(minx / 2, maxx / 2), Utils.getRandom(12, 15), Utils.getRandomInt(minz / 2, maxz / 2));
  331. nomal_node.setWorldRotationFromEuler(Utils.getRandom(0, 300), Utils.getRandom(0, 300), Utils.getRandom(0, 300))
  332. nomal_node.setWorldPosition(p);
  333. nomal_node.parent = this.node;
  334. rigid.applyImpulse(v3(0, 3, 0))
  335. this.allTiles.push(nomal_node);
  336. }
  337. }).start()
  338. }
  339. if (i == tileCount - 1) {
  340. BusyLoadingManager.ins.removeBusy(BUSY_TYPE.RES);
  341. Main.Instance()._GameUI.pasue = false;
  342. }
  343. }
  344. setTimeout(() => {
  345. if (Data.user.useMagnet) {
  346. Main.Instance()._GameUI.pasue = true;
  347. Data.user.magnet--;
  348. let p = this.GetNode("magnet").worldPosition;
  349. this.GetNode("magnet").worldPosition = v3(-10, p.y, p.z);
  350. tween(this.GetNode("magnet")).to(0.5, { worldPosition: v3(0, p.y, p.z) }).call(async () => {
  351. let arr = [];
  352. for (var i = this.allTiles.length - 1; i >= 0; --i) {
  353. let pick = false;
  354. let item = this.allTiles[i];
  355. let tmp: Node = arr[0];
  356. if(tmp){
  357. if (tmp.name == item.name && arr.length < 3) {
  358. arr.push(item);
  359. pick = true;
  360. }
  361. }else{
  362. arr.push(item);
  363. pick = true;
  364. }
  365. if(pick) {
  366. let tile: TileItem = this.allTiles[i].getComponent(TileItem);
  367. tile.destoryCollider();
  368. this.GetNode("magnet_content").addChild(tile.node);
  369. tween(tile.node).to(0.5, { worldPosition: this.GetNode(arr.length % 2 ? "m_left" : "r_left").worldPosition }).start();
  370. this.allTiles.splice(i, 1);
  371. console.log("删除", tile.name, this.allTiles.length)
  372. }
  373. }
  374. Data.user.useMagnet = false;
  375. }).delay(1.5).to(0.5, { worldPosition: v3(10, p.y, p.z) }).call(() => {
  376. this.GetNode("magnet_content").removeAllChildren();
  377. Main.Instance()._GameUI.pasue = false;
  378. if (Data.user.useTime && Data.user.time > 0)
  379. GameEvent.Instance().dispatch(GameConst.USE_ITEM_TIME)
  380. }).start();
  381. }else {
  382. if (Data.user.useTime && Data.user.time > 0){
  383. GameEvent.Instance().dispatch(GameConst.USE_ITEM_TIME)}
  384. }
  385. }, 2000);
  386. }
  387. /**
  388. * 提示
  389. */
  390. restart() {
  391. this.allTiles.map(a => a.destroy());
  392. this.allTiles = [];
  393. Main.Instance()._GameUI.star = 0;
  394. this.collectTiles.map(a => a.destroy());
  395. this.collectTiles = [];
  396. this.createTiles();
  397. this.lock=false
  398. }
  399. /**移除*/
  400. public remove(){
  401. if (this.optionTiles.length === 0 || this.lock) return;
  402. // 获取最后一个收集的物品
  403. const lastItem = this.optionTiles.pop();
  404. if (!lastItem) return;
  405. utils.remove(this.collectTiles,lastItem);
  406. const tile = lastItem.getComponent(TileItem);
  407. tile.removed = false;
  408. tile.auto_rotation = false;
  409. //播放撤销动画
  410. Tween.stopAllByTarget(lastItem);
  411. //const globalIndex = Math.floor(Math.random() * 9);
  412. let lnode = this.GetNode(`l${4}`);
  413. let p:Vec3 = lnode.position.clone();
  414. tween(tile.node)
  415. .to(0.35, {
  416. worldPosition: new Vec3(p.x,p.y + 1,p.z),
  417. worldScale: v3(1.25, 1.25, 1.25)
  418. })
  419. .call(() => {
  420. tile.addCollider();
  421. tile.enableCollider = true;
  422. this.allTiles.push(lastItem);
  423. //向上施加力 然后在向下重力效果
  424. tile.rigid.applyImpulse(v3(0, 3, 0))
  425. this.moveToRightPos(); // 重新排列收集框中的物品
  426. })
  427. .start();
  428. }
  429. /**乱序*/
  430. public mess(){
  431. if(this.allTiles.length === 0 || this.lock) return;
  432. this.allTiles.forEach((item, index) => {
  433. const tileItem = item.getComponent(TileItem);
  434. tileItem.auto_rotation = false;
  435. tileItem.enableCollider = true;
  436. Tween.stopAllByTarget(item);
  437. tween(item)
  438. .to(0.3, {
  439. worldPosition: this.GetNode("l4").worldPosition.clone().add(v3(0, 1, 0)),
  440. worldScale: v3(1.25, 1.25, 1.25)
  441. })
  442. .call(() => {
  443. const rigid = tileItem.addCollider();
  444. rigid.applyImpulse(v3(
  445. Utils.getRandom(-3, 3),
  446. Utils.getRandom(5, 8),
  447. Utils.getRandom(-3, 3)
  448. ));
  449. item.setWorldRotationFromEuler(Utils.getRandom(0, 300), Utils.getRandom(0, 300), Utils.getRandom(0, 300))
  450. })
  451. .start();
  452. });
  453. //audioManager.playOneShot(constants.audios.shuffle);
  454. platformSystem.platform.vibrateShort();
  455. }
  456. /**凑齐*/
  457. public prompt(){
  458. if(this.collectTiles.length <= 0)return;
  459. let obj = {}
  460. for (var i = 0; i < this.collectTiles.length; ++i) {
  461. let name = this.collectTiles[i].name;
  462. if (!obj[name]) obj[name] = 0;
  463. obj[name]++;
  464. }
  465. let hint_succ = false;
  466. let bFind = false;
  467. let hint_name = ""
  468. for (const key in obj) {
  469. if (obj[key] == 2) {
  470. hint_name = key;
  471. bFind = true;
  472. break;
  473. }
  474. }
  475. //找到两个一样
  476. if (bFind) {
  477. console.log("找到两个一样")
  478. for (let i = 0; i < this.allTiles.length; ++i) {
  479. if (this.allTiles[i].name == hint_name) {
  480. this.chooseTile(this.allTiles[i]);
  481. break;
  482. }
  483. }
  484. hint_succ = true;
  485. }else {
  486. if (this.collectTiles.length >= 5) {
  487. MsgHints.show("未找到合适物品");
  488. return
  489. }else {
  490. hint_name = this.collectTiles[0] ? this.collectTiles[0].name : this.allTiles[0].name;
  491. let lsit = this.allTiles.filter(a => {
  492. return a.name == hint_name;
  493. })
  494. lsit.map((a, i) => {
  495. setTimeout(() => {
  496. this.chooseTile(a);
  497. }, 350 * i);
  498. })
  499. hint_succ = true;
  500. }
  501. }
  502. if (hint_succ) {
  503. Data.user.hint--;
  504. }
  505. }
  506. //放回场景中
  507. async pushBask(name: string) {
  508. let Margin = 0;
  509. let maxz = this.GetNode("PlaneDown").worldPosition.z + Margin;
  510. let minz = this.GetNode("PlaneTop").worldPosition.z - Margin;
  511. let minx = this.GetNode("PlaneLeft").worldPosition.x + Margin;
  512. let maxx = this.GetNode("PlaneRight").worldPosition.x - Margin;
  513. let ret = await levelsData.LoadItemPrefabByName(name) as Prefab;
  514. let nomal_node: Node = instantiate(ret);
  515. nomal_node.name = name;
  516. let tile = nomal_node.addComponent(TileItem);
  517. let rigid = tile.addCollider();
  518. nomal_node.scale = v3(1.25,1.25, 1.25)
  519. nomal_node.parent = this.node;
  520. rigid.applyImpulse(v3(0, 3, 0))
  521. let p = v3(minx + (maxx - minx) / 2, Utils.getRandom(12, 15), minz + (maxz - minz) / 2);
  522. nomal_node.setWorldRotationFromEuler(Utils.getRandom(0, 300), Utils.getRandom(0, 300), Utils.getRandom(0, 300))
  523. nomal_node.setWorldPosition(p);
  524. this.allTiles.push(nomal_node);
  525. }
  526. }