示例#1
0
    public virtual void ApplyVelocity(Vector3 velocity)
    {
        var rb = Rigidbody;

        if (rb)
        {
            rb.AddForce(velocity, ForceMode.VelocityChange);
        }
        else if (KsidGet.IsChildOf(Ksid.SandLike) && TryGetParentLabel(out var pl) && pl is SandCombiner sandCombiner)
        {
            CollapseSandByForce(velocity, sandCombiner);
        }
    }
示例#2
0
    internal virtual void MoveZ(float newZ)
    {
        var rb = Rigidbody;

        if (rb)
        {
            rb.transform.position = rb.transform.position.WithZ(newZ);
        }
        else
        {
            transform.position = transform.position.WithZ(newZ);
            if (Ksid.IsChildOf(Ksid.SandLike) && TryGetParentLabel(out var pl) && pl is SandCombiner sandCombiner)
            {
                sandCombiner.CollapseNow();
            }
        }
        KinematicMove(Game.Map);
    }