Ejemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    protected virtual void OnDisable()
    {
        // reenable bob and spin components gradually to prevent popping motions

        if (m_ReenableBobWhenDone)
        {
            vp_Bob bob = GetComponentInChildren <vp_Bob>();
            if (bob != null)
            {
                // re-enable bob in a way that the object floats smoothly
                // off the ground and starts bobbing
                bob.SmoothGroundOffset = true;
                bob.GroundOffset       = BOB_GROUND_OFFSET;
                bob.InitialPosition    = Transform.position;
                bob.enabled            = true;
            }
        }

        if (m_ReenableSpinWhenDone)
        {
            vp_Spin spin = GetComponentInChildren <vp_Spin>();
            if (spin != null)
            {
                // re-enable spin in a way that the object smoothly starts spinning
                spin.Accelerate = true;
                spin.enabled    = true;
            }
        }

        m_BeingTossed = false;
    }
Ejemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    protected virtual void OnEnable()
    {
        // temporarily disable bob and spin components because they will
        // interfere with the toss

        vp_Bob bob = GetComponentInChildren <vp_Bob>();

        if (bob != null)
        {
            bob.enabled = false;
        }

        vp_Spin spin = GetComponentInChildren <vp_Spin>();

        if (spin != null)
        {
            spin.enabled = false;
        }

        Gravity = 0.0055f * Random.Range(0.5f, 1.0f);
    }