quantum-space-buddies/QSB/MeteorSync/WorldObjects/QSBMeteor.cs

40 lines
1.2 KiB
C#
Raw Normal View History

using QSB.WorldSync;
2021-11-14 00:57:06 +00:00
using UnityEngine;
2021-11-11 02:40:02 +00:00
namespace QSB.MeteorSync.WorldObjects
2021-11-11 02:40:02 +00:00
{
public class QSBMeteor : WorldObject<MeteorController>
{
public override void SendInitialState(uint to)
{
// todo SendInitialState
}
2021-11-25 15:38:05 +00:00
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 particleSystem in AttachedObject._impactParticles)
{
particleSystem.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;
}
2021-11-11 02:40:02 +00:00
}
}