示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }