コード例 #1
0
    public FluidComponentManager(World world)
    {
        this.world = world;

        components        = new List <FluidComponent>();
        voxelsToProcess   = new HashSet <Vector3I>();
        voxelComponents   = new Dictionary <Vector3I, FluidComponent>();
        componentComparer = new ComponentComparer();
        searchStack       = new Stack <Vector3I>();
        toRemoveList      = new List <Vector3I>();
    }
コード例 #2
0
        /// <inheritdoc/>
        public TPath RelativeTo(IPurePath parent)
        {
            if (!ComponentComparer.Equals(parent.Drive, Drive) ||
                !ComponentComparer.Equals(parent.Root, Root))
            {
                throw new ArgumentException(String.Format(
                                                "'{0}' does not share the same root/drive as '{1}', " +
                                                "thus cannot be relative.", this, parent));
            }

            var thisDirname = Dirname
                              .Split(PathSeparator[0]).GetEnumerator();
            var parentRelative = parent.Relative().ToString();

            if (parentRelative == String.Empty)
            {
                return(Relative());
            }

            var parentDirname = parentRelative.Split(PathSeparator[0]).GetEnumerator();

            while (parentDirname.MoveNext())
            {
                if (!thisDirname.MoveNext() ||
                    !ComponentComparer.Equals(parentDirname.Current, thisDirname.Current))
                {
                    throw new ArgumentException(String.Format(
                                                    "'{0}' does not start with '{1}'", this, parent));
                }
            }
            var builder = new StringBuilder();

            while (thisDirname.MoveNext())
            {
                if (builder.Length != 0)
                {
                    builder.Append(PathSeparator);
                }
                builder.Append(thisDirname.Current);
            }
            return(PurePathFactoryFromComponents(
                       null, null, null, builder.ToString(), Basename, Extension));
        }