本文整理汇总了C#中Spine.Skeleton.FindSlot方法的典型用法代码示例。如果您正苦于以下问题:C# Skeleton.FindSlot方法的具体用法?C# Skeleton.FindSlot怎么用?C# Skeleton.FindSlot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spine.Skeleton
的用法示例。
在下文中一共展示了Skeleton.FindSlot方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PathConstraint
public PathConstraint (PathConstraintData data, Skeleton skeleton) {
if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
this.data = data;
bones = new ExposedList<Bone>(data.Bones.Count);
foreach (BoneData boneData in data.bones)
bones.Add(skeleton.FindBone(boneData.name));
target = skeleton.FindSlot(data.target.name);
position = data.position;
spacing = data.spacing;
rotateMix = data.rotateMix;
translateMix = data.translateMix;
}
示例2: AddBoundingBoxGameObject
public static PolygonCollider2D AddBoundingBoxGameObject (Skeleton skeleton, string skinName, string slotName, string attachmentName, Transform parent, bool isTrigger = true) {
Skin skin = string.IsNullOrEmpty(skinName) ? skeleton.data.defaultSkin : skeleton.data.FindSkin(skinName);
if (skin == null) {
Debug.LogError("Skin " + skinName + " not found!");
return null;
}
var attachment = skin.GetAttachment(skeleton.FindSlotIndex(slotName), attachmentName);
if (attachment == null) {
Debug.LogFormat("Attachment in slot '{0}' named '{1}' not found in skin '{2}'.", slotName, attachmentName, skin.name);
return null;
}
var box = attachment as BoundingBoxAttachment;
if (box != null) {
var slot = skeleton.FindSlot(slotName);
return AddBoundingBoxGameObject(box.Name, box, slot, parent, isTrigger);
} else {
Debug.LogFormat("Attachment '{0}' was not a Bounding Box.", attachmentName);
return null;
}
}
示例3: Start
void Start () {
game = GameObject.Find ("Gui").GetComponent<GameHandler> ();
boxCollider = GetComponent<BoxCollider2D> ();
character = GetComponent<MeshRenderer> ();
controller = GetComponent<Controller2D> ();
anim = GetComponent<SkeletonAnimation> ();
skeleton = anim.skeleton;
arm = skeleton.FindBone ("RShoulder");
backArm = skeleton.FindBone ("LShoulder");
weap = skeleton.FindBone ("Weapon");
skelRend = GetComponent<SkeletonRenderer> ();
skeleton.FindSlot ("WeaponImage").Attachment = null;
anim.state.ClearTrack(1);
controller.CatchPlayer (this);
crouchTap = new TapInfo (.6f, int.MaxValue);
dashTap = new TapInfo (.6f, int.MaxValue);
//Initiate the width of the HP bar, this may need to be placed in the Update portion if window scaling is changed.
width = healthbar.GetComponent<RectTransform>().rect.width;
startMaxXPos = healthbar.GetComponent<RectTransform>().offsetMax.x;
UpdateGravity();
}
示例4: LoadContent
protected override void LoadContent()
{
skeletonRenderer = new SkeletonRenderer(GraphicsDevice);
String name = "spineboy"; // "goblins";
Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
SkeletonJson json = new SkeletonJson(atlas);
skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
if (name == "goblins") skeleton.SetSkin("goblingirl");
skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin.
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
if (name == "spineboy") {
stateData.SetMix("walk", "jump", 0.2f);
stateData.SetMix("jump", "walk", 0.4f);
}
state = new AnimationState(stateData);
if (true) {
// Event handling for all animations.
state.Start += new EventHandler(Start);
state.End += new EventHandler(End);
state.Complete += new EventHandler<CompleteArgs>(Complete);
state.Event += new EventHandler<EventTriggeredArgs>(Event);
state.SetAnimation("drawOrder", true);
} else {
state.SetAnimation("walk", false);
QueueEntry entry = state.AddAnimation("jump", false);
entry.End += new EventHandler(End); // Event handling for queued animations.
state.AddAnimation("walk", true);
}
skeleton.X = 320;
skeleton.Y = 440;
skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head");
}
示例5: Reset
public virtual void Reset () {
if (meshFilter != null)
meshFilter.sharedMesh = null;
meshRenderer = GetComponent<MeshRenderer>();
if (meshRenderer != null) meshRenderer.sharedMaterial = null;
if (mesh1 != null) {
if (Application.isPlaying)
Destroy(mesh1);
else
DestroyImmediate(mesh1);
}
if (mesh2 != null) {
if (Application.isPlaying)
Destroy(mesh2);
else
DestroyImmediate(mesh2);
}
lastState = new LastState();
mesh1 = null;
mesh2 = null;
vertices = null;
colors = null;
uvs = null;
sharedMaterials = new Material[0];
submeshMaterials.Clear();
submeshes.Clear();
skeleton = null;
valid = false;
if (!skeletonDataAsset) {
if (logErrors)
Debug.LogError("Missing SkeletonData asset.", this);
return;
}
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false);
if (skeletonData == null)
return;
valid = true;
meshFilter = GetComponent<MeshFilter>();
meshRenderer = GetComponent<MeshRenderer>();
mesh1 = newMesh();
mesh2 = newMesh();
vertices = new Vector3[0];
skeleton = new Skeleton(skeletonData);
if (initialSkinName != null && initialSkinName.Length > 0 && initialSkinName != "default")
skeleton.SetSkin(initialSkinName);
submeshSeparatorSlots.Clear();
for (int i = 0; i < submeshSeparators.Length; i++) {
submeshSeparatorSlots.Add(skeleton.FindSlot(submeshSeparators[i]));
}
CollectSubmeshRenderers();
LateUpdate();
if (OnReset != null)
OnReset(this);
}
示例6: LoadContent
protected override void LoadContent () {
skeletonRenderer = new SkeletonMeshRenderer(GraphicsDevice);
skeletonRenderer.PremultipliedAlpha = true;
// String name = "spineboy";
// String name = "goblins-mesh";
String name = "raptor";
bool binaryData = true;
Atlas atlas = new Atlas(assetsFolder + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
float scale = 1;
if (name == "spineboy") scale = 0.6f;
if (name == "raptor") scale = 0.5f;
SkeletonData skeletonData;
if (binaryData) {
SkeletonBinary binary = new SkeletonBinary(atlas);
binary.Scale = scale;
skeletonData = binary.ReadSkeletonData(assetsFolder + name + ".skel");
} else {
SkeletonJson json = new SkeletonJson(atlas);
json.Scale = scale;
skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json");
}
skeleton = new Skeleton(skeletonData);
if (name == "goblins-mesh") skeleton.SetSkin("goblin");
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
state = new AnimationState(stateData);
if (name == "spineboy") {
stateData.SetMix("run", "jump", 0.2f);
stateData.SetMix("jump", "run", 0.4f);
// Event handling for all animations.
state.Start += Start;
state.End += End;
state.Complete += Complete;
state.Event += Event;
state.SetAnimation(0, "test", false);
TrackEntry entry = state.AddAnimation(0, "jump", false, 0);
entry.End += End; // Event handling for queued animations.
state.AddAnimation(0, "run", true, 0);
} else if (name == "raptor") {
state.SetAnimation(0, "walk", true);
state.SetAnimation(1, "empty", false);
state.AddAnimation(1, "gungrab", false, 2);
} else {
state.SetAnimation(0, "walk", true);
}
skeleton.X = 400;
skeleton.Y = 590;
skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head");
}
示例7: Reset
public virtual void Reset()
{
if (meshFilter != null)
meshFilter.sharedMesh = null;
if (renderer != null)
renderer.sharedMaterial = null;
mesh1 = null;
mesh2 = null;
lastVertexCount = 0;
vertices = null;
colors = null;
uvs = null;
sharedMaterials = new Material[0];
submeshMaterials.Clear();
submeshes.Clear();
skeleton = null;
valid = false;
if (!skeletonDataAsset) {
if (logErrors)
Debug.LogError("Missing SkeletonData asset.", this);
return;
}
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false);
if (skeletonData == null)
return;
valid = true;
meshFilter = GetComponent<MeshFilter>();
mesh1 = newMesh();
mesh2 = newMesh();
vertices = new Vector3[0];
skeleton = new Skeleton(skeletonData);
if (initialSkinName != null && initialSkinName.Length > 0 && initialSkinName != "default")
skeleton.SetSkin(initialSkinName);
submeshSeparatorSlots.Clear();
for (int i = 0; i < submeshSeparators.Length; i++) {
submeshSeparatorSlots.Add(skeleton.FindSlot(submeshSeparators[i]));
}
if (OnReset != null)
OnReset(this);
}
示例8: LoadContent
public void LoadContent(SkeletonRenderer sr, Texture2D bt, Atlas atlas, string json)
{
blankTex = bt;
skeletonRenderer =sr;
SkeletonJson skjson = new SkeletonJson(atlas);
skeleton = new Skeleton(skjson.readSkeletonData("robo", json));
tint = new Color(0.5f + ((float)rand.NextDouble() * 0.5f), 0.5f + ((float)rand.NextDouble() * 0.5f), 0.5f + ((float)rand.NextDouble() * 0.5f));
skeleton.R = tint.ToVector3().X;
skeleton.G = tint.ToVector3().Y;
skeleton.B = tint.ToVector3().Z;
foreach (Slot s in skeleton.Slots)
{
if (s.Data.Name != "melee-item" && s.Data.Name != "projectile-item" && s.Data.Name != "fist-item")
{
s.Data.R = skeleton.R;
s.Data.G = skeleton.G;
s.Data.B = skeleton.B;
}
}
skeleton.SetSkin("default");
skeleton.SetSlotsToBindPose();
Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));
skeleton.RootBone.X = Position.X;
skeleton.RootBone.Y = Position.Y;
skeleton.RootBone.ScaleX = Scale;
skeleton.RootBone.ScaleY = Scale;
skeleton.UpdateWorldTransform();
skeleton.FindSlot("fist-item").A = 0f;
fistSound = AudioController.effects["fist"].CreateInstance();
fistSound.IsLooped = true;
fistSound.Volume = 0f;
fistSound.Pitch = -1f;
fistSound.Play();
}