Fix enemies exploding more than once and misc
This commit is contained in:
parent
4e2449aa68
commit
b83e516940
@ -26,7 +26,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 6729850174041497321}
|
m_GameObject: {fileID: 6729850174041497321}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -19.990198, y: 7.5981717, z: -12.029297}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -61,5 +61,5 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
SubBullet: {fileID: 4482402865533696887, guid: 6895e4efeafdc3a4f8f4296856a389fc,
|
SubBullet: {fileID: 4482402865533696887, guid: 6895e4efeafdc3a4f8f4296856a389fc,
|
||||||
type: 3}
|
type: 3}
|
||||||
BulletsShot: 5
|
BulletsShot: 8
|
||||||
TotalArc: 90
|
TotalArc: 90
|
||||||
|
@ -9611,7 +9611,7 @@ MonoBehaviour:
|
|||||||
Sprite: {fileID: 5552990435088311320}
|
Sprite: {fileID: 5552990435088311320}
|
||||||
Trail: {fileID: 4595570391660610945}
|
Trail: {fileID: 4595570391660610945}
|
||||||
Explosion: {fileID: 6411602551704027216}
|
Explosion: {fileID: 6411602551704027216}
|
||||||
Damage: 3.7
|
Damage: 2.5
|
||||||
--- !u!1 &5552990435088311320
|
--- !u!1 &5552990435088311320
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -14,6 +14,8 @@ namespace Saltosion.OneWeapon.Effects {
|
|||||||
private CameraFX CameraFX;
|
private CameraFX CameraFX;
|
||||||
private PlayerFun PlayerFun;
|
private PlayerFun PlayerFun;
|
||||||
|
|
||||||
|
private bool DestroyedAlready = false;
|
||||||
|
|
||||||
private void Start() {
|
private void Start() {
|
||||||
foreach (GameObject Obj in BodypartPrefabs) {
|
foreach (GameObject Obj in BodypartPrefabs) {
|
||||||
Rigidbody2D Body = Obj.GetComponent<Rigidbody2D>();
|
Rigidbody2D Body = Obj.GetComponent<Rigidbody2D>();
|
||||||
@ -36,6 +38,16 @@ namespace Saltosion.OneWeapon.Effects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Explode(bool destroyGameObject) {
|
public void Explode(bool destroyGameObject) {
|
||||||
|
if (destroyGameObject) {
|
||||||
|
// Destroying the object during explosion implies that it can explode only once,
|
||||||
|
// but Destroy() doesn't happen instantly, so here's a guard for that.
|
||||||
|
if (DestroyedAlready) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
DestroyedAlready = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Count = (int)(BodypartMinCount + (BodypartMaxCount - BodypartMinCount) * Random.value);
|
int Count = (int)(BodypartMinCount + (BodypartMaxCount - BodypartMinCount) * Random.value);
|
||||||
for (int i = 0; i < Count; i++) {
|
for (int i = 0; i < Count; i++) {
|
||||||
GameObject Obj = BodypartPrefabs[i % BodypartPrefabs.Length];
|
GameObject Obj = BodypartPrefabs[i % BodypartPrefabs.Length];
|
||||||
|
Loading…
Reference in New Issue
Block a user