Commit b19eaa83 authored by haiyoucuv's avatar haiyoucuv

init

parent 2f6dd977
[
{
"__type__": "cc.Prefab",
"_name": "Animal",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "Animal",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 14
}
],
"_prefab": {
"__id__": 16
},
"_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": "Head",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 9
}
],
"_prefab": {
"__id__": 11
},
"_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": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6dzIL3W1E35IuXoCRFfNn"
},
{
"__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": null,
"_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": "6dl3c1yPVOYZx1iJKGtVyl"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_group": 8,
"_type": 1,
"_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": "36f4FDJJ1Ic7xJG62kgK2v"
},
{
"__type__": "cc.CircleCollider2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"tag": 0,
"_group": 8,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_radius": 20,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "149tzpkANOXpG57LmH6BS4"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "d4RvWudWVDfpQR1dJZBQWA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "12X03M90FPb4tU4xz9R77a"
},
{
"__type__": "07e2fsEmydEsKZ4PtdOb7Lo",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"Head": {
"__id__": 2
},
"bodyPrefab": {
"__uuid__": "8c4f22c7-20c7-4868-88ea-dedb8004999f",
"__expectedType__": "cc.Prefab"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "51cV3MWXxJKYM+pvgsWjZH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1fLq1Ehg5BTYIbo7cQ9ZXL",
"instance": null,
"targetOverrides": null
}
]
\ No newline at end of file
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "37f1dd8d-17a4-406d-9382-91b0969cf75d",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "Animal"
}
}
import { _decorator, math, v3, Vec3, Node } from "cc";
import { _decorator, math, v3, Vec3, Node, Collider2D, Contact2DType, PhysicsGroup } from "cc";
import { Snake } from "./Snake";
import { DirectionType } from "./Enums";
import { DirectionType } from "./Common/Enums";
import { Global } from "./Global";
import { MainGame } from "./MainGame";
......@@ -41,6 +41,23 @@ export class AISnake extends Snake {
private assistTarget: AISnake = null; // 正在协助的AI蛇
onEnable() {
super.onEnable();
const eye = this.head.getChildByName("范围").getComponent(Collider2D);
eye.on(Contact2DType.BEGIN_CONTACT, this.onBeginEye, this);
}
onBeginEye(selfCollider: Collider2D, otherCollider: Collider2D){
super.onBeginEye(selfCollider, otherCollider);
if (otherCollider.group === PhysicsGroup["Body"] && otherCollider.tag != this.tag) {
// 碰到其他蛇身
this.setAngle(this.head.angle + 180);
this.isFast = true;
}
}
death() {
super.death();
......
import {
_decorator, Node, assetManager, SpriteAtlas, Sprite, CircleCollider2D,
math, Collider2D, Contact2DType, ParticleSystem2D, UITransform,
tween, v3, v2, Component, Prefab, PhysicsGroup, resources
} from "cc";
import { Global } from "./Global";
import { PoolManager } from "./PoolManager";
import { FoodType, DirectionType } from "./Enums";
import { isIntersect } from "./uitl";
import { MainGame } from "./MainGame";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame";
const { ccclass, property } = _decorator;
@ccclass("Animal")
export class Animal extends Component {
@property({
type: Node,
displayName: "头部"
})
private Head: Node = null;
@property(Prefab)
private bodyPrefab: Prefab = null;
private uiSanke: UITransform = null;
private uiFondManger: UITransform = null;
private Bodys: Node[] = [];
// 蛇身图片资源
private imgHead: any = null;
private imgBody1: any = null;
private imgBody2: any = null;
private imgTait1: any = null;
private imgTait2: any = null;
// 蛇的属性
private isLife: boolean = false;
private scale: number = 0.2;
private speed: number = 600;
private direction: DirectionType = DirectionType.DEFAULT;
private directionSpeed: number = 0;
private taitLen: number = 2;
private energy: number = 0;
private isRunning: boolean = false;
private tag: number = 0;
// 视野范围
private vw: number = Global.visibleSize.width / 2 + 100;
private vh: number = Global.visibleSize.height / 2 + 100;
private ready: boolean = false;
private b: any = null;
/**
* 初始化蛇
*/
init(x: number, y: number, angle: number, skinId: number = 1, scale: number = 0.2,
length: number = 3, taitLen: number = 1, tag: number = 0) {
this.ready = false;
const skinPath = `skin/s${skinId}`;
this.Head.angle = angle;
this.Head.setPosition(x, y);
this.Head.setScale(scale, scale);
// 加载皮肤资源
resources.load(skinPath, SpriteAtlas, (err, atlas) => {
if (err) {
console.warn(err);
return;
}
// 获取各部分图片
this.imgHead = atlas.getSpriteFrame("head");
this.imgBody1 = atlas.getSpriteFrame("body1");
this.imgBody2 = atlas.getSpriteFrame("body2");
this.imgTait1 = atlas.getSpriteFrame("tait1");
this.imgTait2 = atlas.getSpriteFrame("tait2");
// 初始化属性
this.Bodys = [];
this.scale = scale;
this.speed = this.speed * scale;
this.energy = 0;
this.taitLen = taitLen;
this.tag = tag;
// 设置头部
this.Head.getComponent(Sprite).spriteFrame = this.imgHead;
this.Head.active = isIntersect(
this.Head.getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
// 创建身体节点
for (let i = 0; i < length; i++) {
const body = PoolManager.instance.getNode(this.bodyPrefab, this.node);
const collider = body.getComponent(Collider2D);
if (collider) collider.tag = this.tag;
body.setPosition(9999, 9999);
// 设置身体图片
if (i < length - taitLen) {
body.getComponent(Sprite).spriteFrame = i % 2 == 0 ? this.imgBody2 : this.imgBody1;
} else {
body.getComponent(Sprite).spriteFrame = i == length - 1 ? this.imgTait2 : this.imgTait1;
}
body.active = false;
this.Bodys.push(body);
}
this.isLife = true;
});
this.ready = true;
}
onEnable() {
// 注册碰撞事件
const headCollider = this.Head.getComponent(Collider2D);
if (headCollider) {
headCollider.on(Contact2DType.BEGIN_CONTACT, this.onBeginHead, this);
headCollider.on(Contact2DType.BEGIN_CONTACT, this.onBeginEye, this);
}
this.uiSanke = this.getComponent(UITransform);
this.uiFondManger = MainGame.ins.fondManger.getComponent(UITransform);
}
onDisable() {
// 注销碰撞事件
const headCollider = this.Head.getComponent(Collider2D);
if (headCollider) {
headCollider.off(Contact2DType.BEGIN_CONTACT, this.onBeginHead, this);
headCollider.off(Contact2DType.BEGIN_CONTACT, this.onBeginEye, this);
}
}
/**
* 头部碰撞回调
*/
onBeginHead(selfCollider: Collider2D, otherCollider: Collider2D) {
if (otherCollider.group === PhysicsGroup["Body"] &&
otherCollider.tag != this.tag) {
this.death();
}
}
/**
* 视野碰撞回调
*/
onBeginEye(selfCollider: Collider2D, otherCollider: Collider2D) {
if (otherCollider.group === PhysicsGroup["Prop"]) {
// 碰到食物
const foodType = otherCollider.tag;
this.isRunning = true;
// 计算朝向食物的角度
const headPos = this.Head.getPosition();
const foodPos = otherCollider.node.getPosition();
const worldPos = this.uiFondManger.convertToWorldSpaceAR(foodPos);
const nodePos = this.uiSanke.convertToNodeSpaceAR(worldPos);
const angle = Math.atan2(nodePos.y - headPos.y, nodePos.x - headPos.x);
this.setAngle(angle * (180 / Math.PI));
// 吃掉食物的动画
tween(otherCollider.node)
.to(0.3, {
position: this.Head.getPosition(),
scale: v3(0, 0)
})
.call(() => {
PoolManager.instance.putNode(otherCollider.node);
if (foodType == FoodType.FOOD) {
this.setEnergy(1);
} else if (foodType == FoodType.MONEY) {
this.setEnergy(5);
}
})
.start();
} else if (otherCollider.group === PhysicsGroup["Body"] && otherCollider.tag != this.tag) {
// 碰到其他蛇身
this.setAngle(this.Head.angle + 180);
this.isRunning = true;
}
}
/**
* 设置能量值
*/
setEnergy(value: number) {
this.energy += value;
const needEnergy = Math.floor(this.scale * 10);
if (this.energy >= needEnergy) {
this.grow();
this.energy -= needEnergy;
if (this.scale < 0.8) {
this.scale += 0.005;
}
this.speed = 600 * this.scale;
}
}
/**
* 成长(增加身体节点)
*/
grow() {
const len = this.Bodys.length;
const body = PoolManager.instance.getNode(this.bodyPrefab, this.node);
body.angle = this.Bodys[len - this.taitLen - 1].angle;
body.setPosition(this.Bodys[len - this.taitLen - 1].getPosition());
body.setScale(this.scale, this.scale);
const isEven = (len - this.taitLen) % 2 == 0;
body.getComponent(Sprite).spriteFrame = isEven ? this.imgBody2 : this.imgBody1;
body.getComponent(Collider2D).tag = this.tag;
body.active = isIntersect(
body.getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
this.Bodys.splice(len - this.taitLen, 0, body);
}
/**
* 设置角度
*/
setAngle(angle: number) {
if (this.isLife) {
this.Head.angle = angle;
}
}
/**
* 快速移动
*/
running(dt: number) {
if (!this.isLife) return;
const len = this.Bodys.length - 1;
// 更新身体位置
for (let i = len; i > 1; i--) {
this.Bodys[i].angle = this.Bodys[i - 2].angle;
this.Bodys[i].setPosition(this.Bodys[i - 2].getPosition());
this.Bodys[i].setScale(this.scale, this.scale);
this.Bodys[i].setSiblingIndex(len - i);
this.Bodys[i].active = isIntersect(
this.Bodys[i].getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
}
// 更新第二节位置
this.Bodys[1].angle = this.Head.angle;
this.Bodys[1].setPosition(this.Head.getPosition());
this.Bodys[1].setScale(this.scale, this.scale);
this.Bodys[1].setSiblingIndex(len - 1);
this.Bodys[1].active = isIntersect(
this.Bodys[1].getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
// 更新第一节位置
this.Bodys[0].angle = this.Head.angle;
this.Bodys[0].setPosition(this.getNewPos(this.Head.angle, dt, this.Head.getPosition()));
this.Bodys[0].setScale(this.scale, this.scale);
this.Bodys[0].setSiblingIndex(len);
this.Bodys[0].active = isIntersect(
this.Bodys[0].getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
// 更新头部位置
this.Head.setPosition(
this.getNewPos(this.Head.angle, dt, this.Head.getPosition(), this.speed * 2)
);
this.Head.setScale(this.scale, this.scale);
this.Head.setSiblingIndex(len + 1);
this.Head.active = isIntersect(
this.Head.getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
}
/**
* 普通移动
*/
move(dt: number) {
if (!this.ready || !this.isLife) return;
const len = this.Bodys.length - 1;
// 更新身体位置
for (let i = len; i > 0; i--) {
this.Bodys[i].angle = this.Bodys[i - 1].angle;
this.Bodys[i].setPosition(this.Bodys[i - 1].getPosition());
this.Bodys[i].setScale(this.scale, this.scale);
this.Bodys[i].setSiblingIndex(len - i);
this.Bodys[i].active = isIntersect(
this.Bodys[i].getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
}
// 更新第一节位置
this.Bodys[0].angle = this.Head.angle;
this.Bodys[0].setPosition(this.Head.getPosition());
this.Bodys[0].setScale(this.scale, this.scale);
this.Bodys[0].setSiblingIndex(len);
this.Bodys[0].active = isIntersect(
this.Bodys[0].getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
// 更新头部位置
this.Head.setPosition(
this.getNewPos(this.Head.angle, dt, this.Head.getPosition())
);
this.Head.setScale(this.scale, this.scale);
this.Head.setSiblingIndex(len + 1);
this.Head.active = isIntersect(
this.Head.getPosition(),
MainGame.ins.camera.node.getPosition(),
this.vw,
this.vh
);
}
v = v3();
/**
* AI自动移动
*/
autoMove(dt: number) {
if (!this.isLife) return;
// 预判断下一个位置
this.v = this.getNewPos(
this.Head.angle,
dt,
this.Head.getPosition(),
this.speed * 20
);
const halfWidth = Global.MAP_WIDTH / 2;
const halfHeight = Global.MAP_HEIGHT / 2;
// 如果要超出地图边界,则转向
if (this.v.x <= -halfWidth || this.v.x >= halfWidth ||
this.v.y <= -halfHeight || this.v.y >= halfHeight) {
const angleAbs = Math.abs(this.Head.angle % 180);
this.direction = DirectionType.DEFAULT;
if (angleAbs > 90) {
this.Head.angle += math.randomRangeInt(180 - angleAbs, 360);
} else {
this.Head.angle -= math.randomRangeInt(angleAbs, 180 + angleAbs);
}
}
// 随机改变方向
else if (math.randomRangeInt(0, 11) == 0) {
this.direction = math.randomRangeInt(0, 3);
this.directionSpeed = math.randomRangeInt(0, 6);
}
// 根据方向更新角度
if (this.direction == DirectionType.DEFAULT) {
// 保持当前角度
} else if (this.direction == DirectionType.LEFT) {
this.Head.angle += this.directionSpeed;
} else {
this.Head.angle -= this.directionSpeed;
}
// 随机切换移动状态
if (this.isRunning) {
this.running(dt);
this.isRunning = math.randomRangeInt(1, 20) != 1;
} else {
this.move(dt);
}
}
/**
* 死亡
*/
death() {
if (!this.isLife) return;
this.isLife = false;
this.node.active = false;
// 死亡后将身体变成食物
this.initFond(this.Bodys.length).then(() => {
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.reInit(x, y);
});
}
/**
* 重生
*/
reInit(x: number, y: number) {
this.Head.angle = 0;
this.Head.setPosition(x, y);
this.node.active = true;
this.isLife = true;
}
/**
* 计算新位置
*/
getNewPos(angle: number, dt: number, pos: any, speed: number = this.speed) {
const radian = angle / 180 * Math.PI;
const dir = v2(Math.cos(radian), Math.sin(radian));
return v3(
pos.x + dt * dir.x * speed,
pos.y + dt * dir.y * speed,
0
);
}
/**
* 初始化食物
*/
initItem = (index: number) => {
this.b = this.Bodys[index].getPosition();
MainGame.ins.fondManger.addFood(
math.randomRangeInt(this.b.x - 10, this.b.x + 11),
math.randomRangeInt(this.b.y - 20, this.b.y + 21)
);
this.Bodys[index].setPosition(9999, 9999);
}
/**
* 初始化食物
*/
async initFond(count: number) {
await executePreFrame(getItemGenerator(count, this.initItem), 1, this);
this.ready = true;
}
}
\ No newline at end of file
{
"ver": "4.0.24",
"importer": "typescript",
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "07e2fb04-9b27-44b0-a678-3ed74e6fb2e8",
"uuid": "d528cbc7-2a3f-42db-9b4b-53c4fd007cb5",
"files": [],
"subMetas": {},
"userData": {}
......
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "b2679aee-57f5-40c5-ad4a-e9f87da96139",
"files": [],
"subMetas": {},
"userData": {}
}
......@@ -9,14 +9,12 @@ import {
Prefab,
UITransform,
} from "cc";
import { Joystick } from "./Joystick";
import { FastBtn } from "./FastBtn";
import { Animal } from "./Animal";
import { FondManger } from "./FondManger";
import { Config } from "./Config";
import { Joystick } from "./Components/Joystick";
import { FastBtn } from "./Components/FastBtn";
import { FondManger } from "./Manager/FondManger";
import { Global } from "./Global";
import { Events, GameState } from "./Enums";
import { PoolManager } from "./PoolManager";
import { Events, GameState } from "./Common/Enums";
import { PoolManager } from "./Manager/PoolManager";
import { showToast } from "../../../Module/UIFast";
import Scene from "../../../Module/Scene";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame";
......
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "3ace9ef4-bb4d-4f9a-ab26-3c90b59441a1",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Enum, SpriteFrame, math, v3, Sprite, Collider2D, Component, Prefab, ccenum } from "cc";
import { PoolManager } from "./PoolManager";
import { FoodType } from "./Enums";
import { Global } from "./Global";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame";
import { PoolManager } from "db://assets/Scripts/Scenes/MainGame/Manager/PoolManager";
import { FoodType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums";
import { Global } from "db://assets/Scripts/Scenes/MainGame/Global";
import { executePreFrame, getItemGenerator } from "db://assets/Scripts/Utils/ExecutePreFrame";
const { ccclass, property } = _decorator;
......
......@@ -3,9 +3,9 @@ import {
} from "cc";
import { Snake } from "./Snake";
import { Joystick } from "./Joystick";
import { FastBtn } from "./FastBtn";
import { Events, GameState } from "./Enums";
import { Joystick } from "./Components/Joystick";
import { FastBtn } from "./Components/FastBtn";
import { Events, GameState } from "./Common/Enums";
const { ccclass, property } = _decorator;
......
......@@ -14,9 +14,9 @@ import {
v3,
Vec3,
} from "cc";
import { FoodType } from "./Enums";
import { FoodType } from "./Common/Enums";
import { Global } from "./Global";
import { PoolManager } from "./PoolManager";
import { PoolManager } from "./Manager/PoolManager";
import { isIntersect, loadSkin } from "./uitl";
import { MainGame } from "./MainGame";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame";
......@@ -56,7 +56,7 @@ export class Snake extends Component {
private scale: number = 0.2;
speed: number = 600;
private energy: number = 0;
private tag: number = 0;
protected tag: number = 0;
// 位置相关
private vw: number = Global.visibleSize.width / 2 + 100;
......@@ -141,7 +141,7 @@ export class Snake extends Component {
}
}
private onBeginEye(selfCollider: Collider2D, otherCollider: Collider2D) {
onBeginEye(selfCollider: Collider2D, otherCollider: Collider2D) {
if (otherCollider.group === PhysicsGroup["Prop"]) {
const foodType = otherCollider.tag;
......
......@@ -98,12 +98,12 @@
</style>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/style.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/custom.css" />-->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/style.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/custom.css" />-->
<!-- <script src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>-->
<!-- <script>eruda.init()</script>-->
......@@ -116,20 +116,20 @@
</div>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/polyfills.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/system.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map -->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<script type="systemjs-importmap" charset="utf-8">
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/cocos-js/cc.js"}}
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/cocos-js/cc.js"}}
</script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1730880904289/index.js').catch(function (err) {
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1732157851701/index.js').catch(function (err) {
console.error(err);
})
</script>
......
......@@ -16,7 +16,23 @@
"includeModules": {
"gfx-webgl2": "inherit-project-setting"
}
}
},
"scenes": [
{
"url": "db://assets/Start/Start.scene",
"uuid": "9e293cde-e27b-4902-808b-e884f3e9da32"
},
{
"url": "db://assets/Bundles/HomeScene/HomeScene.scene",
"uuid": "04224ebd-adcd-4112-8010-da14ed5ea48a",
"bundle": "db://assets/Bundles/HomeScene"
},
{
"url": "db://assets/Bundles/MainGame/MainGame.scene",
"uuid": "53947ca7-3484-4b53-800d-509405063d68",
"bundle": "db://assets/Bundles/MainGame"
}
]
},
"BuildTaskManager": {
"taskMap": {
......@@ -26,8 +42,8 @@
"progress": 1,
"state": "success",
"stage": "build",
"message": "2024-11-6 16:15:37 build success in 33 s!",
"detailMessage": "cdf7bb80-fbb4-4caa-8988-5ed2e402a6af.png\r0\r",
"message": "2024-11-21 10:57:54 build success in 23 s!",
"detailMessage": "%c兑吧发布插件 >> 版本号:1732157851701\rcolor: green\r",
"options": {
"name": "cocos-template-3d",
"server": "",
......@@ -74,21 +90,11 @@
"url": "db://assets/Start/Start.scene",
"uuid": "9e293cde-e27b-4902-808b-e884f3e9da32"
},
{
"url": "db://assets/Bundles/GuideScene/GuideScene.scene",
"uuid": "5d6e4c61-d0d4-48df-a049-e0eb6fcaa065",
"bundle": "db://assets/Bundles/GuideScene"
},
{
"url": "db://assets/Bundles/HomeScene/HomeScene.scene",
"uuid": "04224ebd-adcd-4112-8010-da14ed5ea48a",
"bundle": "db://assets/Bundles/HomeScene"
},
{
"url": "db://assets/Bundles/MainGame/GuideGame.scene",
"uuid": "7b5de2a0-8504-46ba-9019-37a3548ce8e1",
"bundle": "db://assets/Bundles/MainGame"
},
{
"url": "db://assets/Bundles/MainGame/MainGame.scene",
"uuid": "53947ca7-3484-4b53-800d-509405063d68",
......@@ -100,7 +106,7 @@
"__version__": "1.3.8",
"logDest": "project://temp/builder/log/web-mobile2024-11-6 15-39.log"
},
"time": "2024-11-6 16:15:04",
"time": "2024-11-21 10:57:31",
"dirty": false
}
}
......
......@@ -14,16 +14,40 @@
"includeModules": {
"gfx-webgl2": "inherit-project-setting"
}
}
},
"scenes": [
{
"url": "db://assets/Start/Start.scene",
"uuid": "9e293cde-e27b-4902-808b-e884f3e9da32"
},
{
"url": "db://assets/Bundles/HomeScene/HomeScene.scene",
"uuid": "04224ebd-adcd-4112-8010-da14ed5ea48a",
"bundle": "db://assets/Bundles/HomeScene"
},
{
"url": "db://assets/Bundles/MainGame/MainGame.scene",
"uuid": "53947ca7-3484-4b53-800d-509405063d68",
"bundle": "db://assets/Bundles/MainGame"
}
]
},
"taskOptionsMap": {
"1730878748609": {
"useWebGPU": false,
"orientation": "auto",
"orientation": "landscape",
"embedWebDebugger": false,
"__version__": "1.0.1"
}
},
"__version__": "1.3.8"
"__version__": "1.3.8",
"options": {
"web-mobile": {
"useWebGPU": false,
"orientation": "landscape",
"embedWebDebugger": false,
"__version__": "1.0.1"
}
}
}
}
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