示例#1
0
        public bool FromJSON(J.Node n)
        {
            var o = n.AsObject("EyesTargetContainer");

            if (o == null)
            {
                return(false);
            }

            o.Opt("enabled", ref enabled_);

            // migration: constant target removed, was redundant with rigidbody
            if (o.HasChildObject("target"))
            {
                var t = o.Get("target").AsObject();

                string type = "";
                t.Opt("factoryTypeName", ref type);

                if (type == "constant")
                {
                    Synergy.LogInfo("found constant eye target, converting to rigidbody");
                    target_ = new RigidbodyEyesTarget();
                    return(target_.FromJSON(t));
                }
            }


            o.Opt <EyesTargetFactory, IEyesTarget>("target", ref target_);

            return(true);
        }