Commit 233ea1d7 authored by haiyoucuv's avatar haiyoucuv

init

parent accfd0ff
This diff is collapsed.
[
{
"__type__": "cc.Prefab",
"_name": "福袋",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "福袋",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 16
},
{
"__id__": 18
},
{
"__id__": 20
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "光",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
}
],
"_prefab": {
"__id__": 9
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 192,
"height": 191
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "66StAJqXFCaJ2ej3HlfBoS"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "91e706a3-2b72-4aae-9409-b4ae87570f9f@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "90C/3naUdLTpUo0dap3pqi"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"playOnLoad": true,
"_clips": [
{
"__uuid__": "e25622d3-ea85-4e16-8e94-1f1a839fbe1b",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "e25622d3-ea85-4e16-8e94-1f1a839fbe1b",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "41IFKRClFAq4STk7UDKwB9"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "64wwZ9uZZBB5gCQrFUdt98",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "图",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
},
{
"__id__": 13
}
],
"_prefab": {
"__id__": 15
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_contentSize": {
"__type__": "cc.Size",
"width": 61,
"height": 59
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5e6yk1hnhLtZvIiPTH+S/y"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "986f5ef8-b353-4dd9-90bd-ed5b536ee6a2@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "87+475Oh1E5JZyBvCWovfH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b5udWGGdZFkr37lglnfJcy",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bdBolABn1LK44IChBt7j2O"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 19
},
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_group": 4,
"_type": 2,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6cxO6EcOZGIY2Mutu8PTpJ"
},
{
"__type__": "cc.CircleCollider2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 21
},
"tag": 0,
"_group": 4,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_radius": 30,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d4nguP1hRPj6hmP9ugayLT"
},
{
"__type__": "5da8aSqHYxAvaSUEz+0fvlM",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3e5kK27VpPMblCs9d+jIA3"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "95QVeGhHxFHYdTtrbtkAQN",
"targetOverrides": null
}
]
\ No newline at end of file
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "082dafb6-e18d-4d23-bfac-18b09cac9bc4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "福袋"
}
}
...@@ -4,6 +4,7 @@ import { AIBehaviorParams } from "./AIBehaviorParams"; ...@@ -4,6 +4,7 @@ import { AIBehaviorParams } from "./AIBehaviorParams";
import { AISnake } from "../AISnake"; import { AISnake } from "../AISnake";
import { MainGame } from "../MainGame"; import { MainGame } from "../MainGame";
import { Global } from "../Global"; import { Global } from "../Global";
import { FoodManger } from "../Manager/FoodManger";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -100,7 +101,7 @@ export class AIPerception { ...@@ -100,7 +101,7 @@ export class AIPerception {
private findOptimalFood(situation: any): Vec3 | null { private findOptimalFood(situation: any): Vec3 | null {
const foods = MainGame.ins.fondManger.node.children; const foods = FoodManger.ins.node.children;
let bestFood = null; let bestFood = null;
let bestScore = -Infinity; let bestScore = -Infinity;
const myPos = this.snake.head.getPosition(); const myPos = this.snake.head.getPosition();
......
...@@ -4,6 +4,7 @@ import { DirectionType } from "./Common/Enums"; ...@@ -4,6 +4,7 @@ import { DirectionType } from "./Common/Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { MainGame } from "./MainGame"; import { MainGame } from "./MainGame";
import { aiPool } from "./Manager/CommonPool"; import { aiPool } from "./Manager/CommonPool";
import { FoodManger } from "./Manager/FoodManger";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -792,7 +793,7 @@ export class AISnake extends Snake { ...@@ -792,7 +793,7 @@ export class AISnake extends Snake {
let nearestFood = null; let nearestFood = null;
let minDistance = this.difficultyParams.viewDistance; let minDistance = this.difficultyParams.viewDistance;
const foods = MainGame.ins.fondManger.node.children; const foods = FoodManger.ins.node.children;
const boundaryBuffer = this.ESCAPE_BOUNDARY; const boundaryBuffer = this.ESCAPE_BOUNDARY;
const mapWidth = Global.MAP_WIDTH; const mapWidth = Global.MAP_WIDTH;
const mapHeight = Global.MAP_HEIGHT; const mapHeight = Global.MAP_HEIGHT;
......
...@@ -4,6 +4,7 @@ import { DirectionType } from "./Common/Enums"; ...@@ -4,6 +4,7 @@ import { DirectionType } from "./Common/Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { MainGame } from "./MainGame"; import { MainGame } from "./MainGame";
import { aiPool } from "./Manager/CommonPool"; import { aiPool } from "./Manager/CommonPool";
import { FoodManger } from "./Manager/FoodManger";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -796,7 +797,7 @@ export class AISnake extends Snake { ...@@ -796,7 +797,7 @@ export class AISnake extends Snake {
let nearestFood = null; let nearestFood = null;
let minDistance = this.difficultyParams.viewDistance; let minDistance = this.difficultyParams.viewDistance;
const foods = MainGame.ins.fondManger.node.children; const foods = FoodManger.ins.node.children;
const boundaryBuffer = this.ESCAPE_BOUNDARY; const boundaryBuffer = this.ESCAPE_BOUNDARY;
const mapWidth = Global.MAP_WIDTH; const mapWidth = Global.MAP_WIDTH;
const mapHeight = Global.MAP_HEIGHT; const mapHeight = Global.MAP_HEIGHT;
......
...@@ -8,12 +8,12 @@ export const Events = { ...@@ -8,12 +8,12 @@ export const Events = {
}; };
// 食物类型枚举 // 食物类型枚举
export enum FoodType { export enum EPropType {
FOOD = 0, // 普通食物 FOOD = 0, // 普通食物
LUCK_BAG = 1 // 福袋 LUCK_BAG = 1 // 福袋
} }
ccenum(FoodType); ccenum(EPropType);
// 移动方向枚举 // 移动方向枚举
export enum DirectionType { export enum DirectionType {
......
import { _decorator, Component, Graphics, math, misc, Node } from "cc"; import { _decorator, Component, Graphics, Label, math, misc, Node } from "cc";
const { ccclass, property, executeInEditMode } = _decorator; const { ccclass, property, executeInEditMode } = _decorator;
...@@ -8,6 +8,10 @@ export class Target extends Component { ...@@ -8,6 +8,10 @@ export class Target extends Component {
@property(Graphics) graphics: Graphics = null; @property(Graphics) graphics: Graphics = null;
@property(Label) cdTxt: Label = null;
@property(Label) goalTxt: Label = null;
start() { start() {
// this.graphics.clear(); // this.graphics.clear();
// this.graphics.moveTo(120, 0); // this.graphics.moveTo(120, 0);
...@@ -30,10 +34,7 @@ export class Target extends Component { ...@@ -30,10 +34,7 @@ export class Target extends Component {
51, 51,
]; ];
const totalLength = phases.reduce((a, b, i) => { const totalLength = phases.reduce((a, b, i) => a + b, 0);
phases[i] = a + b;
return phases[i];
}, 0);
// Tip: 注意此时phases的结果 // Tip: 注意此时phases的结果
......
...@@ -56,8 +56,6 @@ export class MainGame extends Scene { ...@@ -56,8 +56,6 @@ export class MainGame extends Scene {
@property(Player) player: Player = null; @property(Player) player: Player = null;
@property(FoodManger) fondManger: FoodManger = null;
@property(Node) animalNode: Node = null; @property(Node) animalNode: Node = null;
@property(Camera) camera: Camera = null; @property(Camera) camera: Camera = null;
...@@ -94,7 +92,7 @@ export class MainGame extends Scene { ...@@ -94,7 +92,7 @@ export class MainGame extends Scene {
}); });
// 初始化食物和NPC // 初始化食物和NPC
this.fondManger.init(this.maxFood); FoodManger.ins.init(this.maxFood);
// this.fondManger.init(2000); // this.fondManger.init(2000);
this.initAnimal(this.maxAnimal); this.initAnimal(this.maxAnimal);
// this.initAnimal(1); // this.initAnimal(1);
...@@ -118,7 +116,7 @@ export class MainGame extends Scene { ...@@ -118,7 +116,7 @@ export class MainGame extends Scene {
this.lengthTxt.string = `${length}`; this.lengthTxt.string = `${length}`;
this.killTxt.string = `${killNum}名`; this.killTxt.string = `${killNum}名`;
this.luckyNum.string = ${luckNum}`; this.luckyNum.string = ${luckNum + gameStore.startInfo?.accumulateLuckNum || 0}`;
} }
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
Prefab, Prefab,
instantiate, Vec2 instantiate, Vec2
} from "cc"; } from "cc";
import { FoodType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums"; import { EPropType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums";
import { Global } from "db://assets/Scripts/Scenes/MainGame/Global"; import { Global } from "db://assets/Scripts/Scenes/MainGame/Global";
import { executePreFrame, getItemGenerator } from "db://assets/Scripts/Utils/ExecutePreFrame"; import { executePreFrame, getItemGenerator } from "db://assets/Scripts/Utils/ExecutePreFrame";
import { Food } from "../Props/Food"; import { Food } from "../Props/Food";
...@@ -22,6 +22,11 @@ const { ccclass, property } = _decorator; ...@@ -22,6 +22,11 @@ const { ccclass, property } = _decorator;
@ccclass("FoodManger") @ccclass("FoodManger")
export class FoodManger extends Component { export class FoodManger extends Component {
private static _ins: FoodManger = null;
static get ins() {
return this._ins;
}
@property({ type: [SpriteFrame] }) @property({ type: [SpriteFrame] })
private foods: SpriteFrame[] = []; private foods: SpriteFrame[] = [];
...@@ -31,6 +36,11 @@ export class FoodManger extends Component { ...@@ -31,6 +36,11 @@ export class FoodManger extends Component {
maxFood: number = 100; maxFood: number = 100;
onLoad() { onLoad() {
FoodManger._ins = this;
}
onDestroy() {
FoodManger._ins = null;
} }
/** /**
...@@ -63,13 +73,16 @@ export class FoodManger extends Component { ...@@ -63,13 +73,16 @@ export class FoodManger extends Component {
*/ */
addFood(x?: number, y?: number, energy: number = 1) { addFood(x?: number, y?: number, energy: number = 1) {
const maxW = Global.MAP_HEIGHT / 2 - 100;
const maxH = Global.MAP_HEIGHT / 2 - 100;
// 如果没有指定位置,随机生成位置 // 如果没有指定位置,随机生成位置
if (!x) { if (!x) {
x = math.randomRangeInt(-(Global.MAP_WIDTH / 2 - 50), Global.MAP_WIDTH / 2 - 50); x = math.randomRange(-maxW, maxW);
} }
if (!y) { if (!y) {
y = math.randomRangeInt(-(Global.MAP_HEIGHT / 2 - 50), Global.MAP_HEIGHT / 2 - 50); y = math.randomRange(-maxH, maxH);
} }
const food = foodPool.get() || instantiate(this.foodPrefab); const food = foodPool.get() || instantiate(this.foodPrefab);
...@@ -87,7 +100,7 @@ export class FoodManger extends Component { ...@@ -87,7 +100,7 @@ export class FoodManger extends Component {
// 设置碰撞类型 // 设置碰撞类型
const collider = food.getComponent(Collider2D); const collider = food.getComponent(Collider2D);
if (collider) { if (collider) {
collider.tag = FoodType.FOOD; collider.tag = EPropType.FOOD;
} }
food.active = true; food.active = true;
...@@ -97,11 +110,7 @@ export class FoodManger extends Component { ...@@ -97,11 +110,7 @@ export class FoodManger extends Component {
* 初始化单个食物 * 初始化单个食物
*/ */
initItem = (_: number) => { initItem = (_: number) => {
// 随机生成位置 this.addFood();
const x = math.randomRangeInt(-(Global.MAP_WIDTH / 2 - 50), Global.MAP_WIDTH / 2 - 50);
const y = math.randomRangeInt(-(Global.MAP_HEIGHT / 2 - 50), Global.MAP_HEIGHT / 2 - 50);
this.addFood(x, y);
}; };
async initFoods(infoArr: { x: number, y: number, energy: number }[]) { async initFoods(infoArr: { x: number, y: number, energy: number }[]) {
......
...@@ -6,9 +6,9 @@ import { ...@@ -6,9 +6,9 @@ import {
Prefab, Prefab,
instantiate, instantiate,
} from "cc"; } from "cc";
import { FoodType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums"; import { EPropType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums";
import { Global } from "db://assets/Scripts/Scenes/MainGame/Global"; import { Global } from "db://assets/Scripts/Scenes/MainGame/Global";
import { executePreFrame, getItemGenerator } from "db://assets/Scripts/Utils/ExecutePreFrame"; import gameStore from "../../../store/gameStore";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -18,61 +18,55 @@ const { ccclass, property } = _decorator; ...@@ -18,61 +18,55 @@ const { ccclass, property } = _decorator;
@ccclass("LuckyBagManager") @ccclass("LuckyBagManager")
export class LuckyBagManager extends Component { export class LuckyBagManager extends Component {
@property(Prefab) private static _ins: LuckyBagManager = null;
fuDaiPrefab: Prefab = null; static get ins() {
return this._ins;
}
maxFood: number = 5; @property(Prefab)
luckyBagPrefab: Prefab = null;
onLoad() { onLoad() {
LuckyBagManager._ins = this;
} }
/** onDestroy() {
* 初始化食物 LuckyBagManager._ins = null;
*/
async init(maxFood: number = 100) {
this.maxFood = maxFood;
await executePreFrame(getItemGenerator(maxFood, this.initItem), 1, this);
} }
/** start() {
* 设置食物 this.flushItems();
*/ }
add(x?: number, y?: number) {
// 如果没有指定位置,随机生成位置 flushItems() {
if (!x) { const { luckNum } = gameStore.gameInfo || {};
x = math.randomRangeInt(-(Global.MAP_WIDTH / 2 - 50), Global.MAP_WIDTH / 2 - 50); const { currentAcquireNum } = gameStore.startInfo || {};
}
if (!y) { const flushNum = Math.min(currentAcquireNum - luckNum, 3);
y = math.randomRangeInt(-(Global.MAP_HEIGHT / 2 - 50), Global.MAP_HEIGHT / 2 - 50);
}
const food = instantiate(this.fuDaiPrefab); this.add(flushNum);
}
// 设置食物属性 add(num: number = 1) {
food.setPosition(x, y);
this.node.addChild(food);
// 设置碰撞类型 const maxW = Global.MAP_HEIGHT / 2 - 100;
const collider = food.getComponent(Collider2D); const maxH = (Global.MAP_HEIGHT / 2 - 100);
if (collider) {
collider.tag = FoodType.LUCK_BAG;
}
food.active = true; for (let i = 1; i <= num; i++) {
} const x = math.randomRange(-maxW, maxW);
const y = math.randomRange(-maxH, maxH);
const node = instantiate(this.luckyBagPrefab);
/** // 设置食物属性
* 初始化单个食物 node.setPosition(x, y);
*/ this.node.addChild(node);
initItem = (_: number) => {
// 随机生成位置
const x = math.randomRangeInt(-(Global.MAP_WIDTH / 2 - 50), Global.MAP_WIDTH / 2 - 50);
const y = math.randomRangeInt(-(Global.MAP_HEIGHT / 2 - 50), Global.MAP_HEIGHT / 2 - 50);
this.add(x, y); // 设置碰撞类型
}; const collider = node.getComponent(Collider2D);
if (collider) {
collider.tag = EPropType.LUCK_BAG;
}
}
}
} }
import { _decorator } from "cc"; import { _decorator } from "cc";
import { propPool } from "../Manager/CommonPool";
import { PropBase } from "./PropBase"; import { PropBase } from "./PropBase";
import { Snake } from "../Snake"; import { Snake } from "../Snake";
...@@ -14,7 +13,8 @@ export class LuckyBag extends PropBase { ...@@ -14,7 +13,8 @@ export class LuckyBag extends PropBase {
recycle() { recycle() {
this.node.removeFromParent(); this.node.removeFromParent();
propPool.put(this.node); this.node.destroy();
// propPool.put(this.node);
} }
} }
\ No newline at end of file
...@@ -15,9 +15,9 @@ import { ...@@ -15,9 +15,9 @@ import {
} from "cc"; } from "cc";
import { Global } from "./Global"; import { Global } from "./Global";
import { isIntersect, loadSkin } from "./utils/uitl"; import { isIntersect, loadSkin } from "./utils/uitl";
import { MainGame } from "./MainGame";
import { bodyPool } from "./Manager/CommonPool"; import { bodyPool } from "./Manager/CommonPool";
import { PropBase } from "./Props/PropBase"; import { PropBase } from "./Props/PropBase";
import { FoodManger } from "./Manager/FoodManger";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -382,7 +382,7 @@ export class Snake extends Component { ...@@ -382,7 +382,7 @@ export class Snake extends Component {
}; };
}); });
MainGame.ins.fondManger.initFoods(foodArr); FoodManger.ins.initFoods(foodArr);
} }
protected getNewPos(angle: number, dt: number, currentPos: Vec3, speed: number = this.speed): Vec3 { protected getNewPos(angle: number, dt: number, currentPos: Vec3, speed: number = this.speed): Vec3 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment