C# Class SpriteExploder, Unity-2D-Destruction

Inheritance: MonoBehaviour
Datei anzeigen Open project: mjholtzem/Unity-2D-Destruction Class Usage Examples

Public Methods

Method Description
GenerateTriangularPieces ( GameObject source, int extraPoints, int subshatterSteps, Material mat = null ) : List
GenerateVoronoiPieces ( GameObject source, int extraPoints, int subshatterSteps, Material mat = null ) : List

Private Methods

Method Description
calcPivotCenterDiff ( GameObject target ) : Vector3

calculates the distance between the targets pivot and it's actual center

calcPolyColliderPoints ( List points, Vector2 offset ) : Vector2[]
calcTriangles ( Voronoi, region ) : int[]
calcUV ( Vector3 vertices, MeshRenderer mRend, Transform sTransform ) : Vector2[]
calcUV ( Vector3 vertices, SpriteRenderer sRend, Transform sTransform ) : Vector2[]

calculates the UV coordinates for the given vertices based on the provided Sprite

calcVerts ( Voronoi, region ) : Vector3[]
centerMeshPivot ( GameObject target, Vector3 diff ) : void

Sets the pivot of the target object to it's center

createFragmentMaterial ( GameObject source ) : Material
generateTriangularPiece ( GameObject source, List tri, Vector2 origVelocity, Vector3 origScale, Quaternion origRotation, Material mat ) : GameObject
generateVoronoiPiece ( GameObject source, List region, Vector2 origVelocity, Vector3 origScale, Quaternion origRotation, Material mat ) : GameObject
getPoints ( BoxCollider2D collider ) : List

generates a list of points from a box collider

getPoints ( PolygonCollider2D collider ) : List

generates a list of points from a polygon collider

getRect ( GameObject source ) : Rect

generates a rectangle based on the rendering bounds of the object

getRect ( List region ) : Rect
getRendererPoints ( GameObject source ) : List
getUVRange ( Vector2 &min, Vector2 &max, Vector2 uv ) : void
scaleRange ( float target, float oldMin, float oldMax, float newMin, float newMax ) : float
setFragmentMaterial ( GameObject newSprite, GameObject source ) : void

assigns a new material for a fragment

Method Details

GenerateTriangularPieces() public static method

public static GenerateTriangularPieces ( GameObject source, int extraPoints, int subshatterSteps, Material mat = null ) : List
source GameObject
extraPoints int
subshatterSteps int
mat Material
return List

GenerateVoronoiPieces() public static method

public static GenerateVoronoiPieces ( GameObject source, int extraPoints, int subshatterSteps, Material mat = null ) : List
source GameObject
extraPoints int
subshatterSteps int
mat Material
return List