public void OnEnable()
 {
     this.me             = (ProjectorMount)base.target;
     this.brain          = null;
     this.targetProperty = serializedObject.FindProperty("target");
     this.gizmosProperty = serializedObject.FindProperty("gizmos");
 }
        public void OnEnable()
        {
            this.me               = (ProjectorBrain)base.target;
            this.mount            = this.me.GetComponentInChildren <ProjectorMount>();
            this.editor           = null;
            this.settingsProperty = serializedObject.FindProperty("settings");

            if (this.me.Settings != null)
            {
                RealignViewports();
            }
        }
Exemple #3
0
 public void Awake()
 {
     this.eyes     = base.GetComponentInChildren <ProjectorEyes>();
     this.mount    = base.GetComponentInChildren <ProjectorMount>();
     this.emitters = this.mount.GetOrdered();
 }
        public static void DrawAreaGizmos(ProjectorMount mount, GizmoType type)
        {
            ProjectorEmitter[] emitters = mount.Get();

            for (int i = emitters.Length - 1; i >= 0; --i)
            {
                if (emitters[i].Configuration == null)
                {
                    continue;
                }

                Vector3[] plane = emitters[i].TransformPlane();

                if (mount.Gizmos.HasFlag(ProjectorGizmos.Viewport))
                {
                    Gizmos.color = Color.yellow;

                    Gizmos.DrawLine(emitters[i].transform.position, plane[0]);
                    Gizmos.DrawLine(emitters[i].transform.position, plane[1]);
                    Gizmos.DrawLine(emitters[i].transform.position, plane[2]);
                    Gizmos.DrawLine(emitters[i].transform.position, plane[3]);

                    Gizmos.DrawLine(plane[0], plane[1]);
                    Gizmos.DrawLine(plane[1], plane[2]);
                    Gizmos.DrawLine(plane[2], plane[3]);
                    Gizmos.DrawLine(plane[3], plane[0]);
                }

                if (mount.Gizmos.HasFlag(ProjectorGizmos.Wireframe))
                {
                    Color softYellow = Color.yellow;
                    softYellow.a = 0.2f;
                    Gizmos.color = softYellow;

                    Vector3 a1 = Vector3.Lerp(plane[0], plane[1], 0.25f);
                    Vector3 a2 = Vector3.Lerp(plane[0], plane[1], 0.75f);
                    Vector3 b1 = Vector3.Lerp(plane[3], plane[2], 0.25f);
                    Vector3 b2 = Vector3.Lerp(plane[3], plane[2], 0.75f);

                    Vector3 c1 = Vector3.Lerp(plane[1], plane[2], 0.25f);
                    Vector3 c2 = Vector3.Lerp(plane[1], plane[2], 0.75f);
                    Vector3 d1 = Vector3.Lerp(plane[0], plane[3], 0.25f);
                    Vector3 d2 = Vector3.Lerp(plane[0], plane[3], 0.75f);

                    Gizmos.DrawLine(a1, b1);
                    Gizmos.DrawLine(a2, b2);
                    Gizmos.DrawLine(c1, d1);
                    Gizmos.DrawLine(c2, d2);
                }

                if (mount.Gizmos.HasFlag(ProjectorGizmos.Anchors))
                {
                    Vector3[] equalizationAnchors = emitters[i].Plane.TransformPlane(emitters[i].Configuration.ScaledEqualizationAnchors());

                    if (equalizationAnchors.Length > 0)
                    {
                        Gizmos.color = new Color(0.9f, 1f, 0.5f, 1f);

                        Gizmos.DrawLine(equalizationAnchors[0], equalizationAnchors[1]);
                        Gizmos.DrawLine(equalizationAnchors[1], equalizationAnchors[2]);
                        Gizmos.DrawLine(equalizationAnchors[2], equalizationAnchors[3]);
                        Gizmos.DrawLine(equalizationAnchors[3], equalizationAnchors[0]);
                    }
                }
            }
        }