SHADE_Y3/Assets/Scripts/UI/SC_MultiImageList.cs

52 lines
1.0 KiB
C#

using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class MultiImageList:Script
{
public List<MaterialAsset> imageAssetList = new List<MaterialAsset>();
[NonSerialized]
private int index = 0;
protected override void awake()
{
}
protected override void start()
{
}
public void NextImage()
{
++index;
if(index >= imageAssetList.Count())
{
index = 0;
}
Renderable rend = GetComponent<Renderable>();
rend.SetMaterial(imageAssetList[index]);
}
public void PrevImage()
{
if (index == 0)
index = imageAssetList.Count();
--index;
Renderable rend = GetComponent<Renderable>();
rend.SetMaterial(imageAssetList[index]);
}
}
}