36 lines
1.1 KiB
C#
Raw Normal View History

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