Пример #1
0
        public static void linkPacToStores(PatternArrayController pac, Dictionary<string, FreePatternStore> storesDict)
        {
            foreach (CellPattern pat in pac.patterns) {

                // Is it a FreePattern
                if (pat.GetType() == typeof(FreePattern)) {
                    FreePattern freePat = pat as FreePattern;

                    // Warn if already linked
                    if (freePat.store != null)
                        Debug.LogWarning("FreePattern's store '"+freePat.storeName+"' already linked - overwriting");

                    // Warn if FreePattern has specified a store
                    if (freePat.storeName == "unassigned") {
                        Debug.LogWarning("FreePattern's store has not been specified");
                        break;
                    }

                    // Does dict contain store?
                    if (storesDict.ContainsKey(freePat.storeName)) {
                        freePat.store = storesDict[freePat.storeName];
                    }
                    else {
                        Debug.LogError("FreePatternStoreLinker not passed store '"+freePat.storeName+"'.");
                    }
                }
            }
        }
        private void setController(PatternArrayController pac)
        {
            controller_ = new SerializedObject(pac);

            patternCount_ = controller_.FindProperty(patternSizePath_);
        }