/// Is this position and surrounding area completely clear of solid objects except for provided one? public bool IsFloatingAt(GameObject[] context, Vector3Int position, bool isServer) { foreach (Vector3Int pos in position.BoundsAround().allPositionsWithin) { if (!MetaTileMap.IsEmptyAt(context, pos, isServer)) { return(false); } } return(true); }
/// Is this position and surrounding area completely clear of solid objects? public bool IsFloatingAt(Vector3Int position) { foreach (Vector3Int pos in position.BoundsAround().allPositionsWithin) { if (!metaTileMap.IsEmptyAt(pos)) { return(false); } } return(true); }
/// Should player NOT stick to the station at this position? public bool IsNonStickyAt(Vector3Int position, bool isServer) { foreach (Vector3Int pos in position.BoundsAround().allPositionsWithin) { if (!MetaTileMap.IsNoGravityAt(pos, isServer)) { return(false); } } return(true); }
/// <summary> /// Gets the interactable tiles for the matrix at the indicated world position. Unless there's only space! /// in that case tries to fetch an adjacent matrix, in the case of none, it returns the space matrix /// </summary> public static Matrix TryGetNonSpaceMatrix(Vector3Int worldPos, bool isServer) { var matrixInfo = MatrixManager.AtPoint(worldPos, isServer); if (matrixInfo.Matrix.IsSpaceMatrix == false) { return(matrixInfo.Matrix); } //This is just space! Lets try getting an adjacent matrix foreach (var pos in worldPos.BoundsAround().allPositionsWithin) { matrixInfo = MatrixManager.AtPoint(pos, isServer); if (matrixInfo.Matrix.IsSpaceMatrix == false) { return(matrixInfo.Matrix); } } //we're in space and theres nothing but space all around us, we tried. return(MatrixManager.Instance.spaceMatrix); }