Example #1
0
    // Sets the pivot point according to its type and given dimensions.
    // If type == custom, a_fWidth and a_fHeight are used as custom pivot point coords
    public static Vector2 ComputePivotCoords(float a_fWidth, float a_fHeight, PivotType a_ePivotType, Vector2 a_f2CustomPivotPoint)
    {
        // Compute new pivot point from pivot type
        switch (a_ePivotType)
        {
        default:
        case PivotType.Custom:                  return(a_f2CustomPivotPoint);                //new Vector2( a_fWidth,        a_fHeight );

        case PivotType.BottomLeft:              return(new Vector2(0.0f, 0.0f));

        case PivotType.BottomCenter:    return(new Vector2(a_fWidth * 0.5f, 0.0f));

        case PivotType.BottomRight:     return(new Vector2(a_fWidth, 0.0f));

        case PivotType.MiddleLeft:              return(new Vector2(0.0f, a_fHeight * 0.5f));

        case PivotType.MiddleCenter:    return(new Vector2(a_fWidth * 0.5f, a_fHeight * 0.5f));

        case PivotType.MiddleRight:     return(new Vector2(a_fWidth, a_fHeight * 0.5f));

        case PivotType.TopLeft:                 return(new Vector2(0.0f, a_fHeight));

        case PivotType.TopCenter:               return(new Vector2(a_fWidth * 0.5f, a_fHeight));

        case PivotType.TopRight:                return(new Vector2(a_fWidth, a_fHeight));
        }
    }
    // Deep copy constructor
    public Uni2DEditorSpriteSettings(Uni2DEditorSpriteSettings a_rSpriteSettings)
    {
        this.textureContainer = new Texture2DContainer(a_rSpriteSettings.textureContainer);                     // Deep copy
        this.atlas            = a_rSpriteSettings.atlas;
        this.sharedMaterial   = a_rSpriteSettings.sharedMaterial;

        this.renderMesh             = a_rSpriteSettings.renderMesh;
        this.usePhysicBuildSettings = a_rSpriteSettings.usePhysicBuildSettings;

        this.spriteScale       = a_rSpriteSettings.spriteScale;
        this.pivotType         = a_rSpriteSettings.pivotType;
        this.pivotCustomCoords = a_rSpriteSettings.pivotCustomCoords;
        this.vertexColor       = a_rSpriteSettings.vertexColor;
        this.physicsMode       = a_rSpriteSettings.physicsMode;
        this.collisionType     = a_rSpriteSettings.collisionType;
        this.isKinematic       = a_rSpriteSettings.isKinematic;

        this.renderMeshAlphaCutOff            = a_rSpriteSettings.renderMeshAlphaCutOff;
        this.renderMeshPolygonizationAccuracy = a_rSpriteSettings.renderMeshPolygonizationAccuracy;
        this.renderMeshPolygonizeHoles        = a_rSpriteSettings.renderMeshPolygonizeHoles;

        this.alphaCutOff            = a_rSpriteSettings.alphaCutOff;
        this.extrusionDepth         = a_rSpriteSettings.extrusionDepth;
        this.polygonizationAccuracy = a_rSpriteSettings.polygonizationAccuracy;
        this.polygonizeHoles        = a_rSpriteSettings.polygonizeHoles;

        this.renderMeshGridHorizontalSubDivs = a_rSpriteSettings.renderMeshGridHorizontalSubDivs;
        this.renderMeshGridVerticalSubDivs   = a_rSpriteSettings.renderMeshGridVerticalSubDivs;

        this.skinQuality          = a_rSpriteSettings.skinQuality;
        this.boneInfluenceFalloff = a_rSpriteSettings.boneInfluenceFalloff;
    }
Example #3
0
 public static Vector2 ComputePivotCoords(Texture2D a_rTexture, PivotType a_eSpritePivotType, Vector2 a_f2CustomPivotPoint)
 {
     if (a_rTexture == null)
     {
         return(Uni2DSpriteUtils.ComputePivotCoords(0.0f, 0.0f, a_eSpritePivotType, a_f2CustomPivotPoint));
     }
     else
     {
         return(Uni2DSpriteUtils.ComputePivotCoords(a_rTexture.width, a_rTexture.height, a_eSpritePivotType, a_f2CustomPivotPoint));
     }
 }
