2022-03-11 13:40:52 +00:00
|
|
|
|
using QSB.WorldSync;
|
2021-11-14 00:57:06 +00:00
|
|
|
|
using UnityEngine;
|
2021-11-11 02:40:02 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.MeteorSync.WorldObjects;
|
|
|
|
|
|
|
|
|
|
public class QSBMeteor : WorldObject<MeteorController>
|
2021-11-11 02:40:02 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public static bool IsSpecialImpact(GameObject go) =>
|
2022-03-11 03:38:59 +00:00
|
|
|
|
go == Locator.GetPlayerCollider().gameObject ||
|
|
|
|
|
Locator.GetProbe() != null && go == Locator.GetProbe()._anchor._collider.gameObject;
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public void SpecialImpact()
|
|
|
|
|
{
|
|
|
|
|
AttachedObject._intactRenderer.enabled = false;
|
|
|
|
|
AttachedObject._impactLight.enabled = true;
|
|
|
|
|
AttachedObject._impactLight.intensity = AttachedObject._impactLightCurve.Evaluate(0f);
|
2022-03-11 03:38:59 +00:00
|
|
|
|
foreach (var impactParticle in AttachedObject._impactParticles)
|
2022-02-25 06:04:54 +00:00
|
|
|
|
{
|
2022-03-11 03:38:59 +00:00
|
|
|
|
impactParticle.Play();
|
2022-03-03 03:46:33 +00:00
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
AttachedObject._impactSource.PlayOneShot(AudioType.BH_MeteorImpact);
|
|
|
|
|
foreach (var owCollider in AttachedObject._owColliders)
|
|
|
|
|
{
|
|
|
|
|
owCollider.SetActivation(false);
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
2022-03-03 03:46:33 +00:00
|
|
|
|
|
|
|
|
|
AttachedObject._owRigidbody.MakeKinematic();
|
|
|
|
|
FragmentSurfaceProxy.UntrackMeteor(AttachedObject);
|
|
|
|
|
FragmentCollisionProxy.UntrackMeteor(AttachedObject);
|
|
|
|
|
AttachedObject._ignoringCollisions = false;
|
|
|
|
|
AttachedObject._hasImpacted = true;
|
|
|
|
|
AttachedObject._impactTime = Time.time;
|
2021-11-11 02:40:02 +00:00
|
|
|
|
}
|
2022-03-11 03:17:06 +00:00
|
|
|
|
}
|