Nextrek
Diff Revisions
167
vs
168
for /3DSpace/Assets/SpaceUnity/_Demo/Scrips/SU_Spaceship.cs
|
@@ -67,7 +67,7 @@ |
67 |
67 |
|
} |
68 |
68 |
|
|
69 |
69 |
|
// Cache reference to rigidbody to improve performance |
70 |
|
- |
_cacheRigidbody = rigidbody; |
|
70 |
+ |
_cacheRigidbody = GetComponent<Rigidbody>(); |
71 |
71 |
|
if (_cacheRigidbody == null) |
72 |
72 |
|
{ |
73 |
73 |
|
Debug.LogError("Spaceship has no rigidbody - the thruster scripts will fail. Add rigidbody component to the spaceship."); |
|
@@ -97,7 +97,7 @@ |
97 |
97 |
|
// Play sound effect when firing |
98 |
98 |
|
if (soundEffectFire[weaponType] != null) |
99 |
99 |
|
{ |
100 |
|
- |
audio.PlayOneShot(soundEffectFire[weaponType]); |
|
100 |
+ |
GetComponent<AudioSource>().PlayOneShot(soundEffectFire[weaponType]); |
101 |
101 |
|
} |
102 |
102 |
|
} |
103 |
103 |
|
} |