Skip to content

Commit 2fe84ca

Browse files
committed
修复Mplayer的粒子效果
1 parent 1880909 commit 2fe84ca

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CrazyCar/Assets/Prefabs/MPlayer.prefab

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ MonoBehaviour:
316316
waterWaveParticle: {fileID: 5554609525667224409}
317317
driftColors:
318318
- {r: 0.50980395, g: 0.85098046, b: 0.92549026, a: 1}
319-
- {r: 0.21960786, g: 0.21960786, b: 0.21960786, a: 1}
320-
- {r: 1, g: 1, b: 1, a: 1}
321-
- {r: 0.13333334, g: 0.23137257, b: 0.32941177, a: 1}
319+
- {r: 0.9245283, g: 0.6040546, b: 0.13519046, a: 1}
320+
- {r: 0.8980392, g: 0.14126626, b: 0.09019609, a: 1}
321+
- {r: 0.042052314, g: 0.05251596, b: 0.990566, a: 1}
322322
driftPower: 0
323323
plexusVFX: {fileID: 668321200006424457}
324324
--- !u!65 &3226108444913594261
@@ -6037,7 +6037,7 @@ Transform:
60376037
m_PrefabAsset: {fileID: 0}
60386038
m_GameObject: {fileID: 7445944657121216050}
60396039
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
6040-
m_LocalPosition: {x: 0, y: 0, z: 0}
6040+
m_LocalPosition: {x: -0, y: 2.67, z: 0}
60416041
m_LocalScale: {x: 1, y: 1, z: 1}
60426042
m_ConstrainProportionsScale: 0
60436043
m_Children:

CrazyCar/Assets/Scripts/Game/MPlayer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ public void StartDrift() {
288288
//计算漂移等级
289289
private void CalculateDriftingLevel() {
290290
driftPower += Time.fixedDeltaTime;
291+
Debug.LogError("+++++++driftPower = " + driftPower + " driftLevel = " + driftLevel);
291292
//0.7秒提升一个漂移等级
292293
if (driftPower < 0.7) {
293294
driftLevel = DriftLevel.One;

CrazyCar/Assets/Scripts/Game/MPlayerStyle.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ private void FixedUpdate() {
3838
return;
3939
}
4040

41-
if (mPlayer.isDrifting) {
42-
ChangeDriftColor();
43-
}
44-
4541
ShowVFX();
4642
}
4743

@@ -70,6 +66,7 @@ private void ShowVFX() {
7066
if (leftTrail.enabled == true) {
7167
EnableScreenEffect();
7268
PlayDriftParticle();
69+
ChangeDriftColor();
7370
this.GetSystem<ISoundSystem>().PlayWheelEngineSound();
7471
} else {
7572
DisableScreenEffect();
@@ -80,14 +77,18 @@ private void ShowVFX() {
8077

8178
private void PlayDriftParticle() {
8279
foreach (var tempParticle in wheelsParticeles) {
83-
tempParticle.Play();
80+
if (!tempParticle.isPlaying) {
81+
tempParticle.Play();
82+
}
8483
}
8584
plexusVFX.gameObject.SetActiveFast(true);
8685
}
8786

8887
private void StopDriftParticle() {
8988
foreach (var tempParticle in wheelsParticeles) {
90-
tempParticle.Stop();
89+
if (tempParticle.isPlaying) {
90+
tempParticle.Stop();
91+
}
9192
}
9293
plexusVFX.gameObject.SetActiveFast(false);
9394
}

0 commit comments

Comments
 (0)