Ejemplo n.º 1
0
    public void Toggle()
    {
        if (!toggling)
        {
            toggling = true;

            locked = !locked;

            Spring1.spring = locked ? 0.0f : baseSpring1;
            Spring2.spring = locked ? 0.0f : baseSpring2;

            if (locked)
            {
                MyHelperFuncs.StopRigid(Block1);
                MyHelperFuncs.StopRigid(Block2);
            }
            else
            {
                MyHelperFuncs.StartRigid(Block1);
                MyHelperFuncs.StartRigid(Block2);
            }

            StartCoroutine(StopToggle(m_time));
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Awake()
    {
        //Renderer1 = Block1.gameObject.GetComponent<Renderer>();
        //Renderer2 = Block2.gameObject.GetComponent<Renderer>();
        Spring1 = Block1.gameObject.GetComponent <SpringJoint>();
        Spring2 = Block2.gameObject.GetComponent <SpringJoint>();

        baseSpring1 = Spring1.spring;
        baseSpring2 = Spring2.spring;

        Spring1.spring = 0.0f;
        Spring2.spring = 0.0f;

        baseToBlockOne            = Block1.position - Block2.position;
        Block1.transform.position = Block2.transform.position + baseToBlockOne / COMPRESS;

        MyHelperFuncs.StopRigid(Block1);
        MyHelperFuncs.StopRigid(Block2);
    }
Ejemplo n.º 3
0
 public void StopMoving()
 {
     MyHelperFuncs.StopRigid(m_myRigidBody);
     MyHelperFuncs.StartRigid(m_myRigidBody);
 }