Пример #1
0
    public void HandleSelfStay(Collider _collider)
    {
        if (!enableSelfScale)
        {
            return;
        }

        if (_collider.gameObject.tag == "GameController")
        {
            // just in case
            if (!m_inSelfScalingMode && !m_inSelfScalingSupportMode)
            {
                otherController = _collider.gameObject.GetComponentInParent <GrabnStretch> ();
                if (otherController.InSelfScalingMode)
                {
                    m_inSelfScalingSupportMode = true;
                }
                else
                {
                    m_inSelfScalingMode = true;
                    firstTouchTime      = Time.time;
                }
            }

            if (m_inSelfScalingMode && otherController.InSelfScalingSupportMode)
            {
                float threshold = firstTouchTime + scaleWaitTime;
                if (Time.time > threshold)
                {
                    isBusySelfScaling = true;
                    ScaleSelf(player);
                }
            }
        }
    }
Пример #2
0
    public void HandleSelfOver(Collider _collider)
    {
        if (!enableSelfScale)
        {
            return;
        }

        if (_collider.gameObject.tag == "GameController")
        {
            otherController = _collider.gameObject.GetComponentInParent <GrabnStretch> ();
            if (otherController.InSelfScalingMode)
            {
                m_inSelfScalingSupportMode = true;
                m_inSelfScalingMode        = false;
//				Debug.Log (_collider.name + ": S_Scaling Support");
            }
            else
            {
                m_inSelfScalingSupportMode = false;
                m_inSelfScalingMode        = true;
//				Debug.Log (_collider.name + ": S_Scaling");
            }

            if (m_inSelfScalingMode)
            {
                originalScale = player.localScale;
                initialControllersDistance = (attachPoint.position - otherController.attachPoint.position).sqrMagnitude;
                firstTouchTime             = Time.time;
            }
            DeviceVibrate();
        }
    }
Пример #3
0
    public void HandleSelfExit(Collider _collider)
    {
        if (!enableSelfScale)
        {
            return;
        }

        if (_collider.gameObject.tag == "GameController")
        {
            if (m_inSelfScalingMode || m_inSelfScalingSupportMode)
            {
                m_inSelfScalingMode        = false;
                m_inSelfScalingSupportMode = false;
                otherController            = null;
                firstTouchTime             = 0f;
                isBusySelfScaling          = false;

//				Debug.Log (_collider.name + ": handle exit");
            }
        }
    }