Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car
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
car
Commits
c5bdc215
Commit
c5bdc215
authored
May 29, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
c1aca8f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
82 deletions
+9
-82
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+3
-3
RoleCarColorsSysterm.ts
assets/CarColorsGame/Scrips/Systerms/RoleCarColorsSysterm.ts
+6
-79
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
c5bdc215
...
@@ -1805,10 +1805,10 @@
...
@@ -1805,10 +1805,10 @@
},
},
"_lrot": {
"_lrot": {
"__type__": "cc.Quat",
"__type__": "cc.Quat",
"x":
0
,
"x":
-0.08715574274765817
,
"y": 0,
"y": 0,
"z": 0,
"z": 0,
"w":
1
"w":
0.9961946980917455
},
},
"_lscale": {
"_lscale": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
...
@@ -1820,7 +1820,7 @@
...
@@ -1820,7 +1820,7 @@
"_layer": 1073741824,
"_layer": 1073741824,
"_euler": {
"_euler": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x":
-1
0,
"y": 0,
"y": 0,
"z": 0
"z": 0
},
},
...
...
assets/CarColorsGame/Scrips/Systerms/RoleCarColorsSysterm.ts
View file @
c5bdc215
...
@@ -62,61 +62,6 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -62,61 +62,6 @@ export class RoleCarColorsSysterm extends Component {
},
1
)
},
1
)
}
}
refreshRoleLine
()
{
const
points
=
find
(
"Scene/Parkings"
).
children
let
cars
:
Array
<
Node
>
=
[]
for
(
let
i
=
points
.
length
;
i
--
;)
{
if
(
points
[
i
].
name
===
"inuse"
&&
points
[
i
].
children
.
length
===
2
)
{
cars
.
push
(
points
[
i
].
children
[
1
])
}
}
let
colors
:
Array
<
CarColors
>
=
[]
for
(
let
i
=
cars
.
length
;
i
--
;)
{
const
car
=
cars
[
i
]
const
carComp
=
car
.
getComponent
(
CarCarColorsComponent
)
let
num
=
10
if
(
carComp
.
carType
===
CarTypes
.
Minivan
)
{
num
=
6
}
else
if
(
carComp
.
carType
===
CarTypes
.
Sedan
)
{
num
=
4
}
num
-=
carComp
.
roleNum
console
.
log
(
num
)
for
(;
num
--
;)
{
// console.log(num)
colors
.
push
(
carComp
.
carColor
)
}
}
console
.
log
(
colors
.
length
)
const
roles
=
find
(
"Scene/Roles"
).
children
for
(
let
i
=
0
;
i
<
colors
.
length
;
i
++
)
{
if
(
i
>=
roles
.
length
)
{
break
}
const
roleCom
=
roles
[
i
].
getComponent
(
RoleCarColorsComponent
)
if
(
roleCom
.
color
!==
colors
[
i
])
{
const
colorIndex
=
CarColorsGlobalInstance
.
instance
.
carSysterm
.
carSeats
.
lastIndexOf
(
colors
[
i
])
// 存量未找到,从队列中找
if
(
colorIndex
===
-
1
)
{
for
(
let
j
=
roles
.
length
;
j
--
;)
{
if
(
roles
[
j
].
getComponent
(
RoleCarColorsComponent
).
color
===
colors
[
i
])
{
roles
[
j
].
getComponent
(
RoleCarColorsComponent
).
color
=
roleCom
.
color
break
}
}
}
else
{
CarColorsGlobalInstance
.
instance
.
carSysterm
.
carSeats
[
colorIndex
]
=
roleCom
.
color
}
roleCom
.
color
=
colors
[
i
]
}
}
this
.
isGaming
=
true
}
addRoleToLine
()
{
addRoleToLine
()
{
const
rolesNode
=
find
(
"Scene/Roles"
)
const
rolesNode
=
find
(
"Scene/Roles"
)
...
@@ -141,24 +86,6 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -141,24 +86,6 @@ export class RoleCarColorsSysterm extends Component {
}
}
}
}
unlockParkPoint
()
{
const
points
=
find
(
"Scene/Parkings"
).
children
if
(
points
[
5
].
name
===
"lock"
)
{
points
[
5
].
name
=
"empty"
points
[
5
].
children
[
0
].
children
[
0
].
active
=
true
points
[
5
].
children
[
0
].
children
[
1
].
active
=
false
return
}
if
(
points
[
6
].
name
===
"lock"
)
{
points
[
6
].
name
=
"empty"
points
[
6
].
children
[
0
].
children
[
0
].
active
=
true
points
[
6
].
children
[
0
].
children
[
1
].
active
=
false
return
}
}
// 上客
// 上客
moveToCar
()
{
moveToCar
()
{
const
roles
=
[...
find
(
"Scene/Roles"
).
children
]
const
roles
=
[...
find
(
"Scene/Roles"
).
children
]
...
@@ -264,7 +191,7 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -264,7 +191,7 @@ export class RoleCarColorsSysterm extends Component {
roleCom
.
playIdle
()
roleCom
.
playIdle
()
roleCom
.
isHorizon
=
false
roleCom
.
isHorizon
=
false
role
.
setRotationFromEuler
(
-
40
,
0
,
0
)
role
.
setRotationFromEuler
(
-
40
,
0
,
0
)
role
.
setPosition
(
-
10
,
0
,
-
6
-
index
*
2
)
role
.
setPosition
(
4.5
,
0
,
-
6
-
index
*
2
)
return
return
}
}
...
@@ -273,7 +200,7 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -273,7 +200,7 @@ export class RoleCarColorsSysterm extends Component {
let
wpos
=
role
.
getWorldPosition
()
let
wpos
=
role
.
getWorldPosition
()
let
forward
=
new
Vec3
(
0
,
0
,
-
1
)
let
forward
=
new
Vec3
(
0
,
0
,
-
1
)
if
(
roleCom
.
isHorizon
)
{
if
(
roleCom
.
isHorizon
)
{
forward
=
new
Vec3
(
-
1
,
0
,
0
)
forward
=
new
Vec3
(
1
,
0
,
0
)
}
}
const
add
=
forward
.
clone
().
multiplyScalar
(
dt
*
-
20
)
const
add
=
forward
.
clone
().
multiplyScalar
(
dt
*
-
20
)
...
@@ -292,17 +219,17 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -292,17 +219,17 @@ export class RoleCarColorsSysterm extends Component {
pos
.
add
(
add
)
pos
.
add
(
add
)
// 到达终点判定
// 到达终点判定
if
(
roleCom
.
isHorizon
&&
pos
.
x
>
0
)
{
if
(
roleCom
.
isHorizon
&&
pos
.
x
<
-
6
)
{
roleCom
.
playIdle
()
roleCom
.
playIdle
()
roleCom
.
isIntarget
=
true
roleCom
.
isIntarget
=
true
role
.
setRotationFromEuler
(
-
40
,
0
,
0
)
role
.
setRotationFromEuler
(
-
40
,
0
,
0
)
role
.
setPosition
(
0
,
0
,
0.2
)
role
.
setPosition
(
-
6
,
0
,
0.2
)
return
return
}
else
if
(
!
roleCom
.
isHorizon
&&
pos
.
z
>
0
)
{
}
else
if
(
!
roleCom
.
isHorizon
&&
pos
.
z
>
0
)
{
roleCom
.
playIdle
()
roleCom
.
playIdle
()
roleCom
.
isHorizon
=
true
roleCom
.
isHorizon
=
true
role
.
setRotationFromEuler
(
0
,
90
,
-
30
)
role
.
setRotationFromEuler
(
0
,
-
90
,
30
)
role
.
setPosition
(
-
10
,
0
,
0
)
role
.
setPosition
(
4.5
,
0
,
0
)
return
return
}
}
if
(
role
.
getComponent
(
RoleCarColorsComponent
).
status
===
"sit"
)
return
if
(
role
.
getComponent
(
RoleCarColorsComponent
).
status
===
"sit"
)
return
...
...
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