コード例 #1
0
    public void CheckSpringDirection()
    {
        Bounds  b          = bounds;
        Vector3 constraint = mPanel.CalculateConstrainOffset(b.min, b.max);

        constraint.y = 0f;

        if (constraint.magnitude > 1f)
        {
            if (constraint.x < 0f)
            {
                if (mSpringDirection == ESPRING_DIRECTION.None)
                {
                    //Debug.Log("Direction : Left");
                    mSpringDirection = ESPRING_DIRECTION.Left;
                }
            }
            else
            {
                if (mSpringDirection == ESPRING_DIRECTION.None)
                {
                    //Debug.Log("Direction : Right");
                    mSpringDirection = ESPRING_DIRECTION.Right;
                }
            }
        }
        else
        {
            mSpringDirection = ESPRING_DIRECTION.None;
        }
    }
コード例 #2
0
    public void DisableSpring()
    {
        SpringPanel sp = GetComponent <SpringPanel>();

        if (sp != null)
        {
            sp.enabled = false;
        }
        mSpringDirection = ESPRING_DIRECTION.None;
    }