Exemplo n.º 1
0
 void FreeBox()
 {
     if (ControlledBox != null)
     {
         ControlledBox.GetComponent <Rigidbody2D>().collisionDetectionMode = CollisionDetectionMode2D.Discrete;
         ControlledBox.enabled = false;
         ControlledBox         = null;
         ControlledBoxStats    = null;
     }
 }
Exemplo n.º 2
0
    void CatchBox(GameObject Target)
    {
        if (Target != null)
        {
            ControlledBoxStats = Target.GetComponent <BoxStats>();
            ControlledBox      = Target.GetComponent <RelativeJoint2D>();

            if (ControlledBoxStats.State.State == BoxState.Losted)
            {
                FreeBox();
            }
            else
            {
                ControlledBox.GetComponent <Rigidbody2D>().collisionDetectionMode = CollisionDetectionMode2D.Continuous;
                ControlledBox.connectedBody = GetComponent <Rigidbody2D>();
                ControlledBox.enabled       = true;
            }
        }
    }