Commit e55d0230 authored by spc's avatar spc

护盾

parent 64a5c744
......@@ -1473,25 +1473,9 @@
"_enabled": true,
"__prefab": null,
"prefabs": [
{
"__uuid__": "b9232624-687a-4ac8-8c34-47be816572bc",
"__expectedType__": "cc.Prefab"
},
{
"__uuid__": "a16bac22-bcf1-4674-b657-1d95d7fe0ddf",
"__expectedType__": "cc.Prefab"
},
{
"__uuid__": "c5548e2c-ccd8-49e3-b525-ac731a211cb9",
"__expectedType__": "cc.Prefab"
},
{
"__uuid__": "63dfad2d-5ed9-4ff4-91fa-23281e6d8c08",
"__expectedType__": "cc.Prefab"
},
{
"__uuid__": "2d321722-ed4a-4ed1-a125-c08fdb45fd53",
"__expectedType__": "cc.Prefab"
}
],
"_id": "11KeIXjZ1F149IZe9ojuU7"
......@@ -2211,6 +2195,10 @@
"__uuid__": "6e23acc0-7ab0-4a63-992e-1ab0f711381f",
"__expectedType__": "cc.Prefab"
},
"defenseEffectPrefab": {
"__uuid__": "a6dda613-b5e8-4416-8e79-1e10a37295c6",
"__expectedType__": "cc.Prefab"
},
"joystick": {
"__id__": 58
},
......@@ -11035,9 +11023,9 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 137,
"g": 111,
"b": 45,
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "获得一张加速卡",
......@@ -11635,7 +11623,7 @@
"y": 180,
"z": 0
},
"_id": "0dsrFMEQJJVrvEfi43CUhd"
"_id": "derZ4rgy5Lu7DvAuTdMxaz"
},
{
"__type__": "cc.UITransform",
......@@ -11657,7 +11645,7 @@
"x": 0,
"y": 1
},
"_id": "4335gx07dF/4MUyduSfMt4"
"_id": "3b08TrYw9F8JZrB0Bfg/IZ"
},
{
"__type__": "cc.Sprite",
......@@ -11693,7 +11681,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "04FjJJrylE/KB1+7PwMSg1"
"_id": "a68lVUgBtAjaM9S/RYr8/7"
},
{
"__type__": "cc.Node",
......@@ -11741,7 +11729,7 @@
"y": 0,
"z": 0
},
"_id": "7cCOpA89NEk4CyVigjYPNC"
"_id": "c3XpO5fqNKlp49LWnsQ/p8"
},
{
"__type__": "cc.UITransform",
......@@ -11763,7 +11751,7 @@
"x": 0,
"y": 1
},
"_id": "3fTpcHoyFKPpp0gS6y7ixC"
"_id": "6eb4lLrbZG44MOlLl+/i2O"
},
{
"__type__": "cc.Sprite",
......@@ -11799,7 +11787,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "89Eo+ibm9LE55j5uq/Yev8"
"_id": "4c2XlVznZOHKzqy2/t6cud"
},
{
"__type__": "cc.Node",
......@@ -11847,7 +11835,7 @@
"y": 0,
"z": 0
},
"_id": "a0frOuZfJJWq1oauN0JLNN"
"_id": "03kaLta/ZA8YVi7hZLMyLe"
},
{
"__type__": "cc.UITransform",
......@@ -11869,7 +11857,7 @@
"x": 0,
"y": 1
},
"_id": "20VeHw9uFExLCpV5aelkcv"
"_id": "9e8nrYwUVNO73lE7XCuw8t"
},
{
"__type__": "cc.Sprite",
......@@ -11905,7 +11893,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "2dkEM7rrVHvaPwL/MEMfuz"
"_id": "ee7hRDFTpMZY+pfV6HEYRm"
},
{
"__type__": "cc.UITransform",
......
[
{
"__type__": "cc.AnimationClip",
"_name": "护盾",
"_objFlags": 0,
"__editorExtras__": {
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 60,
"speed": 0.5,
"wrapMode": 22,
"enableTrsBlending": false,
"_duration": 0.3333333333333333,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
}
],
"_exoticAnimation": null,
"_events": [
{
"frame": 0,
"func": "",
"params": []
},
{
"frame": 0.3333333333333333,
"func": "",
"params": []
}
],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 11
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.VectorTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channels": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 9
}
],
"_nComponents": 3
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
"scale"
]
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 4
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.30000001192092896,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.5,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 6
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.30000001192092896,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.5,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 8
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.3333333432674408
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 10
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,
"refClip": null
}
]
\ No newline at end of file
{
"ver": "2.0.3",
"importer": "animation-clip",
"imported": true,
"uuid": "b5aaf4bd-0093-4d03-951f-2a533801c02d",
"files": [
".cconb"
],
"subMetas": {},
"userData": {
"name": "护盾"
}
}
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d76fd7c9-ff20-4244-9574-9e954d4d7d6c",
"files": [],
"subMetas": {},
"userData": {}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "a3433f21-754e-48e2-946a-9810323cd43a",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a3433f21-754e-48e2-946a-9810323cd43a@6c48a",
"displayName": "护盾",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "a3433f21-754e-48e2-946a-9810323cd43a",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a3433f21-754e-48e2-946a-9810323cd43a@f9941",
"displayName": "护盾",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 662,
"height": 662,
"rawWidth": 662,
"rawHeight": 662,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-331,
-331,
0,
331,
-331,
0,
-331,
331,
0,
331,
331,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
662,
662,
662,
0,
0,
662,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-331,
-331,
0
],
"maxPos": [
331,
331,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "a3433f21-754e-48e2-946a-9810323cd43a@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "a3433f21-754e-48e2-946a-9810323cd43a@6c48a"
}
}
......@@ -805,6 +805,10 @@
"__uuid__": "6e23acc0-7ab0-4a63-992e-1ab0f711381f",
"__expectedType__": "cc.Prefab"
},
"defenseEffectPrefab": {
"__uuid__": "a6dda613-b5e8-4416-8e79-1e10a37295c6",
"__expectedType__": "cc.Prefab"
},
"difficulty": 4.6772417976120195,
"_id": ""
},
......
[
{
"__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": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 8
},
"_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": 0.5,
"y": 0.5,
"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__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_contentSize": {
"__type__": "cc.Size",
"width": 662,
"height": 662
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6f6Z2Z+s5Ii5C/35JQ8Asp"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "a3433f21-754e-48e2-946a-9810323cd43a@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 2,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "76UFr6rgBHHIbWJEMl4Wwg"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"playOnLoad": false,
"_clips": [
{
"__uuid__": "b5aaf4bd-0093-4d03-951f-2a533801c02d",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "b5aaf4bd-0093-4d03-951f-2a533801c02d",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bbiqK69OFLtZi6eonC2yWP"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": null,
"targetOverrides": null
}
]
\ No newline at end of file
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "a6dda613-b5e8-4416-8e79-1e10a37295c6",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "护盾效果"
}
}
......@@ -35,10 +35,13 @@
},
{
"__id__": 20
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 22
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -465,6 +468,24 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "d4nguP1hRPj6hmP9ugayLT"
},
{
"__type__": "e082eyhc7pGMbgblcjlkh0j",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c5Pf8dPC1E44qfcKWI+dAF"
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
......@@ -35,10 +35,13 @@
},
{
"__id__": 20
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 22
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -465,6 +468,24 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "d4nguP1hRPj6hmP9ugayLT"
},
{
"__type__": "b811aywtq9ApLMRmklhV9QS",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5d076ZIGRG/a81nbe8g7hs"
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
......@@ -35,10 +35,13 @@
},
{
"__id__": 20
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 22
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -465,6 +468,24 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "d4nguP1hRPj6hmP9ugayLT"
},
{
"__type__": "db8b7edPSxCbLTwGFe5esQp",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "7dcuaX0utKrreJRsiKKhch"
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
......@@ -35,10 +35,13 @@
},
{
"__id__": 20
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 22
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -465,6 +468,24 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "d4nguP1hRPj6hmP9ugayLT"
},
{
"__type__": "2a22eGuq9hBtb+kOg9IhmGl",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "75Ofi/sa1FoahIOG9waEgA"
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
import { _decorator, Component, Node } from 'cc';
import { PropBase } from './PropBase';
import { Snake } from '../Snake';
const { ccclass, property } = _decorator;
@ccclass('Defense')
export class Defense extends PropBase {
start() {
}
beEaten(target: Snake) {
console.warn("useDefense")
target.useDefense();
}
update(deltaTime: number) {
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "2a22e1ae-abd8-41b5-bfa4-3a0f488661a5",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Component, Node } from 'cc';
import { PropBase } from './PropBase';
const { ccclass, property } = _decorator;
@ccclass('Double')
export class Double extends PropBase {
start() {
}
beEaten() {
}
update(deltaTime: number) {
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "db8b779d-3d2c-426c-b4f0-1857b97ac429",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Component, Node } from 'cc';
import { PropBase } from './PropBase';
const { ccclass, property } = _decorator;
@ccclass('Length')
export class Length extends PropBase {
start() {
}
beEaten() {
}
update(deltaTime: number) {
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "b811acb0-b6af-40a4-b311-9a496157d412",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Component, Node } from 'cc';
import { PropBase } from './PropBase';
const { ccclass, property } = _decorator;
@ccclass('Speed')
export class Speed extends PropBase {
start() {
}
beEaten(){
}
update(deltaTime: number) {
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "e082eca1-73ba-4631-b81b-95c8e5921d23",
"files": [],
"subMetas": {},
"userData": {}
}
......@@ -49,6 +49,8 @@ export class Snake extends Component {
@property(Prefab) bodyPrefab: Prefab = null;
@property(Prefab) accEffectPrefab: Prefab = null;
@property(Prefab) magnetEffectPrefab: Prefab = null;
@property(Prefab) defenseEffectPrefab: Prefab = null;
cardMap: Map<ECard, number> = new Map<ECard, number>();
......@@ -71,6 +73,9 @@ export class Snake extends Component {
// 磁铁效果
magnetEffectNode: Node = null;
//护盾效果
defenseEffectNode: Node = null;
isLife: boolean = false;
// 福袋个数
......@@ -121,6 +126,10 @@ export class Snake extends Component {
this.head.addChild(this.magnetEffectNode);
this.magnetEffectNode.active = false;
this.defenseEffectNode = instantiate(this.defenseEffectPrefab)
this.head.addChild(this.defenseEffectNode);
this.defenseEffectNode.active = false;
this.eatCollider = this.head.getChildByName("吃饭范围").getComponent(CircleCollider2D);
this.eatPropCollider = this.head.getChildByName("吃道具范围").getComponent(CircleCollider2D);
}
......@@ -230,6 +239,12 @@ export class Snake extends Component {
private onBeginHead(selfCollider: Collider2D, otherCollider: Collider2D) {
if (otherCollider.group === PhysicsGroup["Body"] && otherCollider.tag != this.tag) {
if (this.invincibleTime > 0) {
console.warn(" 无敌的我")
this.breakDefense()
return;
}
const playerTs = otherCollider?.node?.parent?.getComponent(Player);
if (playerTs) {
gameStore.gameInfo.killNum++;
......@@ -574,13 +589,50 @@ export class Snake extends Component {
}
set invincibleTime(value: number) {
this._invincibleTime = Math.max(this._invincibleTime, value);
this._invincibleTime = value;
}
clearInvincible() {
this.defenseTw?.removeSelf();
this.defenseEffectNode.active = false
this._invincibleTime = 0;
}
defenseTw: Tween<any> = null;
useDefense() {
this.clearInvincible();
this.invincibleTime = 30;
this.defenseEffectNode.active = true;
this.defenseTw = tween(this)
.delay(this.invincibleTime - 3)
.call(() => {
this.defenseEffectNode.getComponent(Animation).play();
})
.delay(3)
.call(() => {
this.clearInvincible();
})
.start();
}
breakDefense() {
if (this.invincibleTime <= 3) return;
/**3s内继续走无敌 */
this.defenseTw?.removeSelf();
this.invincibleTime = 3;
this.defenseEffectNode.getComponent(Animation).play();
this.defenseTw = tween(this)
.delay(3)
.call(() => {
this.clearInvincible();
})
.start();
}
}
\ No newline at end of file
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