Skip to content

Commit 5a70e60

Browse files
committed
完成漂移测试
1 parent 39c5d41 commit 5a70e60

12 files changed

+1202
-1225
lines changed

CrazyCar/Assembly-CSharp-Editor.csproj

Lines changed: 250 additions & 256 deletions
Large diffs are not rendered by default.

CrazyCar/Assembly-CSharp-firstpass.csproj

Lines changed: 235 additions & 241 deletions
Large diffs are not rendered by default.

CrazyCar/Assembly-CSharp.csproj

Lines changed: 235 additions & 241 deletions
Large diffs are not rendered by default.

CrazyCar/Assets/Scripts/Common/MPlayer.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,20 @@ void Update() {
6868
hInput = Input.GetAxisRaw("Horizontal");
6969
}
7070

71-
if ((Input.GetKey(KeyCode.Space) || sInput > 0) && currentForce > 0) {
72-
if (isGround && !isDrifting &&
73-
rig.velocity.sqrMagnitude > 10) {
71+
if (((Input.GetKey(KeyCode.Space) && isUseKeyboard) || (sInput > 0 && !isUseKeyboard)) && currentForce > 0) {
72+
if (isGround && !isDrifting && rig.velocity.sqrMagnitude > 10) {
7473
StartDrift();
7574
}
7675
}
7776

78-
if (Input.GetKeyUp(KeyCode.Space) || sInput == 0) {
77+
if ((Input.GetKeyUp(KeyCode.Space) && isUseKeyboard) || (sInput == 0 && !isUseKeyboard)) {
7978
if (isDrifting) {
8079
Boost(boostForce);
8180
StopDrift();
8281
}
8382
}
83+
// 不能放在FixedUpdate 加速时间太短
84+
ShowScreenEffect();
8485
}
8586

8687
public void ConfirmStatus(PlayerStateMsg playerStateMsg) {
@@ -111,6 +112,14 @@ private void FixedUpdate() {
111112
}
112113
}
113114

115+
private void ShowScreenEffect() {
116+
if (leftTrail.enabled == true) {
117+
EnableScreenEffect();
118+
} else {
119+
DisableScreenEffect();
120+
}
121+
}
122+
114123
public void AdjustPlayerPosition(Vector3 pos) {
115124
peerTargetPos = pos;
116125
}
@@ -176,10 +185,9 @@ private void ReduceForce() {
176185
}
177186

178187
if (currentForce <= normalForce) {
179-
DisableScreenEffect();
180188
DisableTrail();
189+
}
181190

182-
}
183191
currentForce = Mathf.MoveTowards(currentForce, targetForce, 60 * Time.fixedDeltaTime);//每秒60递减,可调
184192
}
185193

@@ -233,7 +241,6 @@ private void StartDrift() {
233241
driftDirection = DriftDirection.Right;
234242
m_DriftOffset = Quaternion.Euler(0f, -30, 0f);
235243
}
236-
237244
PlayDriftParticle();
238245
}
239246

@@ -261,7 +268,6 @@ private void StopDrift() {
261268
private void Boost(float boostForce) {
262269
//按照漂移等级加速:1 / 1.1 / 1.2
263270
currentForce = (1 + (int)driftLevel / 10) * boostForce;
264-
EnableScreenEffect();
265271
EnableTrail();
266272
}
267273

CrazyCar/Assets/StreamingAssets/avatar.manifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ManifestFileVersion: 0
2-
CRC: 2609764841
2+
CRC: 2776471209
33
Hashes:
44
AssetFileHash:
55
serializedVersion: 2
6-
Hash: d1d41fdc0a1697887adb7e6a2e51faca
6+
Hash: b99e280df02593fde9ce4e342f4ea477
77
TypeTreeHash:
88
serializedVersion: 2
99
Hash: c90fc19e2679e5295d10bd00f33cb4c3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"avatar":"9370cfe1c8e8884648f086b820bca347","equip":"6e255c8279db8f8436b31738cd57e50d"}
1+
{"avatar":"9370cfe1c8e8884648f086b820bca347","equip":"0dc989fbf1109552e44cb6d6ac3ca5d7"}

CrazyCar/Assets/StreamingAssets/equip.manifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ManifestFileVersion: 0
2-
CRC: 675956164
2+
CRC: 1362249926
33
Hashes:
44
AssetFileHash:
55
serializedVersion: 2
6-
Hash: ce56992c59052a40fd931403a68e4f88
6+
Hash: f640d8e3481bd3a16a0c80fb55a5bd0a
77
TypeTreeHash:
88
serializedVersion: 2
99
Hash: 4d5164c33b6ba89d8440f356dc2efae8
-23.8 KB
Binary file not shown.

CrazyCar/ProjectSettings/GraphicsSettings.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ GraphicsSettings:
3838
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
3939
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
4040
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
41+
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
4142
m_PreloadedShaders: []
4243
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
4344
type: 0}

CrazyCar/UnityWebSocket.Editor.csproj

Lines changed: 234 additions & 240 deletions
Large diffs are not rendered by default.

CrazyCar/UnityWebSocket.Runtime.csproj

Lines changed: 228 additions & 234 deletions
Large diffs are not rendered by default.
Binary file not shown.

0 commit comments

Comments
 (0)