public static bool ArePipeCompatible(PipeData pipe1, int Direction, PipeData pipe2,
                                             out ConnectAndType ConnectAndType)
        {
            if (pipe1.PipeLayer == pipe2.PipeLayer)
            {
                int pipe2Direction = Direction + 2;
                if (pipe2Direction > 3)
                {
                    pipe2Direction -= 4;
                }

                if (pipe2.Connections.Directions[pipe2Direction].Bool)
                {
                    if (pipe2.Connections.Directions[pipe2Direction].pipeType
                        .HasFlag(pipe1.Connections.Directions[Direction].pipeType))
                    {
                        ConnectAndType = pipe1.Connections.Directions[Direction];
                        return(true);
                    }
                }
            }

            ConnectAndType = null;
            return(false);
        }
        public ConnectAndType Copy()
        {
            var Newone = new ConnectAndType();

            Newone.Bool     = Bool;
            Newone.pipeType = pipeType;
            Newone.PortType = PortType;
            return(Newone);
        }
        public void PipeOffset(int OffSet)
        {
            var NewConnectionss = new ConnectAndType[4];

            for (int i = 0; i < Directions.Length; i++)
            {
                int Location = i + OffSet;
                if (Location > 3)
                {
                    Location -= 4;
                }

                NewConnectionss[Location] = Directions[i];
            }

            Directions = NewConnectionss;
        }