// 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; }
// Creates a new sprite settings with the given texture. // If the a_bPhysic argument is set to true, the settings will // depict a physical sprite public Uni2DEditorSpriteSettings(Texture2D a_rTexture2D, bool a_bPhysic = false) { this.textureContainer = new Texture2DContainer(a_rTexture2D, true); atlas = Uni2DEditorUtils.FindFirstTextureAtlas(textureContainer.GUID); // Set physic mode accordingly to given argument this.physicsMode = a_bPhysic ? PhysicsMode.Dynamic : PhysicsMode.NoPhysics; }
// Returns true if the Uni2DSprite data have been generated // for a given physic mode public bool AreDataGenerated(Uni2DSprite.PhysicsMode a_ePhysicMode) { return(this.renderMesh != null && this.renderMeshMaterial != null && (a_ePhysicMode == Uni2DSprite.PhysicsMode.NoPhysics || // No physic == no mesh collider to generate (this.meshCollidersList != null && this.meshCollidersList.Contains(null) == false && this.meshColliderComponentsList != null && this.meshColliderComponentsList.Contains(null) == false ) )); }
// 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; }
// Creates a new sprite settings with the given texture. // If the a_bPhysic argument is set to true, the settings will // depict a physical sprite public Uni2DEditorSpriteSettings( Texture2D a_rTexture2D, bool a_bPhysic = false ) { this.textureContainer = new Texture2DContainer( a_rTexture2D, true ); atlas = Uni2DEditorUtils.FindFirstTextureAtlas( textureContainer.GUID ); // Set physic mode accordingly to given argument this.physicsMode = a_bPhysic ? PhysicsMode.Dynamic : PhysicsMode.NoPhysics; }