protected GameBlock GetBlock(GameObject o)
        {
            MBDrawScope b     = o.GetComponent <MBDrawScope>();
            GameBlock   block = ((GameBlock)b.scope);

            return(block);
        }
Beispiel #2
0
 public GameBlock()
 {
     gameObject = new GameObject();
     _collider  = gameObject.AddComponent <BoxCollider>();
     _drawScope = gameObject.AddComponent <MBDrawScope>();
     gameObject.AddComponent <MB_MouseInteraction>();
     _drawScope.scope = this;
 }
Beispiel #3
0
    void OnSelected()
    {
        GameObject g = ActiveDocument.doc.selectedObject;

        try
        {
            MBDrawScope b = g.GetComponent <MBDrawScope>();
            textObject.text = ((GameBlock)b.scope).guid.ToString();
        }
        catch {  }
    }
        public virtual void OnRenderObject()
        {
            Vector3[] pts = makePts();
            if (this.Size == null)
            {
                return;
            }
            Material mat = MBDrawScope.GetMat();

            mat.SetPass(0);

            GL.PushMatrix();
            GL.Begin(GL.LINE_STRIP);
            GL.Color(lineColor);
            for (int i = 0; i <= 4; i++)
            {
                int index = i;
                if (index >= 4)
                {
                    index = 0;
                }
                GL.Vertex(pts[index]);
            }
            GL.End();
            GL.Begin(GL.LINE_STRIP);
            for (int i = 4; i <= 8; i++)
            {
                int index = i;
                if (index >= 8)
                {
                    index = 4;
                }
                GL.Vertex(pts[index]);
            }
            GL.End();
            GL.PopMatrix();

            GL.PushMatrix();
            GL.Begin(GL.LINES);
            GL.Color(lineColor);
            for (int i = 0; i < 4; i++)
            {
                GL.Vertex(pts[i]);
                GL.Vertex(pts[i + 4]);
            }
            GL.End();
            GL.PopMatrix();
        }