Disable kill streak contributions for furniture

This commit is contained in:
Jens Pitkänen 2019-08-22 22:50:50 +03:00
parent d2ceb75736
commit a5be7dbcec
9 changed files with 19 additions and 11 deletions

View File

@ -144,6 +144,7 @@ MonoBehaviour:
BodypartMinCount: 2
BodypartMaxCount: 4
DebrisType: 0
IsFurniture: 0
--- !u!114 &3362493323285318061
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -164,6 +164,7 @@ MonoBehaviour:
BodypartMinCount: 2
BodypartMaxCount: 4
DebrisType: 0
IsFurniture: 0
--- !u!114 &3362493323285318061
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -358,6 +358,7 @@ MonoBehaviour:
BodypartMinCount: 2
BodypartMaxCount: 4
DebrisType: 0
IsFurniture: 0
--- !u!114 &4655711410523782340
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -108,7 +108,7 @@ namespace Saltosion.OneWeapon.AI.Behaviours {
Health.Damage(Damage, Direction, false);
}
}
Explodable.Explode(true);
Explodable.Explode(true, false);
}
}
}

View File

@ -10,6 +10,7 @@ namespace Saltosion.OneWeapon.Effects {
public float BodypartMinCount = 1;
public float BodypartMaxCount = 1;
public DebrisType DebrisType;
public bool IsFurniture = true;
private CameraFX CameraFX;
private PlayerFun PlayerFun;
@ -35,11 +36,11 @@ namespace Saltosion.OneWeapon.Effects {
private void Update() {
if (DebugExplode) {
DebugExplode = false;
Explode(false);
Explode(false, false);
}
}
public void Explode(bool destroyGameObject) {
public void Explode(bool destroyGameObject, bool causedByPlayerAttack) {
// 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 (destroyGameObject && DestroyedAlready) {
@ -66,8 +67,12 @@ namespace Saltosion.OneWeapon.Effects {
DebrisLauncher.Splatter(DebrisType, transform.position + (Vector3)Direction * 0.5f, Vector2.zero, ParticlesPerBodypart, 50f, 360f);
}
if (causedByPlayerAttack) {
if (!IsFurniture) {
PlayerFun.GainKill();
PlayerFun.Explosion(false);
}
PlayerFun.Explosion(IsFurniture);
}
CameraFX.ScreenShake(10);
if (destroyGameObject) {

View File

@ -18,11 +18,11 @@ namespace Saltosion.OneWeapon.Enemies {
Explodable = GetComponent<Explodable>();
}
public void Damage(float amount, Vector2 fromDirection, bool applyPlayerDamageBoost) {
public void Damage(float amount, Vector2 fromDirection, bool causedByPlayerAttack) {
DebrisLauncher.Splatter(DebrisType.Blood, transform.position, -fromDirection, (int)(amount), 100f, 100);
CurrentHealth -= amount * (1 + (applyPlayerDamageBoost ? PlayerFun.CurrentDamageBoost : 0.0f));
CurrentHealth -= amount * (1 + (causedByPlayerAttack ? PlayerFun.CurrentDamageBoost : 0.0f));
if (CurrentHealth <= 0) {
Explodable.Explode(true);
Explodable.Explode(true, causedByPlayerAttack);
}
}
}

View File

@ -60,7 +60,7 @@ namespace Saltosion.OneWeapon.Environment {
}
if (GunsLeft == 0) {
if (ExplodeOnEmpty) {
Explodable.Explode(true);
Explodable.Explode(true, true);
}
Destroy(this);
}

View File

@ -21,7 +21,7 @@ namespace Saltosion.OneWeapon.Guns {
} else if (VendingMachine != null) {
VendingMachine.ExpelGun();
} else if (Explodable != null) {
Explodable.Explode(true);
Explodable.Explode(true, true);
} else if (Collider.tag == "Environment") {
DebrisLauncher.Splatter(DebrisType.Structural, transform.position, Direction, (int)(5 * Intensity), 30 * Intensity, 360);
}

View File

@ -27,7 +27,7 @@ namespace Saltosion.OneWeapon.Player {
} else if (VendingMachine != null) {
VendingMachine.ExpelGun();
} else if (Explodable != null) {
Explodable.Explode(true);
Explodable.Explode(true, true);
}
}
}