Commit 3d7c9bb6 authored by haiyoucuv's avatar haiyoucuv

GuideLayer

parent 82b0f61a
...@@ -3369,15 +3369,15 @@ ...@@ -3369,15 +3369,15 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 5, "x": 5,
"y": 0, "y": 0.5,
"z": 2.8 "z": 2.8
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 1.7347234759768069e-18, "x": 0,
"y": 0.49999999999999994, "y": 0.5056662096028154,
"z": 3.004629197474319e-18, "z": 0,
"w": 0.8660254037844387 "w": 0.8627292069160065
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -3390,8 +3390,8 @@ ...@@ -3390,8 +3390,8 @@
"_euler": { "_euler": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 60, "y": 60.751173663453024,
"z": 3.975693351829396e-16 "z": 0
}, },
"_id": "06+Blx3VBJcKGdRFbBnVpe" "_id": "06+Blx3VBJcKGdRFbBnVpe"
}, },
...@@ -3540,7 +3540,7 @@ ...@@ -3540,7 +3540,7 @@
"followOffset": { "followOffset": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 5, "x": 5,
"y": -0.5, "y": 0,
"z": 2.8 "z": 2.8
}, },
"followDamping": 0, "followDamping": 0,
......
import { import {
_decorator, Collider, CollisionEventType, color, Color, easing, ICollisionEvent, _decorator,
Collider,
Color,
easing,
ICollisionEvent,
Input, Input,
input, input,
instantiate, ITriggerEvent, Label, Light, instantiate,
Node, ParticleSystem, PhysicsGroup, PhysicsSystem, ITriggerEvent,
Label,
Light,
Node,
ParticleSystem,
PhysicsSystem,
PointToPointConstraint, PointToPointConstraint,
Prefab, Prefab,
primitives, RigidBody,
RigidBody, Tween, tween, Tween,
tween,
v3, v3,
Vec3, Vec3,
} from "cc"; } from "cc";
...@@ -15,7 +25,7 @@ import Scene from "db://assets/Module/Scene"; ...@@ -15,7 +25,7 @@ import Scene from "db://assets/Module/Scene";
import { ImprovedNoise } from "../../Utils/ImprovedNoise"; import { ImprovedNoise } from "../../Utils/ImprovedNoise";
import { Wall } from "./Wall"; import { Wall } from "./Wall";
import { sleep } from "../../Utils/Utils"; import { sleep } from "../../Utils/Utils";
import { MainColor, randomManColor } from "./Config"; import { randomManColor } from "./Config";
const {ccclass, property} = _decorator; const {ccclass, property} = _decorator;
...@@ -43,7 +53,18 @@ export class MainGame extends Scene { ...@@ -43,7 +53,18 @@ export class MainGame extends Scene {
@property({type: Label, group: "UI"}) scoreLabel: Label = null; @property({type: Label, group: "UI"}) scoreLabel: Label = null;
_score: number = 0; private _propScore: number = 0;
set propScore(value: number) {
this._propScore = value;
this.updateScore();
}
get propScore() {
return this._propScore;
}
private _score: number = 0;
set score(value: number) { set score(value: number) {
this._score = value; this._score = value;
this.scoreLabel.string = value.toString(); this.scoreLabel.string = value.toString();
...@@ -114,7 +135,7 @@ export class MainGame extends Scene { ...@@ -114,7 +135,7 @@ export class MainGame extends Scene {
this.changeMainColor(color); this.changeMainColor(color);
} else if (otherName == "圆环") { } else if (otherName == "圆环") {
otherCollider.node.active = false; otherCollider.node.active = false;
this.score += 10; this.propScore += 10;
} }
} }
...@@ -271,13 +292,16 @@ export class MainGame extends Scene { ...@@ -271,13 +292,16 @@ export class MainGame extends Scene {
maxZ = 0; maxZ = 0;
updateScore() {
this.score = ~~(this.maxZ * 10) + this.propScore;
}
update(dt: number) { update(dt: number) {
const pPos = this.player.position; const pz = -this.player.position.z;
const pz = Math.abs(Math.round(pPos.z));
if (pz > this.maxZ) { if (pz > this.maxZ) {
this.score += pz - this.maxZ;
this.maxZ = pz; this.maxZ = pz;
this.updateScore();
} }
this.checkFrame++; this.checkFrame++;
......
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