Skip to content

Commit

Permalink
api improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
EudyContreras committed Feb 21, 2021
1 parent 333c35a commit 706e40e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.eudycontreras.boneslibrary.properties.ShapeType
class BoneBuilder internal constructor(
private val boneProperties: BoneProperties
) {

/**
* Allows building shimmer ray properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ import com.eudycontreras.boneslibrary.properties.ShapeType
class SkeletonBuilder internal constructor(
private val skeletonProperties: SkeletonProperties
) {

/**
* Allows building bone properties.
*
* @param builder The target encapsulation of the bone builder
*
* @see BoneProperties
* @see BoneBuilder
*/
fun withBoneBuilder(builder: BoneBuilder.() -> Unit): SkeletonBuilder {
builder.invoke(skeletonProperties.getBoneProps().builder())
return this
}

/**
* Allows building bone properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class SkeletonProperties internal constructor() : Cloneable<SkeletonProperties>
*/
@Synchronized
fun getBoneProps(ownerId: Int): BoneProperties {
return boneProperties[ownerId] ?: BoneProperties()
return boneProperties[ownerId] ?: defaultBoneProperties.clone()
.apply {
boneProperties[ownerId] = this
}
Expand Down Expand Up @@ -393,7 +393,7 @@ class SkeletonProperties internal constructor() : Cloneable<SkeletonProperties>
* @author Eudy Contreras
* @since March 2020
*
* If true, dds the given id and the state to the map of state owner.
* If true, Adds the given id and the state to the map of state owner.
* When false it will remove the state owner since there in no point of
* keeping a loaded owner's state.
*
Expand Down

0 comments on commit 706e40e

Please sign in to comment.