Ejemplo n.º 1
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        var gravityObjectRB = collision.GetComponent <ControllableGravityObjectRigidBody>();

        if (gravityObjectRB)
        {
            ObjectsInsideOfMagnetZone.Add(gravityObjectRB);
            if (_currentlyTracking == null)
            {
                _currentlyTracking = gravityObjectRB;
            }
        }
    }
Ejemplo n.º 2
0
    public void OnTriggerExit2D(Collider2D collision)
    {
        var gravityObjectRB = collision.GetComponent <ControllableGravityObjectRigidBody>();

        if (gravityObjectRB)
        {
            ObjectsInsideOfMagnetZone.Remove(gravityObjectRB);
            if (gravityObjectRB == _currentlyTracking)
            {
                _currentlyTracking = null;
            }
        }
    }
Ejemplo n.º 3
0
 public void ClearTrackingData()
 {
     ObjectsInsideOfMagnetZone.Clear();
     _currentlyTracking = null;
 }