示例#1
0
    public bool checkPush(Direction direction, int force)
    {
        GameObject next = faces[(int)direction];
        if (next != null)
        {
            force--;
            if(next.tag == "pushable" && force >= 0)
            {
                attached = next.GetComponent<Movement>();
                if (attached.checkPush(direction, force))
                {
                    moving = direction;
                    return true;
                }else
                {
                    attached = null;
                    return false;
                }

            }
            else
            {
                return false;
            }
        } else
        {
            return true;
        }
    }