Browse Source

Deleted FixedHeightSprite

master
chrisgregan 10 years ago
parent
commit
6a5bce416d
  1. 36
      Assets/Fungus/Scripts/FixedHeightSprite.cs
  2. 8
      Assets/Fungus/Scripts/FixedHeightSprite.cs.meta

36
Assets/Fungus/Scripts/FixedHeightSprite.cs

@ -1,36 +0,0 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
/**
* Adjusts the scale of a sprite to fit into a fixed number of vertical world units.
* This helps to keep room sprites neatly organised in the editor.
*/
[ExecuteInEditMode]
public class FixedHeightSprite : MonoBehaviour
{
public float height = 2f;
public void Update()
{
if (!Application.isPlaying)
{
SpriteRenderer spriteRenderer = renderer as SpriteRenderer;
if (!spriteRenderer || !spriteRenderer.sprite)
{
return;
}
transform.position = new Vector3(transform.position.x, transform.position.y, 0);
transform.rotation = Quaternion.identity;
float spriteHeight = spriteRenderer.sprite.bounds.extents.y * 2;
float scale = height / spriteHeight;
transform.localScale = new Vector3(scale, scale, 1f);
}
}
}
}

8
Assets/Fungus/Scripts/FixedHeightSprite.cs.meta

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 09bfb0dc7847247568d08205da364d93
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save