public virtual bool CanPlace(Vector2Int coords, ObjectGrid objectGrid) { return(!objectGrid.CheckCell(coords) && !objectGrid.CheckCell(coords + new Vector2Int(1, 0)) && !objectGrid.CheckCell(coords + new Vector2Int(-1, 0)) && !objectGrid.CheckCell(coords + new Vector2Int(0, 1)) && !objectGrid.CheckCell(coords + new Vector2Int(0, -1)) && !objectGrid.CheckCell(coords + new Vector2Int(1, 1)) && !objectGrid.CheckCell(coords + new Vector2Int(-1, -1)) && !objectGrid.CheckCell(coords + new Vector2Int(1, -1)) && !objectGrid.CheckCell(coords + new Vector2Int(-1, 1))); }
/** * Colors the trap at the given position if one exists. Returns that trap's SpriteRenderer whcih should be passed into UnhighlightTrap. */ public AbstractTrap HighlightTrap(Vector3 screenPos, Color color) { if (oGrid.CheckCell(screenPos)) { AbstractTrap trap = (AbstractTrap)oGrid.GetCellObject(screenPos); trap.SetColor(color); return(trap); } return(null); }
private bool CheckDelete(Vector2 mousePosition) { return(Input.GetMouseButton(1) && objectGrid.CheckCell(mousePosition) && objectGrid.IsWithinBounds(mousePosition) && !ChestAtPosition(mousePosition)); }