Ejemplo n.º 1
0
    // This function will look for a tile type at a specific point and return the first version it finds
    // Returns null if it can't find one
    public static Tile tileAtPoint(Vector2 point, TileTags testTags)
    {
        int numObjects = Physics2D.OverlapPointNonAlloc(point, _maybeColliderResults);

        for (int i = 0; i < numObjects && i < _maybeColliderResults.Length; i++)
        {
            Tile maybeTile = _maybeColliderResults[i].GetComponent <Tile>();
            if (maybeTile != null && maybeTile.hasTag(testTags))
            {
                return(maybeTile);
            }
        }
        return(null);
    }
Ejemplo n.º 2
0
    /////////////////////////////////


    // These are convenient functions for adding/removing/checking for tags
    // Since they involve bitwise operations, probably best to use these functions instead of altering the tags property directly from code
    public bool hasTag(TileTags tag)
    {
        return((tags & tag) != 0);
    }
Ejemplo n.º 3
0
 public void addTag(TileTags tagsToAdd)
 {
     tags |= tagsToAdd;
 }
Ejemplo n.º 4
0
 public void removeTag(TileTags tagsToRemove)
 {
     tags = tags & ~(tagsToRemove);
 }
Ejemplo n.º 5
0
 protected void removeTag(TileTags tagsToRemove)
 {
     tags = tags & ~(tagsToRemove);
 }
Ejemplo n.º 6
0
 protected void addTag(TileTags tagsToAdd)
 {
     tags |= tagsToAdd;
 }