Example #1
0
        virtual public float[][] getColormap()
        {
            // traverse back up hierarchy of objects until reaching figure (which has the colormap)
            //TODO: add support for subplots with different colormaps in same figure

            var go = transform.gameObject.GetComponent <MFigure>();

            if (go == null)
            {
                return(mParent.getColormap());
            }
            // if reached here, we are an object with a colormap
            MFigure fig = transform.gameObject.GetComponent <MFigure>();

            return(fig.Colormap);
        }
Example #2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            GameObject gameObject = new GameObject();

            gameObject.AddComponent <MFigure>();
            MFigure mf = gameObject.GetComponent <MFigure>();

            mf.name = "MFigure";

            try
            {
                JObject jo = JObject.Load(reader);
                serializer.Populate(jo.CreateReader(), mf);
                mf.LinkChildren();
            } catch (Exception ex)
            {
                Debug.LogErrorFormat("Exception during serialization: {0}: {1}\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
            }

            return(mf);
        }