复制的感觉挺有用就保存下来
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CURRENT : MonoBehaviour {
private List<int> content = new List<int>
{
5,
6,
7,
13,
8,
9,
10,
11,
12,
14
};
//列表当前ID
private int currentID = 0;
//下一个ID
public int NextID
{
get
{
currentID++;
print("数:" + currentID);
currentID = currentID % content.Count;
print("余数:" + currentID);
return currentID;
}
}
//上一个ID
public int LastID
{
get
{
currentID--;
if (currentID < 0) currentID = content.Count - 1;
print("数:" + currentID);
currentID = currentID % content.Count;
print("余数:" + currentID);
return currentID;
}
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
print(content[NextID]);
}
if (Input.GetMouseButtonDown(1))
{
print(content[LastID]);
}
}
}