Esempio n. 1
0
        // Clone constructor
        public LBObjPrefab(LBObjPrefab lbObjPrefab)
        {
            groupMemberGUID = lbObjPrefab.groupMemberGUID;

            prefab                 = lbObjPrefab.prefab;
            prefabName             = lbObjPrefab.prefabName;
            showPrefabPreview      = lbObjPrefab.showPrefabPreview;
            isKeepPrefabConnection = lbObjPrefab.isKeepPrefabConnection;
        }
        private void SetClassDefaults()
        {
            // Assign a unique identifier
            seriesGUID = System.Guid.NewGuid().ToString();
            seriesName = "(new) series";

            // By default, place prefabs along the path
            useSubGroups = false;

            // Prefab varibles
            mainObjPrefabList = new List <LBObjPrefab>();
            startObjPrefab    = new LBObjPrefab();
            endObjPrefab      = new LBObjPrefab();

            // SubGroup variables
            mainObjSubGroupList = new List <LBObjSubGroup>();
            startObjSubGroup    = new LBObjSubGroup();
            endObjSubGroup      = new LBObjSubGroup();

            startMemberOffset = 0f;
            endMemberOffset   = 0f;

            layoutMethod          = LBObjPath.LayoutMethod.Spacing;
            selectionMethod       = LBObjPath.SelectionMethod.Alternating;
            isLastObjSnappedToEnd = true;
            spacingDistance       = 10f;
            maxMainPrefabs        = 5;
            sparcePlacementCutoff = 1f;
            pathSpline            = LBObjPath.PathSpline.Centre;
            prefabOffsetZ         = 0f;
            use3DDistance         = false;
            useNonOffsetDistance  = false;
            prefabStartOffset     = 0f;
            prefabEndOffset       = 0f;

            // Off by default for backward compatibility
            isRandomisePerGroupRegion = false;

            showInEditor = true;
        }
        // Clone constructor
        public LBObjPathSeries(LBObjPathSeries lbObjPathSeries)
        {
            if (lbObjPathSeries == null)
            {
                SetClassDefaults();
            }
            else
            {
                seriesGUID = lbObjPathSeries.seriesGUID;
                seriesName = lbObjPathSeries.seriesName;

                useSubGroups = lbObjPathSeries.useSubGroups;

                // Prefab varibles
                if (lbObjPathSeries.mainObjPrefabList != null)
                {
                    mainObjPrefabList = lbObjPathSeries.mainObjPrefabList.ConvertAll(mp => new LBObjPrefab(mp));
                }
                else
                {
                    mainObjPrefabList = new List <LBObjPrefab>();
                }
                if (lbObjPathSeries.startObjPrefab != null)
                {
                    startObjPrefab = new LBObjPrefab(lbObjPathSeries.startObjPrefab);
                }
                else
                {
                    startObjPrefab = null;
                }
                if (lbObjPathSeries.endObjPrefab != null)
                {
                    endObjPrefab = new LBObjPrefab(lbObjPathSeries.endObjPrefab);
                }
                else
                {
                    endObjPrefab = null;
                }

                // SubGroup variables
                if (lbObjPathSeries.mainObjSubGroupList != null)
                {
                    mainObjSubGroupList = lbObjPathSeries.mainObjSubGroupList.ConvertAll(msg => new LBObjSubGroup(msg));
                }
                else
                {
                    mainObjSubGroupList = new List <LBObjSubGroup>();
                }
                if (lbObjPathSeries.startObjSubGroup != null)
                {
                    startObjSubGroup = new LBObjSubGroup(lbObjPathSeries.startObjSubGroup);
                }
                else
                {
                    startObjSubGroup = null;
                }
                if (lbObjPathSeries.endObjSubGroup != null)
                {
                    endObjSubGroup = new LBObjSubGroup(lbObjPathSeries.endObjSubGroup);
                }
                else
                {
                    endObjSubGroup = null;
                }

                startMemberOffset = lbObjPathSeries.startMemberOffset;
                endMemberOffset   = lbObjPathSeries.endMemberOffset;

                layoutMethod              = lbObjPathSeries.layoutMethod;
                selectionMethod           = lbObjPathSeries.selectionMethod;
                spacingDistance           = lbObjPathSeries.spacingDistance;
                maxMainPrefabs            = lbObjPathSeries.maxMainPrefabs;
                isLastObjSnappedToEnd     = lbObjPathSeries.isLastObjSnappedToEnd;
                sparcePlacementCutoff     = lbObjPathSeries.sparcePlacementCutoff;
                pathSpline                = lbObjPathSeries.pathSpline;
                prefabOffsetZ             = lbObjPathSeries.prefabOffsetZ;
                prefabStartOffset         = lbObjPathSeries.prefabStartOffset;
                prefabEndOffset           = lbObjPathSeries.prefabEndOffset;
                use3DDistance             = lbObjPathSeries.use3DDistance;
                useNonOffsetDistance      = lbObjPathSeries.useNonOffsetDistance;
                isRandomisePerGroupRegion = lbObjPathSeries.isRandomisePerGroupRegion;
                showInEditor              = lbObjPathSeries.showInEditor;
            }
        }