Пример #1
0
        public virtual void setTarget(CellPattern pattern)
        {
            serializedTarget_ = new SerializedObject(pattern);

            originCol_ = serializedTarget_.FindProperty("originCol");
            originRow_ = serializedTarget_.FindProperty("originRow");
            rows_      = serializedTarget_.FindProperty("rows"     );
            colsLeft_  = serializedTarget_.FindProperty("colsLeft" );
            colsRight_ = serializedTarget_.FindProperty("colsRight");
        }
Пример #2
0
        public override void setTarget(CellPattern pattern)
        {
            base.setTarget (pattern);

            cellType_ = serializedTarget_.FindProperty("cellType");
        }
 // Assigns a pattern inside the serialised list
 private void setPattern(int index, CellPattern pattern)
 {
     // Check array bounds, and allow growth by one element if necessary
     if      (index > patternCount_.intValue) {
         Debug.LogError("Cannot set pattern more than element beyond bounds (index:"+index+")");
         return;
     }
     else if (index == patternCount_.intValue) {
         patternCount_.intValue++;
     }
     controller_.FindProperty(string.Format(patternDataPath_,index)).objectReferenceValue = pattern;
 }
 private void swapPatterns(CellPattern pat1, CellPattern pat2, int index1, int index2)
 {
     setPattern(index1, pat2);
     setPattern(index2, pat1);
 }
        private CellPattern[] patternsArray()
        {
            var count = controller_.FindProperty("patterns.Array.size").intValue;
            var array = new CellPattern[count];

            for (var i=0; i<count; i++) {
                array[i] = controller_.FindProperty(string.Format(patternDataPath_,i)).objectReferenceValue as CellPattern;
            }

            return array;
        }