LevelEndProp.cs 582 B

1234567891011121314151617
  1. using UnityEngine;
  2. using System.Collections;
  3. /// <summary>
  4. /// Level end prop which will be scale the y position to make it adapt to multiple aspect ratios
  5. /// The important thing is that the vertical pivots for the sprites are set properly
  6. /// (namely top or bottom according to whether it should be at the top or bottom of the screen)
  7. /// </summary>
  8. public class LevelEndProp : MonoBehaviour
  9. {
  10. void Start()
  11. {
  12. Vector3 pos = transform.localPosition;
  13. pos.y = (pos.y / (GameConstants.GAME_HEIGHT/2)) * (AspectRatioFixer.UIManualHeight/2);
  14. transform.localPosition = pos;
  15. }
  16. }