Beispiel #1
0
    private bool CanChangeColor(GameColor newColor)
    {
        if (managed)
        {
            return(true);
        }
        _collider2DsBuffer = _collider2DsBuffer ?? new Collider2D[16];

        _contactFilter2D.SetLayerMask(_colorsManager.GetLayerMask(newColor));

        if (_collider2D == null)
        {
            Debug.Log("ColoredGameObject#canChangeColor " + gameObject.name);
        }
        int count = _collider2D.OverlapCollider(_contactFilter2D, _collider2DsBuffer);

        //Debug.Log("ColoredGameObject#canChangeColor " + gameObject.name + " -> Got  " + count + " Collisions");
        for (int i = 0; i < count; ++i)
        {
            Debug.Log("ColoredGameObject#canChangeColor " + gameObject.name + " -> Collision detected with " + _collider2DsBuffer[i].gameObject.name);
        }
        return(count == 0);
    }