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
3aaa6993
Commit
3aaa6993
authored
Nov 21, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
a0ce4989
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
319 additions
and
307 deletions
+319
-307
AISnake.ts
assets/Scripts/Scenes/MainGame/AISnake.ts
+10
-1
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+309
-306
No files found.
assets/Scripts/Scenes/MainGame/AISnake.ts
View file @
3aaa6993
...
...
@@ -41,6 +41,15 @@ export class AISnake extends Snake {
private
assistTarget
:
AISnake
=
null
;
// 正在协助的AI蛇
death
()
{
super
.
death
();
this
.
node
.
removeFromParent
();
this
.
destroy
();
MainGame
.
ins
.
initAnimal
(
1
);
}
private
get
difficultyParams
()
{
return
{
reactionTime
:
math
.
lerp
(
0.8
,
0.2
,
(
this
.
difficulty
-
1
)
/
4
),
...
...
@@ -560,7 +569,7 @@ export class AISnake extends Snake {
}
private
executeEscaping
()
{
if
(
!
this
.
escapeTarget
)
{
if
(
!
this
.
escapeTarget
?.
isLife
)
{
// 如果没有特定的逃离目标,检查并避开所有潜在威胁
this
.
avoidAllThreats
();
return
;
...
...
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
3aaa6993
...
...
@@ -154,6 +154,8 @@ export class Snake extends Component {
.
call
(()
=>
{
PoolManager
.
instance
.
putNode
(
otherCollider
.
node
);
if
(
!
this
.
isLife
)
return
;
if
(
foodType
==
FoodType
.
FOOD
)
{
this
.
addEnergy
(
1
);
}
...
...
@@ -306,6 +308,7 @@ export class Snake extends Component {
this
.
node
.
active
=
false
;
this
.
initFond
(
this
.
bodyArr
.
length
);
}
protected
getNewPos
(
angle
:
number
,
dt
:
number
,
currentPos
:
Vec3
,
speed
:
number
=
this
.
speed
):
Vec3
{
...
...
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