using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class GameObjectUtils
{
    public static T GetOrAddComponent<T>(this GameObject obj) where T : Component
    {
        var comp = obj.GetComponent<T>();
        if (!comp) comp = obj.AddComponent<T>();
        return comp;
    }

    public static bool AllowedLayer(this LayerMask mask, int layerIndex)
    {
        return ((1 << layerIndex) & mask.value) != 0;
    }
}