Example #4
0
 public static Vector2 ComputePivotCoords( Texture2D a_rTexture, PivotType a_eSpritePivotType, Vector2 a_f2CustomPivotPoint )
 {
     if( a_rTexture == null )
     {
         return Uni2DSpriteUtils.ComputePivotCoords( 0.0f, 0.0f, a_eSpritePivotType, a_f2CustomPivotPoint );
     }
     else
     {
         return Uni2DSpriteUtils.ComputePivotCoords( a_rTexture.width, a_rTexture.height, a_eSpritePivotType, a_f2CustomPivotPoint );
     }
 }
Example #5
0
	// Sets the pivot point according to its type and given dimensions.
	// If type == custom, a_fWidth and a_fHeight are used as custom pivot point coords
	public static Vector2 ComputePivotCoords( float a_fWidth, float a_fHeight, PivotType a_ePivotType, Vector2 a_f2CustomPivotPoint )
	{
		// Compute new pivot point from pivot type
		switch( a_ePivotType )
		{
			default:
			case PivotType.Custom: 			return a_f2CustomPivotPoint; //new Vector2( a_fWidth,        a_fHeight );
			case PivotType.BottomLeft: 		return new Vector2( 0.0f,            0.0f );
			case PivotType.BottomCenter: 	return new Vector2( a_fWidth * 0.5f, 0.0f );
			case PivotType.BottomRight: 	return new Vector2( a_fWidth,        0.0f );
			case PivotType.MiddleLeft: 		return new Vector2( 0.0f,            a_fHeight * 0.5f );
			case PivotType.MiddleCenter: 	return new Vector2( a_fWidth * 0.5f, a_fHeight * 0.5f );
			case PivotType.MiddleRight: 	return new Vector2( a_fWidth,        a_fHeight * 0.5f );
			case PivotType.TopLeft: 		return new Vector2( 0.0f,            a_fHeight );
			case PivotType.TopCenter: 		return new Vector2( a_fWidth * 0.5f, a_fHeight );
			case PivotType.TopRight: 		return new Vector2( a_fWidth,        a_fHeight );
		}
	}
	// Deep copy constructor
	public Uni2DEditorSpriteSettings( Uni2DEditorSpriteSettings a_rSpriteSettings )
	{
		this.textureContainer       = new Texture2DContainer( a_rSpriteSettings.textureContainer );	// Deep copy
		this.atlas                  = a_rSpriteSettings.atlas;
		this.sharedMaterial			= a_rSpriteSettings.sharedMaterial;
		
		this.renderMesh             = a_rSpriteSettings.renderMesh;
		this.usePhysicBuildSettings = a_rSpriteSettings.usePhysicBuildSettings;
		
		this.spriteScaleMode        = a_rSpriteSettings.spriteScaleMode;
		this.spriteScale            = a_rSpriteSettings.spriteScale;
		this.spriteScaleNotUniform  = a_rSpriteSettings.spriteScaleNotUniform;
		this.pivotType				= a_rSpriteSettings.pivotType;
		this.pivotCustomCoords		= a_rSpriteSettings.pivotCustomCoords;
		this.vertexColor            = a_rSpriteSettings.vertexColor;
		this.dimensionMode			= a_rSpriteSettings.dimensionMode;
		this.physicsMode            = a_rSpriteSettings.physicsMode;
		this.collisionType          = a_rSpriteSettings.collisionType;
		this.isKinematic            = a_rSpriteSettings.isKinematic;
		this.isTrigger				= a_rSpriteSettings.isTrigger;
	
		this.renderMeshAlphaCutOff            = a_rSpriteSettings.renderMeshAlphaCutOff;
		this.renderMeshPolygonizationAccuracy = a_rSpriteSettings.renderMeshPolygonizationAccuracy;
		this.renderMeshPolygonizeHoles = a_rSpriteSettings.renderMeshPolygonizeHoles;
	
		this.alphaCutOff            = a_rSpriteSettings.alphaCutOff;
		this.extrusionDepth         = a_rSpriteSettings.extrusionDepth;
		this.polygonizationAccuracy = a_rSpriteSettings.polygonizationAccuracy;
		this.polygonizeHoles        = a_rSpriteSettings.polygonizeHoles;
		
		this.onlyBorder = a_rSpriteSettings.onlyBorder;
		this.subdivide = a_rSpriteSettings.subdivide;
		this.subdivisionCount = a_rSpriteSettings.subdivisionCount;

		this.renderMeshGridHorizontalSubDivs = a_rSpriteSettings.renderMeshGridHorizontalSubDivs;
		this.renderMeshGridVerticalSubDivs   = a_rSpriteSettings.renderMeshGridVerticalSubDivs;

		this.skinQuality          = a_rSpriteSettings.skinQuality;
		this.boneInfluenceFalloff = a_rSpriteSettings.boneInfluenceFalloff;
	}