MIF_E31222569/Assets/ToothyV/Scripts/UI/MateriSelector.cs

69 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MateriSelector : MonoBehaviour
{
[SerializeField]
protected MateriList materiList;
protected int currentIndex = 0;
public int CurrentIndex => currentIndex;
public void ClampIndex()
{
if(materiList.totalMateri == 0)
{
Debug.LogWarning(" Mission Selector is empty kocak !");
return;
}
if(currentIndex >= materiList.totalMateri)
{
currentIndex = 0;
}
if(currentIndex < 0)
{
currentIndex = materiList.totalMateri - 1;
}
}
public void SetIndex (int index)
{
currentIndex = index;
ClampIndex();
}
public void IncrementIndex()
{
SetIndex(currentIndex+1);
}
public void DecrementIndex()
{
SetIndex(currentIndex-1);
}
public MateriSpec GetMission(int index)
{
return materiList.GetMateri(index);
}
public MateriSpec GetCurrentMission()
{
return materiList.GetMateri(currentIndex);
}
public MateriSpec GetNextMissionDubbing()
{
return materiList.GetMateri(currentIndex);
}
public MateriSpec GetPreviousMissionDubbing()
{
return materiList.GetMateri(currentIndex);
}
}