Exemplo n.º 1
0
        public void Create(Material defaultMaterial)
        {
            button     = new GameObject(string.Format("HUDButton{0}", button_counter++));
            buttonDisc = AppendMeshGO("disc",
                                      MeshGenerators.CreateTrivialDisc(Radius, 32),
                                      defaultMaterial, button);

            buttonDisc.transform.Rotate(Vector3.right, -90.0f);              // ??
        }
Exemplo n.º 2
0
        public void Create(PrimitiveType eType, Material bgMaterial, Material primMaterial)
        {
            button     = new GameObject(string.Format("HUDButton{0}", button_counter++));
            buttonDisc = AppendMeshGO("disc",
                                      MeshGenerators.CreateTrivialDisc(Radius, 32), bgMaterial, button);
            buttonDisc.transform.Rotate(Vector3.right, -90.0f);              // ??

            GameObject prim     = AppendUnityPrimitiveGO("primitive", eType, primMaterial, button);
            float      primSize = Radius * 0.7f;

            prim.transform.localScale = new Vector3(primSize, primSize, primSize);
            prim.transform.Translate(0.0f, 0.0f, -primSize);
            prim.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self);
        }
Exemplo n.º 3
0
 Mesh make_button_body_mesh()
 {
     if (Shape.Type == HUDShapeType.Disc)
     {
         return(MeshGenerators.CreateTrivialDisc(Shape.Radius, Shape.Slices));
     }
     else if (Shape.Type == HUDShapeType.Rectangle)
     {
         return(MeshGenerators.CreateTrivialRect(Shape.Width, Shape.Height,
                                                 Shape.UseUVSubRegion == true ?
                                                 MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare));
     }
     else
     {
         throw new Exception("[HUDButton::make_button_body_mesh] unknown shape type!");
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a fMesh of the shape/dimensions specified by Shape
 /// </summary>
 public static fMesh MakeBackgroundMesh(HUDShape Shape)
 {
     if (Shape.Type == HUDShapeType.Disc)
     {
         return(MeshGenerators.CreateTrivialDisc(Shape.Radius, Shape.Slices));
     }
     else if (Shape.Type == HUDShapeType.Rectangle)
     {
         return(MeshGenerators.CreateTrivialRect(Shape.Width, Shape.Height,
                                                 Shape.UseUVSubRegion == true ?
                                                 MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare));
     }
     else if (Shape.Type == HUDShapeType.RoundRect)
     {
         return(MeshGenerators.CreateRoundRect(Shape.Width, Shape.Height, Shape.Radius, Shape.Slices,
                                               Shape.UseUVSubRegion == true ?
                                               MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare,
                                               Shape.RoundRectSharpCorners));
     }
     else
     {
         throw new Exception("HUDUtil.MakeBackgroundMesh: unknown shape type!");
     }
 }