mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-11 01:28:44 +08:00
[unity] Fixes to some sample scripts.
This commit is contained in:
parent
ad9e87e81f
commit
1565b40bd3
@ -123,7 +123,7 @@ namespace Spine.Unity.Examples {
|
||||
public void PlayShoot () {
|
||||
// Play the shoot animation on track 1.
|
||||
skeletonAnimation.AnimationState.SetAnimation(1, shoot, false);
|
||||
//skeletonAnimation.state.AddEmptyAnimation(1, 0.1f, 0f);
|
||||
skeletonAnimation.AnimationState.AddEmptyAnimation(1, .3f, .3f);
|
||||
gunSource.pitch = GetRandomPitch(gunsoundPitchOffset);
|
||||
gunSource.Play();
|
||||
gunParticles.randomSeed = (uint)Random.Range(0, 100);
|
||||
|
||||
@ -42,7 +42,6 @@ namespace Spine.Unity.Examples {
|
||||
[SpineSlot] public string handSlot;
|
||||
public Vector2 newHandOffset;
|
||||
public float newHandRotation;
|
||||
public Texture2D handTexture;
|
||||
|
||||
[Header("From Sprite")]
|
||||
public Sprite dagger;
|
||||
@ -79,7 +78,6 @@ namespace Spine.Unity.Examples {
|
||||
newHand.Rotation = newHandRotation;
|
||||
newHand.UpdateOffset();
|
||||
int handSlotIndex = skeleton.FindSlotIndex(handSlot);
|
||||
handTexture = newHand.GetRegion().ToTexture();
|
||||
newSkin.AddAttachment(handSlotIndex, handAttachmentName, newHand);
|
||||
|
||||
// Case 2: Create an attachment from a Unity Sprite (Sprite texture needs to be Read/Write Enabled in the inspector.
|
||||
@ -106,6 +104,8 @@ namespace Spine.Unity.Examples {
|
||||
skeleton.SetSkin(newSkin);
|
||||
skeleton.SetToSetupPose();
|
||||
skeleton.SetAttachment(weaponSlot, daggerName);
|
||||
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace Spine.Unity.Examples {
|
||||
|
||||
void AddRigidbody () {
|
||||
var rb = gameObject.AddComponent<Rigidbody2D>();
|
||||
#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5
|
||||
#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3_OR_NEWER
|
||||
rb.freezeRotation = true;
|
||||
#else
|
||||
rb.fixedAngle = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user