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 { Snake } from "./Snake";
import { DirectionType } from "./Enums"; import { DirectionType } from "./Common/Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { MainGame } from "./MainGame"; import { MainGame } from "./MainGame";
...@@ -41,6 +41,23 @@ export class AISnake extends Snake { ...@@ -41,6 +41,23 @@ export class AISnake extends Snake {
private assistTarget: AISnake = null; // 正在协助的AI蛇 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() { death() {
super.death(); super.death();
......
This diff is collapsed.
{ {
"ver": "4.0.24", "ver": "1.2.0",
"importer": "typescript", "importer": "directory",
"imported": true, "imported": true,
"uuid": "07e2fb04-9b27-44b0-a678-3ed74e6fb2e8", "uuid": "d528cbc7-2a3f-42db-9b4b-53c4fd007cb5",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}
......
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "b2679aee-57f5-40c5-ad4a-e9f87da96139",
"files": [],
"subMetas": {},
"userData": {}
}
...@@ -9,14 +9,12 @@ import { ...@@ -9,14 +9,12 @@ import {
Prefab, Prefab,
UITransform, UITransform,
} from "cc"; } from "cc";
import { Joystick } from "./Joystick"; import { Joystick } from "./Components/Joystick";
import { FastBtn } from "./FastBtn"; import { FastBtn } from "./Components/FastBtn";
import { Animal } from "./Animal"; import { FondManger } from "./Manager/FondManger";
import { FondManger } from "./FondManger";
import { Config } from "./Config";
import { Global } from "./Global"; import { Global } from "./Global";
import { Events, GameState } from "./Enums"; import { Events, GameState } from "./Common/Enums";
import { PoolManager } from "./PoolManager"; import { PoolManager } from "./Manager/PoolManager";
import { showToast } from "../../../Module/UIFast"; import { showToast } from "../../../Module/UIFast";
import Scene from "../../../Module/Scene"; import Scene from "../../../Module/Scene";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame"; 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 { _decorator, Enum, SpriteFrame, math, v3, Sprite, Collider2D, Component, Prefab, ccenum } from "cc";
import { PoolManager } from "./PoolManager"; import { PoolManager } from "db://assets/Scripts/Scenes/MainGame/Manager/PoolManager";
import { FoodType } from "./Enums"; import { FoodType } from "db://assets/Scripts/Scenes/MainGame/Common/Enums";
import { Global } from "./Global"; import { Global } from "db://assets/Scripts/Scenes/MainGame/Global";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame"; import { executePreFrame, getItemGenerator } from "db://assets/Scripts/Utils/ExecutePreFrame";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
......
...@@ -3,9 +3,9 @@ import { ...@@ -3,9 +3,9 @@ import {
} from "cc"; } from "cc";
import { Snake } from "./Snake"; import { Snake } from "./Snake";
import { Joystick } from "./Joystick"; import { Joystick } from "./Components/Joystick";
import { FastBtn } from "./FastBtn"; import { FastBtn } from "./Components/FastBtn";
import { Events, GameState } from "./Enums"; import { Events, GameState } from "./Common/Enums";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
......
...@@ -14,9 +14,9 @@ import { ...@@ -14,9 +14,9 @@ import {
v3, v3,
Vec3, Vec3,
} from "cc"; } from "cc";
import { FoodType } from "./Enums"; import { FoodType } from "./Common/Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { PoolManager } from "./PoolManager"; import { PoolManager } from "./Manager/PoolManager";
import { isIntersect, loadSkin } from "./uitl"; import { isIntersect, loadSkin } from "./uitl";
import { MainGame } from "./MainGame"; import { MainGame } from "./MainGame";
import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame"; import { executePreFrame, getItemGenerator } from "../../Utils/ExecutePreFrame";
...@@ -56,7 +56,7 @@ export class Snake extends Component { ...@@ -56,7 +56,7 @@ export class Snake extends Component {
private scale: number = 0.2; private scale: number = 0.2;
speed: number = 600; speed: number = 600;
private energy: number = 0; private energy: number = 0;
private tag: number = 0; protected tag: number = 0;
// 位置相关 // 位置相关
private vw: number = Global.visibleSize.width / 2 + 100; private vw: number = Global.visibleSize.width / 2 + 100;
...@@ -141,7 +141,7 @@ export class Snake extends Component { ...@@ -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"]) { if (otherCollider.group === PhysicsGroup["Prop"]) {
const foodType = otherCollider.tag; const foodType = otherCollider.tag;
......
...@@ -98,12 +98,12 @@ ...@@ -98,12 +98,12 @@
</style> </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/1732157851701/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/1732157851701/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/1732157851701/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> <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/1730880904289/style.css" />--> <!-- <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/1730880904289/custom.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 src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>-->
<!-- <script>eruda.init()</script>--> <!-- <script>eruda.init()</script>-->
...@@ -116,20 +116,20 @@ ...@@ -116,20 +116,20 @@
</div> </div>
<!-- Polyfills bundle. --> <!-- 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. --> <!-- 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 --> <!-- 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"> <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>
<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); console.error(err);
}) })
</script> </script>
......
...@@ -16,7 +16,23 @@ ...@@ -16,7 +16,23 @@
"includeModules": { "includeModules": {
"gfx-webgl2": "inherit-project-setting" "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": { "BuildTaskManager": {
"taskMap": { "taskMap": {
...@@ -26,8 +42,8 @@ ...@@ -26,8 +42,8 @@
"progress": 1, "progress": 1,
"state": "success", "state": "success",
"stage": "build", "stage": "build",
"message": "2024-11-6 16:15:37 build success in 33 s!", "message": "2024-11-21 10:57:54 build success in 23 s!",
"detailMessage": "cdf7bb80-fbb4-4caa-8988-5ed2e402a6af.png\r0\r", "detailMessage": "%c兑吧发布插件 >> 版本号:1732157851701\rcolor: green\r",
"options": { "options": {
"name": "cocos-template-3d", "name": "cocos-template-3d",
"server": "", "server": "",
...@@ -74,21 +90,11 @@ ...@@ -74,21 +90,11 @@
"url": "db://assets/Start/Start.scene", "url": "db://assets/Start/Start.scene",
"uuid": "9e293cde-e27b-4902-808b-e884f3e9da32" "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", "url": "db://assets/Bundles/HomeScene/HomeScene.scene",
"uuid": "04224ebd-adcd-4112-8010-da14ed5ea48a", "uuid": "04224ebd-adcd-4112-8010-da14ed5ea48a",
"bundle": "db://assets/Bundles/HomeScene" "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", "url": "db://assets/Bundles/MainGame/MainGame.scene",
"uuid": "53947ca7-3484-4b53-800d-509405063d68", "uuid": "53947ca7-3484-4b53-800d-509405063d68",
...@@ -100,7 +106,7 @@ ...@@ -100,7 +106,7 @@
"__version__": "1.3.8", "__version__": "1.3.8",
"logDest": "project://temp/builder/log/web-mobile2024-11-6 15-39.log" "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 "dirty": false
} }
} }
......
...@@ -14,16 +14,40 @@ ...@@ -14,16 +14,40 @@
"includeModules": { "includeModules": {
"gfx-webgl2": "inherit-project-setting" "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": { "taskOptionsMap": {
"1730878748609": { "1730878748609": {
"useWebGPU": false, "useWebGPU": false,
"orientation": "auto", "orientation": "landscape",
"embedWebDebugger": false, "embedWebDebugger": false,
"__version__": "1.0.1" "__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