mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-28 18:25:18 +00:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using QSB.WorldSync;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.MeteorSync.WorldObjects;
|
|
|
|
public class QSBMeteor : WorldObject<MeteorController>
|
|
{
|
|
public static bool IsSpecialImpact(GameObject go) =>
|
|
go == Locator.GetPlayerCollider().gameObject ||
|
|
Locator.GetProbe() != null && go == Locator.GetProbe()._anchor._collider.gameObject;
|
|
|
|
public void SpecialImpact()
|
|
{
|
|
AttachedObject._intactRenderer.enabled = false;
|
|
AttachedObject._impactLight.enabled = true;
|
|
AttachedObject._impactLight.intensity = AttachedObject._impactLightCurve.Evaluate(0f);
|
|
foreach (var impactParticle in AttachedObject._impactParticles)
|
|
{
|
|
impactParticle.Play();
|
|
}
|
|
|
|
AttachedObject._impactSource.PlayOneShot(AudioType.BH_MeteorImpact);
|
|
foreach (var owCollider in AttachedObject._owColliders)
|
|
{
|
|
owCollider.SetActivation(false);
|
|
}
|
|
|
|
AttachedObject._owRigidbody.MakeKinematic();
|
|
FragmentSurfaceProxy.UntrackMeteor(AttachedObject);
|
|
FragmentCollisionProxy.UntrackMeteor(AttachedObject);
|
|
AttachedObject._ignoringCollisions = false;
|
|
AttachedObject._hasImpacted = true;
|
|
AttachedObject._impactTime = Time.time;
|
|
}
|
|
}
|