Browse Source

Fixed Changing portrait facing flips incorrectly #190

master
chrisgregan 9 years ago
parent
commit
1ccedcc7b4
  1. 2
      Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs
  2. 1211
      Assets/Tests/Narrative/NarrativeTests.unity
  3. 20
      Assets/Tests/Narrative/PortraitFlipTest.cs
  4. 12
      Assets/Tests/Narrative/PortraitFlipTest.cs.meta

2
Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs

@ -381,6 +381,8 @@ namespace Fungus
GameObject tempGO = GameObject.Instantiate(character.state.portraitImage.gameObject);
tempGO.transform.SetParent(character.state.portraitImage.transform, false);
tempGO.transform.localPosition = Vector3.zero;
tempGO.transform.localScale = character.state.position.localScale;
Image tempImage = tempGO.GetComponent<Image>();
tempImage.sprite = character.state.portraitImage.sprite;
tempImage.preserveAspect = true;

1211
Assets/Tests/Narrative/NarrativeTests.unity

File diff suppressed because it is too large Load Diff

20
Assets/Tests/Narrative/PortraitFlipTest.cs

@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;
public class PortraitFlipTest : MonoBehaviour {
void Update ()
{
Transform t = gameObject.transform.FindChild("Canvas/JohnCharacter");
if (t == null)
{
return;
}
if (t.transform.localScale.x != -1f)
{
IntegrationTest.Fail("Character object not flipped horizontally");
}
}
}

12
Assets/Tests/Narrative/PortraitFlipTest.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cd9f5c93d50b44e9ba1b822ff6993500
timeCreated: 1444231183
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save