[unity] Fixes to some sample scripts.

This commit is contained in:
pharan 2017-05-07 02:56:37 +08:00
parent ad9e87e81f
commit 1565b40bd3
3 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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;