Crumble
namespace Griff.Scenes;
public sealed class Crumble : Component, IDrawEffectA platform that gives way, with no code: once something on its Layers stands on it, it shakes for Delay seconds and falls away, coming back Respawn seconds later. Needs a collider.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Crumbled
Section titled “Crumbled”public bool Crumbled { get; set; }True while it’s gone (its entity is hidden). Saved, so it stays gone when the game rewinds.
public float Delay { get; set; }Seconds it shakes, once stood on, before it falls away.
Effect
Section titled “Effect”public string? Effect { get; set; }A prefab spawned where it was as it falls away, e.g. a burst of “Rubble”.
IsShaking
Section titled “IsShaking”public bool IsShaking { get; }True while it’s shaking, about to go.
Layers
Section titled “Layers”public string? Layers { get; set; }The collision layers that set it off by standing on it, e.g. “Player”. Empty is any body.
Respawn
Section titled “Respawn”public float Respawn { get; set; }Seconds until it comes back. 0 never comes back.
ShakeOffset
Section titled “ShakeOffset”public Vector2 ShakeOffset { get; }How far it’s shaken off its place right now; it’s drawn there, while its collider stays put.
public string? Sound { get; set; }A sound played as it falls away, e.g. “Sounds/crumble.wav”.
Methods
Section titled “Methods”AcceptsLayer
Section titled “AcceptsLayer”public bool AcceptsLayer(string? layer)True if something on collision layer layer sets it off.
Events
Section titled “Events”public event Action<Crumble>? FellRaised when it falls away.
Returned
Section titled “Returned”public event Action<Crumble>? ReturnedRaised when it comes back.