public static void TryApplyTo(Transform transform, IntVector2 directionOfSliding) { var actor = transform.entity; if (!actor.HasSlidingEntityModifier() && directionOfSliding != IntVector2.Zero // No walls ahead && !transform.HasBlockRelative(directionOfSliding, Layers.BLOCK)) { SlidingEntityModifier.AddTo(actor, directionOfSliding); Preset(actor); Sliding.AppliedPath.GetIfExists(actor)?.Pass(actor); } }
public static bool Enter(Entity actor, CellMovementContext context) { if (!actor.TryGetSlipperyComponent(out var slippery) || actor.IsDead()) { return(false); } // TODO: check stats if (context.transform.layer.HasEitherFlag(TargetedLayer) && context.HasNotMoved()) { SlidingEntityModifier.TryApplyTo(context.transform, context.direction); } return(true); }