Exemple #1
0
        public override IEyesTarget Clone(int cloneFlags)
        {
            var t = new RandomEyesTarget();

            CopyTo(t, cloneFlags);
            return(t);
        }
Exemple #2
0
 private void CopyTo(RandomEyesTarget t, int cloneFlags)
 {
     t.distance_    = distance_;
     t.centerX_     = centerX_;
     t.centerY_     = centerY_;
     t.xRange_      = xRange_;
     t.yRange_      = yRange_;
     t.avoidXRange_ = avoidXRange_;
     t.avoidYRange_ = avoidYRange_;
 }
Exemple #3
0
        public RandomEyesTargetUI(
            EyesModifierTargetUIContainer parent, EyesTargetContainer tc)
            : base(parent, tc)
        {
            target_ = tc.Target as RandomEyesTarget;

            var r = new FloatRange(0, 10);

            atom_ = new AtomList(
                "Relative atom", target_?.Atom?.uid, AtomChanged,
                null, Widget.Right);

            rel_ = new ForceReceiverList(
                "Relative receiver", target_?.RelativeTo?.name,
                ReceiverChanged, Widget.Right);

            distance_ = new FloatSlider(
                "Distance", target_.Distance, r, DistanceChanged, Widget.Right);

            centerX_ = new FloatSlider(
                "Offset X", target_.CenterX, r, CenterXChanged, Widget.Right);

            centerY_ = new FloatSlider(
                "Offset Y", target_.CenterY, r, CenterYChanged, Widget.Right);

            xRange_ = new FloatSlider(
                "Range X", target_.RangeX, r, RangeXChanged, Widget.Right);

            yRange_ = new FloatSlider(
                "Range Y", target_.RangeY, r, RangeYChanged, Widget.Right);

            avoidXRange_ = new FloatSlider(
                "Avoid range X", target_.AvoidRangeX, r,
                AvoidRangeXChanged, Widget.Right);

            avoidYRange_ = new FloatSlider(
                "Avoid range Y", target_.AvoidRangeY, r,
                AvoidRangeYChanged, Widget.Right);

            rel_.Atom = target_.Atom;
        }
Exemple #4
0
        private void UpdateRandomPlane(Preview p, RandomEyesTarget rt)
        {
            var rel = rt.RelativeTo ?? modifier_.Head;

            Vector3 fwd = rel.rotation * Vector3.forward;
            Vector3 ver = rel.rotation * Vector3.up;
            Vector3 hor = rel.rotation * Vector3.right;

            p.plane.transform.localPosition =
                rel.position +
                fwd * rt.Distance +
                ver * rt.CenterY +
                hor * rt.CenterX;

            p.plane.transform.localScale = new Vector3(
                rt.RangeX * 2, rt.RangeY * 2, 0.01f);

            p.plane.transform.localRotation = rel.rotation;

            if (rt.AvoidRangeX == 0 && rt.AvoidRangeY == 0)
            {
                p.planeAvoid.SetActive(false);
            }
            else
            {
                p.planeAvoid.SetActive(p.t.Enabled);

                p.planeAvoid.transform.localPosition =
                    rel.position +
                    fwd * rt.Distance +
                    ver * rt.CenterY +
                    hor * rt.CenterX;

                p.planeAvoid.transform.localScale = new Vector3(
                    rt.AvoidRangeX * 2, rt.AvoidRangeY * 2, 0.01f);

                p.planeAvoid.transform.localRotation =
                    Quaternion.LookRotation(fwd);
            }
        }