Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MingSnake_241120
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
MingSnake_241120
Commits
6e16ba55
Commit
6e16ba55
authored
Dec 13, 2024
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
各种道具
parent
82a6c745
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
420 additions
and
56 deletions
+420
-56
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+34
-11
pregress.prefab
assets/Bundles/MainGame/prefab/progress/pregress.prefab
+217
-4
Enums.ts
assets/Scripts/Scenes/MainGame/Common/Enums.ts
+1
-0
Target.ts
assets/Scripts/Scenes/MainGame/Components/Target.ts
+35
-5
progress.ts
assets/Scripts/Scenes/MainGame/Components/progress.ts
+32
-2
Global.ts
assets/Scripts/Scenes/MainGame/Global.ts
+12
-1
Player.ts
assets/Scripts/Scenes/MainGame/Player.ts
+13
-1
DoubleExpPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/DoubleExpPropBtn.ts
+3
-1
GrowPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/GrowPropBtn.ts
+1
-1
ShieldPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/ShieldPropBtn.ts
+5
-1
SpeedPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/SpeedPropBtn.ts
+7
-2
Length.ts
assets/Scripts/Scenes/MainGame/Props/Length.ts
+3
-1
Speed.ts
assets/Scripts/Scenes/MainGame/Props/Speed.ts
+5
-2
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+52
-24
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
6e16ba55
...
...
@@ -199,7 +199,7 @@
"_priority": 40000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight":
764.9450222882615
,
"_orthoHeight":
525.1806451612904
,
"_near": 0,
"_far": 2000,
"_color": {
...
...
@@ -1721,9 +1721,25 @@
"_enabled": true,
"__prefab": null,
"prefabs": [
{
"__uuid__": "2d321722-ed4a-4ed1-a125-c08fdb45fd53",
"__expectedType__": "cc.Prefab"
},
{
"__uuid__": "63dfad2d-5ed9-4ff4-91fa-23281e6d8c08",
"__expectedType__": "cc.Prefab"
},
{
"__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"
}
],
"_id": "11KeIXjZ1F149IZe9ojuU7"
...
...
@@ -2680,7 +2696,7 @@
"_priority": 50000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight":
764.9450222882615
,
"_orthoHeight":
525.1806451612904
,
"_near": 1,
"_far": 2000,
"_color": {
...
...
@@ -11874,7 +11890,7 @@
"y": 180,
"z": 0
},
"_id": "
422AVml+tFIKy+13ga83PD
"
"_id": "
21ncP0mwJCNLC8C9rCq0oT
"
},
{
"__type__": "cc.UITransform",
...
...
@@ -11896,7 +11912,7 @@
"x": 0,
"y": 1
},
"_id": "
ebJYX+SdVPabCz/5smqtyT
"
"_id": "
13+uBdfxBAxY+WR7mSembg
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -11932,7 +11948,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "
0ffS2CgpZCcJsfqSsAT1Ob
"
"_id": "
33jw/zvE9Jb7GxpO1ziMyJ
"
},
{
"__type__": "cc.Node",
...
...
@@ -11980,7 +11996,7 @@
"y": 0,
"z": 0
},
"_id": "
4fWhA+0EhIEoCgp/P6EOR4
"
"_id": "
c29Np6vHJEYZLSvcBnddzB
"
},
{
"__type__": "cc.UITransform",
...
...
@@ -12002,7 +12018,7 @@
"x": 0,
"y": 1
},
"_id": "
29ebNxOLdA8bdM1nrhZEBK
"
"_id": "
648iyNyIVOkJuHdtaUGiXz
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -12038,7 +12054,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "
17XElo95VFpqd+g+IQke4d
"
"_id": "
9fZjCvWcxDvLRchq31GKKw
"
},
{
"__type__": "cc.Node",
...
...
@@ -12086,7 +12102,7 @@
"y": 0,
"z": 0
},
"_id": "
209xdx8nBNjbO1i75x2YGp
"
"_id": "
bet07Fb6ZGn4yPP+y6VVDv
"
},
{
"__type__": "cc.UITransform",
...
...
@@ -12108,7 +12124,7 @@
"x": 0,
"y": 1
},
"_id": "
24BWRCBjpCR6WbyE99XV0w
"
"_id": "
49Tg6fH3ZLpa/LQ0KjDtvc
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -12144,7 +12160,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "e
cAvFArrZMlqxwS7uOaNfX
"
"_id": "e
9dVwUcIpAG4M9VaOe1tG+
"
},
{
"__type__": "cc.UITransform",
...
...
@@ -13969,6 +13985,13 @@
"getTxt": {
"__id__": 301
},
"proConLayout": {
"__id__": 366
},
"progressPrefab": {
"__uuid__": "94f37305-05fb-419e-8214-1daee819dee3",
"__expectedType__": "cc.Prefab"
},
"_id": "dfl2fX641H3qOpggystLiY"
},
{
...
...
assets/Bundles/MainGame/prefab/progress/pregress.prefab
View file @
6e16ba55
...
...
@@ -20,19 +20,22 @@
"_children": [
{
"__id__": 2
},
{
"__id__": 16
}
],
"_active": true,
"_components": [
{
"__id__":
16
"__id__":
22
},
{
"__id__":
18
"__id__":
24
}
],
"_prefab": {
"__id__": 2
0
"__id__": 2
6
},
"_lpos": {
"__type__": "cc.Vec3",
...
...
@@ -367,6 +370,165 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "progressText",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
},
{
"__id__": 19
}
],
"_prefab": {
"__id__": 21
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 40,
"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": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 16
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "632K7dl6xFUqRg5yf9mocs"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 16
},
"_enabled": true,
"__prefab": {
"__id__": 20
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "道具使用中",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3cNzoUQwVCaKe3cxHVnVpw"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "50t02wm+JJVoudx0hEtFe+",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
...
...
@@ -377,7 +539,7 @@
},
"_enabled": true,
"__prefab": {
"__id__":
17
"__id__":
23
},
"_contentSize": {
"__type__": "cc.Size",
...
...
@@ -405,8 +567,59 @@
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"progressBg": {
"__id__": 11
},
"progressBar": {
"__id__": 6
},
"progressText": {
"__id__": 19
},
"spProgressBgFrames": [
{
"__uuid__": "f16ce13f-bcee-4d87-be58-70aea892f0e2@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "da8cd411-fa6d-4b36-b0ba-c05f00c363ae@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "227071c1-206c-481e-b4f5-e24196129a1e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "f16ce13f-bcee-4d87-be58-70aea892f0e2@f9941",
"__expectedType__": "cc.SpriteFrame"
}
],
"spProgressBarFrames": [
{
"__uuid__": "e4470900-50e3-4ba9-938f-0dff1587a3ac@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "2d56c3f6-7313-4006-b7a0-725c70cd8879@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "38e66909-a950-4d99-9a97-7a9706fb21e2@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "e4470900-50e3-4ba9-938f-0dff1587a3ac@f9941",
"__expectedType__": "cc.SpriteFrame"
}
],
"spProgressTexts": [
"磁铁吸附加成中",
"移动速度加成中",
"护盾保护加成中",
"双倍经验加成中"
],
"_id": ""
},
{
...
...
assets/Scripts/Scenes/MainGame/Common/Enums.ts
View file @
6e16ba55
...
...
@@ -23,6 +23,7 @@ ccenum(EPropType);
export
type
ECard
=
EPropType
.
CARD_A
|
EPropType
.
CARD_B
|
EPropType
.
CARD_C
;
export
type
ESporpType
=
EPropType
.
MAGNET
|
EPropType
.
SPEED
|
EPropType
.
SHIELD
|
EPropType
.
DOUBLE_EXP
;
// 移动方向枚举
export
enum
DirectionType
{
...
...
assets/Scripts/Scenes/MainGame/Components/Target.ts
View file @
6e16ba55
import
{
_decorator
,
Component
,
easing
,
Graphics
,
Label
,
Animation
,
misc
,
Node
,
Tween
,
tween
,
v3
,
UIOpacity
,
Prefab
,
instantiate
,
Layout
,
AnimationClip
}
from
"cc"
;
import
{
Global
}
from
"../Global"
;
import
Svga
from
"../../../../Component/Svga/Svga"
;
import
{
ECard
,
EPropType
}
from
"../Common/Enums"
;
import
{
ECard
,
EPropType
,
ESporpType
}
from
"../Common/Enums"
;
import
{
progress
}
from
"./progress"
;
const
{
ccclass
,
property
,
executeInEditMode
}
=
_decorator
;
...
...
@@ -60,6 +61,8 @@ export class Target extends Component {
@
property
(
Prefab
)
progressPrefab
:
Prefab
=
null
;
progressObj
=
{}
/**道具倒计时 */
...
...
@@ -206,10 +209,37 @@ export class Target extends Component {
addProgress
()
{
const
progressItem
=
instantiate
(
this
.
progressPrefab
)
// progressItem.
this
.
proConLayout
.
addChild
(
progressItem
)
updateProgress
(
type
:
ESporpType
,
pro
:
number
)
{
// MAGNET, // 磁铁 黄色 5
// SPEED, // 加速 蓝色 6
// SHIELD, // 护盾 绿色 7
// DOUBLE_EXP, // 双倍经验 黄色 9
let
type2type
=
{
[
EPropType
.
MAGNET
]:
0
,
[
EPropType
.
SPEED
]:
1
,
[
EPropType
.
SHIELD
]:
2
,
[
EPropType
.
DOUBLE_EXP
]:
3
}
let
progressItem
=
this
.
progressObj
[
type
]
if
(
!
progressItem
)
{
progressItem
=
instantiate
(
this
.
progressPrefab
)
progressItem
.
getComponent
(
progress
).
changeSpFrame
(
type2type
[
type
])
this
.
proConLayout
.
insertChild
(
progressItem
,
0
)
this
.
progressObj
[
type
]
=
progressItem
}
if
(
pro
<=
0
)
{
/**先直接移除 */
progressItem
.
removeFromParent
()
this
.
progressObj
[
type
]
=
null
return
}
progressItem
.
getComponent
(
progress
).
changePro
(
pro
)
}
...
...
assets/Scripts/Scenes/MainGame/Components/progress.ts
View file @
6e16ba55
import
{
_decorator
,
Component
,
Nod
e
}
from
'cc'
;
import
{
_decorator
,
Component
,
Label
,
Node
,
ProgressBar
,
Sprite
,
SpriteFram
e
}
from
'cc'
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'progress'
)
export
class
progress
extends
Component
{
@
property
(
Sprite
)
progressBg
:
Sprite
=
null
;
@
property
(
Sprite
)
progressBar
:
Sprite
=
null
;
@
property
(
Label
)
progressText
:
Label
=
null
;
@
property
([
SpriteFrame
])
spProgressBgFrames
:
SpriteFrame
[]
=
[];
@
property
([
SpriteFrame
])
spProgressBarFrames
:
SpriteFrame
[]
=
[];
@
property
([
String
])
spProgressTexts
:
string
[]
=
[];
start
()
{
}
/**
*
* @param type
*
*/
changeSpFrame
(
type
)
{
this
.
progressBg
.
spriteFrame
=
this
.
spProgressBgFrames
[
type
];
this
.
progressBar
.
spriteFrame
=
this
.
spProgressBarFrames
[
type
];
this
.
progressText
.
string
=
this
.
spProgressTexts
[
type
];
}
changePro
(
pro
)
{
this
.
progressBg
.
getComponent
(
ProgressBar
).
progress
=
pro
}
update
(
deltaTime
:
number
)
{
}
}
assets/Scripts/Scenes/MainGame/Global.ts
View file @
6e16ba55
...
...
@@ -17,7 +17,7 @@ export class Global {
static
HALF_MAP_HEIGHT
:
number
=
Global
.
MAP_HEIGHT
*
0.5
;
/** 道具CD */
static
PROP_CD
:
number
=
15
;
static
PROP_CD
:
number
=
3
;
/** 防御道具持续时间 */
...
...
@@ -25,6 +25,17 @@ export class Global {
/** 破防无敌时间 */
static
PROP_SHIELD_INVINCIBLE_TIME
:
number
=
3
;
/** 加速道具持续时间 */
static
PROP_SPEED_DUR_TIME
:
number
=
30
;
/** 磁吸道具持续时间 */
static
PROP_MAGNET_DUR_TIME
:
number
=
30
;
/** 磁吸吸取半径 */
static
PROP_MAGNET_RADIUS
:
number
=
240
/** 加长道具增加能量值 */
static
PROP_ADD_LENGTH
:
number
=
10
;
static
getRandomPosition
(
padding
:
number
=
0
):
IVec2Like
{
const
maxW
=
Global
.
HALF_MAP_WIDTH
-
padding
;
...
...
assets/Scripts/Scenes/MainGame/Player.ts
View file @
6e16ba55
import
{
_decorator
,
EventKeyboard
,
Input
,
input
,
KeyCode
,
director
,
Camera
,
lerp
,
_decorator
,
EventKeyboard
,
Input
,
input
,
KeyCode
,
director
,
Camera
,
lerp
,
tween
,
}
from
"cc"
;
import
{
Snake
}
from
"./Snake"
;
...
...
@@ -8,6 +8,7 @@ import { FastBtn } from "./Components/FastBtn";
import
{
ECard
,
EPropType
,
Events
}
from
"./Common/Enums"
;
import
gameStore
from
"../../store/gameStore"
;
import
{
Target
}
from
"./Components/Target"
;
import
{
Global
}
from
"./Global"
;
const
{
ccclass
,
property
}
=
_decorator
;
...
...
@@ -123,6 +124,17 @@ export class Player extends Snake {
}
}
useGrow
()
{
super
.
useGrow
()
}
useDefense
():
void
{
super
.
useDefense
()
Target
.
ins
.
updateProgress
(
EPropType
.
SHIELD
,
100
)
}
onLoad
()
{
super
.
onLoad
();
this
.
tag
=
Snake
.
getTag
();
...
...
assets/Scripts/Scenes/MainGame/PropBtn/DoubleExpPropBtn.ts
View file @
6e16ba55
import
{
_decorator
}
from
"cc"
;
import
{
PropBtn
}
from
"../Components/PropBtn"
;
import
{
Target
}
from
"../Components/Target"
;
import
{
EPropType
}
from
"../Common/Enums"
;
const
{
ccclass
}
=
_decorator
;
@
ccclass
(
'DoubleExpPropBtn'
)
...
...
@@ -13,7 +15,7 @@ export class DoubleExpPropBtn extends PropBtn {
doUse
()
{
super
.
doUse
();
Target
.
ins
.
updateProgress
(
EPropType
.
DOUBLE_EXP
,
100
)
// TODO 效果
this
.
startCd
();
...
...
assets/Scripts/Scenes/MainGame/PropBtn/GrowPropBtn.ts
View file @
6e16ba55
...
...
@@ -14,7 +14,7 @@ export class GrowPropBtn extends PropBtn {
doUse
()
{
super
.
doUse
();
MainGame
.
ins
.
player
.
useGrow
()
// TODO 效果
this
.
startCd
();
...
...
assets/Scripts/Scenes/MainGame/PropBtn/ShieldPropBtn.ts
View file @
6e16ba55
import
{
_decorator
}
from
"cc"
;
import
{
PropBtn
}
from
"../Components/PropBtn"
;
import
{
Global
}
from
"../Global"
;
import
{
Target
}
from
"../Components/Target"
;
import
{
EPropType
}
from
"../Common/Enums"
;
import
{
MainGame
}
from
"../MainGame"
;
const
{
ccclass
}
=
_decorator
;
...
...
@@ -15,7 +18,8 @@ export class ShieldPropBtn extends PropBtn {
doUse
()
{
super
.
doUse
();
MainGame
.
ins
.
player
.
useDefense
()
// Target.ins.updateProgress(EPropType.SHIELD, 100)
// TODO 效果
this
.
startCd
();
...
...
assets/Scripts/Scenes/MainGame/PropBtn/SpeedPropBtn.ts
View file @
6e16ba55
import
{
_decorator
,
Component
,
Node
,
tween
}
from
"cc"
;
import
{
PropBtn
}
from
"../Components/PropBtn"
;
import
{
MainGame
}
from
"../MainGame"
;
import
{
Global
}
from
"../Global"
;
import
{
Target
}
from
"../Components/Target"
;
import
{
EPropType
}
from
"../Common/Enums"
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'SpeedPropBtn'
)
...
...
@@ -15,10 +18,12 @@ export class SpeedPropBtn extends PropBtn {
doUse
()
{
super
.
doUse
();
Target
.
ins
.
updateProgress
(
EPropType
.
SPEED
,
100
)
MainGame
.
ins
.
player
.
moveScale
+=
1
;
tween
(
this
.
node
)
.
delay
(
5
)
.
call
(()
=>
{
.
delay
(
Global
.
PROP_SPEED_DUR_TIME
)
.
call
(()
=>
{
MainGame
.
ins
.
player
.
moveScale
-=
1
;
});
...
...
assets/Scripts/Scenes/MainGame/Props/Length.ts
View file @
6e16ba55
import
{
_decorator
,
Component
,
Node
}
from
'cc'
;
import
{
PropBase
}
from
'./PropBase'
;
import
{
Snake
}
from
'../Snake'
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'Length'
)
...
...
@@ -10,7 +11,8 @@ export class Length extends PropBase {
beEaten
()
{
beEaten
(
target
:
Snake
)
{
target
.
useGrow
()
}
...
...
assets/Scripts/Scenes/MainGame/Props/Speed.ts
View file @
6e16ba55
import
{
_decorator
,
Component
,
Node
}
from
'cc'
;
import
{
PropBase
}
from
'./PropBase'
;
import
{
Snake
}
from
'../Snake'
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'Speed'
)
...
...
@@ -9,8 +10,10 @@ export class Speed extends PropBase {
}
beEaten
(){
beEaten
(
target
:
Snake
)
{
console
.
warn
(
"useDefense"
)
target
.
useSpeed
();
}
update
(
deltaTime
:
number
)
{
...
...
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
6e16ba55
...
...
@@ -21,6 +21,7 @@ import { FoodManger } from "./Manager/FoodManger";
import
{
ECard
,
EPropType
}
from
"./Common/Enums"
;
import
{
Player
}
from
"./Player"
;
import
gameStore
from
"../../store/gameStore"
;
import
{
Target
}
from
"./Components/Target"
;
const
{
ccclass
,
property
}
=
_decorator
;
...
...
@@ -540,35 +541,35 @@ export class Snake extends Component {
this
.
clearMagnet
();
this
.
magnetEffectNode
.
active
=
true
;
this
.
magnetEffectNode
.
getComponent
(
Animation
).
play
();
this
.
eatCollider
.
radius
=
240
;
this
.
eatCollider
.
radius
=
Global
.
PROP_MAGNET_RADIUS
;
this
.
magnetTw
=
tween
(
this
)
.
delay
(
10
)
.
delay
(
Global
.
PROP_MAGNET_DUR_TIME
)
.
call
(()
=>
{
this
.
clearMagnet
();
})
.
start
();
}
//
flushMagnet() {
// FoodManger.ins.node.children.forEach((child) => {
// const propTs = child.getComponent(PropBase);
// if (propTs.canEaten) {
// propTs.canEaten = false;
// Tween.stopAllByTarget(child);
// tween(child)
// .to(0.5, {
// position: this.head.getPosition(),
// })
// .call(() => {
// if (this.isLife) {
// propTs.beEaten(this);
// }
// propTs.recycle();
// })
// .start();
// }
// });
//
}
flushMagnet
()
{
// FoodManger.ins.node.children.forEach((child) => {
// const propTs = child.getComponent(PropBase);
// if (propTs.canEaten) {
// propTs.canEaten = false;
// Tween.stopAllByTarget(child);
// tween(child)
// .to(0.5, {
// position: this.head.getPosition(),
// })
// .call(() => {
// if (this.isLife) {
// propTs.beEaten(this);
// }
// propTs.recycle();
// })
// .start();
// }
// });
}
clearMagnet
()
{
this
.
magnetTw
?.
removeSelf
();
...
...
@@ -607,8 +608,7 @@ export class Snake extends Component {
this
.
defenseEffectNode
.
active
=
true
;
this
.
defenseEffectNode
.
getComponent
(
Animation
).
resume
()
this
.
defenseEffectNode
.
getComponent
(
Animation
).
pause
()
this
.
defenseTw
=
tween
(
this
)
.
delay
(
this
.
invincibleTime
-
Global
.
PROP_SHIELD_INVINCIBLE_TIME
)
this
.
defenseTw
=
tween
(
this
).
delay
(
this
.
invincibleTime
-
Global
.
PROP_SHIELD_INVINCIBLE_TIME
)
.
call
(()
=>
{
this
.
defenseEffectNode
.
getComponent
(
Animation
).
play
();
})
...
...
@@ -619,6 +619,11 @@ export class Snake extends Component {
.
start
();
}
onUpdateDefense
()
{
console
.
warn
(
"xxx"
)
}
breakDefense
()
{
if
(
this
.
invincibleTime
<=
Global
.
PROP_SHIELD_INVINCIBLE_TIME
)
return
;
/**3s内继续走无敌 */
...
...
@@ -634,7 +639,30 @@ export class Snake extends Component {
}
/***************************** 加速 ***************************/
/**
* 使用加速道具
*/
useSpeed
()
{
this
.
moveScale
=
2
;
tween
(
this
.
node
)
.
delay
(
Global
.
PROP_SPEED_DUR_TIME
)
.
call
(()
=>
{
this
.
moveScale
=
1
;
});
}
/***************************** 加长 ***************************/
useGrow
()
{
this
.
addEnergy
(
Global
.
PROP_ADD_LENGTH
)
}
/***************************** 双倍 ***************************/
useDouble
()
{
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment