Kategóriák: Minden - unity - data - textures - abstract

a Mike Ton 10 éve

578

Grid_FrameWork

A framework in Unity called GFGrid offers a flexible and abstract class for constructing grids. The GFGrid class serves as a template that cannot operate on its own or be attached to any object.

Grid_FrameWork

Grid_FrameWork

Unity

Data Source
Textures

No compression

RGB16

Color Threshold

Green

2

G=253 to G=255 okay

Not RGBA16

Alpha channel compressed???

Advanced

Set to Read/Write

Abstract

GFGrid

All grids inherit from the GFGrid class. GFGrid is an abstract class, which means it cannot do anything on its own and it cannot be attached to any object. Rather it serves as a template for what its children, the specific grids, have to be able to do, but not how they do it. You say that GFRectGrid, GFHexGrid and GFPolarGrid “implement” GFGrid.

Of course you can still reference any grid by its respective type like this:

var myGrid: GFRectGrid // UnityScript

GFRectGrid myGrid // C#

The downside is that if you change your opinion and want another kind of grid you need to change your source code as well. Or maybe you don’t know what type of grid you are dealing with. Writing var myGrid: GFGrid lets you use any sort of grid you desire and always picks the right implementation of the function. So the following code will always return the appropriate vector for any grid type:

var myGrid: GFGrid;

var myVec: Vector3 = myGrid.NearestVertexW(transform.position);

Please see the scripting reference sections for detailed information on the API.

members

renderTo

renderFrom

size

Defines the size of the drawing and rendering of the grid. Keep in mind that the grid is infinitely large, the drawing is just a visual representation, stretching on all three directions from the origin. The size is either absolute or relative to the grid's other parameters, depending on the value of relativeSize. If you set useCustomRenderRange to true that range will override this size.

boolean

useCustomRenderRange

renderLineWidth

relativeSize

Set this to true if you want the drawing to have relative size, i.e. to scale with the spacing/radius or whatever the specific grid uses. Otherwise set it to false.

enum

GridPlane

XY

XZ

YZ

functions

Void

Render

Vectrosity

GetVectrosityPointsSeparate ()

GetVectrosityPoints()

DrawGrid()

Draw in Editor

Using Gizmo

RenderGrid()

Draw in Game

Vector3

Other

Scale

ScaleTransform

ScaleVector3

Align

AlignTransform

position and rotation

Fits an object inside the grid by using the object’s Transform. Setting doRotate makes the object take on the grid’s rotation. The parameter lockAxis makes the function not touch the corresponding coordinate.

AlignVector3

position

aligns the position while respecting all axes and uses a default size of 1 x 1 x 1

Co-ordinate

Nearest

return

GridPos

NearestBoxG (worldPoint)

NearestFaceG (worldPoint)

NearestVertexG (worldPoint)

WorldPos

NearestBoxW (worldPoint)

NearestFaceW (worldPoint)

NearestVertexW (worldPoint)

GridToWorld (gridPoint)

WorldToGrid (worldPoint)

implements

GFLayeredGrid

plane

plane (XY, XZ or YZ) the grid is aligned to

depth

how far apart these layers are

layered

GFPolarGrid

GFHexGrid

GFRectGrid