Exemplo n.º 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);
        }
Exemplo n.º 2
0
        private void TypeChanged(IEyesTarget t)
        {
            if (container_ == null)
            {
                return;
            }

            container_.Target = t;
            stale_            = true;
            NameChanged();

            Synergy.Instance.UI.NeedsReset("eyes target type changed");
        }
Exemplo n.º 3
0
            private Color GetColor(IEyesTarget t, float a)
            {
                a = Utilities.Clamp(a * alpha_, 0, 1);

                if (t is RigidbodyEyesTarget)
                {
                    return(new Color(1, 0, 0, a));
                }
                else if (t is RandomEyesTarget)
                {
                    return(new Color(0, 0, 1, a));
                }
                else
                {
                    return(new Color(1, 1, 1, a));
                }
            }
Exemplo n.º 4
0
 public EyesTargetContainer(IEyesTarget t = null)
 {
     target_ = t;
 }