Пример #1
0
        private static bool AddNeighbour(ref Vector3I dir,
            MySlimBlock thisBlock, MyCubeBlockDefinition.MountPoint[] thisMountPoints,
            MySlimBlock otherBlock, MyCubeBlockDefinition.MountPoint[] otherMountPoints,
            MySlimBlock thisParentBlock, MySlimBlock otherParentBlock)
        {
            if (MyCubeGrid.CheckMountPointsForSide(thisBlock.BlockDefinition, thisMountPoints, ref thisBlock.Orientation,
                ref thisBlock.Position, ref dir, otherBlock.BlockDefinition, otherMountPoints, ref otherBlock.Orientation,
                ref otherBlock.Position))
            {
                if (thisBlock.ConnectionAllowed(ref otherBlock.Position, ref dir, otherBlock))
                {
                    Debug.Assert(!otherParentBlock.Neighbours.Contains(thisParentBlock), "Inconsistent neighbours");
                    // Add parents
                    thisParentBlock.Neighbours.Add(otherParentBlock);
                    otherParentBlock.Neighbours.Add(thisParentBlock);
                    return true;
                }
            }

            return false;
        }