HeavenStudioPlus/Assets/Scripts/Common/CanvasScroll.cs
Rapandrasmus efa8378797
Space Dance and Crop Stomp visual improvements + canvasScroll (#450)
* sprites1

* papapapunch

* dancers sheet done

* crop stomp

* Particulate

* Added veggie bag and particle to crop stomp, wip though

* Space dance scrolling background has been added

* cool

* Canvas Scroll hype

* Canvas scroll implemented in space soccer

* 4k

* gramps wip

* more

* assbun conflict fixed + long hair fix

* Space dance bop modernization and fixes

* ok

* sprites done

* wait.

* fixed space dance stuff

* Made miss return to idle

* catchy tune 3

* epic

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
2023-06-06 18:59:56 +00:00

29 lines
874 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace HeavenStudio.Common
{
public class CanvasScroll : MonoBehaviour
{
[SerializeField] RawImage[] _imgs;
public float NormalizedX = 0.0f;
public float NormalizedY = 0.0f;
public Vector2 Normalized { get { return new Vector2(NormalizedX, NormalizedY); } set { NormalizedX = value.x; NormalizedY = value.y; } }
public float TileX = 1.0f;
public float TileY = 1.0f;
public Vector2 Tile { get { return new Vector2(TileX, TileY); } set { TileX = value.x; TileY = value.y; } }
private void Update()
{
foreach (var img in _imgs)
{
img.uvRect = new Rect(new Vector2(NormalizedX, NormalizedY) * Tile, img.uvRect.size);
}
}
}
}