mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge pull request #253 from Fenrisul/master
Added basic skeleton extension methods for Slot, Attachments, and Bone t...
This commit is contained in:
commit
f035c0d119
73
spine-unity/Assets/spine-unity/SkeletonExtensions.cs
Normal file
73
spine-unity/Assets/spine-unity/SkeletonExtensions.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Spine;
|
||||
|
||||
public static class SkeletonExtensions {
|
||||
|
||||
public static void SetColor(this Slot slot, Color color){
|
||||
slot.A = color.a;
|
||||
slot.R = color.r;
|
||||
slot.G = color.g;
|
||||
slot.B = color.b;
|
||||
}
|
||||
|
||||
public static void SetColor(this Slot slot, Color32 color){
|
||||
slot.A = color.a / 255f;
|
||||
slot.R = color.r / 255f;
|
||||
slot.G = color.g / 255f;
|
||||
slot.B = color.b / 255f;
|
||||
}
|
||||
|
||||
public static void SetColor(this RegionAttachment attachment, Color color){
|
||||
attachment.A = color.a;
|
||||
attachment.R = color.r;
|
||||
attachment.G = color.g;
|
||||
attachment.B = color.b;
|
||||
}
|
||||
|
||||
public static void SetColor(this RegionAttachment attachment, Color32 color){
|
||||
attachment.A = color.a / 255f;
|
||||
attachment.R = color.r / 255f;
|
||||
attachment.G = color.g / 255f;
|
||||
attachment.B = color.b / 255f;
|
||||
}
|
||||
|
||||
public static void SetColor(this MeshAttachment attachment, Color color){
|
||||
attachment.A = color.a;
|
||||
attachment.R = color.r;
|
||||
attachment.G = color.g;
|
||||
attachment.B = color.b;
|
||||
}
|
||||
|
||||
public static void SetColor(this MeshAttachment attachment, Color32 color){
|
||||
attachment.A = color.a / 255f;
|
||||
attachment.R = color.r / 255f;
|
||||
attachment.G = color.g / 255f;
|
||||
attachment.B = color.b / 255f;
|
||||
}
|
||||
|
||||
public static void SetColor(this SkinnedMeshAttachment attachment, Color color){
|
||||
attachment.A = color.a;
|
||||
attachment.R = color.r;
|
||||
attachment.G = color.g;
|
||||
attachment.B = color.b;
|
||||
}
|
||||
|
||||
public static void SetColor(this SkinnedMeshAttachment attachment, Color32 color){
|
||||
attachment.A = color.a / 255f;
|
||||
attachment.R = color.r / 255f;
|
||||
attachment.G = color.g / 255f;
|
||||
attachment.B = color.b / 255f;
|
||||
}
|
||||
|
||||
public static void SetPosition(this Bone bone, Vector2 position){
|
||||
bone.X = position.x;
|
||||
bone.Y = position.y;
|
||||
}
|
||||
|
||||
public static void SetPosition(this Bone bone, Vector3 position){
|
||||
bone.X = position.x;
|
||||
bone.Y = position.y;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea85c8f6a91a6ab45881b0dbdaabb7d0
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Loading…
x
Reference in New Issue
Block a user